A piecewise function with fractions and without tiny text

I would like to create a piecewise function which includes fractions. But the solutions I have found so far squish the fractions in to tiny text that is nearly illegible.

The cases environment results in tiny text and only allows for one alignment character.

\begin{align}
E(r) &=
\begin{cases}
\frac{q}{4 \pi \epsilon_0 r^2} & \quad \text{if} \quad r > 0 \\
0 & \quad \text{otherwise}
\end{cases}
\end{align}


The array environment allows for multiple alignment characters but the text is still tiny.

\begin{align}
E(r) &=
\left\{
\begin{array}{ll}
\frac{q}{4 \pi \epsilon_0 r^2} & \quad \text{if} \quad r > 0 \\
0 & \quad \text{otherwise}
\end{array}
\right.
\end{align}


The split environment should do what I want but I haven't found away around the error ! Extra }, or forgotten \right.. It has something to do with \left\{ and \right..

\begin{align}
E(r) &=
\left\{
\begin{split}
\frac{q}{4 \pi \epsilon_0 r^2} & \quad \text{if} \quad r > 0 \\
0 & \quad \text{otherwise}
\end{split}
\right.
\end{align}

-
since you are using amsmath you can use \dfrac instead of \frac to keep the fractions set in display style. – David Carlisle Jan 12 '13 at 23:56
\dfrac works good as well. – jmahler Jan 13 '13 at 0:14

1 Answer

This looks like a perfect job for dcases from the mathtools package, which loads and extends the amsmath package.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
$E(r) = \begin{dcases} \frac{q}{4 \pi \epsilon_0 r^2} & \quad \text{if} \quad r > 0 \\ 0 & \quad \text{otherwise} \end{dcases}$
\end{document}

-
dcases works great, thanks! – jmahler Jan 13 '13 at 0:10
@user24328 you're very welcome :) happy to help. Welcome to the group! – cmhughes Jan 13 '13 at 0:11