Re: [NTG-context] How to add a local texmf tree to context minimals?

2011-03-24 Thread Mojca Miklavec
On Wed, Mar 23, 2011 at 20:08, Ulrike Fischer wrote:

 At second I want actually to add more than one tree ;-)

 My main problem is that there quite a lot of configuration files
 which look like good candidates (I found texmf.cnf, texmfcnf.lua,
 context.cnt, contextcnf.lua.) and that I don't know where to put a
 local version which will not be changed by updates.

texmf.cnf is for MKII and texmfcnf.lua is for MKIV. The files
context.cnf and contextcnf.lua are not used. They are usually just the
source for texmf.cnf and texmfcnf.lua, but they are not taken
automatically.

One way is to set environmental variables, but probably a better way
is to create a copy of texmf.cnf  texmfcnf.lua in texmf-local/web2c/
and change the TEXMF variable there. No, wait. texmf-local is not
known until texmf.cnf is actually read in (chicked-and-egg problem).
Can you please try to put texmf.cnf in top level (next to setuptex)
and see if mkii/kpathsea works that way (finds proper trees)? There is
a hardcoded algorithm with a list of paths that are checked for
texmf.cnf file, but I'm not sure what the sequence of those paths is.

For MKIV you can put texmfcnf.lua anywhere and then set the TEXMFCNF
environmental variable (I think, I'm not sure, I would have to try
again), but the better way is to make it work automatically in the
same way as for MKII, let's say by putting a modified version of
texmfcnf.lua two folders up.

Mojca
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Metfun macro for triangle

2011-03-24 Thread Otared Kavian
Hi all,

I have a document in which I must draw several triangles for which two summits, 
say z0, z1, and the length of the two other sides are known, so that the third 
summit, say z2, is completly determined.
In order to draw one triangle the following works fine:

\setupcolors[state=start]
\starttext
\startMPcode
z0 = (0cm,0cm) ;
z1 = (5cm,0cm) ;
path p, q ; 
pickup pencircle scaled 2mm ;
drawdot z0 ;
drawdot z1 ;
p := halfcircle scaled 8 cm ; % twice the length of the second side at 
z0
p := p shifted z0 ;
q := halfcircle scaled 6 cm ;  % twice the length of the second side at 
z1
q := q shifted z1  ;
z2 = p intersectionpoint q ;
drawdot z2 ;
pickup pencircle scaled 1mm ;
draw z0--z1--z2--cycle withcolor blue ;
\stopMPcode
\stoptext

However I would like to have a macro, for instance named Triangle, which 
accepts four arguments z0,z1, length_1, length_2, so that in a MetaPost code i 
can use
draw Triangle(z0,z1, 4, 3) withcolor blue ;
in order to draw the above triangle. 
Has anyone any idea about how to do this?

Thanks in advance for your help: OK
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
I would like to use the date of the document in the generated PDF. (It is
not interesting when the PDF is generated, but when the source was last
changed.) How would I do this?

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to add a local texmf tree to context minimals?

2011-03-24 Thread Hans Hagen

On 24-3-2011 7:57, Mojca Miklavec wrote:

On Wed, Mar 23, 2011 at 20:08, Ulrike Fischer wrote:


At second I want actually to add more than one tree ;-)

My main problem is that there quite a lot of configuration files
which look like good candidates (I found texmf.cnf, texmfcnf.lua,
context.cnt, contextcnf.lua.) and that I don't know where to put a
local version which will not be changed by updates.


texmf.cnf is for MKII and texmfcnf.lua is for MKIV. The files
context.cnf and contextcnf.lua are not used. They are usually just the
source for texmf.cnf and texmfcnf.lua, but they are not taken
automatically.

One way is to set environmental variables, but probably a better way
is to create a copy of texmf.cnf  texmfcnf.lua in texmf-local/web2c/
and change the TEXMF variable there. No, wait. texmf-local is not
known until texmf.cnf is actually read in (chicked-and-egg problem).


Did you test it?

Just put a cnf there and run

mtxrun --configurations

and see what gets reported. Here I have one in the local tree because I 
need to hook in my dev paths.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to add a local texmf tree to context minimals?

2011-03-24 Thread Ulrike Fischer
Am Thu, 24 Mar 2011 07:57:36 +0100 schrieb Mojca Miklavec:


 At second I want actually to add more than one tree ;-)

 My main problem is that there quite a lot of configuration files
 which look like good candidates (I found texmf.cnf, texmfcnf.lua,
 context.cnt, contextcnf.lua.) and that I don't know where to put a
 local version which will not be changed by updates.
 
 texmf.cnf is for MKII and texmfcnf.lua is for MKIV. The files
 context.cnf and contextcnf.lua are not used. They are usually just the
 source for texmf.cnf and texmfcnf.lua, but they are not taken
 automatically.
 
 One way is to set environmental variables, but probably a better way
 is to create a copy of texmf.cnf  texmfcnf.lua in texmf-local/web2c/
 and change the TEXMF variable there. No, wait. texmf-local is not
 known until texmf.cnf is actually read in (chicked-and-egg problem).
 Can you please try to put texmf.cnf in top level (next to setuptex)
 and see if mkii/kpathsea works that way (finds proper trees)? There is
 a hardcoded algorithm with a list of paths that are checked for
 texmf.cnf file, but I'm not sure what the sequence of those paths is.

It seems to work if I move texmfcnf.lua to texmf-local (even
unchanged it had an immediate effect: nothing worked anymore, until
I run a mtxrun --generate ;-).) 

Now I have to find out, where to store the files so that both
context and latex can use them. 


-- 
Ulrike Fischer 

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to add a local texmf tree to context minimals?

2011-03-24 Thread Mojca Miklavec
On Thu, Mar 24, 2011 at 10:39, Ulrike Fischer wrote:

 It seems to work if I move texmfcnf.lua to texmf-local (even
 unchanged it had an immediate effect: nothing worked anymore, until
 I run a mtxrun --generate ;-).)

 Now I have to find out, where to store the files so that both
 context and latex can use them.

If LaTeX needs a modified setup, you need to copy and adapt texmf.cnf
(like for MKII).

Mojca

(No, I admit that I didn't test if texmf.cnf in texmf-local works, but
I would find it at least a bit weird if it texmf-local would be
hardcoded into kpathsea.)
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] search path for require(...)

2011-03-24 Thread Ulrike Fischer
I'm trying to store the virtual lua chess fonts I'm currently
creating so that latex and context can use them. 

1. At first I stored the vf-chess-XX.lua in tex/luatex. This works
for latex but not for context. tex/generic works for both. 

2. My fonts loads a lua-file which should be shared by all fonts
with 

chessfss=require('chessfss')

latex finds the chessfss.lua without problems in various locations
(e.g. tex/generic) but context not. How can I solve this problem?



-- 
Ulrike Fischer 

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Cecil Westerhof
When using \startitemize … \stopitemize there is no indent for the first
paragraph when using \head, but there is when using \item. How can I make
that by \item the first paragraph also has no indentation?

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metfun macro for triangle

2011-03-24 Thread Otared Kavian
Hi Stefan,

Thanks for the quick answer and solution!
Your solution works perfectly in mkiv; however typesetting with mkii results in
! Undefined control sequence.
l.3 \startMPdefinitions
Is there a solution with mkii?

