\recurselevel inside \bTABLE\eTABLE
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? knd regards Willi
On Sun, 17 Mar 2013 13:00:22 +0100
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?
\starttext \subject{bTABLE--eTABLE: recurse creates rows} \bTABLE \dorecurse{3} {\bTR \bTD #1 \eTD \eTR} \eTABLE \stoptext Alan
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 Wolfgang
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... Aditya
Thank you all! I was trying to find your info Adytia, but failed :-) Willi On Mar 17, 2013, at 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...
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 ___________________________________________________________________________________
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 -----------------------------------------------------------------
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 ___________________________________________________________________________________
Am 17.03.2013 um 22:58 schrieb Willi Egger
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.
See my change, you have to put \expanded before \bTD because when you write \bTD \expanded{\recurselevel} \eTD context will store “\expanded{\recurselevel}” which is expanded after all cells are created and \recurselevel has its default value. Wolfgang
Hi Wolfgang, hm, I see, that I did not read your first message correctly. Thank you for pointing me to it! Willi On Mar 19, 2013, at 8:23 AM, Wolfgang Schuster wrote:
Am 17.03.2013 um 22:58 schrieb Willi Egger
: 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.
See my change, you have to put \expanded before \bTD because when you write
\bTD \expanded{\recurselevel} \eTD
context will store “\expanded{\recurselevel}” which is expanded after all cells are created and \recurselevel has its default value.
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 ___________________________________________________________________________________
Am 17.03.2013 um 22:17 schrieb Wolfgang Schuster
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
Needs \expanded: \bTABLE \dorecurse{3}{\bTR\expanded{\bTD\recurselevel\eTD}\eTR} \eTABLE Wolfgang
participants (5)
-
Aditya Mahajan
-
Alan BRASLAU
-
Hans Hagen
-
Willi Egger
-
Wolfgang Schuster