# Issue with delimiters of small matrix

I am using the mathtools package in order to right-align entries in small matrices. My code is below. The issue is that the delimiters in the first matrix are not the appropriate size; they should be the same size as the delimiters in the second matrix. I'm sure the issue is because of right-aligning.

How can I fix the delimiters in the first matrix without resorting to using \bigl( and \bigr)?

\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{mathtools}

\begin{document}

Here is a sentence.
\begin{enumerate}
%
\item $A = \left( \begin{smallmatrix*}[r] 1 & 2 \\ 5 & 7 \end{smallmatrix*} \right)$
%
\item $A = \left( \begin{smallmatrix*}[r] 1 & -1\\ 2 & 3 \end{smallmatrix*} \right)$
\end{enumerate}

\end{document}


-
I am not sure what's causing the problem but a \vphantom seems to give the desired size: \item $A = \left( \begin{smallmatrix*}[r] 1 & \vphantom{-}2 \\ 5 & 7 \end{smallmatrix*} \right)$ –  Gonzalo Medina Mar 14 '13 at 4:27
Here is a picture (if I can include it). ![example][1] [1]: i.stack.imgur.com/NpFS9.png –  Noob Mar 14 '13 at 4:37
I suppose a \vphantom would work, but I don't like the fact that mathtools (I suppose it's the fault of mathtools) doesn't have the appropriate size delimiters for my example. –  Noob Mar 14 '13 at 4:44
it's not the fault of mathtools but (as someone else has said) the fact that the minus has extra depth. this is built into the font (at least for computer modern), the reasoning being that plus and minus should have the same dimensions and spacing. –  barbara beeton Mar 14 '13 at 16:51

The operator - has greater depth than the surrounding numerals. As such, the second smallmatrix is "taller" than the first, causing the delimiters to stretch further. The following highlights this somewhat:

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\setlength{\fboxsep}{-\fboxrule}
\newcommand{\boxit}[1]{\text{\fbox{$#1$}}}
\begin{document}
$\left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{2} \\ \boxit{5} & \boxit{7} \end{smallmatrix*}\right) \quad {\def\boxit#1{#1} \left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{2} \\ \boxit{5} & \boxit{7} \end{smallmatrix*}\right)} \qquad \left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{-1} \\ \boxit{2} & \boxit{3} \end{smallmatrix*}\right) \quad {\def\boxit#1{#1} \left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{-1} \\ \boxit{2} & \boxit{3} \end{smallmatrix*}\right)}$
\end{document}


\boxit puts a bounding box around the element. Note how the elements in the first row of the second smallmatrix are not vertically aligned.

The marginal increase in height is enough to increase the delimiters. This behaviour can be adjusted via setting elements like \delimitershortfall and/or \delimiterfactor. In the following example, I've set \delimitershortfall to 0pt:

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\setlength{\fboxsep}{-\fboxrule}
\newcommand{\boxit}[1]{\text{\fbox{$#1$}}}
\begin{document}
\setlength{\delimitershortfall}{0pt}
$\left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{2} \\ \boxit{5} & \boxit{7} \end{smallmatrix*}\right) \quad {\def\boxit#1{#1} \left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{2} \\ \boxit{5} & \boxit{7} \end{smallmatrix*}\right)} \qquad \left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{-1} \\ \boxit{2} & \boxit{3} \end{smallmatrix*}\right) \quad {\def\boxit#1{#1} \left(\begin{smallmatrix*}[r] \boxit{1} & \boxit{-1} \\ \boxit{2} & \boxit{3} \end{smallmatrix*}\right)}$
\end{document}


@Nathan: You can either duplicate the "offending" object using \vphantom (to avoid taking up horizontal space and affect alignment), or insert \mathstrut in one element of every row. Struts are commonly used for such tasks and maintaining a consistent vertical alignment. –  Werner Mar 14 '13 at 6:02