Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to write matrices one below the other but I want the vertical lines (compare example below) to be aligned. Eventually, there will be several matrices in one document - in the example below there are only two.

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{align}
\begin{array}{l}
\mathrm{I} \\
\mathrm{II} \\
\mathrm{III} \\
\end{array}
\left (
\begin{array}{rrr|r}
3 & 6 & 3 & 3 \\
2 & 1 & -1 & -1 \\
-1 & 2 & 2 & 1 \\
\end{array}
\right )
\begin{array}{c}
\\
\mathrm{II} + \left (-\frac 2 3 \right ) \cdot \mathrm{I} \\
\mathrm{III} + \left (\frac 1 3 \right ) \cdot \mathrm{I}\\
\end{array}
\end{align}
\begin{align}
\begin{array}{l}
\mathrm{I^{**}}\\
\mathrm{II^{**}} \\
\mathrm{III^{***}} \\
\end{array}
\left (
\begin{array}{rrr|r}
1 & 0 & 0 & 1 \\
0 & 1 & 0 & -1 \\
0 & 0 & 1 & 2 \\
\end{array}
\right )
\end{align} 
\end{document}
share|improve this question

2 Answers 2

up vote 5 down vote accepted

If the numbers in the last column are of the same size, you can just put both matrices in the same align and put the alignment point (&) just after the matrices. I also added some extra space between the two lines with \\[2\jot].

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{align}
\begin{array}{l}
\mathrm{I} \\
\mathrm{II} \\
\mathrm{III} \\
\end{array}
\left (
\begin{array}{rrr|r}
3 & 6 & 3 & 3 \\
2 & 1 & -1 & -1 \\
-1 & 2 & 2 & 1 \\
\end{array}
\right )&
\begin{array}{c}
\\
\mathrm{II} + \left (-\frac 2 3 \right ) \cdot \mathrm{I} \\
\mathrm{III} + \left (\frac 1 3 \right ) \cdot \mathrm{I}\\
\end{array}
\\[2\jot]
\begin{array}{l}
\mathrm{I^{**}}\\
\mathrm{II^{**}} \\
\mathrm{III^{***}} \\
\end{array}
\left (
\begin{array}{rrr|r}
1 & 0 & 0 & 1 \\
0 & 1 & 0 & -1 \\
0 & 0 & 1 & 2 \\
\end{array}
\right )&
\end{align} 
\end{document}
share|improve this answer

In order to further ease the reader's ability to let his/her eye roam vertically across the display, I would not only align the two vertical bars but also the various columns of the matrices through judicious insertions of \phantom{-} instructions.

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
\begin{array}{l}
\mathrm{I} \\
\mathrm{II} \\
\mathrm{III\phantom{^{***}}} \\
\end{array}
&\left (
\begin{array}{rrr|r}
3 & \phantom{-}6 & 3 & 3 \\
2 & 1 & -1 & -1 \\
-1 & 2 & 2 & 1 \\
\end{array}
\right )
\begin{array}{l}
\\
\mathrm{II} + \left (-\tfrac 2 3 \right ) \cdot \mathrm{I} \\
\mathrm{III} + \left (\tfrac 1 3 \right ) \cdot \mathrm{I}\\
\end{array}
\\
\begin{array}{l}
\mathrm{I^{**}}\\
\mathrm{II^{**}} \\
\mathrm{III^{***}} \\
\end{array}
&\left (
\begin{array}{rrr|r}
\phantom{-}1 & \phantom{-}0 & \phantom{-}0 & 1 \\
0 & 1 & 0 & -1 \\
0 & 0 & 1 & 2 \\
\end{array}
\right )
\end{align*} 
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.