I have several environments in my .tex file. I'd like to know if there is a way to reset all counters at once?
To clarify what I mean, suppose we have environments theorem
, proposition
, etc., and instead of using individual commands \setcounter{theorem}{0}
, \setcounter{proposition}{0}
, etc, for resetting the counters to 0 I'd like to know if there is a way for resetting all counters using a single command.
Thanks
Best Answer
You can't just reset all counters. Well, that's not entirely true; but it's probably not what you want (for example, the
page
counter should most likely not be reset...).You could create a command that takes a list of counters for possible resetting. Here's such an implementation:
\resetcounterlist{<CSV list>}
takes a<CSV list>
of counters that you want to have reset. Then, issuing\resetcounters
will reset the counters in<CSV list>
to zero. Here's a complete example:Note that this might confuse
hyperref
.