# Splitting equation in align environment

I am attaching a picture of what I want to achieve. I am trying to use align* environment, and I've read all related questions to this, but with no luck. Can someone tell me a way which gives a result like this?

P.S. I know enough TeX for writing fractions and \cap. Just having trouble with alignment.

• What do you want to align? – karlkoeller Feb 1 '15 at 10:36

## 2 Answers

Being in align or not is irrelevant: what you want is to have a handy way for splitting the description inside the parentheses.

Here's how you can do with the help of mathtools (it automatically loads amsmath).

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\AfterProb}{(}{)}
\DeclareMathOperator{\ProbOp}{P}
\newcommand{\Prob}{\ProbOp\AfterProb}

\newcommand{\splitdesc}[1]{%
\begin{multlined}#1\end{multlined}%
}

\begin{document}

$\Prob[\Big]{\splitdesc{\text{first large text} \mid \\ \text{second large text}}} = \frac{ \Prob*{\splitdesc{\text{first large text} \cap {} \\ \text{second large text}}} }{ \Prob{\text{second large text}} }$

\end{document}


The example features two ways for setting the parentheses around \splitdesc; I'd prefer the one on the left. With \Prob* you basically get \left( and \right), but this gives too prominent parentheses.

Note {} after \cap, in order to get the correct spacing before the intersection symbol.

Note also that \Prob can be used anywhere, not only in this context (provided it's in a math formula, of course).

• This is good, however, I am using \mathbf{P} in the rest of the document for probability operator. Can you explain me how to achieve the same result, except for declaring a separate \probOp operator? – taninamdar Feb 1 '15 at 16:53
• @taninamdar Just change \DeclareMathOperator{\ProbOp}{P} into \DeclareMathOperator{\ProbOp}{\mathbf{P}} – egreg Feb 1 '15 at 16:54
• Thanks! And I suspect I'll have to remove [\Big] part to make it appear consistent too, right? – taninamdar Feb 1 '15 at 16:55
• @taninamdar I used two alternative forms; if you remove [\Big] you'll get small parentheses. For automatically sized parentheses (not recommended), use \Prob* – egreg Feb 1 '15 at 16:56

I don't think you want align here:

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator\PP{P}
\begin{document}

$\PP\begin{pmatrix} \text{first large text} \mid {}\\ \text{second large text} \end{pmatrix} = \frac { \PP\begin{pmatrix} \text{first large text} \cap {}\\ \text{second large text} \end{pmatrix} } { \PP\begin{pmatrix} \text{second large text} \end{pmatrix} }$

\end{document}


or following your comment perhaps you want

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator\PP{P}
\begin{document}

\begin{align}
\PP\begin{pmatrix}
\text{first large text} \mid {}\\
\text{second large text}
\end{pmatrix}
&=
\frac
{
\PP\begin{pmatrix}
\text{first large text} \cap {}\\
\text{second large text}
\end{pmatrix}
}
{
\PP\begin{pmatrix}
\text{second large text}
\end{pmatrix}
}\\
&=
\frac
{
\PP\begin{pmatrix}
\text{first largeer text} \cap {}\\
\text{second larger text}
\end{pmatrix}
}
{
\PP\begin{pmatrix}
\text{second largerrr text}
\end{pmatrix}
}
\end{align}

\end{document}

• Well I want to write further steps after this. Like the actual calculation. – taninamdar Feb 1 '15 at 10:37
• @taninamdar OK I added to my answer. How were we to guess you wanted a multi-line display from your picture:-) – David Carlisle Feb 1 '15 at 10:41