LaTeX画阶梯型矩阵

\documentclass[UTF8]{ctexart}
\usepackage{nicematrix}
\usepackage{tikz}

\begin{document}
    \[\begin{pNiceArray}{>{\strut}CCCC}%
    [create-extra-nodes,margin,%extra-margin=2pt,
    code-after = {\tikz\draw[name suffix = -large,
        blend mode = multiply]
        (1-1.north west)
        |- (2-2.north west)
        |- (3-3.north west)
        |- (4-4.north west)
        |- (4-4.south east) ; } ]
    A_{11} & A_{12} & A_{13} & A_{14} \\
    A_{21} & A_{22} & A_{23} & A_{24} \\
    A_{31} & A_{32} & A_{33} & A_{34} \\
    A_{41} & A_{42} & A_{43} & A_{44}
    \end{pNiceArray}\]
\end{document}

\documentclass[UTF8]{ctexart}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
    \[\begin{pNiceArray}{>{\strut}CCCCC}%
    [create-extra-nodes,margin, % extra-margin=1pt,
    code-after={\tikz\draw[dashed,name suffix=-large,blend mode=multiply]
        ($(1-1.north west)+(3pt,0pt)$)
        |- (2-2.north west)
        |- (3-4.north west)
        |- ($(3-5.south east)-(3pt,0pt)$);}]
    1 & 0 & 2 & 0 & -3\\
    0 & 1 & -1 & 0 & -4\\
    0 & 0 & 0 & 1 & 1 \\
    0 & 0 & 0 & 0 & 0
    \end{pNiceArray}\]
\end{document}

posted @ 2021-08-03 22:09  梧桐鹿  阅读(600)  评论(0编辑  收藏  举报