18
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
  X_i = 
  \begin{cases}
    \left[\begin{smallmatrix}
      0 \\ 1 \\ 2
    \end{smallmatrix}\right]
    &
    \text{if $i$ is even;}
    \\
    \left[\begin{smallmatrix}
      2 \\ 1 \\ 0
    \end{smallmatrix}\right]
    &
    \text{otherwise.}
  \end{cases}
\end{equation*}
\end{document}

This is the LaTeX code that I wrote based on a cases environment. There's no space between the matrices on the right. What's the best way to add some vertical spaces to separate them?

enter image description here

p.s. This is a simplified form of my original writing, so I cannot just accept suggestions like 'use a matrix transpose to transform the column vector into a row vector.'

user19906
  • 1,415

1 Answers1

29

Use the optional argument to \\ to add additional space between the lines, e.g.\\[10pt].

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
  X_i = 
  \begin{cases}
    \left[\begin{smallmatrix}
      0 \\ 1 \\ 2
    \end{smallmatrix}\right]
    &
    \text{if $i$ is even;}
    \\[10pt]
    \left[\begin{smallmatrix}
      2 \\ 1 \\ 0
    \end{smallmatrix}\right]
    &
    \text{otherwise.}
  \end{cases}
\end{equation*}
\end{document}

Or you can load the mathtools package (which loads and extends amsmath) and its dcases environment:

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation*}
  X_i = 
  \begin{dcases}
    \left[\begin{smallmatrix}
      0 \\ 1 \\ 2
    \end{smallmatrix}\right]
    &
    \text{if $i$ is even;}
    \\
    \left[\begin{smallmatrix}
      2 \\ 1 \\ 0
    \end{smallmatrix}\right]
    &
    \text{otherwise.}
  \end{dcases}
\end{equation*}
\end{document}
Torbjørn T.
  • 206,688