\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}
![](https://i.loli.net/2021/01/15/EA4aby6sGpwdJF9.png)
\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}
![](https://i.loli.net/2021/01/15/6OBENlWjoy7Zugr.png)