May I ask one more question?
In the macro you wrote
Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm)
one has to specify the double of the length of each side (because a unit circle 
in MetaPost is a circle having diameter one). Would it be possible to change 
slightly the lines
p := fullcircle scaled la shifted za ;
q := fullcircle scaled lb shifted zb ;
so that la and lb are replaced with their doubled values? I tried
p := fullcircle scaled 2*la shifted za ;
but this does not work.

Thanks for your attention: OK

On 24 mars 2011, at 10:29, Stefan Müller wrote:

 Hi,
 
 what about
 
 \startMPdefinitions
   vardef Triangle(expr za, zb, la, lb) =
   path p, q ;
   pair zc ;
   pickup pencircle scaled 2mm ;
   drawdot za ;
   drawdot zb ;
   p := fullcircle scaled la shifted za ;
   q := fullcircle scaled lb shifted zb ;
   zc = p intersectionpoint q ;
   drawdot zc ;
   pickup pencircle scaled 1mm ;
   za--zb--zc--cycle
   enddef;
 \stopMPdefinitions
 
 \starttext
 \startMPcode
   draw Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm) withcolor blue ;  
 \stopMPcode
 \stoptext
 
 Stefan
 
 On 24.03.2011 09:59, Otared Kavian wrote:
 Hi all,
 
 I have a document in which I must draw several triangles for which two 
 summits, say z0, z1, and the length of the two other sides are known, so 
 that the third summit, say z2, is completly determined.
 In order to draw one triangle the following works fine:
 
 \setupcolors[state=start]
 \starttext
 \startMPcode
  z0 = (0cm,0cm) ;
  z1 = (5cm,0cm) ;
  path p, q ; 
  pickup pencircle scaled 2mm ;
  drawdot z0 ;
  drawdot z1 ;
  p := halfcircle scaled 8 cm ; % twice the length of the second side at 
 z0
  p := p shifted z0 ;
  q := halfcircle scaled 6 cm ;  % twice the length of the second side at 
 z1
  q := q shifted z1  ;
  z2 = p intersectionpoint q ;
  drawdot z2 ;
  pickup pencircle scaled 1mm ;
  draw z0--z1--z2--cycle withcolor blue ;
 \stopMPcode
 \stoptext
 
 However I would like to have a macro, for instance named Triangle, which 
 accepts four arguments z0,z1, length_1, length_2, so that in a MetaPost code 
 i can use
  draw Triangle(z0,z1, 4, 3) withcolor blue ;
 in order to draw the above triangle.
 Has anyone any idea about how to do this?
 
 Thanks in advance for your help: OK
 ___
 If your question is of interest to others as well, please add an entry to 
 the Wiki!
 
 maillist : ntg-context@ntg.nl / 
 http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___
 
 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

%%
Otared Kavian
Département de Mathématiques
Université de Versailles Saint-Quentin
Bâtiment Fermat
45 avenue des Etats Unis
78035 Versailles cedex

Téléphone: +33 1 39 25 46 42
Secrétariat: +33 1 39 25 46 44 
Secrétariat: +33 1 39 25 46 46

e-mail: otared.kav...@math.uvsq.fr




___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to add a local texmf tree to context minimals?

2011-03-24 Thread Ulrike Fischer
Am Thu, 24 Mar 2011 10:45:55 +0100 schrieb Mojca Miklavec:

 On Thu, Mar 24, 2011 at 10:39, Ulrike Fischer wrote:

 It seems to work if I move texmfcnf.lua to texmf-local (even
 unchanged it had an immediate effect: nothing worked anymore, until
 I run a mtxrun --generate ;-).)

 Now I have to find out, where to store the files so that both
 context and latex can use them.
 
 If LaTeX needs a modified setup, you need to copy and adapt texmf.cnf
 (like for MKII).

I'm using the latex from my miktex installation. The context minimal
are needed only for the context tests.



-- 
Ulrike Fischer 

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] search path for require(...)

2011-03-24 Thread Philipp Gesang

On 2011-03-24 10:50:58, Ulrike Fischer wrote:
 I'm trying to store the virtual lua chess fonts I'm currently
 creating so that latex and context can use them. 
 
 1. At first I stored the vf-chess-XX.lua in tex/luatex. This works
 for latex but not for context. tex/generic works for both. 
 
 2. My fonts loads a lua-file which should be shared by all fonts
 with 
 
 chessfss=require('chessfss')
 
 latex finds the chessfss.lua without problems in various locations
 (e.g. tex/generic) but context not. How can I solve this problem?

Hi Ulrike,

see also:
  http://www.ntg.nl/pipermail/ntg-context/2010/047721.html

(You’re going to have to declare the table “chessfss” globally
for this to work.)

Regards, Philipp

 
 
 
 -- 
 Ulrike Fischer 
 
 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___


pgps7zeeAiDR8.pgp
Description: PGP signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Philipp Gesang
On 2011-03-24 10:26:00, Cecil Westerhof wrote:
 I would like to use the date of the document in the generated PDF. (It is
 not interesting when the PDF is generated, but when the source was last
 changed.) How would I do this?

Hi Cecil,

this solution checks only the main file, you’d have to extend it
if you want it to respect included parts as well.

Regards, Philipp

PS: Could be optimized but this way the main function allows for
lazily adjusting the output …

 
 -- 
 Cecil Westerhof

 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

\startluacode
  documentdata = documentdata or { }
  documentdata.changed = documentdata.changed or { }
  local p = io.popen(ls -l --time-style=long-iso \jobname.tex, r)
  local time = p:read(*all)
  p:close()

  local P, R, V = lpeg.P, lpeg.R, lpeg.V
  local C, Ct = lpeg.C, lpeg.Ct

  local p_lsout = P{
[1] = lsout,
lsout = Vbefore * Vdate,
before = (1 - Vdate)^1,
date  = Ct(C(Vfour)
 * Vhyphen
 * C(Vtwo)
 * Vhyphen
 * C(Vtwo)
 * Vspace
 * Ct(C(Vtwo)
* P:
* C(Vtwo))),
hyphen  = P-,
space   = P ,
four= Vdigit * Vdigit * Vdigit * Vdigit,
two = Vdigit * Vdigit,
digit   = R09,
  }
  
  local changed = p_lsout:match(time)

  function documentdata.changed.get_changed ()
if documentdata.changed.__last_changed then
  return documentdata.changed.__last_changed end
local dateform = {
  changed[3],
  .,
  changed[2],
  .,
  changed[1],
  \\space ,
  changed[4][1],
  :,
  changed[4][2],
}
local datestr = table.concat(dateform)
documentdata.changed.__last_changed = datestr
return datestr
  end
\stopluacode

\unexpanded\def\getdate{%
  \ctxlua{context(documentdata.changed.get_changed())}%
}

\starttext

The source of this file was last modified {\os\getdate}.

\stoptext


pgpcFOtsss5RK.pgp
Description: PGP signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metfun macro for triangle

2011-03-24 Thread Stefan Müller



On 24.03.2011 10:57, Otared Kavian wrote:

Hi Stefan,

Thanks for the quick answer and solution!
Your solution works perfectly in mkiv; however typesetting with mkii results in
! Undefined control sequence.
l.3 \startMPdefinitions
Is there a solution with mkii?


Then just drop the MPdefinitions section and put the complete vardef 
before your normal mp code in the MPcode section. That should work, I think.



May I ask one more question?
In the macro you wrote
Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm)
one has to specify the double of the length of each side (because a unit circle 
in MetaPost is a circle having diameter one). Would it be possible to change 
slightly the lines


Now that's strange... But I see what you mean. I didn't notice.


