1

I would like to write an augmented matrix with labeled rows out of the right bracket of the matrix, in such a way to enlight operations by row for Gaussian elimination procedure. I'm using this code for writing augmented matrices

Preamble:

\newenvironment{sysmatrix}[1]
{\left(\begin{array}{@{}#1@{}}}
{\end{array}\right)}

Result:

$$
  \begin{sysmatrix}{rrr|r}
   1 &  2 & 0 & 0 \\
  -1 &  1 & 2 & 0 \\
   1 &  0 & 1 & 5 \\
   0 & -2 & 1 & 4
   \end{sysmatrix}
$$

So now, how can I get labeled rows at the right? Have you some suggestions for sample codes?

Thank you

1
  • 1
    Off-topic: You should not use $$…$$ in LaTeX. Use, e.g., \[…\] instead.
    – cabohah
    Commented Apr 5 at 9:03

2 Answers 2

1

With {pNiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\newenvironment{sysmatrix}
{\begin{pNiceArray}[last-col]}
{\end{pNiceArray}}

\[\begin{sysmatrix}{rrr|r}
 1 &  2 & 0 & 0 & L_1 \\
-1 &  1 & 2 & 0 & L_2 \\
 1 &  0 & 1 & 5 & L_3 \\
 0 & -2 & 1 & 4
\end{sysmatrix}\]

\end{document}

You need several compilations.

Output of the above code

0

I solved by creating a matrix with

\begin{matrix}
\end{matrix}

at the right of the main one, and putting operations by rows into its elements.

Thank you anyway.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .