32

Suppose I have the equations

\begin{align}
 f(x) = x^2
 g(x) = \exp( x )
\end{align}

I would like to use on single label for these lines, and ideally the equation number would be placed vertically between these two lines.

Although this question appears very basic, I have not found an explanation neither via search engines, nor on this website.

2

2 Answers 2

38

The very thing you want is the split environment, provided by the amsmath class.

Sample code.

\documentclass{article}
\usepackage[paperwidth=90mm]{geometry}% <-- better demonstrates the vertical alignment
\usepackage{amsmath}
\begin{document}

Eqn.~\eqref{eqn:eqlabel} has a single label split
across the two equations, as you can see here:
\begin{align}
\label{eqn:eqlabel}
\begin{split}
 f(x) &= x^2 ,
\\
 g(x) &= \exp( x ) .
\end{split}
\end{align}

\end{document}

Result.

Sample document using the split environment

5
  • Note: You can also use split not just within the align environment, but also within eqnarray.
    – Paul
    Nov 28, 2014 at 21:07
  • 1
    That's as maybe, but you should not use eqnarray. Nov 29, 2014 at 17:15
  • forgot double slash \\ : f(x) &= x^2 ,\\ g(x) &= \exp( x ) .
    – Ivan Kush
    Dec 20, 2016 at 11:31
  • How to align equ no. (1) with last line?
    – Dr.PB
    Mar 31, 2017 at 17:49
  • 1
    @Mr.EU: in that case you should use equation together with aligned, as in \begin{equation} \label{eqn:eqlabel} \begin{aligned}[b] f(x) &= x^2 , \\ g(x) &= \exp( x ) . \end{aligned} \end{equation}. Note the [b] after the {aligned}: this puts the equation number on the bottom line (more specifically, it aligns the baseline of the bottom of the entire aligned environment with the baseline of whatever comes before and after it in the equation, such as the equation number). Apr 6, 2017 at 9:11
20

You can use an aligned or gathered environment inside an equation:

Sample output

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
  \label{eq:t}
  \begin{aligned}
    f(x) &= x^2\\        
    g(x) &= \exp(x)
  \end{aligned}
\end{equation}

\begin{equation}
  \label{eq:u}
  \begin{gathered}
    f(x) = x^2\\        
    g(x) = \exp(x)
  \end{gathered}
\end{equation}

\end{document}
4
  • forgot double slash \\ : f(x) = x^2\\ g(x) = \exp( x )
    – Ivan Kush
    Dec 20, 2016 at 11:31
  • @IvanKush Thanks for pointing it out. I am 100% certain I didn't forget them, because the code was cut and pasted from the file used to compile the image. However, they had certainly disappeared from the posting. Dec 20, 2016 at 15:11
  • FYI, tex.meta.stackexchange.com/questions/7168/…
    – barbaz
    Jul 30, 2017 at 23:36
  • I like this one the best. I've had issues in the past with \begin{split}. Mar 28, 2022 at 16:43

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