How to stop fractions in display equations from running into each other?
You can use the dcases
environment provided by the mathtools package; this environment gives the same output as with cases
(from amsmath
) except that the rows are set in display style. A little example using the starred version dcases*
in which the second column is set in font active just before the environment:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
\pi(\mu \mid x) &= \frac{\pi(\mu)\,\mathcal{L}(x \mid \mu)}{p(x)} \\
&= \begin{dcases*}
\frac{(1-w)\phi(x)}{p(x)} & for $\mu=0$. \\
\frac{w\gamma(\mu)\phi(x-\mu)}{p(x)} &for $\mu\neq 0$.
\end{dcases*}
\end{align*}
\end{document}
If you want to get away from using an array
, you could consider using the cases
environment offered by amsmath
. Also, there are other possibilities to \arraystretch
and \displaystyle
:
- The new line macro
\\
ofarray
s,tabular
s orcases
can take an optional length argument:\\[<len>]
indicating the length skip between rows. Here<len>
refers to any known TeX lenth unit. - Using
cases
leaves you free fromarray
while still having the option to increase the "row skip" using Option 1. No need to specify a column alignment. amsmath
provides\dfrac{<num>}{<denom>}
which is the\displaystyle
form of\frac{<num>}{<denom>}
.
All these combined in the following MWE is probably what you're after:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
\pi(\mu \mid x) &= \frac{\pi(\mu)\,\mathcal{L}(x \mid \mu)}{p(x)} \\
&= \begin{cases}
\dfrac{(1-w)\phi(x)}{p(x)}
& \text{for $\mu=0$} \\[3ex]
\dfrac{w\gamma(\mu)\phi(x-\mu)}{p(x)}
& \text{for $\mu\neq 0$.}
\end{cases}
\end{align*}
\end{document}
All of these features come standard with amsmath
, so no need to load any additional packages. Also note the use of \text
for text in math mode. This is another feature provided by amsmath
.