# Fractions seem too large in a column vector

The fractions in my column vector look too large:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\begin{bmatrix} -4 \\ - \frac{5}{2} \\ \frac{9}{2} \end{bmatrix}$
\end{document}


The denominator "2" from "-5/2" actually creeps slightly over the numerator "9" from "9/2". Is this correct behaviour? It looks bad.

A TABstack allows the inter-row baselineskip to be specified, while still keeping the baselineskip uniform, which I find important for vector/matrix notation.

\documentclass{article}
\usepackage{tabstackengine}
\begin{document}
$\setstackgap{L}{1.3\baselineskip} \mathbf{X} = \bracketVectorstack{ -4 \\ - \frac{5}{2} \\ \frac{9}{2}}$
\end{document} • Infact. You are very able with LaTeX.+1 again. – Sebastiano Feb 27 '18 at 13:02
• @Sebastiano Thank you, but I am a one-trick pony: stacking. – Steven B. Segletes Feb 27 '18 at 13:02

You can obtain a correct vertical padding with the cellspace package, which lets you define minimal vertical paddings at top and bottom of cells in column with specifier prefixed with the letter S (or C if you load siunitx). For matrices, which have no specifier, this is done with the [math] option of the package.

If you want a left or right alignment of the elements in a matrix, you can use the xmatrix* environments defined by mathtools. However, cellspace does not work with these environments . So, either you use a xmatrix environment (centred) and the classic trick of \phantom{...} elements where necessary, or you use the \setcellgapes{xxx}\makegapedcells construct defined by makecell.

Last point: I used the medium-sized fractions from nccmath, as I don't the size discrepancy between display style numbers and textstyle fractions.

Here is a demo:

\documentclass{article}
\usepackage{mathtools, nccmath}
\usepackage[math]{cellspace}
\setlength{\cellspacetoplimit}{2pt}
\setlength{\cellspacebottomlimit}{2pt}
\usepackage{makecell}
\setcellgapes{2pt}

\begin{document}

$\begin{bmatrix}-4 \\ - \mfrac{5}{2} \\ \phantom{-}\mfrac{9}{2} \end{bmatrix} \qquad \makegapedcells\begin{bmatrix*}[r] -4 \\ - \mfrac{5}{2} \\ \mfrac{9}{2} \end{bmatrix*}$

\end{document} • I wanted to use \phantom you know? :) I'm glad that some of my ideas are correct. +1 – Sebastiano Feb 27 '18 at 14:33
• You should have. It's a good idea, as long as you don't have to insert tons of them. – Bernard Feb 27 '18 at 14:42

I would like to suggest that you load the mathtools package. In addition to automatically loading the amsmath package, the mathtools package provides "starred" variants of the pmatrix, bmatrix, and vmatrix environments; these permit either left- or right-alignment of the cell contents. (The non-starred variants of the matrix-like environments automatically center the cell contents horizontally.) \documentclass{article}
\usepackage{mathtools} % for 'bmatrix*' env.
\begin{document}
$\begin{bmatrix*}[r] -4 \\[0.5ex] -\frac{5}{2} \\[1ex] \frac{9}{2} \end{bmatrix*}$
\end{document}

• The problem with such an approach is twofold: 1) it screws up the global math axis, so that X= prepended to your result will have a different math axis than the -5/2, and 2) it fouls up the math axes of the other vector rows, such that appending a + \begin{bmatrix*}[r] -4 \\ 2 \\3 \end{bmatrix*} to your result will have each vector row out of sync with the other. Didn't mean to pick on you, in particular, Mico, but as the most seasoned participant of those providing answers, you will immediately know what I refer to. – Steven B. Segletes Feb 27 '18 at 19:54
• @StevenB.Segletes - Thanks. I don't mind your direct words at all! (Quite on the contrary!) Indeed, if this bmatrix* environment were part of some larger expression, I'd almost certainly take a different approach. However, absent such pertinent information, I simply tried to create an "ok-looking column vector". No more, no less. – Mico Feb 27 '18 at 20:17

I have added only + for the fraction \frac{9}{2} and [3pt] a little space between the second row and the third row. \documentclass{article}
\usepackage{amsmath}

\begin{document}
$\begin{bmatrix} -4 \\ - \frac{5}{2} \\[3pt] +\frac{9}{2} \end{bmatrix}$
\end{document}

• Nice quick trick. (Maybe you can put the plus white... but \phantom I suppose is the right way). BTW is there a mode/package have the 4 of the same size of the 5 in the fraction? – Hastur Feb 28 '18 at 7:01
• If I get it, the \scriptstyle ends its scope in the cell. Thank you... I had already upvoted so... – Hastur Feb 28 '18 at 8:52
• Thank you. I have removed the addendum because there are many users that give me downvote. – Sebastiano Feb 28 '18 at 9:53
• Downvotes without explanations are far to be useful for anyone... (I can always get it from the history). – Hastur Feb 28 '18 at 9:56
• :-) thank you. Often I have downvotes without any explanation. – Sebastiano Feb 28 '18 at 9:58