NiceArray,左边距

NiceArray,左边距

关于这段代码,我希望左边距NiceArray 与第一列的距离更大。可以吗,非常感谢

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

答案1

我提供了原始方案(等式 1)的两种替代方案。

第一个(等式 2)具有扩展的单元格,第二个(等式 3)仅使用nicematrix(无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}

更新最后一个等式也可以不用 来写出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

相关内容