TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I revert the action of \numberwithin{mycounter}{section} so that mycounter does not reset with a new section?

Example: (This is not exactly my case but this is easy to understand.) I would like to have equation numbered within a section in the first part of the document, so I use \numberwithin{equation}{section}. But in the next part to number it directly. Like

Section 1
  equation (1.1)
  equation (1.2)
Section 2
  equation (2.1)
  equation (2.2)
  equation (2.3)
Section 3
  equation (1)
  equation (2)
  equation (3)
share|improve this question
See also tex.stackexchange.com/questions/28333/… – lockstep Jan 25 '12 at 22:21
up vote 9 down vote accepted

The package chngcntr does exactly that:


share|improve this answer
Thanks, master! Just a note, the macro \counterwithout kills the effect of both \numberwithin and \counterwithin, which is terrific! – yo' Jan 25 '12 at 21:29
Either use \numberwithin or \counterwithin, not both. – egreg Jan 25 '12 at 21:31
... and what should I do if some package uses \numberwithin itself without giving me a chance to prevent it? And to the case, I was thinking about putting \let\numberwithin\counterwithin after loading both amsmath and chngcntr. – yo' Jan 25 '12 at 21:38
The difference between \numberwithin and \counterwithin is that the former does a global redefinition, it shouldn't be a problem if \numberwithin is used only in the preamble. – egreg Jan 25 '12 at 21:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.