I would like to use multiple labels in the same equation when using amsmath. Basic latex already has this feature, but not amsmath, which seems to manipulate labels in complicated ways. Is it possible to alter the amsmath.sty code to restore this feature?

Or, alternatively, how to temporarily unload the amsmath package? This issue arises when compiling together different articles with \include, some using amsmath and not others. But I found that unloading packages is not possible in latex.

  • Welcome to TeX.SE! You can use backticks, ` `, to "highlight" words and other items that are TeX instructions or filenames. I've done so in your posting.
    – Mico
    Jan 5, 2012 at 12:15
  • 4
    What exactly do you mean by "labels"? Do you want to assign multiple \label{...} commands to one equation, or do you want more than one "tag" (equation number, etc) to show up next to the object of interest? The amsmath package provides the command \tag{...}, which lets users create fairly elaborate tags.
    – Mico
    Jan 5, 2012 at 12:24
  • I want to assign multiple \label{...} commands to one equation. I use one label to number the equation, and other labels to number the parameters appearing in it (I use stepcounter, etc..). Labels are used to refer to those parameters (I use ~100 parameters). I would prefer not to alter my document, because I already wrote it without amsmath, but now I need to compile it with another document that uses amsmath...
    – mosta
    Jan 5, 2012 at 14:13
  • Have a look at the question tex.stackexchange.com/questions/9939/… and the answer that Martin Scharrer provided.
    – Mico
    Jan 5, 2012 at 15:09
  • 3
    I suggest you post a MWE (minimum working example) of your code, containing maybe two equations and the various \label commands you're trying to make compatible with amsmath. Without such a MWE, it's very difficult (impossible?) to figure out what's going one and what may have to be done. Thanks.
    – Mico
    Jan 5, 2012 at 20:12

3 Answers 3


According to p. 86 of the cleveref user guide,

With amsmath, the original \label command is stored in \ltx@label, and \label@in@display replaces \label inside [single-line] equations. \label@in@display just saves the label for later, and defining it is left until the end of the equation, when \ltx@label is finally called.

Hence, you may want to include the following code in the preamble, after loading the amsmath package:


so that you have a command that doesn't contain the "secret letter" @. Alternatively, you could execute the command \let\ltxxlabel\label before loading the amsmath package. Then, replace all \label commands in your document -- except, of course, those that are actually associated with equation numbers -- with \ltxxlabel.

I cannot try out this suggested solution myself since I don't have a clear idea as to how you use the \label command in your document for purposes other than creating associations with equation numbers. Nevertheless, I would encourage you to try out this method.

Addendum: The cleveref user guide has the following to say about the treatment of the \label macro in the multiline equation environments (such as gather, align, and multline) of the amsmath environment:

The amsmath multi-line equation environments scan their bodies twice: Once to measure, once to typeset. In the measure phase, the \label command is disabled by letting it to \@gobble. ... Unfortunately, amsmath wasn't designed with redefinitions of \label in mind ... The multline environment works a bit differently to the other amsmath environments, in that \label is disabled during the typesetting phase, and enabled during the measuring phase.

Given these observations, it would seem that only the adventurous and daring may want to delve into redefining the ways that amsmath works with the \label command in its multiline equation environments. I must admit to not being sufficiently daring, at least not in this category...


y &= x \tag{foo}\\
y &= x \tag*{[bar]}\\
y &= x \tag{baz}\\
y &= x \label{foobarbaz}

See Equation~\ref{foobar} and \ref{foobarbaz}.

enter image description here

  • thank you, but it does not exactly reply to what I want: I would prefer not to alter my document, because I already wrote it without amsmath, but now I need to compile it with another document that uses amsmath...I use \label in combination with \stepcounter,\incr... to number the parameters inside the equation.
    – mosta
    Jan 5, 2012 at 14:24

The reason for this is because amsmath's align environment actually collects or gather the entire contents before typesetting it for horizontal alignment purposes. At least one way around this would be to reverse your thinking, and therefore reference the parameters in the equation and label them within your text. This way there is no conflict in labelling an entry twice within align.

Here is a minimal example that illustrates this concept:

Referencing parameters in amsmath's align environment

\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcounter{parms} \renewcommand{\theparms}{[\arabic{parms}]}
  y &= ax^2+bx+c \label{eq1}\\
  z &= i_{\ref{eq-i}}+j_{\ref{eq-j}}+k_{\ref{eq-k}} \label{eq2}
See~\eqref{eq1} and~\eqref{eq2}.
Specifically,~\eqref{eq2} has parameters~\newparm{eq-i},~\newparm{eq-j} and~\newparm{eq-k}.

The command \newparm{<label>} defines the labelling of a parameter (using \refstepcounter). It also prints the parameters number and then labels it as <label>. The display of the parameter is set by \theparms where parms is the parameter counter. All this can be modified.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .