How to show a formula too long to fit in a line?
For example: $$ P(Y-X=m | Y > X) = \sum_{k} P(Y-X=m, X=k | Y > X) = \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) = \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).$$
Thanks!
How to show a formula too long to fit in a line?
For example: $$ P(Y-X=m | Y > X) = \sum_{k} P(Y-X=m, X=k | Y > X) = \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) = \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).$$
Thanks!
Use double dollars and the \begin{align*} environment (within TeX-mode) to solve the problem.
$$\begin{align*} P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \\ &= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \\ &= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{align*}$$
$$\begin{align*}
P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \
&= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \
&= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{align*}$$
\left(
and ends with a \right)
? The align
environment seems to fail (in MathJax) for that case.
$\endgroup$
– Eric Nitardy
Mar 19 '11 at 17:47
\right.
to close the left(
on the first line and the invisible \left.
to open the closing \right)
on the last line and make \begin{align}...\end{align}
happy.
$\endgroup$
– Isaac
Mar 19 '11 at 19:26
\begin{align*}
environment can be used without first going into TeX mode (without the double dollar signs), though it sometimes requires you to escape with extra backslashes to get the interpreter to understand.
$\endgroup$
– Arturo Magidin
Mar 19 '11 at 21:13
\left
and \right
pairs not working across line breaks is also inherent already in standard TeX, so not a problem with MathJax per se. The usual way to solve the problem is to manually insert \big
and similar versions. See en.wikipedia.org/wiki/Help:Displaying_a_formula
$\endgroup$
– Willie Wong
Mar 23 '11 at 16:11
\begin{align*}
and \begin{align}
?
$\endgroup$
– user93957
Jan 29 '14 at 12:42
align*
is an unnumbered environment, whereas align
is numbered.
$\endgroup$
– Asaf Karagila♦
Jan 29 '14 at 13:04
Alternatively, since MathJax supports the amsmath
extensions, the split
environment is also supported:
$$\begin{split}P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \\ &= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \\ &= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{split}$$
which is generated by
$$\begin{split}
P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \\ &= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \\ &= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{split}$$
\mid
instead of |
... :)
$\endgroup$
– t.b.
Aug 7 '11 at 9:56
\middle
to go along with \left
and \right
though.
$\endgroup$
– J. M. isn't a mathematician
Aug 7 '11 at 10:14
As the last mathematician in the world still using Plain TeX, I'd do it with eqalign.
$$\eqalign{P(Y-X=m\mid Y\gt X)&=\sum_kP(Y-X=m,X=k\mid Y\gt X)\cr&=\sum_kP(Y-X=m\mid X=k,Y\gt X)\,P(X=k\mid Y>X)\cr&=\sum_kP(Y-k=m\mid Y\gt k)\,P(X=k\mid Y\gt X)\cr}$$
\eqalign{
P(Y-X=m\mid Y\gt X)
&=\sum_kP(Y-X=m,X=k\mid Y\gt X)\cr
&=\sum_kP(Y-X=m\mid X=k,Y\gt X)\,P(X=k\mid Y>X)\cr
&=\sum_kP(Y-k=m\mid Y\gt k)\,P(X=k\mid Y\gt X)\cr
}