[Tex/LaTex] How to reset numbering every new math block

alignamsmathequationsnumbering

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?

Best Answer

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

Related Question