[Tex/LaTex] cases and spacing between array rows

arraysspacing

The space between two rows seems to differ if the cases environment is used. Have a look at the following example:

enter image description here

\documentclass{minimal}

\begin{document}
\[
\begin{array}{l}
f(x) =%
\begin{dcases}
-1 & x < 0 \\
1 & x > 0
\end{dcases} \\[2em]
g(x) = x \\[2em]
k(x) =%
\begin{dcases}
-1 & x < 0 \\
1 & x > 0
\end{dcases}
\end{array}
\]
\end{document}

I adjust the space between the rows by adding 2em but it looks different. Does someone has an explanation for it?

Best Answer

array increases the line spacing in a construct such as \\[2em] by adding 2em to its standard strut depth. However, your construction produces something that is deeper than the standard strut already, so the adjustment is not as much as you thought you requested. As you are using dcases which is in mathtools you could, or even should, use an align* environment instead, and that will space correctly.

Sample output

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\verb+array+ example with large depth on lines has a problem:
\[
\begin{array}{l}
  f(x) = \vrule height 2em depth 2em \\[2em]
  g(x) = x \\[2em]
  k(x) = \vrule height 2em depth 2em
\end{array}
\]

The \verb+align*+ version of the original code spaces correctly.

\begin{align*}
  f(x) &=%
  \begin{dcases}
    -1 & x < 0 \\
    1 & x > 0
  \end{dcases} \\[2em]
  g(x) &= x \\[2em]
  k(x) &=%
  \begin{dcases}
    -1 & x < 0 \\
    1 & x > 0
  \end{dcases}
\end{align*}
\end{document}
Related Question