p := fullcircle scaled la shifted za ;
q := fullcircle scaled lb shifted zb ;
so that la and lb are replaced with their doubled values? I tried
p := fullcircle scaled 2*la shifted za ;


Yeah, you need parentheses here, because otherwise Metapost tries to 
scale by 2 and then doesn't know how to multiply the result (the path 
fullcircle scaled 2) with la.


p := fullcircle scaled (2 * la) shifted za ;
q := fullcircle scaled (2 * lb) shifted zb ;



but this does not work.

Thanks for your attention: OK


np, Stefan.


On 24 mars 2011, at 10:29, Stefan Müller wrote:


Hi,

what about

\startMPdefinitions
vardef Triangle(expr za, zb, la, lb) =
path p, q ;
pair zc ;
pickup pencircle scaled 2mm ;
drawdot za ;
drawdot zb ;
p := fullcircle scaled la shifted za ;
q := fullcircle scaled lb shifted zb ;
zc = p intersectionpoint q ;
drawdot zc ;
pickup pencircle scaled 1mm ;
za--zb--zc--cycle
enddef;
\stopMPdefinitions

\starttext
\startMPcode
draw Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm) withcolor blue ;  
\stopMPcode
\stoptext

Stefan

On 24.03.2011 09:59, Otared Kavian wrote:

Hi all,

I have a document in which I must draw several triangles for which two summits, 
say z0, z1, and the length of the two other sides are known, so that the third 
summit, say z2, is completly determined.
In order to draw one triangle the following works fine:

\setupcolors[state=start]
\starttext
\startMPcode
z0 = (0cm,0cm) ;
z1 = (5cm,0cm) ;
path p, q ; 
pickup pencircle scaled 2mm ;
drawdot z0 ;
drawdot z1 ;
p := halfcircle scaled 8 cm ; % twice the length of the second side at 
z0
p := p shifted z0 ;
q := halfcircle scaled 6 cm ;  % twice the length of the second side at 
z1
q := q shifted z1  ;
z2 = p intersectionpoint q ;
drawdot z2 ;
pickup pencircle scaled 1mm ;
draw z0--z1--z2--cycle withcolor blue ;
\stopMPcode
\stoptext

However I would like to have a macro, for instance named Triangle, which 
accepts four arguments z0,z1, length_1, length_2, so that in a MetaPost code i 
can use
draw Triangle(z0,z1, 4, 3) withcolor blue ;
in order to draw the above triangle.
Has anyone any idea about how to do this?

Thanks in advance for your help: OK
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


%%
Otared Kavian
Département de Mathématiques
Université de Versailles Saint-Quentin
Bâtiment Fermat
45 avenue des Etats Unis
78035 Versailles cedex

Téléphone: +33 1 39 25 46 42
Secrétariat: +33 1 39 25 46 44
Secrétariat: +33 1 39 25 46 46

e-mail: otared.kav...@math.uvsq.fr




___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki

Re: [NTG-context] search path for require(...)

2011-03-24 Thread Ulrike Fischer
Am Thu, 24 Mar 2011 11:14:00 +0100 schrieb Philipp Gesang:

 I'm trying to store the virtual lua chess fonts I'm currently
 creating so that latex and context can use them. 
 
 1. At first I stored the vf-chess-XX.lua in tex/luatex. This works
 for latex but not for context. tex/generic works for both. 
 
 2. My fonts loads a lua-file which should be shared by all fonts
 with 
 
 chessfss=require('chessfss')
 
 latex finds the chessfss.lua without problems in various locations
 (e.g. tex/generic) but context not. How can I solve this problem?
 
 Hi Ulrike,
 
 see also:
   http://www.ntg.nl/pipermail/ntg-context/2010/047721.html

Ah. chessfss = require('chessfss.lua') works in context. And it
seems to work with latex too (I had somewhere in the back of my mind
the thought that the .lua extension breaks with latex but can't
reproduce it currently). 


 (You’re going to have to declare the table “chessfss” globally
 for this to work.)

The chessfss.lua has a return Table at the end which declares the
table chessfss. 

To quote from http://lua-users.org/wiki/LuaModuleFunctionCritiqued:

The problems above can be avoided by not using the module function
but instead defining modules in the following simple way: [*1][*2] 

-- hello/world.lua
local M = {}

local function test(n) print(n) end
function M.test1() test(123) end
function M.test2() M.test1(); M.test1() end

return M

and importing modules this way: 

local MT = require hello.world
MT.test2()


-- 
Ulrike Fischer 

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] MLA Workscited example no longer works

2011-03-24 Thread John Haltiwanger
This worked fine when compiling my thesis last year.


-- test-workscited.tex

% for bibliographic entries

% following hanging indent code (also in workscited) taken from
%  http://www.ntg.nl/pipermail/ntg-context/2004/005280.html
% [NTG-context] Re: Again: hanging for a lot of paragraphs?
%  ~ Patrick Gundlach
\def\hangover{\hangafter=1\hangindent=0.5in}
\definestartstop[workscited][
  before={
\page[no]
\indenting[never]
\startalignment[left]
\bibliography{Recommended Reading}
\stopalignment
\setupwhitespace[medium]
\bgroup\appendtoks\hangover\to\everypar
},
  after={
\egroup
\indenting[yes]}]


\starttext

  \startworkscited

\input{knuth}

  \stopworkscited

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] search path for require(...)

2011-03-24 Thread Philipp Gesang
On 2011-03-24 11:34:21, Ulrike Fischer wrote:
 Am Thu, 24 Mar 2011 11:14:00 +0100 schrieb Philipp Gesang:
 
  I'm trying to store the virtual lua chess fonts I'm currently
  creating so that latex and context can use them. 
  
  1. At first I stored the vf-chess-XX.lua in tex/luatex. This works
  for latex but not for context. tex/generic works for both. 
  
  2. My fonts loads a lua-file which should be shared by all fonts
  with 
  
  chessfss=require('chessfss')
  
  latex finds the chessfss.lua without problems in various locations
  (e.g. tex/generic) but context not. How can I solve this problem?
  
  Hi Ulrike,
  
  see also:
http://www.ntg.nl/pipermail/ntg-context/2010/047721.html
 
 Ah. chessfss = require('chessfss.lua') works in context. And it
 seems to work with latex too (I had somewhere in the back of my mind
 the thought that the .lua extension breaks with latex but can't
 reproduce it currently). 
 
 
  (You’re going to have to declare the table “chessfss” globally
  for this to work.)
 
 The chessfss.lua has a return Table at the end which declares the
 table chessfss. 
 
 To quote from http://lua-users.org/wiki/LuaModuleFunctionCritiqued:
 
 The problems above can be avoided by not using the module function
 but instead defining modules in the following simple way: [*1][*2] 

Of course, that’s the Lua way. I can’t guess what you’re up to
but if it’s going to eventually become a module, the “chessfss”
table should not pollute the global namespace. There are
canonical locations (check luat-ini.lua) where the functions and
data should go:

  http://www.ntg.nl/pipermail/ntg-context/2010/054982.html

So you might be better off dropping “require” altogether and just
conclude your module with a line like:

  thirddata = thirddata or { }
  thirddata.chessfss = chessfss

instead of returning a table, then loading it with “loadluafile”.

Regards, Philipp

 
 -- hello/world.lua
 local M = {}
 
 local function test(n) print(n) end
 function M.test1() test(123) end
 function M.test2() M.test1(); M.test1() end
 
 return M
 
 and importing modules this way: 
 
 local MT = require hello.world
 MT.test2()
 
 
 -- 
 Ulrike Fischer 
 
 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___


