22

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.

2
  • 2
    Use \dfrac for \displaystyle\frac Commented Apr 21, 2014 at 19:23
  • 1
    Yes, cases uses \textstyle; the package mathtools provides dcases.
    – egreg
    Commented Apr 21, 2014 at 19:23

2 Answers 2

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.

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{}

6
  • 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? Commented Sep 4, 2014 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
    Commented Sep 4, 2014 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
    Commented Sep 4, 2014 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) Commented Sep 4, 2014 at 20:35
  • my version is TeXstudio 2.8.2
    – user61877
    Commented Sep 5, 2014 at 7:10

You must log in to answer this question.

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