NiceArray, left margin

matricesnicematrix

About this code, I'd like to have left margin of NiceArray is more spaced from first column.
Is it possible, thank you so much

\documentclass[table, svgnames]{book}
\usepackage{mathtools}
\usepackage{nicematrix}
\usepackage{stix}
\usepackage{tabularray}
\usepackage{xcolor}
\usepackage{hhline}
\usepackage{tikz}

\newcommand{\Tonde}[1]{\left(#1\right)}

\begin{document}

\begin{equation}
\left.\begin{NiceArray}{ccccc}%[margin]
  1 & a^{(1)}_{12} & \cdots & a^{(1)}_{1n} & b^{(1)}_1\\
  a^{(1)}_{21} & \Block[fill=Gold1,borders={top,left,right}]{3-3}{}
            a^{(1)}_{22} & \cdots & a^{(1)}_{2n} &
\Block[fill=Gold1,borders={top,left}]{3-1}{}
            b^{(1)}_2\\ \vdots & \vdots  & \ddots & \vdots & \vdots\\
  a^{(1)}_{n1} & a^{(1)}_{n2} & \cdots & a^{(1)}_{nn} & b_n^{(1)}
\CodeAfter \tikz \draw (1-|5) |- (2-|last); \tikz \draw (1-|1) |- (1-|last); \tikz \draw (1-|1) |- (last-|1); 
\end{NiceArray}\right|\begin{array}{cccr}a^{(1)}_{1j}&=&a_{1j}\big/a_{11}&\forall j\in[2,n]\\b_1^{(1)}&=&b_1\big/a_{11}\\a_{ij}^{(1)}&=&a_{ij}-a_{i1}^{(1)}\cdot a_{1j }^{(1)}&\multirow{2}{*}{$\forall i,j\in [2,n]$}\\b_{i}^{(1)}&=&b_i-a_{i1}^{(1)} \cdot b_1^{(1)} \end{array}
\end{equation} 
\end{document}

Best Answer

I offer two alternatives to the original (eq. 1).

The first (eq. 2) with expanded cells and the second (eq. 3) using only nicematrix (without multirow)

a

\documentclass[table, svgnames]{book}
\usepackage{mathtools}
\usepackage{nicematrix}
\usepackage{stix}

\usepackage{xcolor}
\usepackage{hhline}
\usepackage{tikz}

\usepackage{multirow}

\newcommand{\Tonde}[1]{\left(#1\right)}

\setlength{\parindent}{0pt}

\begin{document}
    
\begin{equation}
    \left.\begin{NiceArray}{ccccc}%[margin]
        1 & a^{(1)}_{12} & \cdots & a^{(1)}_{1n} & b^{(1)}_1\\
        a^{(1)}_{21} & \Block[fill=yellow,borders={top,left,right}]{3-3}{}
        a^{(1)}_{22} & \cdots & a^{(1)}_{2n} &
        \Block[fill=yellow,borders={top,left}]{3-1}{}
        b^{(1)}_2\\ \vdots & \vdots  & \ddots & \vdots & \vdots\\
        a^{(1)}_{n1} & a^{(1)}_{n2} & \cdots & a^{(1)}_{nn} & b_n^{(1)}
        \CodeAfter \tikz \draw (1-|5) |- (2-|last); \tikz \draw (1-|1) |- (1-|last); \tikz \draw (1-|1) |- (last-|1); 
    \end{NiceArray}\right|\begin{array}{cccr}a^{(1)}_{1j}&=&a_{1j}\big/a_{11}&\forall j\in[2,n]\\b_1^{(1)}&=&b_1\big/a_{11}\\a_{ij}^{(1)}&=&a_{ij}-a_{i1}^{(1)}\cdot a_{1j }^{(1)}&\multirow{2}{*}{$\forall i,j\in [2,n]$}\\b_{i}^{(1)}&=&b_i-a_{i1}^{(1)} \cdot b_1^{(1)} \end{array}
\end{equation}
    
\bigskip    

\begin{equation}
    \left.\begin{NiceArray}{@{\hspace*{6pt}}ccccc@{\hspace*{6pt}}}[cell-space-limits=3pt]   
        1 & a^{(1)}_{12} & \cdots & a^{(1)}_{1n} & b^{(1)}_1\\
        a^{(1)}_{21} & \Block[fill=yellow,borders={top,left,right}]{3-3}{}
        a^{(1)}_{22} & \cdots & a^{(1)}_{2n} &
        \Block[fill=yellow,borders={top,left}]{3-1}{}
        b^{(1)}_2\\ \vdots & \vdots  & \ddots & \vdots & \vdots\\
        a^{(1)}_{n1} & a^{(1)}_{n2} & \cdots & a^{(1)}_{nn} & b_n^{(1)}
        \CodeAfter
%        \tikz \draw (1-|5) |- (2-|last);
        \tikz \draw (1-|1) |- (1-|last);
        \tikz \draw (1-|1) |- (last-|1);
        \tikz \draw (1-|last) |- (last-|last); 
    \end{NiceArray}\right.
    \begin{array}{cccr}a^{(1)}_{1j}&=&a_{1j}\big/a_{11}&\forall j\in[2,n]\\b_1^{(1)}&=&b_1\big/a_{11}\\a_{ij}^{(1)}&=&a_{ij}-a_{i1}^{(1)}\cdot a_{1j }^{(1)}&\multirow{2}{*}{$\forall i,j\in [2,n]$}\\b_{i}^{(1)}&=&b_i-a_{i1}^{(1)} \cdot b_1^{(1)} 
    \end{array}
\end{equation} 

\bigskip

\begin{equation}
    \left.\begin{NiceArray}{@{\hspace*{6pt}}ccccc@{\hspace*{6pt}}}[cell-space-limits=3pt]   
        1           & a^{(1)}_{12}  & \cdots    & a^{(1)}_{1n}  & b^{(1)}_1\\
        a^{(1)}_{21}&   \Block[fill=yellow,borders={top,left,right}]{3-3}{}
                                a^{(1)}_{22}    & \cdots        & a^{(1)}_{2n} &
                        \Block[fill=yellow,borders={top,left}]{3-1}{}b^{(1)}_2\\
         \vdots     & \vdots        & \ddots    & \vdots        & \vdots\\
        a^{(1)}_{n1}& a^{(1)}_{n2}  & \cdots    & a^{(1)}_{nn}  & b_n^{(1)}
        \CodeAfter
        %        \tikz \draw (1-|5) |- (2-|last);
        \tikz \draw (1-|1) |- (1-|last);
        \tikz \draw (1-|1) |- (last-|1);
        \tikz \draw (1-|last) |- (last-|last); 
    \end{NiceArray}\right. \hspace*{1em}
    \begin{NiceArray}{cccr}[cell-space-limits=2pt]  
        a^{(1)}_{1j}    &=&a_{1j}\big/a_{11}                     &\forall j\in[2,n]\\
        b_1^{(1)}       &=&b_1\big/a_{11}\\
        a_{ij}^{(1)}    &=&a_{ij}-a_{i1}^{(1)}\cdot a_{1j }^{(1)}&\Block{2-1}{\forall i,j\in [2,n]}\\
        b_{i}^{(1)}     &=&b_i-a_{i1}^{(1)} \cdot b_1^{(1)} 
    \end{NiceArray}
\end{equation} 

\end{document}

UPDATE The last equation can also be written without using tikz.

\begin{equation}
    \left.\begin{NiceArray}{@{\hspace*{6pt}}ccccc@{\hspace*{6pt}}}[cell-space-limits=3pt]
        \Block[borders={top,left,right}]{5-5}{}\\[-1em] % added <<<<<<<<<<<<
        1           & a^{(1)}_{12}  & \cdots        & a^{(1)}_{1n}  & b^{(1)}_1\\
        a^{(1)}_{21}&   \Block[fill=yellow,borders={top,left,right}]{3-3}{}
        a^{(1)}_{22}& \cdots        & a^{(1)}_{2n}  &
        \Block[fill=yellow,borders={top,left}]{3-1}{}b^{(1)}_2\\
        \vdots      & \vdots        & \ddots        & \vdots        & \vdots\\
        a^{(1)}_{n1}& a^{(1)}_{n2}  & \cdots        & a^{(1)}_{nn}  & b_n^{(1)}
    \end{NiceArray}\right. \hspace*{1em}
    \begin{NiceArray}{cccr}[cell-space-limits=2pt]  
        a^{(1)}_{1j}    &=&a_{1j}\big/a_{11}                     &\forall j\in[2,n]\\
        b_1^{(1)}       &=&b_1\big/a_{11}\\
        a_{ij}^{(1)}    &=&a_{ij}-a_{i1}^{(1)}\cdot a_{1j }^{(1)}&\Block{2-1}{\forall i,j\in [2,n]}\\
        b_{i}^{(1)}     &=&b_i-a_{i1}^{(1)} \cdot b_1^{(1)} 
    \end{NiceArray}
\end{equation} 

b