2

Suppose I have the following equation (42), a variant version of it (42ᵇⁱˢ), and then a repeated version of (42). Here is how I would express them in my document:

Original equation:

\begin{equation}
  \label{eq:42}
  R=-4\pi E^2h.
\end{equation}

A variant of it:

\begin{equation}
  \label{eq:42bis}
  R=4\pi E^2h,\tag{\ref{eq:42}$^\mathrm{bis}$}
\end{equation}

A repetition of (42) later in the document:

\begin{equation}
  \label{eq:42b}
  R=-4\pi E^2h,\tag{\ref{eq:42}}
\end{equation}

Why does the hyperref package make the links of \ref{eq:42bis} and \ref{eq:42b} both point to the same equation with \label{eq:42}?

Does a \ref{} inside a \tag{} override the \label{} of the equation environment?

thanks

4

The problem here is that you're technically overlaying hyperlinks, and the one pointing to the first equation wins, making it seem like all hyperlinks point to the same destination. You need to use \ref* in the \tags, which removes the actual hyperlink:

enter image description here

\documentclass{article}
\usepackage{amsmath,hyperref}% http://ctan.org/pkg/{amsmath,hyperref}
\begin{document}

\begin{equation}
  \label{eq:42}
  R=-4\pi E^2h.
\end{equation}
\begin{equation}  
  \label{eq:42bis}
  R=4\pi E^2h,\tag{\ref*{eq:42}$^\mathrm{bis}$}
\end{equation}
\begin{equation}
  \label{eq:42b}
  R=-4\pi E^2h,\tag{\ref*{eq:42}}
\end{equation}
See~\eqref{eq:42},~\eqref{eq:42bis} and~\eqref{eq:42b}.
\end{document}
5
  • Hmm… using \ref*{} instead didn't change anything for me, besides removing links. In fact, I would like all the refs to be links, that way someone can click (1ᵇⁱˢ) and get to (1). thanks – Geremia Sep 19 '13 at 6:52
  • @Geremia Werner's answer works perfectly for me. This solution links the labels to exactly where one would expect. Do you want all the labels in the example above to point to the first (1) instead? That would be not very intuitive. Obviously, so is the double overlay thing. – moewe Sep 19 '13 at 9:28
  • @Geremia: You used my exact example and all references were removed? That's not possible. You must be doing something different. – Werner Sep 19 '13 at 14:09
  • @Werner: Your example works perfectly fine, so there must be some other issue going on when I use it in my working document, which uses a custom style sheet, etc. Perhaps it's my publisher's custom style sheet changing things. thanks again – Geremia Sep 19 '13 at 17:40
  • @Geremia: Sure. Until that information is available, there's not much more we can do here. – Werner Sep 19 '13 at 17:41

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.