16

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!

0

1 Answer 1

18

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

9
  • 1
    I tried your solution, but there are gaps in the vertical line between the rows, sadly.
    – msx
    Commented Nov 24, 2013 at 18:44
  • @mhle This might depend on the material in the rows; without an example it's difficult to say.
    – egreg
    Commented Nov 24, 2013 at 19:05
  • here is an example, \documentclass[a4paper,twoside,12pt]{article} \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& 1 \ 1 & 1 &-2 &\BAR& 0 \ 0 & 1 & -1&\BAR& 0 \rowops \add{0}{1} \mult{0}{\cdot -1} \end{gmatrix} \end{align} \end{document}
    – msx
    Commented Nov 24, 2013 at 19:21
  • Hi @egreg, it seems to be the align environment that's the problem...
    – msx
    Commented Nov 24, 2013 at 20:03
  • 1
    @Veliko For some reason, many lines of code have been modified by the site. I'll fix it
    – egreg
    Commented Jan 11, 2017 at 20:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .