4

Consider the following MWE

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
  \renewcommand{\arraystretch}{1.2}
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix} \\
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix}
\end{gather*}

\begin{gather*}
  \renewcommand{\arraystretch}{1.2}
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix} \\
  \renewcommand{\arraystretch}{1.2}
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix}
\end{gather*}
\end{document}

The first gather produces two arrays; in the first, the fractions are properly spaced, while in the second, they are crowded together with the default vertical spacing. Why do I need to re-specify \renewcommand{\arraystretch}{1.2} after the newline? Is there a better way to do this? (I realize I could enclose the whole gather inside a {} pair with a \renewcommand{\arraystretch}{1.2} after the opening {).

2 Answers 2

5

Each entry between line breaks inside the gather environment are placed inside a group. To that end, the scope of \renewcommand{\arraystretch}{1.2} only lasts until the end \\, after which you have to issue it again.

A very similar problem is showcased when you use, for example

enter image description here

\documentclass{article}
\begin{document}
\begin{tabular}{c}
  \bfseries ABC DEF \\
  GHI KLM
\end{tabular}
\end{document}

The bold switch (\bfseries) doesn't span further than \\, and would have to be re-issued to have an effect.

For the stretch to have a global effect across line breaks, you have to issue it outside the environment.

1

Voila:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

{  \renewcommand{\arraystretch}{1.2} % PS
\begin{gather*}
%  \renewcommand{\arraystretch}{1.2}
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix} \\
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix}
\end{gather*}
} % PS

\begin{gather*}
  \renewcommand{\arraystretch}{1.2}
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix} \\
  \renewcommand{\arraystretch}{1.2}
  \begin{pmatrix} \frac{1}{2} \\ \frac{1}{2} \end{pmatrix}
\end{gather*}
\end{document}

enter image description here

The results are the same, because \arraystretch is set for every occurence inside the group (i.e. between lines marked PS in our case).

1
  • Right. As I said in the original post, I realize that this is a solution. I'm trying to understand why the system behaves as it does. Thanks.
    – rogerl
    Dec 7, 2013 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .