
答案1
答案2
這是基於這個答案,它藉用了這個帖子, 和這個答案,它使用這個答案。目的是很好地對齊減號和數字。
\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}