Vertical spacing between fractions in matrix environment [duplicate]

When a fraction is used in a matrix environment, not enough vertical space is put between the rows. Wikibooks recommends using the \em command, but this seems like an inelegant solution. Is there an elegant solution?

marked as duplicate by Werner, Caramdir, Gonzalo Medina, egreg, Stefan Kottwitz♦Nov 10 '11 at 15:45

• It is always best to compose a MWE that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. – Peter Grill Nov 2 '11 at 23:30
• @PeterGrill I would have, but this seems like such an obvious scenario that an MWE isn't necessary and actually clutters the question. Am I wrong? – Quinn Culver Nov 2 '11 at 23:37
• – Werner Nov 2 '11 at 23:39
• @Quinn: MWEs are always welcome and definitely encouraged, since subjective views may interpret questions differently. – Werner Nov 2 '11 at 23:41
• Yeah I realize it is not that hard, but anyone who wants to provide a solution will have to create it to test it and if you provide one to start there is less chance of misinterpretations. – Peter Grill Nov 3 '11 at 0:09

One approach is to add extra space between specific lines, with an optional argument to \\:

\left[\begin{matrix}
\frac{1}{2} & \frac{3}{2} \\
\frac{5}{2} & \frac{7}{2}
\end{matrix}\right]


produces While

\left[\begin{matrix}
\frac{1}{2} & \frac{3}{2} \$6pt] \frac{5}{2} & \frac{7}{2} \end{matrix}\right]  produces • Note that the OP wanted to avoid this approach – cmhughes Nov 3 '11 at 2:12 • @cmhughes: Hm, I didn't see that in the post. Where was it stated? – jtbandes Nov 3 '11 at 4:26 • Wikibooks recommends using the \em command, but this seems like an inelegant solution. No big deal though, it gets the job done :) – cmhughes Nov 3 '11 at 4:48 • OK, I did see that, so I guess my question is... is \em equivalent to \\? – jtbandes Nov 3 '11 at 4:54 • The Wikibooks link recommends using \\[0.3em] and you used \\[6pt]. The similarity (in my mind) is that both are manual approaches. – cmhughes Nov 3 '11 at 5:14 If you use an array environment then you can use the command \renewcommand{\arraystretch}{2.5}  and tweak it to whatever you would like. I have loaded the amsmath package to use \dfrac \documentclass{article} \usepackage{amsmath} \begin{document} Default: \[ \left[ \begin{array}{ccc} \dfrac{5}{6} & \dfrac{1}{6} & 0 \\ \dfrac{5}{6} & 0 & \dfrac{1}{6} \\ 0 & \dfrac{5}{6} & \dfrac{1}{6} \end{array} \right]$
\renewcommand{\arraystretch}{2.5}
Stretched:
$\left[ \begin{array}{ccc} \dfrac{5}{6} & \dfrac{1}{6} & 0 \\ \dfrac{5}{6} & 0 & \dfrac{1}{6} \\ 0 & \dfrac{5}{6} & \dfrac{1}{6} \end{array} \right]$
\end{document}

• But isn't this bad because it used array where matrix is more appropriate? – Quinn Culver Nov 4 '11 at 15:37
• @Quinn: that's up to you! If you'd prefer to use matrix then have a look at the links that people have posted as comments – cmhughes Nov 4 '11 at 15:46

In plain-tex format at least, \matrix calls \normalbaselines, which resets the (base)lineskip(limit)'s to normal(base)lineskip(limit)'s. Plain also has a macro called \openup<dimen> which increases the (base)lineskip(limit)'s by given <dimen>.

So it would seem logical to define a macro \openupnormal, which would do the same as \openup, only for normal(base)lineskip(limit)'s:

\catcode@=11
\def\openupnormal{\afterassignment\@penupnormal\dimen@=}
\catcode@=12


so that one could do:

$$\left[ \openupnormal1\jot\matrix{ % inside this group, increase the % normal(base)lineskip(limit)'s by 1 jot {5\over6} & {1\over6} & 0 \cr {5\over6} & 0 & {1\over6} \cr 0 & {5\over6} & {1\over6} \cr } % the group ends here, and so does the effect of \openupnormal \right] \quad \left[ \matrix{ {5\over6} & {1\over6} & 0 \cr {5\over6} & 0 & {1\over6} \cr 0 & {5\over6} & {1\over6} \cr } \right]$$
\bye (Note that there is no \displaystyle in effect in the above fractions, unlike in \dfrac)

• I use LaTeX, not plain-TeX. Will this still work? Is there an analogous solution for LaTeX? – Quinn Culver Nov 4 '11 at 15:36
• I tried it with LaTeX and no errors. But I suppose you'd write things differently with LaTeX (\makeatletter/\makeatother instead of \catcode's, \frac/\dfrac instead of {x\over y}, \$/\$ instead of  etc. – morbusg Nov 4 '11 at 15:48