I am trying to reset a counter to zero; however hyperref
tries to reference previous equations. I am using:
\setcounter{equation}{0}
And if I have labels in say align
environments:
\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
\begin{align}
x=1
\label{eq:a} \\
y=2
\label{eq:b}
\end{align}
Eq.~\eqref{eq:a}.
Reset counter
\newpage
\setcounter{equation}{0}
\begin{align}
x=10
\label{eq:c} \\
y=20
\label{eq:d}
\end{align}
Now trying to refer to third equation Eq.~\eqref{eq:c}
\end{document}
If I now \ref{eq:c}
, the hyperref
package will point me back to eq:a
(in text, they both have the same number).
Is there a way to fix this without manually stepping a new counter you make? I.e. can you fix it without doing something like this:
\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
\begin{align}
x=1
\label{eq:a} \\
y=2
\label{eq:b}
\end{align}
Eq.~\eqref{eq:a}.
Reset counter
\newpage
%% \setcounter{equation}{0} %Commented out line
\newcounter{newequation} %Added line
\renewcommand{\theequation}{\arabic{newequation}} %Added line
\stepcounter{newequation} %Added line
\begin{align}
x=10
\label{eq:c} \\
\stepcounter{newequation} %Added line
y=20
\label{eq:d}
\end{align}
Now trying to refer to third equation Eq.~\eqref{eq:c}
\end{document}
?