# How to label some lines of a multiline chain of aligned equations

How in LaTeX do I make a multiline chain of equations, aligned on their = signs, and label at least one of them but not all of them, in such a way that equation-references work as they should?

The documentation I've seen addresses the task of laying out a single equation which is too long for a line, but not the task of laying out a chain of equations over several lines, with labels on specific lines.

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\setcounter{equation}{0}
\begin{document}
Text before the equations.
\begin{align*}
f(n+1)&=(n+1)^2 \\\\
&=n^2+2n+1 \label{u} \\\\
&=g(n)+1 \label{v}
\end{align*}
Later I discuss equations \eqref{u} and \eqref{v}.
\end{document}


In searching for the way to do this, I've come across many environments, including align, alignat, aligned, array, equation, eqnarray and various of the above suffixed with *. None of them seem to both compile and work.

Tobias Oetiker's "The Not So Short Introduction to Latex2e", p.64, sect.3.5.2, recommends IEEEeqnarray from the package IEEEtrantools. However my installation of TeX (MiKTeX) doesn't contain IEEEtrantools, and running pdflatex can't find it.

• you might take a look at the documentation for amsmath -- texdoc amsmath. there it mentions the use of \notag to omit the number from selected lines of a multiline block. – barbara beeton May 7 '17 at 12:04

For example using \notag:

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\setcounter{equation}{0}
\begin{document}
Text before the equations.
%\begin{align*}
\begin{align}
f(n+1)&=(n+1)^2 \notag\\
&=n^2+2n+1 \label{u} \\
&=g(n)+1 \label{v}
%\end{align*}
\end{align}
Later I discuss equations \eqref{u} and \eqref{v}.
\end{document}


• Two things I noted, which I mention just in case they help other beginners: 1) if a run of pdflatex says there were undefined references, or if (after inserting lines into the equation chain, say) a reference is wrong, rerunning pdflatex solves this 2) some display-math constructs work only if /not/ enclosed in $$...$$. – Rosie F May 7 '17 at 12:06
• @RosieF So please observe also, that \notag is defined by amsmath. Without it standard \nonumber works. – Przemysław Scherwentke May 7 '17 at 12:10
• @PrzemysławScherwentke -- without amsmath, align wouldn't work, so there's a bit of a tautology there. – barbara beeton May 26 '17 at 14:00