I would like use:


with \section*{} because if the section is not numbered \counterwithin*{equation}{section} doesn't work properly, in fact, I'm using this command to do unnumbered sections even in table of contents:

\newcommand{\sect}[1] {\section*{#1}\addcontentsline{toc}{section}{#1}\addtocounter{section}{1}}

But how I said ... I cannot number properly my equations because counters are not restored to a new unnumbered sections.

So much thanks!


Counters bound to other counters are reset when the master counter is “stepped” with \stepcounter. So I guess that


is what you really want. Unless you want that




gives 3 as the section number for “C” like it seems your code does now. In that case,


will do.

  • Yes, it was just switch \addtocounter{section}{1} with \stepcounter{section} what I did need. Now works how I want, thank you. :) – JFernan Jul 5 '16 at 10:06
  • Mainly because I use this \newcommand{\seclabel}[1] {\numberwithin{equation}{section}\label{#1}} \newcommand{\sseclabel}[1] {\numberwithin{equation}{subsection}\label{#1}} To tag equations what I want. – JFernan Jul 5 '16 at 11:11
  • @JFernan That's a very wrong way to go. – egreg Jul 5 '16 at 11:13
  • Well, I don't want to enumerate all of my equations, only a few concretely. Only which are in cross-reference by labels, specifically. And this way allow me tag only a few equations with properly numeration (referencing its subsection and section even when section is unnumbered). – JFernan Jul 5 '16 at 11:15
  • @JFernan It would be much better to open a new question, with a full specification of your needs. – egreg Jul 5 '16 at 11:19

One can argue about this approach:

A reset equation in each \section* is without information which section is meant actually, so cross-referencing might become difficult, unless hyperref is used with correct linking.

In this solution I applied \xpretocmd for \section to reset the equation counter (which is probably done anyway), so both for \section and \section*.

The sectcont counter is just for making a unique hyperref anchor.










In \ref{eqeinsteinagain} we see...



  E=mc^2 \label{eqeinstein}

  E=mc^2 \label{eqeinsteinother}


  E=mc^2 \label{eqeinsteinagain}

  E=mc^2 \label{eqyeteinstein}


enter image description here

  • Personally, I would not use this approach .... – user31729 Jul 4 '16 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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