Thank you again! Sorry for misspelling your name Aditya! I was surprised, that the solution of Wolfgang does not work, with \expanded{\recurselevel}, though it sounds reasonable. Still all rows are marked 0. Alan's suggestion gives me the desired result. Hm, I was not yet thinking about using cld... Thank you Hans! Willi On Mar 17, 2013, at 10:52 PM, Hans Hagen wrote:
On 3/17/2013 10:38 PM, Aditya Mahajan wrote:
On Sun, 17 Mar 2013, Wolfgang Schuster wrote:
Am 17.03.2013 um 13:00 schrieb Willi Egger
: Dear all,
I should prepare a form with a table. The table rows should be numbered.
How can I get get this done by using \recurselevel. In the attached minimal example all rows are numbered with 0.
\starttext \subject{bTABLE--eTABLE: recurse creates rows} \bTABLE \dorecurse{3} {\bTR \bTD \recurselevel \eTD \eTR} \eTABLE
What do i do wrongly here?
You’re doing nothing wrong but you have to expand the value of the counter.
One feature of natural tables is the calculated width of the cells, to do this context stores the content of all cells in a token register, i.e. context stores \recurselevel as content of the cell and not the value of the iteration. This content is processed after all cells have been stored and the \recurselevel macro uses at this moment its default value 0.
To expand the value of the counter use \expanded{…} to force a expansion.
\bTABLE \dorecurse{3}{\bTR\bTD\recurselevel\eTD\eTR} \eTABLE
There was a long discussion on this a couple of years back. Summarized here:
http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-t...
or
\startluacode context.bTABLE() context.bTR() context.bTD() context.mathematics("(+)") context.eTD() for y = 1,6 do context.bTD() context(y) context.eTD() end context.eTR() for x = 1,6 do context.bTR() context.bTD() context(x) context.eTD() for y = 1,6 do context.bTD() context(x+y) context.eTD() end context.eTR() end context.eTABLE() \stopluacode
----------------------------------------------------------------- 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 ___________________________________________________________________________________