[Tex/LaTex] How to number and label equations displayed as a system

alignamsmathequationsnumbering

I have system of equations (2 consecutive lines of equations) that I need to display. I use to do this just using two consecutive equation environments, but then I noticed the spacing is rather larger between the equations. I've read up on the align environment, which works, but does it ensure the spacing between the equations won't overlap? I would like to be consistent with my approach and if I'm going to run into issues with align later, I assume learn a better option now.

The amsmath does cover most of the options (I believe aligned is another environment? But no multiple numbers/labels?) but it doesn't say how to include numbering and labels for each equation (for the ones where the option is available).

Best Answer

Don't use successive equations to number a system of equations. Rather use align which naturally numbers each in the same, consistent way. To avoid selective numbering, use \nonumber (or \notag), and to provide unique tags to select equations, use \tag{<tag>}.

enter image description here

\documentclass{article}

\usepackage{amsmath}
\usepackage[nopar]{lipsum}

\begin{document}

\lipsum[2]
\begin{align}
           f(x) &= ax^2 + bx + c \\
  ax^2 + bx + c &= g(x) \\
           f(x) &= g(x) \nonumber \\
  dx^2 + ex + f &= f + ex + dx^2 \tag{quadratic}
\end{align}
\lipsum[3]

\end{document}

The starred version align* removes all automatic numbering (like placing \nonumber next to each equation).

align does make sure the successive equations don't overlap, and also that the equations align horizontally with the placed & alignment marks.

aligned is similar, but is typically used to create an alignment with a single number. Here is the same example with aligned:

enter image description here

\documentclass{article}

\usepackage{amsmath}
\usepackage[nopar]{lipsum}

\begin{document}

\lipsum[2]
\begin{equation}
  \begin{aligned}
             f(x) &= ax^2 + bx + c \\
    ax^2 + bx + c &= g(x) \\
             f(x) &= g(x) \\
    dx^2 + ex + f &= f + ex + dx^2
  \end{aligned}
\end{equation}
\lipsum[3]

\end{document}