In my work as LaTeX typesetter I often deal with multiply defined
labels warnings. Most of them are about equations.
My question is, do the \ref
command "always" refer to the last labelled item? In my experience it is so, but I'd like to know if there are cases (e.g. settings o packages) in which this is not true.
E.g. if I have:
\documentclass[11pt]{article}
\begin{document}
\section{Introduction}
Equation~(\ref{eq1})
\begin{equation}
1 +1 =3
\label{eq1}
\end{equation}
Equation~(\ref{eq1})
\begin{equation}
2 +2 =5
\label{eq1}
\end{equation}
\end{document}
both refs refers to the last equation.
Note. We always ask the author(s) to check about the warning but my company policy is to remove the warning "before" sending the proofs. I'm searching for a "scripting" way to manage these cases, commenting all the multiply defined labels except for the last one, yet I need to know if this is a safe approach.
\ref{somelabel}
command refers to a counter labelledsomelabel
. So if you have this message, it means you have some equations with the same label. B.t.w., for equations, you should use\eqef
if you want to have the parentheses around the equation number. – Bernard Jul 2 '17 at 14:42