Talk:ConTeXt and Lua programming/Counters
Jump to navigation
Jump to search
Outdated information
Forcing the Reset of a Counter
In 2015, there was a bug that counters were reset (by chapter, page, etc.) only when they were incremented.
To force the reset, you can increment and then decrement a counter before using it.
\definecounter[mycounter][way=bypage] \setcounter[mycounter][10] \rawcountervalue[mycounter] \page % new page, mycounter should be reset \rawcountervalue[mycounter] % no, it's not reset: you still get '10' \incrementcounter[mycounter]\decrementcounter[mycounter] \rawcountervalue[mycounter] % now you should get '0' because it has been reset
\definenumber or \definecounter ?
\definenumber etc. are obsolete aliases for \definecounter etc.