3

In a paper/document with multiple math blocks, such as align, equation etc. every new block resumes numbering from the number it was left in the previous. How can we reset the numbering, that is, how can each new math block within the same document start enumerating equations from 1?

2
  • 1
    \setcounter{equation}{0} – Steven B. Segletes Aug 18 '15 at 15:13
  • 2
    Sorry for asking, but why would you want this? This would potentially create hundreds of (1)'s making cross references unreadable. – daleif Aug 18 '15 at 15:27
5

Not sure what this is for.

The trick is to add \setcounter{equation}{0} to all the relevant structures.

\documentclass{article}
\usepackage{amsmath}
\usepackage{etoolbox}

\preto\equation{\setcounter{equation}{0}}
\makeatletter
\pretocmd\start@gather{\setcounter{equation}{0}}{}{}
\pretocmd\start@align{\setcounter{equation}{0}}{}{}
\pretocmd\start@multline{\setcounter{equation}{0}}{}{}
\makeatother

\begin{document}
First
\begin{equation}
0=0
\end{equation}
Second
\begin{gather}
0=0\\
0=0\\
0=0
\end{gather}
Third
\begin{align}
0=0\\
0=0\\
0=0\\
0=0
\end{align}
Fourth
\begin{multline}
Aaaaaaaaaaaaaaaaaaaaaaaaaaa\\
bbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{multline}

\end{document}

enter image description here

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.