pgpm5wzu7vGd5.pgp
Description: PGP signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de

 On 2011-03-24 10:26:00, Cecil Westerhof wrote:
  I would like to use the date of the document in the generated PDF. (It is
  not interesting when the PDF is generated, but when the source was last
  changed.) How would I do this?

 this solution checks only the main file, you’d have to extend it
 if you want it to respect included parts as well.


For this moment it is good enough. In the future I'll change it to generate
different formats. (I'll post it here.)

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Marco
On 2011-03-24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de wrote:

This should also work:

\starttext

\startluacode
  function modification_date (file)
local f = file
local attr = lfs.attributes (f)
assert (type(attr) == table)
if attr.mode ~= directory then
  return os.date(%Y-%m-%d %H:%M,attr.modification)
end
  end
\stopluacode

\unexpanded\def\getdate{%
  \ctxlua{context(modification_date (\jobname.tex))}%
}

\getdate

\stoptext


Marco


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] search path for require(...)

2011-03-24 Thread Ulrike Fischer
Am Thu, 24 Mar 2011 11:50:47 +0100 schrieb Philipp Gesang:


 (You’re going to have to declare the table “chessfss” globally
 for this to work.)
 
 The chessfss.lua has a return Table at the end which declares the
 table chessfss. 
 
 To quote from http://lua-users.org/wiki/LuaModuleFunctionCritiqued:
 
 The problems above can be avoided by not using the module function
 but instead defining modules in the following simple way: [*1][*2] 
 
 Of course, that’s the Lua way. I can’t guess what you’re up to
 but if it’s going to eventually become a module, the “chessfss”
 table should not pollute the global namespace. There are
 canonical locations (check luat-ini.lua) where the functions and
 data should go:
 
   http://www.ntg.nl/pipermail/ntg-context/2010/054982.html
 
 So you might be better off dropping “require” altogether and just
 conclude your module with a line like:
 
   thirddata = thirddata or { }
   thirddata.chessfss = chessfss
 
 instead of returning a table, then loading it with “loadluafile”.
 
I'm not writing a module but virtual fonts, and they can be used
with context and latex. So whatever I will be doing should not be
context specific. But I will test if I can keep the chessfss-table
local, and if not put it in thirddata if it exists.


-- 
Ulrike Fischer 

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] How to add a local texmf tree to context minimals?

2011-03-24 Thread Mojca Miklavec
On Thu, Mar 24, 2011 at 11:08, Ulrike Fischer ne...@nililand.de wrote:
 Am Thu, 24 Mar 2011 10:45:55 +0100 schrieb Mojca Miklavec:

 On Thu, Mar 24, 2011 at 10:39, Ulrike Fischer wrote:

 It seems to work if I move texmfcnf.lua to texmf-local (even
 unchanged it had an immediate effect: nothing worked anymore, until
 I run a mtxrun --generate ;-).)

 Now I have to find out, where to store the files so that both
 context and latex can use them.

 If LaTeX needs a modified setup, you need to copy and adapt texmf.cnf
 (like for MKII).

 I'm using the latex from my miktex installation. The context minimal
 are needed only for the context tests.

In MikTeX you only need to open the GUI and add a new TeX root +
regenerate the FNDB (file name database).

Mojca
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Metfun macro for triangle

2011-03-24 Thread Otared Kavian
Hi Stefan,

Thanks for your explanations: everything works as expected and your solution is 
very instructive for me.
Later this weekend I'll put it on the wiki.

Have a nice day.
Best regards: OK

On 24 mars 2011, at 11:29, Stefan Müller wrote:

 
 
 On 24.03.2011 10:57, Otared Kavian wrote:
 Hi Stefan,
 
 Thanks for the quick answer and solution!
 Your solution works perfectly in mkiv; however typesetting with mkii results 
 in
  ! Undefined control sequence.
  l.3 \startMPdefinitions
 Is there a solution with mkii?
 
 Then just drop the MPdefinitions section and put the complete vardef before 
 your normal mp code in the MPcode section. That should work, I think.
 
 May I ask one more question?
 In the macro you wrote
  Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm)
 one has to specify the double of the length of each side (because a unit 
 circle in MetaPost is a circle having diameter one). Would it be possible to 
 change slightly the lines
 
 Now that's strange... But I see what you mean. I didn't notice.
 
  p := fullcircle scaled la shifted za ;
  q := fullcircle scaled lb shifted zb ;
 so that la and lb are replaced with their doubled values? I tried
  p := fullcircle scaled 2*la shifted za ;
 
 Yeah, you need parentheses here, because otherwise Metapost tries to scale by 
 2 and then doesn't know how to multiply the result (the path fullcircle 
 scaled 2) with la.
 
   p := fullcircle scaled (2 * la) shifted za ;
   q := fullcircle scaled (2 * lb) shifted zb ;
 
 
 but this does not work.
 
 Thanks for your attention: OK
 
 np, Stefan.
 
 On 24 mars 2011, at 10:29, Stefan Müller wrote:
 
 Hi,
 
 what about
 
 \startMPdefinitions
 vardef Triangle(expr za, zb, la, lb) =
 path p, q ;
 pair zc ;
 pickup pencircle scaled 2mm ;
 drawdot za ;
 drawdot zb ;
 p := fullcircle scaled la shifted za ;
 q := fullcircle scaled lb shifted zb ;
 zc = p intersectionpoint q ;
 drawdot zc ;
 pickup pencircle scaled 1mm ;
 za--zb--zc--cycle
 enddef;
 \stopMPdefinitions
 
 \starttext
 \startMPcode
 draw Triangle((0cm,0cm), (5cm,0cm), 8cm, 6cm) withcolor blue ;  
 \stopMPcode
 \stoptext
 
 Stefan
 
 On 24.03.2011 09:59, Otared Kavian wrote:
 Hi all,
 
 I have a document in which I must draw several triangles for which two 
 summits, say z0, z1, and the length of the two other sides are known, so 
 that the third summit, say z2, is completly determined.
 In order to draw one triangle the following works fine:
 
 \setupcolors[state=start]
 \starttext
 \startMPcode
z0 = (0cm,0cm) ;
z1 = (5cm,0cm) ;
path p, q ; 
pickup pencircle scaled 2mm ;
drawdot z0 ;
drawdot z1 ;
p := halfcircle scaled 8 cm ; % twice the length of the second side at 
 z0
p := p shifted z0 ;
q := halfcircle scaled 6 cm ;  % twice the length of the second side at 
 z1
q := q shifted z1  ;
z2 = p intersectionpoint q ;
drawdot z2 ;
pickup pencircle scaled 1mm ;
draw z0--z1--z2--cycle withcolor blue ;
 \stopMPcode
 \stoptext
 
 However I would like to have a macro, for instance named Triangle, which 
 accepts four arguments z0,z1, length_1, length_2, so that in a MetaPost 
 code i can use
draw Triangle(z0,z1, 4, 3) withcolor blue ;
 in order to draw the above triangle.
 Has anyone any idea about how to do this?
 
 Thanks in advance for your help: OK
 ___
 If your question is of interest to others as well, please add an entry to 
 the Wiki!
 
 maillist : ntg-context@ntg.nl / 
 http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___
 
 ___
 If your question is of interest to others as well, please add an entry to 
 the Wiki!
 
 maillist : ntg-context@ntg.nl / 
 http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___
 
 %%
 Otared Kavian
 Département de Mathématiques
 Université de Versailles Saint-Quentin
 Bâtiment Fermat
 45 avenue des Etats Unis
 78035 Versailles cedex
 
 Téléphone: +33 1 39 25 46 42
 Secrétariat: +33 1 39 25 46 44
 Secrétariat: +33 1 39 25 46 46
 
 e-mail: otared.kav...@math.uvsq.fr
 
 
 
 
 ___
 If your question is of interest to others as well, please 

