[Tex/LaTex] How to set the “column character width” of a `bmatrix`

amsmathmatrices

Please, consider the following matrix:

\begin{equation}
    \begin{bmatrix*}[r]
         1   &  -123  &  1  &    1  \\
         2   &   123  &  2  &   12  \\
         3   &    12  &  3  &  123  \\
        -4   &     0  &  4  & -123
    \end{bmatrix*}
\end{equation}

When displayed the columns have widths: [2, 4, 1, 4]. (I am probably misusing the word "width" here. I hope the question is clear though.)

My question is: how do I force all columns to have "character width" equal to 4?

Best Answer

Here is a way. However I don't think it would be particularly nice to the eye. There are optical effects which are not directly linked to the column widths and a correction, if any, should be done based on a case by case appreciation. Compare these two ways:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{equation}
     \begin{bmatrix*}[r]
         \phantom{-23}1 & -123 & \phantom{-23}1 & 1 \\
         2 & 123 & 2 & 12 \\
         3 & 12 & 3 & 123 \\
        -4 & 0 & 4 & -123
     \end{bmatrix*}
 \end{equation}

\begin{equation}
     \begin{bmatrix*}[r]
        1 & -123 & \phantom{-3}1 & 1 \\
         2 & 123 & 2 & 12 \\
         3 & 12 & 3 & 123 \\
        -4 & 0 & 4 & -123
     \end{bmatrix*}
 \end{equation}

 \end{document} 

enter image description here

Related Question