11

I'm trying to use cases to present some equations with fractions, and finding that the lines are too compressed to be easily read. Is there a way to increase both the spacing between lines and the size of the typeset characters? The MWE is

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
A = \begin{cases}
\frac{B-.5b}{C-.5c} & \text{sometimes} \\
\frac{D-.3d}{E-.7e} & \text{other times}
\end{cases}
\end{align*}

\end{document}

which produces

squished text in align

2
  • 1
    You can manually increase the height by writing \\[2ex] for example.
    – A.Ellett
    Dec 22, 2014 at 17:53
  • If everyone keeps adding answers, there will be nobody left to vote! 8^) Dec 22, 2014 at 18:19

5 Answers 5

10

mathtools extends amsmath with dcases:

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\[
A = \begin{dcases}
\frac{B-.5b}{C-.5c} & \text{sometimes} \\
\frac{D-.3d}{E-.7e} & \text{other times}
\end{dcases}
\]

\end{document}
2
  • 1
    I'd be tempted to add [1ex] of extra vertical space between the two lines. And I wouldn't use align* for the present case, since it features only one equation.
    – Mico
    Dec 22, 2014 at 18:20
  • @Mico yes to both, I just wanted to highlight using dcases, perhaps the real example has more lines:-) (but it shouldn't use align unless there are some alignment points, I'll edit thanks Dec 22, 2014 at 19:12
4

The following shows how you can replicate cases using an array:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
  A = \begin{cases}
    \frac{B-.5b}{C-.5c} & \text{sometimes} \\
    \frac{D-.3d}{E-.7e} & \text{other times}
  \end{cases}
\end{align*}
\begin{align*}
  A &= \begin{cases}
    \frac{B-.5b}{C-.5c} & \text{sometimes} \\
    \frac{D-.3d}{E-.7e} & \text{other times}
  \end{cases} \\
  A &= \renewcommand{\arraystretch}{1.5}\left\{\begin{array}{@{}l@{\quad}l@{}}
    \frac{B-.5b}{C-.5c} & \text{sometimes} \\
    \frac{D-.3d}{E-.7e} & \text{other times}
  \end{array}\right.\kern-\nulldelimiterspace
\end{align*}

\end{document}

The first align* replicates your output, while the second align* includes the original cases plus an array implementation. When using an array, you can adjust \arraystretch to stretch out the "cases" construction vertically (similar to other suggestions in Column and row padding in tables).

Note that the default \arraystretch for cases under amsmath is 1.2, as depicted in the \env@cases definition (taken from amsmath.dtx`):

\def\env@cases{%
  \let\@ifnextchar\new@ifnextchar
  \left\lbrace
  \def\arraystretch{1.2}%
  \array{@{}l@{\quad}l@{}}%
}

Of course you could change this default 1.2 stretch factor to something larger, but my assumption is that you want only a specific instance of cases to be slightly aired out rather than make a global change.


The size of the characters can be adjusted by using \dfrac instead of \frac. However, this would require a larger \arraystretch than 1.5. I'm not sure what is to be gained by this visually.

3

All that I did was to invoke \displaystyle for each line and to insert an extra blank line. EDITED (upon Werner's reminder) to use \dfrac instead of \displaystyle\frac, when the amsmath package is loaded.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
A = \begin{cases}
\dfrac{B-.5b}{C-.5c} & \text{sometimes} \\
\\
\dfrac{D-.3d}{E-.7e} & \text{other times}
\end{cases}
\end{align*}

\end{document}

enter image description here

1
  • @Werner You are, of course, right. I had forgotten that I loaded amsmath. Dec 22, 2014 at 18:38
3

Here are three ways:

– with the empheq package (it loads mathtools, which loads amsmath, so it's pointless to load any of these);

– with the cases* environment (defined in mathtools) and \dfrac;

– with the cases* environment and \mfrac (medium-sized fractions, ~80 % of \displaystyle), from nccmath.

Added: There's also David Carlisle's excellent suggestion of using dcases (or dcases*), rather than my second proposition.

  \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[overload]{empheq}

\usepackage{nccmath}

\begin{document}

\begin{alignat*}{2}[left = {A = \empheqlbrace}]
 & \frac{B-.5b}{C-.5c} &\quad & \text{sometimes} \\
 & \frac{D-.3d}{E-.7e} & & \text{other times}
\end{alignat*}

\begin{equation*}
  A = \begin{cases*}
     \dfrac{B-.5b}{C-.5c} & sometimes \\
\dfrac{D-.3d}{E-.7e} & other times
  \end{cases*}
\end{equation*}

\begin{equation*}
  A = \begin{cases*}
    \mfrac{B-.5b}{C-.5c} & sometimes \\
\mfrac{D-.3d}{E-.7e} & other times
  \end{cases*}
\end{equation*}

\end{document} 

Note that cases* automatically sets the second column in text mode, so one doesn't have to use text{…}.

enter image description here

1
  • Thanks for pointing out about cases* and \text{}. Also note that cases* requires mathtools.
    – Yuri P.
    Sep 15, 2016 at 10:46
2

An addition to all answers above

A useful feature is to control the vertical distance between the equations of the cases, array, or similar environments. You can do that by writing \\[your distance with units] instead of simply \\. For example \\[1.5em]. It works also for negative spacing, e.g., \\[-0.5em]

In this minimal example I use \\[1.0em]

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
        A = \begin{cases}
            \dfrac{B-.5b}{C-.5c} & \text{sometimes} \\[1.0em]
            \dfrac{D-.3d}{E-.7e} & \text{other times}
        \end{cases}
    \end{align*}

\end{document}

enter image description here

This code is Steven B. Segletes' modified. In my opinion, it looks nicer that just an extra empty line. ;)

You must log in to answer this question.

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