Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

1 Answer

up vote 5 down vote accepted

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.

share|improve this answer
    
Excellent, thank you so much! Could I now ask another question? Your solution yields matrices with the same size delimiters. As you mentioned, however, there is extra height in the second matrix. Can we adjust the first matrix so that the vertical space between its rows is the same as the vertical space between the rows in the second matrix? –  Noob Mar 14 '13 at 4:56
1  
@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
    
Thanks again, friend. –  Noob Mar 14 '13 at 6:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.