TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the stackrel command to indicate important steps in the transformation of formulas. E.g. I would write: A\stackrel{(!)}{=}B so that I can later explain in text why exactly A equals B.

I've written a command \refeq{foo} now that will do this for me. So that I can use \eqqref{foo} later in text and it will automatically show the right number for the right equals sing in text (same as using \label{foo} and ref{foo}).

I only have one problem: when I have an equation that I want to label; and within this equation is also an equals sign that I want to reference to, I get the error

Package amsmath Error: Multiple \label's: label 'rom' will be lost.

what should I do to overcome this? I want to be able to ref to an equation and to any equals sign inside this equation.

Here's my working copy:



\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathllap{\mathpalette\mathllapinternal} \def\mathrlap{\mathpalette\mathrlapinternal} \def\mathclap{\mathpalette\mathclapinternal}


   {\text{\tiny $\mathclap{\roman{qc}}$}}




\begin{equation}A\refeq{AB}B\label{romeo} \end{equation}
\begin{equation}R=B\refeq{BC} C\end{equation}

\eqqref{AB} in equation \ref{romeo} is the same as \eqqref{BC}


Any help on what to do would be great!

I've tried using protect and mbox, but nothing works!

share|improve this question
up vote 8 down vote accepted

I've tried using protect and mbox, but nothing works!

Neither will help because they have nothing to do with the references.

The mathmode \label in your document is defined in the following way (most likely by amsmath):

\ifx \df@label \@empty \else \@amsmath@err {Multiple \string \label 's: label
 '\df@label ' will be lost}\@eha \fi \gdef \df@label

i.e., it simply stores the label in \df@label but checks first if it is still empty. Then later, at the end of the equation, it is finally used.

What you need for your extra labels is IMHO the textmode \label. The following code seems to work. Note that I saved away the \label to \textlabel and use a group to keep the change to \@currentlabel local. (Do not use { } or \bgroup \egroup for this because they create a new math atom in mathmode.) Without the group both actually independent labels will interact which each other, i.e. in your example the romeo label will be also have the number 3, not 1.

   {\text{\tiny $\mathclap{\roman{qc}}$}}

Just replace your definition of \refeq with this one. You might also have a look on \hyperlink and \hypertarget (IIRC) to manually add hyperlinks.

share|improve this answer
thanks! works like a charm. – romeovs Jan 31 '11 at 22:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.