[Tex/LaTex] Numbering one equation in aligned environment

amsmathequationsnumbering

I have the following code:

$\begin{aligned}[t] 
P\{X\in A\}&=\int_A\int_{-1}^1 f(x, y)dydx \\  
&=\int_A\int_{-1}^1\frac{1}{4}dydx \\ 
&=\int_A\frac{1}{4}\times 2dx \\ 
&=\int_A\frac{1}{2}dx 
\end{aligned}$

I want to label the last line as (2). How do I do this?

Best Answer

What you need is split. The number will be assigned automatically.

\documentclass{article}

\usepackage[tbtags]{amsmath}

\usepackage{lipsum} % just for the example

\newcommand{\diff}{\mathop{}\!d} % for integrals

\begin{document}

\lipsum*[2]
\begin{equation}\label{eq:someprob}
\begin{split}
P\{X\in A\}
  &=\int_A\int_{-1}^1 f(x, y)\diff y \diff x \\
  &=\int_A\int_{-1}^1\frac{1}{4}\diff y \diff x \\
  &=\int_A\frac{1}{4}\cdot 2\diff x \\ 
  &=\int_A\frac{1}{2}\diff x 
\end{split}
\end{equation}
\lipsum[3]

\end{document}

enter image description here

Note how I got the right spacing for the differential symbols. If you change your mind and prefer a vertically centered number, remove the tbtags option.

Related Question