Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
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 1

up vote 8 down vote accepted

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

screenshot

\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}
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.