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)

1 Answer 1


The package chngcntr does exactly that:


  • Thanks, master! Just a note, the macro \counterwithout kills the effect of both \numberwithin and \counterwithin, which is terrific!
    – yo'
    Jan 25, 2012 at 21:29
  • Either use \numberwithin or \counterwithin, not both.
    – egreg
    Jan 25, 2012 at 21:31
  • 1
    ... 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, 2012 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, 2012 at 21:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .