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.





September 25th, 2008 at 09:12
“it’s”?
Otherwise nice post, thanks.
September 25th, 2008 at 10:14
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.
April 23rd, 2010 at 12:03
Nice macro
Thank you so much!
Juni 22nd, 2010 at 19:48
This was exactly what I needed for my thesis. Thank you!
Januar 1st, 2013 at 10:15
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
Adel
Januar 1st, 2013 at 16:40
Hi Adel,
I see you refer to other posts, even if you commented to this amsmath post. The other posts contain links to the complete source code of the examples you mentioned. Just read the text.
I.e. for the first one a possible preamble is:
\documentclass{article}\usepackage{tikz}
\usetikzlibrary{matrix}