Typography with TeX and LaTeX

## amsmath: cases and \arraystretch

September 24th, 2008 by Stefan Kottwitz

The amsmath cases environment is using the array environment internally, like its matrix environments. If you want to change the interline spacing of matrices you could redefine \arraystretch, like for any array environment. But it won’t work for cases - amsmath defines an arraystretch value of 1.2 internally.

A solution is to redefine the \env@cases macro. Here’s a redefinition, introducing an optional parameter controlling the spacing:

\makeatletter \renewcommand*\env@cases[1][1.2]{% \let\@ifnextchar\new@ifnextchar \left\lbrace \def\arraystretch{#1}% \array{@{}l@{\quad}l@{}}% } \makeatother

Now by \begin{cases} … \end{cases} the default value of 1.2 will be used, but by using the optional parameter like \begin{cases}[0.8] … \end{cases} the spacing will be adjusted accordingly.

This topic was discussed on mrunix.de.

This entry was posted on Mittwoch, September 24th, 2008 at 22:25 and is filed under Mathematics. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

### 6 responses about “amsmath: cases and \arraystretch”

1. Tom said:

“it’s”?

Otherwise nice post, thanks.

2. Stefan Kottwitz said:

Hi Tom,

thank you for pointing out the typo in the first sentence, I’ve changed it to “its”, meaning the matrix environments of amsmath.

3. Roman said:

Nice macro
Thank you so much!

4. Alison said:

This was exactly what I needed for my thesis. Thank you!

What I see here is art. It is so beautiful. And so frustrating.
How can I produce something like
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em,
column sep=3em]{
& f^\ast E_V& & \vphantom{f^\ast}E_V \\
f^\ast E & & \vphantom{f^\ast}E & \\
& U & & V \\
M & & N & \\};
\path[-stealth]
(m-1-2) edge (m-1-4) edge (m-2-1)
edge [densely dotted] (m-3-2)
(m-1-4) edge (m-3-4) edge (m-2-3)
(m-2-1) edge [-,line width=6pt,draw=white] (m-2-3)
edge (m-2-3) edge (m-4-1)
(m-3-2) edge [densely dotted] (m-3-4)
edge [densely dotted] (m-4-1)
(m-4-1) edge (m-4-3)
(m-3-4) edge (m-4-3)
(m-2-3) edge [-,line width=6pt,draw=white] (m-4-3)
edge (m-4-3);
\end{tikzpicture}

or

\begin{tikzpicture}[start chain] {
\node[on chain] {$0$};
\node[on chain] {$A$} ;
\node[on chain, join={node[above]
{$\scriptstyle\varphi$}}] {$B$};
\node[on chain, join={node[above]
{$\scriptstyle\psi$}}] {$C$};
\node[on chain] {$0$}; }
\end{tikzpicture}

What preamble will allow me to produce those pretty diagrams?
Thank you
\documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix}