I am still a newbie in LaTeX and I am trying to write something like that but I couldn't find how to do so.
Is there an efficient way to write this and if I have multiple steps to show in the reduction how do I align them?
Thanks!
I am still a newbie in LaTeX and I am trying to write something like that but I couldn't find how to do so.
Is there an efficient way to write this and if I have multiple steps to show in the reduction how do I align them?
Thanks!
I would use something like this:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\left(
\begin{array}{*4{l}|l}
1 & 1 & 1 & 1 & b_1\\
0 & 2 & 3 & 3 & b_2-b_1\\
0 & 2 & 3 & 3 & b_3-b_1\\
0 & 4 & 4 & 5 & b_4-b_1\\
\end{array}
\right)
\xrightarrow[L_4 \rightarrow L_4-2L_2]{L_3 \rightarrow L_3-L_2}
\left(
\begin{array}{*4{l}|l}
1 & 1 & 1 & 1 & b_1\\
0 & 2 & 3 & 3 & b_2-b_1\\
0 & 0 & 0 & 0 & b_3-b_1-b_2\\
0 & 0 & -2 & -1 & b_4+b_1-2b_2\\
\end{array}
\right).
\]
\end{document}
array, you might consider aligning the first four columns as 4r instead of 4l so that the minus signs don't shove the negative values out of line.
– barbara beeton
Oct 13 '19 at 17:40
xrightarrow, look at the instructions and examples in section 4.9, "Extensible arrows", in the amsmath user guide (texdoc amsldoc). Also, the answers here do show the proper input method.
– barbara beeton
Oct 14 '19 at 15:58
EDIT: 2020-7-18 Another option could be using the nicematrix package (see the recent version and the comment of the author of the package). Here there is my approach:
\documentclass[a4paper,12pt]{article}
\usepackage{nicematrix}
\usepackage{mathtools}
\begin{document}
\[\left(\begin{NiceArray}{cccc|l}
1 & 1 & 1 & 1 & b_1\\
0 & 2 & 3 & 3 & b_2-b_1\\
0 & 2 & 3 & 3 & b_3-b_1\\
0 & 4 & 4 & 5 & b_4-b_1
\end{NiceArray}\right)
\xrightarrow[L_4 \rightarrow L_4-2L_2]{L_3 \rightarrow L_3-L_2}
\left(\begin{NiceArray}{cccc|l}
1 & 1 & 1 & 1 & b_1\\
0 & 2 & 3 & 3 & b_2-b_1\\
0 & 0 & 0 & 0 & b_3-b_1-b_2\\
0 & 0 & -2 & -1 & b_4+b_1-2b_2\\
\end{NiceArray}\right).\]
\end{document}
There are several procedures to have, for example, on the same arrow your reductions: see this link how to force text to write in two or more lines in overset command for example.
\documentclass[a4paper,12pt]{article}
\usepackage{nicematrix}
\usepackage{mathtools}
\begin{document}
\[\left(\begin{NiceArray}{cccc|l}
1 & 1 & 1 & 1 & b_1\\
0 & 2 & 3 & 3 & b_2-b_1\\
0 & 2 & 3 & 3 & b_3-b_1\\
0 & 4 & 4 & 5 & b_4-b_1
\end{NiceArray}\right)
\xrightarrow{
\begin{subarray}{l}
L_4 \rightarrow L_4-2L_2\\
L_3 \rightarrow L_3-L_2\\
L_2 \rightarrow \frac{1}{2}
%%% here you can add other steps
\end{subarray}
}
\left(\begin{NiceArray}{cccc|l}
1 & 1 & 1 & 1 & b_1\\
0 & 2 & 3 & 3 & b_2-b_1\\
0 & 0 & 0 & 0 & b_3-b_1-b_2\\
0 & 0 & -2 & -1 & b_4+b_1-2b_2\\
\end{NiceArray}\right).\]
\end{document}
You, if it is possible, read the guide of nicematrix package you could get a better result (see the image of the guide to pag. 18, for example).
nicematrix one must write cccc|l instead of CCCC|L in the preambles of {NiceArray} (but there is an option for backward compatibility).
– F. Pantigny
Jul 18 '20 at 21:15