mf
29. Juni 2015 14:35
Hello list,
consider this example, involving a number (counter) to be reset at each
page:

\starttext
\definenumber[MyNumber][way=bypage] % MyNumber=0
\incrementnumber[MyNumber] % MyNumber=1
\incrementnumber[MyNumber] % MyNumber=2
mynumber is \rawcountervalue[MyNumber]. % prints 2
\page % MyNumber=0
\incrementnumber[MyNumber] % MyNumber=1
At the new page, mynumber is \rawcountervalue[MyNumber].
\stoptext

In ConTeXt 2014.05.21 22:04 (the one I get as Debian package) it works
as expected, giving MyNumber=1 at page 2, because MyNumber gets reset
at page break.
In the latest beta (and also in 2014.04.01) the counter does not reset
and it's equal to 3 at the end of page 2.

Another question: when you comment out the increment at page 2, the
counter does not reset, and you get 2 even in version 2014.05.21.

\starttext
\definenumber[MyNumber][way=bypage] % MyNumber=0
\incrementnumber[MyNumber] % MyNumber=1
\incrementnumber[MyNumber] % MyNumber=2
mynumber is \rawcountervalue[MyNumber]. % prints 2
\page % MyNumber=0
% \incrementnumber[MyNumber] COMMENTED OUT
At the new page, mynumber is \rawcountervalue[MyNumber]. % prints 2
\stoptext

Is this a bug or is it the way it should work when you don't increment it?
It’s a bug and hopefully fixed in a new beta but the counter is only reset
when you increment the value.

BTW: The names for the counter commands are \...counter, e.g.

\definecounter[testcounter][way=bypage]

\define\TestCounter
  {\incrementcounter[testcounter]
  %\convertedcounter[testcounter]
   \rawcountervalue [testcounter]}

\starttext
\dorecurse{3}{\TestCounter\page}
\stoptext

Wolfgang