Am 05.03.2009 um 01:17 schrieb luigi scarso:

\starttext
%%% TeX version
\bTABLE
\dorecurse{5}
{\bTR\expandafter \bTD \recurselevel. \eTD\expandafter
        \bTD \recurselevel  \eTD\eTR}
\eTABLE

\dorecurse{2}
{\recurselevel. \recurselevel\crlf}

And you think it's a good idea to use \expandafter in your document?

\expanded is the tool for users to get this result without knowledge
about TeX internals and expansion, this is from core-ntb:

% permits \expanded{\bTD ... \eTD}

\unexpanded\def\eTR{}
\unexpanded\def\eTD{}
\unexpanded\def\eTH{}
\unexpanded\def\eTN{}

%%% luatex version
\startluacode
   tprint = function(s) tex.sprint(tex.ctxcatcodes,s) end
   tprint('\\bTABLE')
   for j = 1,5 do
       tprint('\\bTR')
tprint('\\bTD' .. j .. '.' .. '\\eTD' .. '\\bTD' .. j .. '\ \eTD')
       tprint('\\eTR')
   end
   tprint('\\eTABLE')
\stopluacode
\stoptext

Nice solution and real alternative for package writers to avoid \expandafter and \expanded but nothing for a normal user, I should keep this in my mind.

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

Reply via email to