
Eu tenho um código e isso funciona bem.
Mas por uma questão de detalhe, me perguntei:
quero uma distância muito pequena da última coluna de anotação até o parêntese direito.
É no sentido de nicematrix.sty
usar \hspace{-0.5ex}
aqui,
em \newcolumntype{L}{>{\hspace{-0.5ex}$\ttfamily\footnotesize}l<{$}}
?
Ou nicematrix.sty
conhece uma chave correspondente para o espaçamento desta coluna?
\documentclass{article}
\def\NoOfVariables{3}% Input number of variables here! %%%
\usepackage{amsmath}
\usepackage{nicematrix}
\newcolumntype{L}{>{\hspace{-0.5ex}$\ttfamily\footnotesize}l<{$}}
\NewDocumentEnvironment{LGS}{}
{%
\let \{ \lgroup
\let \} \rgroup
\begin{NiceArray}{\{ *{\NoOfVariables}{r} | r \} L}}%
{\end{NiceArray}}
\usepackage{fontawesome}
\newcommand\error{\faWarning}
\newcommand\mal{\ensuremath{\cdot}{}}
\newcommand\step{\hspace{1em}\ensuremath{\rightarrow}\hspace{1em}}
\begin{document}
\noindent$\begin{LGS}
1 & 2 & -1 & 1 & {} \\
0 & 1 & 1 & 2 & {} \\
2 & 1 & 1 & 1 & {-2\mal I} \\
3 & 2 & 1 & 1 & {-3\mal I} \\
\end{LGS}
\step
\begin{LGS}
1 & 2 & -1 & 1 & {} \\
0 & 1 & 1 & 2 & {} \\
0 & -3 & 3 & -1 & {} \\
0 & -4 & 4 & -2 & {:2} \\
\end{LGS}
\step \dots \step
\begin{LGS}
1 & 0 & -3 & -3 & {} \\
0 & 1 & 1 & 2 & {} \\
0 & 0 & 6 & 5 & {} \\
0 & 0 & 0 & -1 & {\error} \\
\end{LGS}$
\end{document}
Responder1
Eu acho que sua solução é uma boa solução. Porém, como os ambientes de nicematrix
são construídos sobre o ambiente padrão {array}
(na versão definida no pacote clássico array
, que é carregado por nicematrix
), sugiro uma solução no espírito de {array}
.
Em an {array}
, an \hspace{2\arraycolsep}
é inserido entre duas colunas consecutivas. Usando a construção especial @{...}
no preâmbulo do array, você pode substituir esses elementos por qualquer coisa que desejar, por exemplo, uma instrução \hspace{...}
ajustada.
Foi o que fiz no código a seguir.
\documentclass{article}
\usepackage{nicematrix}
\newcolumntype{L}{>{$\ttfamily\footnotesize}l<{$}}
\NewDocumentEnvironment{LGS}{}
{%
\let \{ \lgroup
\let \} \rgroup
\begin{NiceArray}{\{ r r r | r \} @{\hspace{1.8ex}} L}}% Input number of columns! %%%
{\end{NiceArray}}
\usepackage{fontawesome}
\newcommand\error{\faWarning}
\newcommand\mal{\ensuremath{\cdot}{}}
\newcommand\step{\hspace{1em}\ensuremath{\rightarrow}\hspace{1em}}
\begin{document}
\noindent$\begin{LGS}
1 & 2 & -1 & 1 & {} \\
0 & 1 & 1 & 2 & {} \\
2 & 1 & 1 & 1 & {-2\mal I} \\
3 & 2 & 1 & 1 & {-3\mal I} \\
\end{LGS}
\step
\begin{LGS}
1 & 2 & -1 & 1 & {} \\
0 & 1 & 1 & 2 & {} \\
0 & -3 & 3 & -1 & {} \\
0 & -4 & 4 & -2 & {:2} \\
\end{LGS}
\step \dots \step
\begin{LGS}
1 & 0 & -3 & -3 & {} \\
0 & 1 & 1 & 2 & {} \\
0 & 0 & 6 & 5 & {} \\
0 & 0 & 0 & -1 & {\error} \\
\end{LGS}$
\end{document}