Q:

How to use Gauss Package which displays as below?

I want to use latex code to display gauss elimination as shown below.

Thanks a lot!!

A:

\documentclass{article}

\usepackage{gauss}
\usepackage{xcolor}

\newcommand{\smallvec}[2]{\left(\begin{smallmatrix}#1\\#2\end{smallmatrix}\right)}

\begin{document}

\begin{align*}
    \left.\begin{gmatrix}
        1 & -1 & 0 \\
        0 & 1 & 1 \\
        0 & 3 & 1
    \end{gmatrix}\right|
    \begin{gmatrix}
        \smallvec{0}{1} \\
        \smallvec{1}{0} \\
        \smallvec{2}{-1}
    \rowops
        \add[\cdot(-3)][+]{1}{2}
    \end{gmatrix}\sim\quad\left.\begin{gmatrix}
        1 & -1 & 0 \\
        0 & 1 & 1 \\
        0 & \mathbf{\color{red} 0} & -2
    \end{gmatrix}\right|
    \begin{gmatrix}
        \smallvec{0}{1} \\
        \smallvec{1}{0} \\
        \smallvec{-1}{-1}
    \end{gmatrix}
\end{align*}

\end{document}

Some comments:

You can't insert a vertical line inside a gmatrix environment, but you can put two two gmatrix next to each other with a vertical line in the middle. The row operations can then be added to the second gmatrix in the standard way.
To have the vectors in the same size as the matrix entries, I use the environment smallmatrix. I defined the macro \smallvec to have a shorthand for that.
If you are planning to use the combination of red + bold several times, you can define a shorthand macro for that, too:
\newcommand{\mathemph}[1]{\mathbf{\color{red}#1}}

