20

what should I do to stop the cases environment compressing the first line of the following?

\begin{equation}
\alpha_{mn} = \begin{cases} \frac{16\mu^2}{mn\pi^2\left[\pi^2(m^2/a^2 + n^2/b^2) - \mu^2\right]} &\mbox{for } m \mbox{ and } n \mbox{ odd;} 
\\ 0 &\mbox{for } m \mbox{ or } n \mbox{ even;} \end{cases} \\[1ex]
\end{equation}

I'm not sure to do tex on this site, but if anyone tries it they see the first case is compressed because it's a fraction.

marli
  • 165
Stefan
  • 261
  • 1
  • 2
  • 4

2 Answers2

31

The package mathtools (that also loads amsmath) provides dcases and dcases*:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\alpha_{mn} =
\begin{dcases*}
\frac{16\mu^2}{mn\pi^2[\pi^2(m^2/a^2 + n^2/b^2) - \mu^2]} &
  for $m$ and $n$ odd;\\
0\vphantom{\frac{0}{0}} & for $m$ or $n$ even;
\end{dcases*}
\end{equation}
\end{document}

enter image description here

The difference between cases and dcases is that display style is used in the latter, but not in the former. The dcases* form sets the second part in text mode, making it more convenient to type textual conditions.

The \vphantom{\frac{0}{0}} is an adjustment to make the construction more balanced. Note that you don't need \left and \right in the denominator, which would make the brackets too big.

egreg
  • 1,121,712
7

Two alternatives (I couldn't use the mathtools package because it was marked as obsolete) which work in the cases environment:

  1. use the function \mathlarger{} including the fraction you want to be displayed larger (also works with \sum symbol)

  2. (only for fractions) use the function \dfrac{} instead of \frac{}

marli
  • 165
user61877
  • 71
  • 1
  • 2
  • 3
    Welcome to TeX.SX. mathtools is not an obsolete package, so I wonder why you'd get that message. And amsmath is required for \dfrac, isn't it? – Torbjørn T. Sep 04 '14 at 13:54
  • Thank you! I'm not sure why mathtools is marked as obsolete, the software wouldn't let me install it as other packages. These are my first 72 hours using LaTeX so I can't provide more info.. And to complete the discussion the package relsize is required for \mathlarger{}. – user61877 Sep 04 '14 at 16:59
  • Which TeX distribution do you use? It's very odd that you would get a message that the mathtools package is obsolete; that's definitely not the case. Incidentally, the \dfrac macro was mentioned in a comment below the original posting. – Mico Sep 04 '14 at 17:42
  • mathtools and friends have recently been ”rearranged“ ... i wonder if that's what is being referenced? (i catalogued the change on 20 aug) – wasteofspace Sep 04 '14 at 20:35
  • my version is TeXstudio 2.8.2 – user61877 Sep 05 '14 at 07:10
  • i like \dfrac – Xovee Jul 16 '22 at 10:30