Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)
\SomeCommandToPutHere{equation}
Section 3
  equation (1)
  equation (2)
  equation (3)
share|improve this question
1  
See also tex.stackexchange.com/questions/28333/… –  lockstep Jan 25 '12 at 22:21

1 Answer 1

up vote 9 down vote accepted

The package chngcntr does exactly that:

\counterwithin{equation}{section}

\counterwithout{equation}{section}
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
3  
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

 
discard

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.