Disproportion in initializing user counters
Hello ConTeXist. I encountered a disproportion in initializing user counters. Why initialization at the beginning of the source text does not work and what is the mechanism of how the user counters work. Thanx Jaroslav Hajtmar Here is a sample example: \definecounter[mycounter] \def\getmycounter{\incrementcounter[mycounter]\getnumber[mycounter]} \startbuffer[groups] \startxrow \startxcell \getmycounter\stopxcell \startxcell Content of column\stopxcell \stopxrow \stopbuffer \starttext %\setcounter[mycounter][0] % initializing at this point not working (the counter is 10 more than it should be). WHY? \startxtable \startxrow \startxcell Column 1\stopxcell \startxcell Column 2\stopxcell \stopxrow \setcounter[mycounter][0] % initializing at this point works fine \dorecurse{5}{\getbuffer[groups]} \stopxtable \stoptext
On 7/15/2018 12:33 PM, Jaroslav Hajtmar wrote:
Hello ConTeXist.
I encountered a disproportion in initializing user counters. Why initialization at the beginning of the source text does not work and what is the mechanism of how the user counters work.
Thanx Jaroslav Hajtmar
Here is a sample example:
\definecounter[mycounter]
\def\getmycounter{\incrementcounter[mycounter]\getnumber[mycounter]}
\startbuffer[groups]
\startxrow
\startxcell \getmycounter\stopxcell
\startxcell Content of column\stopxcell
\stopxrow
\stopbuffer
\starttext
%\setcounter[mycounter][0] % initializing at this point not working (the counter is 10 more than it should be). WHY?
\startxtable
\startxrow
\startxcell Column 1\stopxcell
\startxcell Column 2\stopxcell
\stopxrow
\setcounter[mycounter][0] % initializing at this point works fine
\dorecurse{5}{\getbuffer[groups]}
\stopxtable
\stoptext
tables take multiple passes so you need to decrement when still trialtypesetting \iftrialtypesetting .. \fi -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 07/15/2018 03:49 PM, Hans Hagen wrote:
On 7/15/2018 12:33 PM, Jaroslav Hajtmar wrote:
Hello ConTeXist.
I encountered a disproportion in initializing user counters. Why initialization at the beginning of the source text does not work and what is the mechanism of how the user counters work. [...] \starttext
%\setcounter[mycounter][0] % initializing at this point not working (the counter is 10 more than it should be). WHY?
tables take multiple passes so you need to decrement when still trialtypesetting
\iftrialtypesetting .. \fi
Many thanks for your reply, Hans. The original issue was mine, using with the handlecsv module. And I had no idea about what was wrong there. Many thanks for your help, Pablo -- http://www.ousia.tk
Hi Pablo, when you use the label mechanism to create a counter context ensures to print the right counter value in the table. Wolfgang
Pablo Rodriguez mailto:oinos@gmx.es 15. Juli 2018 um 16:47
Many thanks for your reply, Hans.
The original issue was mine, using with the handlecsv module. And I had no idea about what was wrong there.
Many thanks for your help,
Pablo
On 07/15/2018 07:20 PM, Wolfgang Schuster wrote:
Hi Pablo,
when you use the label mechanism to create a counter context ensures to print the right counter value in the table.
Hi Wolfgang, would it be possible to provide me with a minimal sample? I don‘t use labels and I don’t know how to use them with counters in xtables. Many thanks for your help, Pablo -- http://www.ousia.tk
On 7/15/2018 13:34, Pablo Rodriguez wrote:
On 07/15/2018 07:20 PM, Wolfgang Schuster wrote:
Hi Pablo,
when you use the label mechanism to create a counter context ensures to print the right counter value in the table.
Hi Wolfgang,
would it be possible to provide me with a minimal sample?
I don‘t use labels and I don’t know how to use them with counters in xtables.
Many thanks for your help,
Pablo
Easier than counters: \definelabel [QQ][text=,headcolor=red] \starttext \startxtable \startxrow \startxcell one \stopxcell \startxcell two \QQ[there] \stopxcell \stopxrow \startxrow \startxcell alpha \QQ\stopxcell \startxcell beta \QQ[here] \stopxcell \stopxrow \stopxtable See entry \in[here]. \stoptext -- Rik
On 07/15/2018 07:54 PM, Rik wrote:
Easier than counters:
\definelabel [QQ][text=,headcolor=red] \starttext \startxtable \startxrow \startxcell one \stopxcell \startxcell two \QQ[there] \stopxcell \stopxrow \startxrow \startxcell alpha \QQ\stopxcell \startxcell beta \QQ[here] \stopxcell \stopxrow \stopxtable
See entry \in[here].
\stoptext
Hi Rik, I totally agree: this is much easier than counters. Many thanks for your help, Pablo -- http://www.ousia.tk
Thank very much to explain the problem and to example with labels - very useful information for me.
Thanks to all.
Jaroslav Hajtmar
15. 7. 2018 v 19:20, Wolfgang Schuster
participants (5)
-
Hans Hagen
-
Jaroslav Hajtmar
-
Pablo Rodriguez
-
Rik
-
Wolfgang Schuster