4

I can't adjust the spacing this awkward spacing between the row operation sign and the bottom two matrices. I would want to align the bottom two matrices to the left (right next to the row operation signs). I have tried using \setlength\mathindent{0}, but couldn't find a fix. Here's the picture and complete code Here's

    \documentclass{article}
%\usepackage{amsmath}
\usepackage{array}
\newenvironment{rowequmat}[1]{\left(\array{@{}#1@{}}}{\endarray\right)}
\newenvironment{redmatrix}
  {\left(\array{@{}rrr|c@{}}}
  {\endarray\right)}
\newenvironment{ropmatrix}
  {\array{@{}c@{}}}
  {\endarray}
\newcommand\opone[2]{\xrightarrow{(#1)\times r_#2}}
\newcommand\optwo[3]{\xrightarrow{r_#1{}+{} #2r_#3}}
\usepackage[fleqn]{amsmath}
\setlength\mathindent{0pt}
\begin{document}
\begin{alignat*}{5}
&
\huge{
\begin{redmatrix}
 -2 & -1 & 1 & c_1 - a\\
 -1 &  -2 & -1 & c_2 - a \\
 -1 &  -1 & -2 & c_3 - a \\
\end{redmatrix}} \\[\parskip]
&
\setlength\mathindent{0pt}
\huge{
\begin{ropmatrix}
\optwo{2}{}{3}
\end{ropmatrix}}
&
\huge{
\begin{redmatrix}
 -2 & -1 & -1 & c_1 - a \\
  0 &  -1 & 1 & c_2 - c_3 \\
  0 & -1  & -3 & 2c_3 - c_1 -a \\   
\end{redmatrix}}\\\\[\parskip]
\\
&
\huge{
\begin{ropmatrix}
\opone{1/3}{2}
\end{ropmatrix}}
&
\huge{
\begin{redmatrix}
-2 & -1 & -1 & c_1 - a \\
 0 & -1 & 1 & c_2 - c_3 \\
 0 & 0  & 4 & 3c_3 - c_2 - c_1 -a \\   
\end{redmatrix}}\\
\\
\end{alignat*}
\end{document}

Any help will be immensely appreciated.

  • 2
    \huge{ size commands do not take an argument so there should be no { but also they can not be inside a math environment such as aligned – David Carlisle May 18 '18 at 22:38
  • Welcome to TeX.SE! What's the purpose of rowequmat here? – user121799 May 18 '18 at 22:39
2

enter image description here

\documentclass{article}
\usepackage{array}
\newenvironment{rowequmat}[1]{\left(\array{@{}#1@{}}}{\endarray\right)}
\newenvironment{redmatrix}
  {\left(\array{@{}rrr|c@{}}}
  {\endarray\right)}
% \newenvironment{ropmatrix}
%   {\array{@{}c@{}}}
%   {\endarray}
\newcommand\opone[2]{\xrightarrow{(#1)\times r_#2}}
\newcommand\optwo[3]{\xrightarrow{r_#1{}+{} #2r_#3}}
\usepackage[fleqn]{amsmath}
\usepackage{mathtools}
\setlength\mathindent{0pt}
\begin{document}
I'm wondering if you are looking for
\begin{align*}
\MoveEqLeft[5]{
\begin{redmatrix}
 -2 & -1 & 1 & c_1 - a\\
 -1 &  -2 & -1 & c_2 - a \\
 -1 &  -1 & -2 & c_3 - a \\
\end{redmatrix} }\\
\optwo{2}{}{3}
&
\begin{redmatrix}
 -2 & -1 & -1 & c_1 - a \\
  0 &  -1 & 1 & c_2 - c_3 \\
  0 & -1  & -3 & 2c_3 - c_1 -a \\   
\end{redmatrix}
\\
\opone{1/3}{2}
&
\begin{redmatrix}
-2 & -1 & -1 & c_1 - a \\
 0 & -1 & 1 & c_2 - c_3 \\
 0 & 0  & 4 & 3c_3 - c_2 - c_1 -a \\   
\end{redmatrix}
\end{align*}
or
\begin{align*}
&\begin{redmatrix}
 -2 & -1 & 1 & c_1 - a\\
 -1 &  -2 & -1 & c_2 - a \\
 -1 &  -1 & -2 & c_3 - a \\
\end{redmatrix} \\
\optwo{2}{}{3}
&
\begin{redmatrix}
 -2 & -1 & -1 & c_1 - a \\
  0 &  -1 & 1 & c_2 - c_3 \\
  0 & -1  & -3 & 2c_3 - c_1 -a \\   
\end{redmatrix}
\\
\opone{1/3}{2}
&
\begin{redmatrix}
-2 & -1 & -1 & c_1 - a \\
 0 & -1 & 1 & c_2 - c_3 \\
 0 & 0  & 4 & 3c_3 - c_2 - c_1 -a \\   
\end{redmatrix}
\end{align*}
\end{document}
  • I was looking for the second one. Thank you :) – Asad Raza May 19 '18 at 2:53
  • @AsadRaza If the answer worked for you, could you perhaps accept it by clicking the check mark left of it? – user121799 May 19 '18 at 3:05
1

Albeit I don't see why you want a \huge fontsize, I propose one of these layouts, with a simplified code, and equal lengths arrows (with the eqparbox package). Note \huge is not a command which takes ann argument but a mere switch, and a matrix doesn't end with a \\ (this adds an empty row).

 \documentclass{article}
 \usepackage[showframe]{geometry}
\usepackage[fleqn]{mathtools}
\usepackage{eqparbox}
\usepackage{array}
\newenvironment{rowequmat}[1]{\left(\array{@{}#1@{}}}{\endarray\right)}
\newenvironment{redmatrix}
  {\left(\array{@{}rrr|c@{}}}
  {\endarray\right)}
\newenvironment{ropmatrix}
  {\array{@{}c@{}}}
  {\endarray}
\newcommand\opone[2]{\xrightarrow{\eqmakebox[op]{$\, (#1)\times r_#2 $\,}}}
\newcommand\optwo[3]{\xrightarrow{\eqmakebox[op]{\,$ r_#1{}+{} #2r_#3 $\,}}}
\setlength\mathindent{0pt}

\begin{document}

{\huge
\begin{align*}
 & \begin{redmatrix}
 -2 & -1 & 1 & c_1 - a\\
 -1 & -2 & -1 & c_2 - a \\
 -1 & -1 & -2 & c_3 - a
\end{redmatrix} \\[0.7ex]
\optwo{2}{}{3}
&
\begin{redmatrix}
 -2 & -1 & -1 & c_1 - a \\
  0 & -1 & 1 & c_2 - c_3 \\
  0 & -1 & -3 & 2c_3 - c_1 -a
\end{redmatrix}\\[0.7ex]
\opone{1/3}{2}
&
\begin{redmatrix}
-2 & -1 & -1 & c_1 - a \\
 0 & -1 & 1 & c_2 - c_3 \\
 0 & 0 & 4 & 3c_3 - c_2 - c_1 -a
\end{redmatrix}
\end{align*}}

{\huge
\begin{flalign*}
 & \mathrlap{\begin{redmatrix}
 -2 & -1 & 1 & c_1 - a\\
 -1 & -2 & -1 & c_2 - a \\
 -1 & -1 & -2 & c_3 - a
\end{redmatrix}} & & \\[0.7ex]
 & \optwo{2}{}{3}
 \begin{redmatrix}
 -2 & -1 & -1 & c_1 - a \\
  0 & -1 & 1 & c_2 - c_3 \\
  0 & -1 & -3 & 2c_3 - c_1 -a
\end{redmatrix}
\\[0.7ex]
 & \opone{1/3}{2}
\begin{redmatrix}
-2 & -1 & -1 & c_1 - a \\
 0 & -1 & 1 & c_2 - c_3 \\
 0 & 0 & 4 & 3c_3 - c_2 - c_1 -a
\end{redmatrix}
\end{flalign*}}

\end{document} 

enter image description here

  • I am a LateX novice and this is HUGE help. I, however, can't figure our a way to input a minus operation (say $R_2 -R_1$). – Asad Raza May 19 '18 at 2:52

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.