[Tex/LaTex] How to typeset row operations on augmented matrix

amsmathmath-mode

I would like to typeset row operations on a augmented matrix, but the "gauss"-package does not seem to support the vertical line just before the
last column, any way to do this?

Thanks!

Best Answer

The package can't support typing | somewhere like in arrays. But we can emulate it:

\documentclass{article}
\usepackage{amsmath}
\usepackage{gauss}

% patch gauss macros for doing their work in `align'
% and other amsmath environments; see
% http://tex.stackexchange.com/questions/146532/
\usepackage{etoolbox}
\makeatletter
\patchcmd\g@matrix
 {\vbox\bgroup}
 {\vbox\bgroup\normalbaselines}% restore the standard baselineskip
 {}{}
\makeatother


\newcommand{\BAR}{%
  \hspace{-\arraycolsep}%
  \strut\vrule % the `\vrule` is as high and deep as a strut
  \hspace{-\arraycolsep}%
}

\begin{document}
\[
\begin{gmatrix}[p]
1 & 2 & \BAR & 3 \\
4 & 5 & \BAR & 6 \\
7 & 8 & \BAR & 9
\rowops
 \swap{0}{1}
 \mult{0}{\cdot 7}
 \add[5]{1}{2}
\end{gmatrix}
\]
\end{document}

In other words, I create a new column that takes no horizontal space, where I place a bar.

enter image description here