9

I have this case formula which I need to make a little more readable by adding a little more space, vertically, between the two cases.

\begin{cases} f = -\frac {w_1*m + w_2*\frac{-d}{d_M} + w_3*\frac{r}{N} + w_4*s}{w_1+w_2+w_3+w_4} &\hbox{when }m \geq t \\ f = -\frac {w_1*m + 5*w_2*\frac{-d}{d_M} + w_3*\frac{r}{N} + w_4*s}{w_1+w_2+w_3+w_4} & \hbox{when } m< t \end{cases}

enter image description here

How to add an extra space in the latex case above?

Lucien S.
  • 193
  • 4

1 Answers1

13

Just to increase vertical space between lines in cases by \\[1em]:

\[
    \begin{cases} 
f = -\dfrac {w_1*m + w_2*\frac{-d}{d_M} 
        + w_3*\frac{r}{N} + w_4*s}{w_1+w_2+w_3+w_4} 
    &   \text{when }m \geq t    \\[3ex]% this increase vertical space between lines
f = -\dfrac {w_1*m + 5*w_2*\frac{-d}{d_M} 
        + w_3*\frac{r}{N} + w_4*s}{w_1+w_2+w_3+w_4} 
    & \text{when } m< t 
    \end{cases}
\]

Result:

enter image description here

If you like to have more space, than increase distance between lines. I also suggest to \dfrac instead \frac or even better use the dcases environment instead of cases. To my taste equation will look better. For dcases you need to add package mathtools to preamble of your document, but no \dfrac is needed. Example:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
    \begin{dcases} 
f = -\frac {w_1\cdot m + w_2\cdot \frac{-d}{d_M} 
        + w_3\cdot \frac{r}{N} + w_4\cdot s}{w_1+w_2+w_3+w_4} 
    &   \text{when }m \geq t    \\
f = -\frac {w_1\cdot m + 5\cdot w_2\cdot \frac{-d}{d_M} 
        + w_3\cdot \frac{r}{N} + w_4\cdot s}{w_1+w_2+w_3+w_4} 
    & \text{when } m< t 
    \end{dcases}
\]
\end{document}

enter image description here

Torbjørn T.
  • 206,688
Zarko
  • 296,517
  • Thanks for the tip on dfrac! This looks so much better indeed. – Lucien S. Sep 29 '15 at 19:06
  • better to use a dimension intended for vertical measure, e.g. ex. (em is for horizontal measure.) but better still, try \openup\jot which increases the distance between lines in a math structure locally by 3pt. – barbara beeton Sep 29 '15 at 20:15
  • @barbarabeeton, thank you for comment. I will correct vertical measure in my answer. Possibilities openup is new to me. Where I can find some explanation about it? – Zarko Sep 29 '15 at 20:24
  • The dcases environment is provided by mathtools, not empheq. The side conditions are better input as \text{when $m\geq t$} and \text{when $m<t$}. With the dcases* environment (again requires mathtools) they can be input as when $m\geq t$ and when $m<t$, because text mode is implicit after the &. – egreg Sep 29 '15 at 20:43
  • @egreg, wel, my document, by which i generate equation in my answer, has empheq, not mathtools Does ampheq call mathtools? About writing text in cases I agree with you, I just didn't bother with this. – Zarko Sep 29 '15 at 21:30
  • @Zarko Line 56 of empheq.sty says \RequirePackage{mathtools}[2004/10/10] – egreg Sep 29 '15 at 21:34
  • @egreg, thank you for this information. I will correct my answer accordingly and in my other documents stop to load bot document. When using empheq I will left to it to call mathtools :-) – Zarko Sep 29 '15 at 21:44