
Tengo algunas gauss
matrices en un align*
entorno, como este:
\documentclass{article}
\usepackage{amsmath}
\usepackage{gauss}
\newcommand{\BAR}{%
\hspace{-\arraycolsep}%
\strut\vrule % the `\vrule` is as high and deep as a strut
\hspace{-\arraycolsep}%
}
\begin{document}
\begin{align*}
= &\begin{gmatrix}[p]
1 & 0 & 1 & \BAR & 5 \\
0 & 1 & - 2 & \BAR & -2 \\
0 & 0 & 1 & \BAR & 3 \\
0 & 0 & 3 & \BAR & 9
\rowops
\add[-2]{1}{0}
\add[-4]{1}{2}
\add[-3]{1}{3}
\end{gmatrix} \\
= &\begin{gmatrix}[p]
1 & 0 & 0 & \BAR & 2 \\
0 & 1 & 0 & \BAR & 4 \\
0 & 0 & 1 & \BAR & 3 \\
0 & 0 & 0 & \BAR & 0
\rowops
\end{gmatrix}
\end{align*}
\end{document}
Las matrices están alineadas, pero también quiero mantener el mismo ancho de columna para cada matriz. ¿Cómo podría hacer esto?
Respuesta1
Hice una macro \addwd[]{}
que se puede colocar en cualquier fila de la columna que necesite ampliación. Hace que el argumento obligatorio tenga el ancho del argumento opcional. De forma predeterminada, el argumento opcional tiene un ancho de "-0".
(Tenga en cuenta que cambié "-2" al final de la segunda fila a "-25" para demostrar el método para columnas de mayor ancho)
\documentclass{article}
\usepackage{amsmath}
\usepackage{gauss}
\usepackage{calc}
\newcommand{\BAR}{%
\hspace{-\arraycolsep}%
\strut\vrule % the `\vrule` is as high and deep as a strut
\hspace{-\arraycolsep}%
}
\newcommand\addwd[2][-0]{\makebox[\widthof{$#1$}]{$#2$}}
\begin{document}
\begin{align*}
= &\begin{gmatrix}[p]
1 & 0 & 1 & \BAR & 5 \\
0 & 1 & - 2 & \BAR & -25 \\
0 & 0 & 1 & \BAR & 3 \\
0 & 0 & 3 & \BAR & 9
\rowops
\add[-2]{1}{0}
\add[-4]{1}{2}
\add[-3]{1}{3}
\end{gmatrix} \\
= &\begin{gmatrix}[p]
1 & 0 & \addwd{0} & \BAR & \addwd[-25]{2} \\
0 & 1 & 0 & \BAR & 4 \\
0 & 0 & 1 & \BAR & 3 \\
0 & 0 & 0 & \BAR & 0
\rowops
\end{gmatrix}
\end{align*}
\end{document}