8

Is there some standard way to create multiple display equations like the following

enter image description here

without having to use:

  1. \renewcommand*{\arraystretch}{2} (so that the two rows in the second equation don't get too close to each other)
  2. array environment (so that I can use \renewcommand*{\arraystretch}{2}. Can't use the align environment again)
  3. \displaystyle (so that things would be displayed the way they would if I used align)

as I've done below? My solution just seems like such a kludgy hack. There has to be a better/standard way...right?

\documentclass[10pt]{article}
\usepackage{amsmath}
\begin{document}
\renewcommand*{\arraystretch}{2}{
    \begin{align*}
      \pi(\mu \mid x) &= \frac{\pi(\mu)\,\mathcal{L}(x \mid \mu)}{p(x)} \\
                      &= \left\{
                            \begin{array}{lcl}
                              \displaystyle{\frac{(1-w)\phi(x)}{p(x)}}
                                & \mbox{for} & \mu = 0 \\
                              \displaystyle{\frac{w\gamma(\mu)\phi(x-\mu)}{p(x)}}
                                & \mbox{for} & \mu \neq 0. \\
                            \end{array}
                          \right.\\
    \end{align*}
    }
\end{document}
1

2 Answers 2

7

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}

enter image description here

1
  • I didn't know until I read your answer that the dcases environment of the mathtools package does such a good job of automatically setting the spacing between consecutive lines. Really neat!
    – Mico
    Oct 27, 2011 at 2:21
6

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:

  1. The new line macro \\ of arrays, tabulars or cases can take an optional length argument: \\[<len>] indicating the length skip between rows. Here <len> refers to any known TeX lenth unit.
  2. Using cases leaves you free from array while still having the option to increase the "row skip" using Option 1. No need to specify a column alignment.
  3. 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:

enter image description here

\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.

1
  • Wonderfully helpful. Never knew about \\[<len>]. I followed up with a question on it here.
    – lowndrul
    Oct 26, 2011 at 15:46

You must log in to answer this question.

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