In the following MWE, I receive a warning and a reference points to the wrong element.
\documentclass{article}
\usepackage{hyperref}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{eq1}
\end{equation}
\begin{equation}\tag{\ref*{eq1}b}
\label{eq1b}
\end{equation}
\begin{equation}
\label{eq2}
\end{equation}
This reference is incorrect: \ref{eq2} points to 1b. Also, this warnings appear:
\begin{verbatim}
pdfTeX warning (ext4): destination with the same identifier
(name{equation.0.2}) has been already used, duplicate ignored
\end{verbatim}
\end{document}
In this variant with equation*
, the latter problem is fixed, but a new one introduced. A link that was fine before is now wrong:
\documentclass{article}
\usepackage{hyperref}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{eq1}
\end{equation}
\begin{equation*}\tag{\ref*{eq1}b}
\label{eq1b}
\end{equation*}
\begin{equation}
\label{eq2}
\end{equation}
This reference is incorrect: \ref{eq1b} points to 1. No warning.
\end{document}
How can I get all references correct?
These questions are similar, but don't help:
Hyperlinking problems when using subequations, hyperref and cleveref
Hyperref jumps to the wrong equation if the equation has a \tag and cleveref is used
Best Answer
As stated in the answer to Hyperref jumps to the wrong equation if the equation has a \tag and cleveref is used by CyberSingularity, the starred environment should be used. If you do it and load
hyperref
afteramsmath
all links are correct:Note that this holds only for
equation
(it might be a feature request to Heiko Oberdiek making\tag
work properly inequation
). Foralign
and the other multiline environments there's no problem: