![上三角矩陣下三角有大零?](https://rvso.com/image/254726/%E4%B8%8A%E4%B8%89%E8%A7%92%E7%9F%A9%E9%99%A3%E4%B8%8B%E4%B8%89%E8%A7%92%E6%9C%89%E5%A4%A7%E9%9B%B6%EF%BC%9F.png)
我可以表示一個上梯形矩陣,如下圖所示。我想用跨越低三角形行和列的單個大零替換所有這些零,並且可能還沿著對角線添加分隔符,清楚地表明它是上對角矩陣。我怎樣才能做到這一點?
\newcommand\x{\XSolid}
%\newcommand\x{\ding{53}}
\begin{equation}
\left(
\begin{array}{*5{c}}
\x & \x & \x & \x & \x \\
0 & \x & \x & \x & \x \\
0 & 0 & \x & \x & \x \\
0 & 0 & 0 & \x & \x \\
0 & 0 & 0 & 0 & \x \\
\end{array}\right)
\end{equation}
單獨的問題...為什麼\x
我定義的命令輸出#
而不是預期的十字符號?#
無論我使用\XSolid
還是,它都會輸出相同的符號\ding{53}
更新:將答案作為輸入,我結束了這樣做:
\newcommand\x{\times}
\newcommand\bigzero{\makebox(0,0){\text{\huge0}}}
\newcommand*{\bord}{\multicolumn{1}{c|}{}}
\begin{equation}
\left(
\begin{array}{ccccc}
\x & \x & \x & \x & \x \\ \cline{1-1}
\bord & \x & \x & \x & \x \\ \cline{2-2}
& \bord & \x & \x & \x \\ \cline{3-3}
& \bigzero & \bord & \x & \x \\ \cline{4-4}
& & & \bord & \x \\ \cline{5-5}
\end{array}\right)
\end{equation}
產生這個:
答案1
\documentclass[]{article}
\usepackage{mathtools}
\begin{document}
\[
\left(
\begin{array}{ccccc}
1 \\
& 1 & & \text{\huge0}\\
& & 1 \\
& \text{\huge0} & & 1 \\
& & & & 1
\end{array}
\right)
\]
\end{document}
或者\makebox(0,0){\text{\huge0}}
如果你想有相同的行距。
答案2
以防萬一:您可能需要在對角線上重複點。這是一種醜陋的方法。
\newcount\dotcnt\newdimen\deltay
\def\Ddot#1#2(#3,#4,#5,#6){\deltay=#6\setbox1=\hbox to0pt{\smash{\dotcnt=1
\kern#3\loop\raise\dotcnt\deltay\hbox to0pt{\hss#2}\kern#5\ifnum\dotcnt<#1
\advance\dotcnt 1\repeat}\hss}\setbox2=\vtop{\box1}\ht2=#4\box2}
舉個例子(當然使用 amsmath):
\[\begin{pmatrix}
1\Ddot{12}.(6pt,-2pt,6pt,-5pt)&1\Ddot8.(9pt,2pt,6pt,0pt)&\quad&\quad&1\\
&&&&\\
&&&&\\
&&&&\\
&\mbox{\Huge 0}&&&\\
&&&&1\\
\end{pmatrix}\]
答案3
與.{pNiceMatrix}
nicematrix
\documentclass{article}
\usepackage{nicematrix,tikz}
\begin{document}
$\begin{pNiceMatrix}[left-margin]
\times & \times & \times & \times & \times \\
& \times & \times & \times & \times \\
& & \times & \times & \times \\
\Block{2-2}<\Huge>{0}
& & & \times & \times \\
& & & & \times \\
\CodeAfter
\tikz \draw (2-|1) -| (3-|2) -| (4-|3) -| (5-|4) -| (6-|5) ;
\end{pNiceMatrix}$
\end{document}