Re: [NTG-context] Metfun macro for triangle

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Stefan Müller wrote:




On 24.03.2011 10:57, Otared Kavian wrote:

Hi Stefan,

Thanks for the quick answer and solution!
Your solution works perfectly in mkiv; however typesetting with mkii 
results in

! Undefined control sequence.
l.3 \startMPdefinitions
Is there a solution with mkii?


Then just drop the MPdefinitions section and put the complete vardef before 
your normal mp code in the MPcode section. That should work, I think.


Or you can use

\startMPinclusions[+]

\stopMPinclusions

[+] appends to the existing content of MPinclusion, so you can have 
multiple such sections.


Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Cecil Westerhof wrote:


When using \startitemize … \stopitemize there is no indent for the first
paragraph when using \head, but there is when using \item. How can I make
that by \item the first paragraph also has no indentation?


See 
http://wiki.contextgarden.net/Indentation#Setting_up_indentation_inside_environments


What you need is

\setupindenting[big,yes]
\setupitemize[1][indenting=next]

\starttext
\startitemize
  \item \input knuth
\stopitemize
\stoptext

Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Aditya Mahajan wrote:


On Thu, 24 Mar 2011, Cecil Westerhof wrote:


When using \startitemize … \stopitemize there is no indent for the first
paragraph when using \head, but there is when using \item. How can I make
that by \item the first paragraph also has no indentation?


See 
http://wiki.contextgarden.net/Indentation#Setting_up_indentation_inside_environments


What you need is

\setupindenting[big,yes]
\setupitemize[1][indenting=next]

\starttext
\startitemize
 \item \input knuth
\stopitemize
\stoptext


Actually, in MkII indenting=yes does the right thing (no indentation of 
the first line). I would consider MkIV behavior a bug.


I don't know what is the best solution. Perhaps changing


\normalexpanded{\noexpand\setupindenting[\v!reset,\v!yes,\currentitemindenting]}%

to

\normalexpanded{\noexpand\setupindenting[\v!reset,\v!next,\v!yes,\currentitemindenting]}%

Then, \setupitemize[1][indenting=first] will indent the first line, 
indenting=yes, will not (untested).


Another option is to change reset so that it sets indentfirstparagraph to 
false, but that might create havoc at other places.


Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Wolfgang Schuster

Am 24.03.2011 um 15:29 schrieb Aditya Mahajan:

 On Thu, 24 Mar 2011, Aditya Mahajan wrote:
 
 On Thu, 24 Mar 2011, Cecil Westerhof wrote:
 
 When using \startitemize … \stopitemize there is no indent for the first
 paragraph when using \head, but there is when using \item. How can I make
 that by \item the first paragraph also has no indentation?
 
 See 
 http://wiki.contextgarden.net/Indentation#Setting_up_indentation_inside_environments
 
 What you need is
 
 \setupindenting[big,yes]
 \setupitemize[1][indenting=next]
 
 \starttext
 \startitemize
 \item \input knuth
 \stopitemize
 \stoptext
 
 Actually, in MkII indenting=yes does the right thing (no indentation of the 
 first line). I would consider MkIV behavior a bug.

This is a feature of MkIV to allow one to indent the first paragraph of an 
\item (was a feature request) which isn’t possible with MkII.

\starttext
\startitemize[indenting={yes,medium}]
\item \input knuth
\stopitemize
\stoptext

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Cecil Westerhof
2011/3/24 Aditya Mahajan adit...@umich.edu

 On Thu, 24 Mar 2011, Cecil Westerhof wrote:

  When using \startitemize … \stopitemize there is no indent for the first
 paragraph when using \head, but there is when using \item. How can I make
 that by \item the first paragraph also has no indentation?


 See
 http://wiki.contextgarden.net/Indentation#Setting_up_indentation_inside_environments

 What you need is

 \setupindenting[big,yes]
 \setupitemize[1][indenting=next]

 \starttext
 \startitemize
  \item \input knuth
 \stopitemize
 \stoptext


Does not work. I tried:
\setupindenting[yes,medium]
\setupitemize[1][indentnext=no]
\setupitemgroup[itemize][indentnext=no]

\starttext
` Backtick\crlf
' Apostrophe\crlf
‘ Open curly quote\crlf
’ Close curly quote

‘some quoted text’

“some doublequoted text”

\setupbodyfont[palatino,rm,12pt]

‘some quoted text’

“some doublequoted text”

\startitemize
\item Alleen een test

\input knuth
\stopitemize

\stoptext

But the first paragraph is still indented.

I still find it strange that \head does not indent the first and \item does.
I would expect them to behave the same.

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Cecil Westerhof wrote:


2011/3/24 Aditya Mahajan adit...@umich.edu


On Thu, 24 Mar 2011, Cecil Westerhof wrote:

 When using \startitemize … \stopitemize there is no indent for the first

paragraph when using \head, but there is when using \item. How can I make
that by \item the first paragraph also has no indentation?



See
http://wiki.contextgarden.net/Indentation#Setting_up_indentation_inside_environments

What you need is

\setupindenting[big,yes]
\setupitemize[1][indenting=next]

\starttext
\startitemize
 \item \input knuth
\stopitemize
\stoptext



Does not work. I tried:
   \setupindenting[yes,medium]
   \setupitemize[1][indentnext=no]
   \setupitemgroup[itemize][indentnext=no]

   \starttext
   ` Backtick\crlf
   ' Apostrophe\crlf
   ‘ Open curly quote\crlf
   ’ Close curly quote

   ‘some quoted text’

   “some doublequoted text”

   \setupbodyfont[palatino,rm,12pt]

   ‘some quoted text’

   “some doublequoted text”

   \startitemize
   \item Alleen een test

   \input knuth
   \stopitemize

   \stoptext

But the first paragraph is still indented.

I still find it strange that \head does not indent the first and \item does.
I would expect them to behave the same.


Well, you did not add indenting=next key

Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Marco net...@lavabit.com

 On 2011-03-24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de wrote:

 This should also work:

 \starttext

 \startluacode
  function modification_date (file)
local f = file
local attr = lfs.attributes (f)
assert (type(attr) == table)
if attr.mode ~= directory then
  return os.date(%Y-%m-%d %H:%M,attr.modification)
end
  end
 \stopluacode

 \unexpanded\def\getdate{%
  \ctxlua{context(modification_date (\jobname.tex))}%
 }

 \getdate

 \stoptext


I would like to do something like the following:
\getdate would return os.date(%Y-%m-%d,attr.modification)
and
\getdate{long} would return os.date(%Y-%m-%d
%H:%M,attr.modification)

I have looked at lua, but do not see how to do it. (Something else to
learn.)

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Cecil Westerhof wrote:


2011/3/24 Marco net...@lavabit.com


On 2011-03-24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de wrote:

This should also work:

\starttext

\startluacode
 function modification_date (file)
   local f = file
   local attr = lfs.attributes (f)
   assert (type(attr) == table)
   if attr.mode ~= directory then
 return os.date(%Y-%m-%d %H:%M,attr.modification)
   end
 end
\stopluacode

\unexpanded\def\getdate{%
 \ctxlua{context(modification_date (\jobname.tex))}%
}

