nicematrix: 열 공간 제어

nicematrix: 열 공간 제어

코드가 있는데 잘 작동합니다.

그러나 세부적인 질문으로 나는 스스로에게 질문했습니다.
마지막 주석 열에서 오른쪽 괄호까지 아주 작은 거리를 원합니다.

여기서, in 을 nicematrix.sty사용한다는 의미인가요 ? \hspace{-0.5ex}
\newcolumntype{L}{>{\hspace{-0.5ex}$\ttfamily\footnotesize}l<{$}}

아니면 nicematrix.sty이 열 간격에 해당하는 키를 알고 있나요?

여기에 이미지 설명을 입력하세요

\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}

답변1

나는 귀하의 솔루션이 좋은 솔루션이라고 생각합니다. 그러나 의 환경은 nicematrix표준 환경 ( 에 의해 로드되는 {array}클래식 패키지에 정의된 버전 )을 기반으로 구성되므로 의 정신으로 솔루션을 제안합니다 .arraynicematrix{array}

an 에서는 두 개의 연속 열 사이에 {array}an이 삽입됩니다. 배열의 프리앰블에서 \hspace{2\arraycolsep}특수 구성을 사용하면 @{...}이러한 요소를 원하는 대로 바꿀 수 있습니다(예: 명령 \hspace{...}조정).

이것이 제가 다음 코드에서 수행한 작업입니다.

\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}

위 코드의 출력

관련 정보