Using \label with amsmath nested environments
Using align
inside gather
is officially supported (see p. 23 of amsldoc.pdf
, the end of section 10.2). However, using \label
inside the inner align
is buggy: if \notag
is used, then the error is raised, if \notag
is not used, a label in the second line is duplicated.
A horrible hack is to disable the error generation:
\makeatletter
\def\label@in@display{\gdef\df@label}
\makeatother
This of course will suppress the error also when it's legitimately raised, so use with care.
clearly this is a bug, and will be investigated as such.
but here's another horrible hack that merely gives the nasty warning that
LaTeX Warning: Label `important' multiply defined.
at least you wouldn't have to press enter every time ...
\documentclass[a5paper]{article}
\usepackage{amsmath}
\begin{document}
\begin{gather}
\begin{align}
a &= b + c \tag*{} \\
b - a &= -c
\label{important} \\
c - a &= -b
\end{align}\\
a - (b-a) - (c-a) = 2a
\end{gather}
some text with an xref: \eqref{important}
\end{document}