6

I would like to have a little more space between the rows of an array for better clarity. I tried \vspace{} at the end of the rows but LateX ignored it. I can accomplish something close to what I want with extra rows but that adds a bit more space than I'd like (but I can live with it). Here's what I have:

\documentclass{amsbook} 
\begin{document}
BEFORE:

\[
f(n) = \left\{ 
\begin{array}{cl} 
        0 & \text{if n=1 }\\ 
        \frac{n}{2} & \text{if n is even} \\ 
        -\left( \frac{n-1}{2}  \right)   & \text{if n $\ge$ 1 is odd} 
\end{array} \right.
\]

This is cramped visually, especially given my poor eyesight.

AFTER:

\[
f(n) = \left\{ 
\begin{array}{cl} 
        0 & \text{if n=1 }\\ 
        \\
        \frac{n}{2} & \text{if n is even} \\ 
        \\
        -\left( \frac{n-1}{2}  \right)   & \text{if n $\ge$ 1 is odd} 
\end{array} \right.
\]

This works but is overkill.
\end{document}
1
  • 2
    \renewcommand\arraystretch{1.5} before entering the array environment. The number 1.5 can be tweaked. Commented Dec 29, 2021 at 0:15

3 Answers 3

6

The \\ command has an optional length parameter. So you can add, e.g.,

\documentclass{amsbook} 
\begin{document}
BEFORE:

\[
f(n) = \left\{ 
\begin{array}{cl} 
        0 & \text{if n=1 }\\[6pt] 
        \frac{n}{2} & \text{if n is even} \\[9pt] 
        -\left( \frac{n-1}{2}  \right)   & \text{if n $\ge$ 1 is odd} 
\end{array} \right.
\]

This is cramped visually, especially given my poor eyesight.

AFTER:

\[
f(n) = \left\{ 
\begin{array}{cl} 
        0 & \text{if n=1 }\\[12pt] 
        \frac{n}{2} & \text{if n is even} \\[15pt] 
        -\left( \frac{n-1}{2}  \right)   & \text{if n $\ge$ 1 is odd} 
\end{array} \right.
\]

This works but is overkill.
\end{document}

according to your taste.

To tell the truth, I would rather write -\left( \dfrac{n-1}{2} \right) & \text{if $n \ge 1$ is odd} and so on, so that the number $n$ is always in math mode.

2
  • Good point, thanks. Is \dfrac native to LateX? It's not showing up in my handy list of commands. Commented Dec 29, 2021 at 1:51
  • @TonyK \dfrac is AMSTeX-based. You use amsbook, so adding amsmath shouldn't be a problem. Commented Dec 29, 2021 at 2:48
2

You may try the +array environment provided by tabularray package:

\documentclass{amsbook} 

\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document}

This \verb!+array! environment sets default vertical space \verb!rowsep=2pt!:

\[
f(n) = \left\{ 
\begin{+array}{@{}cl} 
        0 & \text{if n=1 }\\ 
        \frac{n}{2} & \text{if n is even} \\ 
        -\left( \frac{n-1}{2}  \right)   & \text{if n $\ge$ 1 is odd} 
\end{+array} \right.
\]

You may also adjust the vertical space by changing \verb!rowsep!:

\[
f(n) = \left\{ 
\begin{+array}{colspec={@{}cl},rowsep=1pt} 
        0 & \text{if n=1 }\\ 
        \frac{n}{2} & \text{if n is even} \\ 
        -\left( \frac{n-1}{2}  \right)   & \text{if n $\ge$ 1 is odd} 
\end{+array} \right.
\]

\end{document}

enter image description here

1

A variation of the first example in @L.R.J answer (+1):

\documentclass{amsbook}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}

\begin{document}
\[
f(n) = \left\{
\begin{+array}{colspec={@{}c Q[l, mode=text]} }
                    0   &   if $n=1$            \\
         \frac{n}{2}    &   if $n$ is even      \\
        -\frac{n-1}{2}  &   if $n \ge 1$ is odd
\end{+array} \right.
\]
\end{document}

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.