\getdate

\stoptext



I would like to do something like the following:
   \getdate would return os.date(%Y-%m-%d,attr.modification)
and
   \getdate{long} would return os.date(%Y-%m-%d
%H:%M,attr.modification)

I have looked at lua, but do not see how to do it. (Something else to
learn.)


Untested:

\def\getdate%
  {\dosinglegroupempty\dogetdate}

\def\dogetdate#1%
   {context{modification_date(\jobname.tex, #1)}}

and then in the lua code

function modification_date(file, format)

if format == long then

else
...
end

end

Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Aditya Mahajan adit...@umich.edu

   \getdate would return os.date(%Y-%m-%d,attr.modification)
 and
   \getdate{long} would return os.date(%Y-%m-%d
 %H:%M,attr.modification)

 I have looked at lua, but do not see how to do it. (Something else to
 learn.)

 I would like to do something like the following:

 Untested:

 \def\getdate%
  {\dosinglegroupempty\dogetdate}

 \def\dogetdate#1%
   {context{modification_date(\jobname.tex, #1)}}

 and then in the lua code

 function modification_date(file, format)
 
 if format == long then
 
 else
 ...
 end

 end


I have:
\startluacode
  function modification_date(file, format)
local f= file
local attr = lfs.attributes(f)

assert (type(attr) == table)
if attr.mode ~= directory then
  if format == long then
return os.date(%Y-%m-%d %H:%M,attr.modification)
  else
return os.date(%Y-%m-%d,attr.modification)
  end
end
  end
\stopluacode

\def\getdate%
 {\dosinglegroupempty\dogetdate}

\def\dogetdate#1%
  {context{modification_date(\jobname.tex, #1)}}

This results in:
contextmodification_date(subversion.tex, )

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Wolfgang Schuster

Am 24.03.2011 um 17:29 schrieb Cecil Westerhof:

 \def\getdate%
  {\dosinglegroupempty\dogetdate}
 
 \def\dogetdate#1%
   {context{modification_date(\jobname.tex, #1)}}

\def\getdate
  {\dosingleempty\dogetdate}

\def\dogetdate[#1]%
  {\ctalua{context(modification_date(\jobname.tex, #1))}}

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Wolfgang Schuster schuster.wolfg...@googlemail.com


 Am 24.03.2011 um 17:29 schrieb Cecil Westerhof:

  \def\getdate%
   {\dosinglegroupempty\dogetdate}
 
  \def\dogetdate#1%
{context{modification_date(\jobname.tex, #1)}}

 \def\getdate
  {\dosingleempty\dogetdate}

 \def\dogetdate[#1]%
  {\ctalua{context(modification_date(\jobname.tex, #1))}}


I have:
\startluacode
  function modification_date(file, format)
local f= file
local attr = lfs.attributes(f)

assert (type(attr) == table)
if attr.mode ~= directory then
  if format == long then
return os.date(%Y-%m-%d %H:%M,attr.modification)
  else
return os.date(%Y-%m-%d,attr.modification)
  end
end
  end
\stopluacode

\def\getdate
 {\dosingleempty\dogetdate}

\def\dogetdate[#1]%
 {\ctalua{context(modification_date(\jobname.tex, #1))}}

\starttext

\getdate

\stoptext

This gives:
\dogetdate [#1]-\ctalua
 {context(modification_date(\jobname .tex, #1))}
l.29 \getdate[]

?

I tried with \getdate, \getdate{} and \getdate[].

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Philipp Gesang
On 2011-03-24 18:15:31, Cecil Westerhof wrote:
 2011/3/24 Wolfgang Schuster schuster.wolfg...@googlemail.com
 
 
  Am 24.03.2011 um 17:29 schrieb Cecil Westerhof:
 
   \def\getdate%
{\dosinglegroupempty\dogetdate}
  
   \def\dogetdate#1%
 {context{modification_date(\jobname.tex, #1)}}
 
  \def\getdate
   {\dosingleempty\dogetdate}
 
  \def\dogetdate[#1]%
   {\ctalua{context(modification_date(\jobname.tex, #1))}}
 
 
 I have:
 \startluacode
   function modification_date(file, format)
 local f= file
 local attr = lfs.attributes(f)
 
 assert (type(attr) == table)
 if attr.mode ~= directory then
   if format == long then
 return os.date(%Y-%m-%d %H:%M,attr.modification)
   else
 return os.date(%Y-%m-%d,attr.modification)
   end
 end
   end
 \stopluacode
 
 \def\getdate
  {\dosingleempty\dogetdate}
 
 \def\dogetdate[#1]%
  {\ctalua{context(modification_date(\jobname.tex, #1))}}
   ^
s/\\ctalua/\\ctxlua/

Regards, Philipp
 
 \starttext
 
 \getdate
 
 \stoptext
 
 This gives:
 \dogetdate [#1]-\ctalua
  {context(modification_date(\jobname .tex, #1))}
 l.29 \getdate[]
 
 ?
 
 I tried with \getdate, \getdate{} and \getdate[].
 
 -- 
 Cecil Westerhof

 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___



pgpjkRKcvCmDZ.pgp
Description: PGP signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Marco
On 2011-03-24 Cecil Westerhof cldwester...@gmail.com wrote:

 \def\dogetdate[#1]%
  {\ctalua{context(modification_date(\jobname.tex, #1))}}
^^^
Try \ctxlua …


Marco


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Cecil Westerhof
2011/3/24 Aditya Mahajan adit...@umich.edu

 paragraph when using \head, but there is when using \item. How can I make
 that by \item the first paragraph also has no indentation?


 See

 http://wiki.contextgarden.net/Indentation#Setting_up_indentation_inside_environments

 What you need is

 \setupindenting[big,yes]
 \setupitemize[1][indenting=next]

 \starttext
 \startitemize
  \item \input knuth
 \stopitemize
 \stoptext


 Does not work. I tried:
   \setupindenting[yes,medium]
   \setupitemize[1][indentnext=no]
   \setupitemgroup[itemize][indentnext=no]

   \starttext
   ` Backtick\crlf
   ' Apostrophe\crlf
   ‘ Open curly quote\crlf
   ’ Close curly quote

   ‘some quoted text’

   “some doublequoted text”

   \setupbodyfont[palatino,rm,12pt]

   ‘some quoted text’

   “some doublequoted text”

   \startitemize
   \item Alleen een test

   \input knuth
   \stopitemize

   \stoptext

 But the first paragraph is still indented.

 I still find it strange that \head does not indent the first and \item
 does.
 I would expect them to behave the same.

  When using \startitemize … \stopitemize there is no indent for the first

 Well, you did not add indenting=next key


That is the problem when you try different possibilities. :-{

I know have:
\setupindenting[yes,medium]
\setupitemize[1][indenting=next]
%\setupitemize[1][indentnext=no]
%\setupitemgroup[itemize][indentnext=no]

\starttext

\startitemize
\item Alleen een test

\input knuth
\stopitemize

\stoptext

Stil the same problem. I tried it also with what is now in comment.

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Wolfgang Schuster

Am 24.03.2011 um 18:26 schrieb Cecil Westerhof:

 \startitemize
 \item Alleen een test

This is the paragraph which is not indented.

 \input knuth

This starts the second paragraph which is now indented.

There is nothing wrong here. To prevent indentation you can add \noindentation 
at the begin of the second paragraph.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Florian Wobbe
 \def\getdate
  {\dosingleempty\dogetdate}
 
 \def\dogetdate[#1]%
  {\ctalua{context(modification_date(\jobname.tex, #1))}}

How would you automatically find out the filename which the macro is called 
from? For instance if the file with the macro is included in a master document.

Florian

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de

   {\ctalua{context(modification_date(\jobname.tex, #1))}}
^
 s/\\ctalua/\\ctxlua/


I have:
\startluacode
  function modification_date(file, format)
local f= file
local attr = lfs.attributes(f)

assert (type(attr) == table)
if attr.mode ~= directory then
  if format == long then
return os.date(%Y-%m-%d %H:%M,attr.modification)
  else
return os.date(%Y-%m-%d,attr.modification)
  end
end
  end
\stopluacode

\def\getdate
 {\dosingleempty\dogetdate}

\def\dogetdate[#1]%
 {\ctxlua{context(modification_date(\jobname.tex, #1))}}

\starttext

\getdate

\getdate{short}

\getdate{long}

\stoptext

This gives:
2011-03-24
2011-03-24short
2011-03-24long

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Cecil Westerhof
2011/3/24 Wolfgang Schuster schuster.wolfg...@googlemail.com

  \startitemize
  \item Alleen een test

 This is the paragraph which is not indented.

  \input knuth

 This starts the second paragraph which is now indented.

 There is nothing wrong here. To prevent indentation you can add
 \noindentation at the begin of the second paragraph.


When using:
\startitemize
\item Alleen een test

\input knuth
\head Alleen een test

\input knuth
\stopitemize

Then the first paragraph of knuth is not indented by head, but is indented
by item. This I find not consistent. I would prefer item to work like head.

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Florian Wobbe wrote:


\def\getdate
 {\dosingleempty\dogetdate}

\def\dogetdate[#1]%
 {\ctalua{context(modification_date(\jobname.tex, #1))}}


How would you automatically find out the filename which the macro is called 
from? For instance if the file with the macro is included in a master document.


\inputfilename

So, if you want the name of the file in which this macro is defined in, 
then something like this should work:


\edef\thisfilename{\inputfilename}

\def.{\thisfilename.tex, ...}


Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Philipp Gesang
On 2011-03-24 18:42:12, Cecil Westerhof wrote:
 2011/3/24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de
 
{\ctalua{context(modification_date(\jobname.tex, #1))}}
 ^
  s/\\ctalua/\\ctxlua/
 
 
 I have:
 \startluacode
   function modification_date(file, format)
 local f= file
 local attr = lfs.attributes(f)
 
 assert (type(attr) == table)
 if attr.mode ~= directory then
   if format == long then
 return os.date(%Y-%m-%d %H:%M,attr.modification)
   else
 return os.date(%Y-%m-%d,attr.modification)
   end
 end
   end
 \stopluacode
 
 \def\getdate
  {\dosingleempty\dogetdate}
 
 \def\dogetdate[#1]%
  {\ctxlua{context(modification_date(\jobname.tex, #1))}}
 
 \starttext
 
 \getdate
 
 \getdate{short}

\getdate[long]
\getdate[nil]
\getdate[false]

In context optional args are specified in brackets. It’s all
documented on the wiki:
  http://wiki.contextgarden.net/Commands_with_optional_arguments

Regards, phg


 
 \getdate{long}
 
 \stoptext
 
 This gives:
 2011-03-24
 2011-03-24short
 2011-03-24long
 
 -- 
 Cecil Westerhof

 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___



pgpqn4pHZK5qt.pgp
Description: PGP signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] No indent with first paragraph with \item

2011-03-24 Thread Wolfgang Schuster

Am 24.03.2011 um 18:46 schrieb Cecil Westerhof:

 Then the first paragraph of knuth is not indented by head, but is indented by 
 item. This I find not consistent. I would prefer item to work like head. 

\item ≠ \head

If both would behave the same way there is no need to have two commands.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Florian Wobbe
 How would you automatically find out the filename which the macro is called 
 from? For instance if the file with the macro is included in a master 
 document.
 
 \inputfilename
 
 So, if you want the name of the file in which this macro is defined in, then 
 something like this should work:
 
 \edef\thisfilename{\inputfilename}
 
 \def.{\thisfilename.tex, ...}

Thanks, nice! I suppose the filename is also directly reachable from inside 
\startluacode ... \stopluacode. How?

Florian

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Hans Hagen

On 24-3-2011 6:30, Marco wrote:

On 2011-03-24 Cecil Westerhofcldwester...@gmail.com  wrote:


 \def\dogetdate[#1]%
  {\ctalua{context(modification_date(\jobname.tex, #1))}}

 ^^^
Try \ctxlua …


or

\cldcontext{modification_date(\jobname.tex, #1)}

but ... is it clever to define modification_date in the global lua 
table? just calling lfs.attributes is just as efficient


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Philipp Gesang pges...@ix.urz.uni-heidelberg.de

  \getdate
 
  \getdate{short}

 \getdate[long]
 \getdate[nil]
 \getdate[false]

 In context optional args are specified in brackets.


I had tried \getdate[long], but the quotes where wrong.



 It’s all
 documented on the wiki:
  http://wiki.contextgarden.net/Commands_with_optional_arguments


I'll look into it.

Thanks.

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Aditya Mahajan

On Thu, 24 Mar 2011, Florian Wobbe wrote:


How would you automatically find out the filename which the macro is called 
from? For instance if the file with the macro is included in a master document.


\inputfilename

So, if you want the name of the file in which this macro is defined in, then 
something like this should work:

\edef\thisfilename{\inputfilename}

\def.{\thisfilename.tex, ...}


Thanks, nice! I suppose the filename is also directly reachable from 
inside \startluacode ... \stopluacode. How?


\start-stop luacode expands its contents. So, the following should work 
(untested)


\startluacode
  thisfilename = \thisfilename.tex
\stopluacode

Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Florian Wobbe
 Thanks, nice! I suppose the filename is also directly reachable from inside 
 \startluacode ... \stopluacode. How?
 
 \start-stop luacode expands its contents. So, the following should work 
 (untested)
 
 \startluacode
  thisfilename = \thisfilename.tex
 \stopluacode

No, that is not what I meant. I thought why do the detour when the filename is 
available from the environment of the lua core. I just found it:
\inputfilename is defined as \ctxsprint{environment.inputfilename}

Florian

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Cecil Westerhof
2011/3/24 Cecil Westerhof cldwester...@gmail.com

 \startluacode
   function modification_date(file, format)
 local f= file
 local attr = lfs.attributes(f)

 assert (type(attr) == table)
 if attr.mode ~= directory then
   if format == long then
 return os.date(%Y-%m-%d %H:%M,attr.modification)
   else
 return os.date(%Y-%m-%d,attr.modification)
   end
 end
   end
 \stopluacode


I made the code a little better:
\startluacode
  os.setlocale(nl_NL)

  function modification_date(file, format)
local f= file
local attr = lfs.attributes(f)
local fmt  = %d %B %Y

assert (type(attr) == table)
if attr.mode ~= directory then
  if format == long then
fmt = fmt ..  %H:%M
  end
  return os.date(fmt,attr.modification)
end
  end
\stopluacode

There is only one problem. I get:
25 March 2011
instead of:
25 maart 2011

What am I doing wrong?

-- 
Cecil Westerhof
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Hans Hagen

On 25-3-2011 12:08, Cecil Westerhof wrote:


I made the code a little better:
\startluacode
   os.setlocale(nl_NL)


blocked in mkiv to prevent unwanted side effects and that will stay


   function modification_date(file, format)
 local f= file
 local attr = lfs.attributes(f)


why the f?

function modification_date(filename,format)
local attr = lfs.attributes(filename)
if type(attr) == table and attr.mode ~= directory then
if format == nice then
return os.date(%Y-%m-%dT%X,attr.modification) .. 
os.timezone(true)

elseif format == long then
return os.date(%d %B %Y %H:%M,attr.modification)
else
return os.date(%d %B %Y,attr.modification)
end
end
return unset
end


print(modification_date(oeps.lua,nice))
print(modification_date(oeps.lua,long))

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] ConTeXt user manual: typo: componentonderdeel

2011-03-24 Thread Paul Menzel
Dear ConTeXt user manual editors,


in table 2.1 on page 19 in the ConTeXt user manual [1] in chapter 2
»Documents« there seems to be a space missing and the Dutch word is
appended to the command.

\componentonderdeel name


Thanks,

Paul


PS: Will an updated version be published sometime?


[1] http://www.pragma-ade.com/general/manuals/cont-eni.pdf


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] ConTeXt user manual: typo: componentonderdeel

2011-03-24 Thread Paul Menzel
Dear ConTeXt user manual editors,


Am Freitag, den 25.03.2011, 00:31 +0100 schrieb Paul Menzel:

 in table 2.1 on page 19 in the ConTeXt user manual [1] in chapter 2
 »Documents« there seems to be a space missing and the Dutch word is
 appended to the command.
 
   \componentonderdeel name

2. Additionally there is a typo in the column title of table 2.1:
s/componnent/component/.

3. On pages 22 and 23 in the examples for the components the command(?)
`\project demos` is missing. (At least it is marked as required in table
2.1.)

4. On page 23 `project.tex` is referenced for the project file, but
`demos.tex` is used in the example.


Thanks,

Paul


 PS: Will an updated version be published sometime?
 
 
 [1] http://www.pragma-ade.com/general/manuals/cont-eni.pdf


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] ConTeXt user manual: typo: componentonderdeel

2011-03-24 Thread Paul Menzel
Dear ConTeXt user manual editors,


Am Freitag, den 25.03.2011, 01:03 +0100 schrieb Paul Menzel:

 Am Freitag, den 25.03.2011, 00:31 +0100 schrieb Paul Menzel:
 
  in table 2.1 on page 19 in the ConTeXt user manual [1] in chapter 2
  »Documents« there seems to be a space missing and the Dutch word is
  appended to the command.
  
  \componentonderdeel name
 
 2. Additionally there is a typo in the column title of table 2.1:
 s/componnent/component/.
 
 3. On pages 22 and 23 in the examples for the components the command(?)
 `\project demos` is missing. (At least it is marked as required in table
 2.1.)
 
 4. On page 23 `project.tex` is referenced for the project file, but
 `demos.tex` is used in the example.

5. On page 25 it should be »… ConTeXt provide*s* …«.


Thanks,

Paul


  PS: Will an updated version be published sometime?
  
  
  [1] http://www.pragma-ade.com/general/manuals/cont-eni.pdf


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] structure: products and subfolders

2011-03-24 Thread Paul Menzel
Dear ConTeXt folks,


following [1] I do not get any PDF output running `context project.tex`.
The product files are in a subfolder. I verified that first with [2] in
a flat structure and then adding a subfolder where no output is created.
Executing ConTeXt with the seperate product files as an argument works.

$ context --version

MTXrun | main context
file: /context/tex/texmf-context/tex/context/base/context.mkiv
MTXrun | current version: 2011.02.04 10:01

I attach the files.

$ ls *
env_mymag.tex  project_mymag.log  project_mymag.tex  project_mymag.tuc

prd_year2004-01:
c_editorial.tex  prd_year2004-01.tex


Thanks,

Paul


[1] 
http://meeting.contextgarden.net/2007/share/sanjoy/sanjoy-typesetting-textbook.pdf
[2] http://wiki.contextgarden.net/Project_structure


test.7z
Description: application/7z-compressed


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use date of the tex file in the document

2011-03-24 Thread Philipp Gesang
On 2011-03-25 00:30:40, Hans Hagen wrote:
 On 25-3-2011 12:08, Cecil Westerhof wrote:
 
 I made the code a little better:
 \startluacode
os.setlocale(nl_NL)
 
 blocked in mkiv to prevent unwanted side effects and that will stay

Still, one can access context’s language substitution tables to
achieve a quasilocale effect (concerning the month, that is).
(- attachments.)

Good night all, Philipp



 
function modification_date(file, format)
  local f= file
  local attr = lfs.attributes(f)
 
 why the f?
 
 function modification_date(filename,format)
 local attr = lfs.attributes(filename)
 if type(attr) == table and attr.mode ~= directory then
 if format == nice then
 return os.date(%Y-%m-%dT%X,attr.modification) ..
 os.timezone(true)
 elseif format == long then
 return os.date(%d %B %Y %H:%M,attr.modification)
 else
 return os.date(%d %B %Y,attr.modification)
 end
 end
 return unset
 end
 
 
 print(modification_date(oeps.lua,nice))
 print(modification_date(oeps.lua,long))
 
 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
  | www.pragma-pod.nl
 -
 ___
 If your question is of interest to others as well, please add an entry to the 
 Wiki!
 
 maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
\ctxloadluafile{getdate}

\def\getdate
  {\dosingleempty\dogetdate}

\def\dogetdate[#1]%
  {\ctxlua{context(documentdata.modification_date(\jobname.tex, #1))}}

\def\Testall{%
  \starttabulate[|r|l|]
\NC nice  \NC {\os\getdate[nice]} \AR
\NC long  \NC {\os\getdate[long]} \AR
\NC plain \NC {\os\getdate}   \AR   
  \stoptabulate
  \hairline%
}

\starttext

\Testall

\language[de]
\Testall

\language[nl]
\Testall

\language[it]
\Testall

\language[no]
\Testall

\stoptext
#!/usr/bin/env texlua

local ldl_texts = languages.data.labels.texts
local u = utf

local function localize_it (str, lang)
local current_language = lang or languages.current(tex.language)
return ldl_texts[u.lower(str)].labels[current_language]
end

local function modification_date (filename, format)
local attr = lfs.attributes(filename)
if type(attr) == table and attr.mode ~= directory then
if format == nice then
return os.date(%Y-%m-%dT%X,attr.modification) ..  
os.timezone(true)
elseif format == long then
local tmp  = string.explode(os.date(%d %B %Y 
%H:%M,attr.modification),  )
local day, month, year, time = table.unpack(tmp)
return day .. .  .. localize_it(month) ..   .. year ..   .. 
time
else
local tmp  = string.explode(os.date(%d %B %Y,attr.modification), 
 )
local day, month, year = table.unpack(tmp)
return day .. .  .. localize_it(month) ..   .. year
end
end
return unset
end

documentdata.modification_date = modification_date


pgpbCcrcaCHGz.pgp
Description: PGP signature
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] structure: products and subfolders

2011-03-24 Thread Wolfgang Schuster

Am 25.03.2011 um 01:31 schrieb Paul Menzel:

 Dear ConTeXt folks,
 
 following [1] I do not get any PDF output running `context project.tex`.
 The product files are in a subfolder. I verified that first with [2] in
 a flat structure and then adding a subfolder where no output is created.
 Executing ConTeXt with the seperate product files as an argument works.

Don’t process project files, only use products or components when you want a 
PDF.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___