Why is there multiply labels in this gather environment?
It's a known problem, see https://github.com/latex3/latex2e/issues/15
The manual of amsmath
explicitly tells that align
can be nested in gather
, see page 26:
However a “register” is not cleared at the proper time and a spurious, but innocuous, warning of There were multiply-defined labels
is issued; this happens in connection with \nonumber
.
In my experiment, patching \endalign
solves the issue.
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\endalign}
{\restorealignstate@}
{\global\let\df@label\@empty\restorealignstate@}
{}{}
\makeatother
\begin{document}
TEST
\begin{gather}
A \equiv X + Y \nonumber \\
\begin{align}
&= C + D + E + F + G \nonumber \\
&= E. \label{some label}
\end{align}
\end{gather}
\end{document}
I do not think one should put an align
environment into a gather
environment, but you can use aligned
. I think that gather
and align
should not be nested as they start their own math environment, but aligned
is precisely made for having an align
type math environment inside another math environment.
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\begin{document}
TEST
\begin{gather}
A \equiv X + Y \nonumber \\
\begin{aligned}[b]\label{some label}
&= C + D + E + F + G \\
&= E.
\end{aligned}
\end{gather}
ANOTHER TEST
\begin{align}
\MoveEqLeft A \equiv X + Y \notag \\
&= C + D + E + F + G \notag\\
&= E. \label{some label}
\end{align}
\end{document}