[NTG-context] Delayed expansion of macro?

2009-06-26 Thread Gerben Wierda

I need to use a macro like this:

\def\typeSQLfile#1{%
\startsetups header:margin
 \framed
   [frame=off,
orientation=90,
width=2\leftmarginwidth,
height=\textheight,
align={top,middle}]
   {#1\hfil\pagenumber\hfil\IfSQprojectname}
\stopsetups
\typefile[SQL]{#1}}

In the following setting:

\starttext
\typeSQLfile{Library-procedures/details.pls}
\typeSQLfile{Library-procedures/hlx$requery.pls}
\stoptext

This results in two problems;
1. The pagenumber is the same on each page for a file
2. The file name with the $ in it crashes the typefile argument (file  
not found), where \typefile itself handles the name OK.


How do I solve these? In LaTeX I would probably use \protect on  
\pagenumber.


G
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Delayed expansion of macro?

2009-06-26 Thread Gerben Wierda

On 26 Jun 2009, at 15:30, Gerben Wierda wrote:


I need to use a macro like this:

\def\typeSQLfile#1{%
\startsetups header:margin
\framed
  [frame=off,
   orientation=90,
   width=2\leftmarginwidth,
   height=\textheight,
   align={top,middle}]
  {#1\hfil\pagenumber\hfil\IfSQprojectname}
\stopsetups
\typefile[SQL]{#1}}

In the following setting:

\starttext
\typeSQLfile{Library-procedures/details.pls}
\typeSQLfile{Library-procedures/hlx$requery.pls}
\stoptext

This results in two problems;
1. The pagenumber is the same on each page for a file
2. The file name with the $ in it crashes the typefile argument  
(file not found), where \typefile itself handles the name OK.


Adding to this, it also crashes (not only file not found) the TeX job  
if there is a _ in the filename (missing $ inserted).


G
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___