3

I'm using amsmath and matrices in the align environment and can't get the text at the end of a line to be flush left.I would like the matrices on the right to be flush with the matrices on the left and not the right margins. enter image description here

\documentclass[oneside,letterpaper,11pt]{report}
\usepackage{mathtools}

\begin{document}

\begin{align*}
\mbox{rref}(A|\vec{b}) \quad &= \quad 
\begin{bmatrix}
2  &  2  &  0  &  0  &  2 & -2 \\
13 &  13 &  -3 &  -6 &  4 & 2 \\
-9 &  -9 &  1  &  2  &  -6& 4 \\
\end{bmatrix}
\quad \rightarrow \quad    
\begin{bmatrix}
1  &  1  &  0  &  0  &  1 & -1 \\
13 &  13 &  -3 &  -6 &  4 & 2 \\
-9 &  -9 &  1  &  2  &  -6& 4 \\
\end{bmatrix} \\
\quad &\rightarrow \quad  
\begin{bmatrix}
1  &  1  &  0  &  0  &  1 & -1 \\
0  &  0  &  -3 &  -6 &  -9& -11  \\
-9 &  -9 &  1  &  2  &  -6& 4 \\
\end{bmatrix} 
\quad \rightarrow \quad   
\begin{bmatrix}
1  &  1  &  0  &  0  &  1 & -1 \\
0  &  0  &  -3 &  -6 &  -9& -11  \\
0  &  0  &  1  &  2  &  3& -5 \\
\end{bmatrix}\\
\end{align*}

\end{document}
  • 1
    Welcome to TeX.SX. When you write "flush with the arrows", do you get the effect you want by deleting the & after the \rightarrow? You could add a \quad space to keep symmetry. Also, it is good form to include a complete "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output. – Sandy G Nov 20 '17 at 4:23
  • Updated the code per requirements and changed delimiters from your suggestion. The effect minimizes the results in the sample code but does not solve the issue. – Patrick Nov 20 '17 at 4:50
  • Still too many &s. Delete the & after the = in the first row after \begin{flalign*}. Then delete both &s in the first line with \rightarrow. Then delete the & after the \rightarrow before the 3rd matrix, and delete both &s around the \rightarrow before the 4th matrix. Lastly, don't leave math mode so much. Your code $R_1$ $\div$ $2$ $\rightarrow$ $R_1$ should be $R_1\div 2 \rightarrow R_1$. – Sandy G Nov 20 '17 at 5:04
3

Maybe this?

\documentclass[oneside,letterpaper,11pt]{report}
\usepackage{mathtools}

\makeatletter
\renewcommand*\env@matrix[1][c]{
\edef\arraystretch{1.25}%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{*\c@MaxMatrixCols #1}}
\makeatother

\begin{document}

\begin{flalign*}
\mbox{rref}(A|\vec{b}) \quad &=&  
\begin{bmatrix}[r]
2  &  2  &  0  &  0  &  2 & -2 \\
13 &  13 &  -3 &  -6 &  4 & 2 \\
-9 &  -9 &  1  &  2  &  -6& 4 \\
\end{bmatrix}
 &&\rightarrow& \quad    
\stackrel{\mbox{$R_1 \div 2 \rightarrow R_1$}}{
\begin{bmatrix}[r]
1  &  1  &  0  &  0  &  1 & -1 \\
13 &  13 &  -3 &  -6 &  4 & 2 \\
-9 &  -9 &  1  &  2  &  -6& 4 \\
\end{bmatrix}} &\\[1.5em]
\quad &\rightarrow&  
\stackrel{\mbox{$R_2 - 13R_1\rightarrow R_2$}}{
\begin{bmatrix}[r]
1  &  1  &  0  &  0  &  1 & -1 \\
0  &  0  &  -3 &  -6 &  -9& -11  \\
-9 &  -9 &  1  &  2  &  -6& 4 \\
\end{bmatrix}} 
 &&\rightarrow& \quad   
\stackrel{\mbox{$R_3 + 9R_1\rightarrow R_2$}}{
\begin{bmatrix}[r]
1  &  1  &  0  &  0  &  1 & -1 \\
0  &  0  &  -3 &  -6 &  -9& -11  \\
0  &  0  &  1  &  2  &  3& -5 \\
\end{bmatrix}} &\\[1.5em] 
\end{flalign*}

\end{document}

enter image description here

  • @SandyG Thanks. hadn't even noticed those before. – Steven B. Segletes Nov 20 '17 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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