[Tex/LaTex] Issue with delimiters of small matrix

delimitersmathtoolsmatrices

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}

picture

Best Answer

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:

enter image description here

\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:

enter image description here

\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}

Read some more about these settings in Automatic size adjustment for nested parentheses.

Related Question