7

I would like to create a formula with the operator \cases, whose lines contain sums:

\begin{cases}\sum (...) \\ \sum (...) \end{cases}

Expressions in the sums are huge, and it would be natural to add some 'smallskip' between two lines. How can I do that?

Mico
  • 506,678
limanac
  • 257

2 Answers2

8

I'd say you have (at least) two choices to get more separation between the lines of the cases environment:

  • Insert a bit of extra space "by hand", via the optional argument to the \\ linebreak directive

  • Use the dcases environment provided by the mathtools environment. Doing so achieves two purposes simultaneously -- you get better spacing between rows, and the contents are set automatically in TeX's \displaystyle math mode.

In the following image, the first group shows the (unsatisfactory) output of an unmodified cases environment; the second group shows the same overall expression but with extra spacing, in the amount of 1ex, inserted after \\; the third group shows the output of using the dcases environment.

enter image description here

\documentclass{article}
\usepackage{mathtools} 
\newcommand\bigsum{\sum_{i=0}^\infty \frac{1}{i^2}} % "\sum & \frac expression"
\begin{document}
%% 0. plain 'cases'
\[
\begin{cases} \bigsum \\ \bigsum \end{cases}
\]
%% 1. 'cases' with manually set extra spacing of 1ex
\[
\begin{cases} \bigsum \\[1ex] \bigsum \end{cases}
\]
%% 2. 'dcases' (no need to insert extra spacing manually)
\[
\begin{dcases} \bigsum \\ \bigsum \end{dcases}
\]
\end{document}
Mico
  • 506,678
4

The package mathtools provides a new enviroment specifically built to display equations or big symbols inside a case environment: dcases.

This could be a useful MWE:

\documentclass{article}
%
\usepackage{mathtools} % automatically loads "amsmath"
%
\begin{document}
%
Standard environment:
\[
\begin{dcases}
\sum_{k=0}^{n}\binom{n}{k}=2^n\\
\int f(x)\,\mathrm{d}x=F(x)+C
\end{dcases}
\]
This is a new defined environment:
\[
\begin{dcases}
\sum_{k=0}^{n}\binom{n}{k}=2^n\\
\int f(x)\,\mathrm{d}x=F(x)+C
\end{dcases}
\]
%
\end{document}

Which gives for the output:

enter image description here

An alternative would be to re-define the environment cases by calling it from the mathtools package, i.e.:

\@ifpackageloaded{mathtools}{%
 \renewenvironment{cases}{\begin{dcases}}{\end{dcases}}%
}{%
% doesn't do anything if the package isn't loaded
}

This macro could be useful inside a custom package (By the way this procedure is purely optional, since inside the LaTeX code it doesn't matter where a "d" is added inside an environment definition).

David Carlisle
  • 757,742
TheVal
  • 2,488
  • Many thanks to you too. I can accept only one answer, I am sorry. – limanac Oct 11 '13 at 12:39
  • @limanac Hehe... don't worry. The only important thing is that the main issue has been solved (I have to admit that when I started LaTeXing I had the same problem as yours). – TheVal Oct 11 '13 at 12:41