Am 05.07.2025 um 11:36 schrieb vm via ntg-context:
the \recurselevel remains at zero, why?
\setupexternalfigures[location=default]
\starttext
\bTABLE[split=repeat]
\dorecurse{20}{\recurselevel\quad } % <-- this shows the \recurselevel
\bTABLEhead
\bTR \bTD[strut=no,align=middle] \dontleavehmode\externalfigure[hacker]
[height=4ex] \eTD \eTR
\eTABLEhead
\bTABLEbody
\dorecurse{100}{\bTR \bTD table cell \recurselevel \eTD \eTR} % <- zero
\eTABLEbody
\eTABLE
\stoptext
Most of contexts table environments process the content multiple times
to get the cell width and height, as a result the loop iterator is
expanded way after the loop has run and the default value 0 is used.
To avoid this you can access the value with #1 (or ##1, ####1 etc. in
nested loops), use \expanded the expand the value (at the moment broken
in lmtx) or use the \expandedrepeat primitive.
\starttext
\bTABLE
\dorecurse{10}{\bTR \bTD row #1 \eTD \eTR}
\eTABLE
% \bTABLE
% \dorecurse{10}{\bTR \expanded{\bTD row \recurselevel \eTD} \eTR}
% \eTABLE
\bTABLE
\expandedrepeat 10 {\bTR \bTD row \the\currentloopiterator \eTD \eTR}
\eTABLE
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________