I present the following answer in the fervent hope that someone, anyone can provide an equivalent response which does not involve XyPic.
Answer
You must \usepackage{xypic}
or equivalent in the pre-amble.
\newcommand\map[1]{\xrightarrow{#1}} % For brevity
\[
\xymatrix @R0em @C0.5ex {
& & & \ar@{-}[dddd] & & & & & & \ar@{-}[dddd] & & & & & & \ar@{-}[dddd] & \\
1 & 2 & 0 & & -1 & & 1 & 2 & 0 & & -1 & & 1 & 2 & 0 & & -1 \\
2 & 1 & 1 & & 1 & \map{R_2-2R_1} & 0 & 3 & -1 & & 3 & & 0 & 3 & -1 & & 3 \\
-1 & 1 & -1 & & -1 & \map{R_3+R_1} & 0 & 3 & -1 & & -2 & \map{R_2+R_3} & 0 & 0 & 0 & & -1 \\
& & & & & & & & & & & & & & & & ~
\POS"2,1"."4,1"."2,5"."4,5"!C*+<0.5pt>\frm{)}
\POS"2,1"."4,1"."2,5"."4,5"!C*+<0.5pt>\frm{(}
\POS"2,7"."4,7"."2,11"."4,11"!C*+<0.5pt>\frm{)}
\POS"2,7"."4,7"."2,11"."4,11"!C*+<0.5pt>\frm{(}
\POS"2,13"."4,13"."2,17"."4,17"!C*+<0.5pt>\frm{)}
\POS"2,13"."4,13"."2,17"."4,17"!C*+<0.5pt>\frm{(}
}
\]
Reasons why I hate this answer
The following complaints are intended with no disrespect to the authors of XyPic, who went to a lot of work to make a package which is quite versatile — but whose time has passed in my opinion.
Xypic is slow. In my experience, if you put more than a handful of smallish \xymatrix
-ces in your document, it will bog down compilation time.
It requires extra rows and columns to implement the "sub-matrix" bars: the \ar@{-}[dddd]
commands implement vertical lines four rows high in the specified columns, which are necessary to span the three rows of the "actual" matrices. It must do so in its own column, and in so doing it unbalances the horizontal spacing between the final two columns of each matrix.
It is extremely cryptic. For instance, unless you are an expert in XyPic, it will be difficult to decipher the final four \POS
lines, which implement the round parentheses about the matrices. (And these commands break if you don't insert some dummy material such as the ~
character in the last row!)
Why have I put round parentheses instead of square ones, in the arguments to \frm
(which produce round parentheses for the matrices)? It's not because I prefer round parentheses; it's because there doesn't seem to be a way to put square ones. The possible decorations, which are described on page 25 of the XyPic guide, does not include them.
In short: it is inefficient, it is clumsy, it is not flexible enough, and the code is uglier than I would like. The only reason why I have any clue how even to write this is because, for a time, the best available tool to automatically draw quantum circuit diagrams was qcircuit.tex, which is based on XyPic. I needed to learn it to try and hack my own figures.
If I hate this answer, why am I posting it?
Because:
- I foresee having to write exactly these sorts of matrix transformations in my future,
- Some answer which ensures proper vertical alignment is better than no answer,
- I hope that if I'm snarky enough, someone will improve this solution using their superior TiKZ-fu or something, and everyone will live happily ever after.