Asked
Active
Viewed 327 times
3 Answers
4
One way is to use array:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\left[\begin{array}{@{} rrr|rrr @{\,}}
1 & 2 & -1 & 1 & 0 & 0 \\
-2 & 0 & 1 & 0 & 1 & 0 \\
1 & -1 & 0 & 0 & 0 & 1 \\
\end{array}\right]
\]
\end{document}
Zarko
- 296,517
-
-
@kile, just ad
\xrightarrow{R_1-R_3}(as is done in @Schrödinger'scat's answer). It require to loadamsmathpackage. See edited answer. – Zarko Feb 04 '20 at 09:33 -
Might be an idea to use
@{} rrr| rrr @{}as that then corresponds to the fence spacings used by the ams matrix envs – daleif Feb 04 '20 at 09:49 -
1
2
This is based on this answer, which borrows from this post, and this answer, which uses this answer. The purpose is to align the minus signs and numbers nicely.
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{% https://tex.stackexchange.com/a/33523
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\usepackage{array}
\makeatletter
\def\CheckMinus\ignorespaces{\@ifnextchar-{}{\phantom{-}}}
\makeatother
\newcolumntype{J}{>{\CheckMinus}l}
\begin{document}
\begin{equation}
\begin{bmatrix}[JJJ|JJJ]
1 & 2 & -1 & 1 & 0 & 0 \\
-2 & 0 & 1 & 0 & 1 & 0 \\
1 & -1 & 0 & 0 & 0 & 1 \\
\end{bmatrix}\xrightarrow{R_1-R_3}
\end{equation}
\end{document}
1
A simple solution with delarray:
\documentclass{article}
\usepackage{amsmath}
\usepackage{delarray}
\begin{document}
\[ \begin{array}[c][{rrr|rrr}]
1 & 2 & -1 & 1 & 0 & 0 \\
-2 & 0 & 1 & 0 & 1 & 0 \\
1 & -1 & 0 & 0 & 0 & 1
\end{array}\xrightarrow{R_1-R_3}
\]
\end{document}
Bernard
- 271,350





\xrightarrow{R_1-R_3}after the matrix. – Feb 04 '20 at 08:30