Row reduction arrow to indicate row-switch
You can use the gauss
package, with some fixes:
\documentclass{report}
\usepackage{amsmath, gauss}
\usepackage{etoolbox}
% see http://tex.stackexchange.com/a/146730/4427
\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{equation*}
\begin{gmatrix}[b]
1 & 1 & 1 & 2 & \BAR & 0\\
2 & 0 & -2 & 2 & \BAR & 0\\
2 & 1 & 0 & 3 & \BAR & 0\\
-1 & 2 & 5 & 1 & \BAR & 0
\rowops
\swap{1}{3}% the count is from 0
\end{gmatrix}
\end{equation*}
\end{document}
Note that you should use equation*
rather than equation
with \notag
.
You can use tikz
with its remember picture
and overlay
options.
\documentclass{report}
\usepackage{amsmath, amssymb, graphics, setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{every picture/.append style={remember picture},
na/.style={baseline=-0.6ex}}
\begin{document}
\begin{equation}\notag
\left[
\begin{array}{cccc | c}
1 & 1 & 1 & 2 & 0\\
2 & 0 & -2 & 2 & 0\tikz[na]\coordinate(a);\\
2 & 1 & 0 & 3 & 0\\
-1 & 2 & 5 & 1 & 0\tikz[na]\coordinate(b);\\
\end{array}
\right]
\end{equation}
% 0.4 cm is the distance between the coordinates inside the square brackets and the arrow tips outside.
% 0.3 cm is the length of the horizontal lines.
\tikz[overlay]\draw[thick,<->] ($(a)+(0.4,0)$) -- +(0.3,0) |- ($(b)+(0.4,0)$);
\end{document}
Here are two other solutions: one with pstricks
and auto-pst-pdf
to compile with pdflatex
(provided you set -shell-escape
switch (TeX Live, MacTeX) or --enable-write18
(MiKTeX) for the compiler). The other uses the dedicated package gauss
which defines a gmatrix
environment, with customisable left and right delimiters.
\documentclass{report}
\usepackage{amsmath, amssymb, graphics, setspace}
\usepackage{pst-node, auto-pst-pdf} %
\usepackage{gauss} %
\newmatrix{|\;}{]}{vb}
\newmatrix{[}{.\,}{lb}
\setlength\rowarrowsep{-3pt}
\begin{document}
\[ \begin{postscript}
\left[ \begin{array}{@{\:}cccc|c @{\:}}%
1 & 1 & 1 & 2 & 0\\
2 & 0 & -2 & 2 & 0\pnode[0,0.8ex]{T}\\
2 & 1 & 0 & 3 & 0\\
-1 & 2 & 5 & 1 & 0\pnode[0,0.8ex]{B}
\end{array} \right]
\ncbar[linewidth=0.6pt, arrows=<->, nodesep=7pt, arrowinset=0.12, linejoin=1,arm=0.25]{T}{B}
\end{postscript}
\]
\[ \begin{gmatrix}[lb]
1 & 1 & 1 & 2 \\
2 & 0 & -2 & 2 \\
2 & 1 & 0 & 3\\
-1 & 2 & 5 & 1 \end{gmatrix} \begin{gmatrix}[vb] %
0\\
0 \\
0\\
0
\rowops
\swap{1}{3}
\end{gmatrix} \]%
\end{document}