在此代码中
\documentclass{book}
\usepackage{mathtools}
\usepackage{stix}
\usepackage{multicol,multirow}
\newcommand{\Tonde}[1]{\left(#1\right)}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
\newcommand*{\Resize}[2]{\resizebox{#1}{!}{$#2$}}%
\begin{document}
\begin{equation}\label{A_MEG_Blocchi}
A^{(\:\:)}\coloneqq\Tonde{\begin{array}{c|c}\multicolumn{2}{c}{}\\\cline{2-2}&K\end{array}}=
\Tonde{\begin{array}{ccc|ccc}a_{11}^{(1)}&\cdots&\cdots&\cdots&\cdots&a_{1n}^{(1)}\\0&\ddots&\ddots&\cdots&\cdots&\vdots\\\vdots&\ddots&a_{k-1,k-1}^{(k-1)}&\cdots&\cdots&a_{k-1,n}^{(k-1)}\\[2mm]\cline{4-6}0&\cdots&0&a_{kk}^{(k)}&\cdots&a_{kn}^{(k)}\\[2mm]\multicolumn{3}{c}{\multirow{3}{*}{$\mathop{\Scale[5]{0}}$}}&\vdots&\ddots&\vdots\\&&&a_{nk}^{(k)}&\cdots&a_{k+1,n}^{(k)}\\[2mm]\end{array}}
\end{equation}
\end{document}
我希望\vspace
行与行之间有更好的衔接array
,我想在第 4 行和第 5 行之间添加一条水平虚线(但仅限于前三列),为什么垂直线是断的?非常感谢。
答案1
不要使用\vspace
来增加 中的行间距array
。相反,将其设置\arraystretch
为大于 1 的数字。在下面的代码中,我运行\renewcommand\arraystretch{1.5}
。
\documentclass{book}
\usepackage{mathtools} % for '\coloneqq' macro
\usepackage{stix}
\usepackage{multirow}
\newcommand{\Tonde}[1]{\left(#1\right)}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
\begin{document}
\renewcommand\arraystretch{1.5} % <-- new
\begin{equation}\label{A_MEG_Blocchi}
A^{(\:\:)} \coloneqq
\Tonde{
\begin{array}{c|c}
\multicolumn{2}{c}{}\\
\cline{2-2}
\phantom{K} & K % <-- '\phantom{K}' is new
\end{array}}
=
\Tonde{
\begin{array}{ccc|ccc}
a_{11}^{(1)}&\cdots&\cdots&\cdots&\cdots&a_{1n}^{(1)} \\
0&\ddots&\ddots&\cdots&\cdots&\vdots \\
\vdots&\ddots&a_{k-1,k-1}^{(k-1)}&\cdots&\cdots&a_{k-1,n}^{(k-1)} \\[1mm]
\cline{4-6}
\multicolumn{3}{c|}{\multirow{3}{*}{\Scale[4]{$0$}}}
&a_{kk}^{(k)} & \cdots & a_{kn}^{(k)} \\
& & & \vdots&\ddots&\vdots\\
&&&a_{nk}^{(k)}&\cdots&a_{k+1,n}^{(k)}
\end{array}}
\end{equation}
\end{document}
答案2
tblr
使用新 LaTeX3 包环境的替代解决方案tabularray
:
\documentclass{book}
\usepackage{mathtools}
\usepackage{stix}
\newcommand{\Tonde}[1]{\left(#1\right)}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
\newcommand*{\Resize}[2]{\resizebox{#1}{!}{$#2$}}%
\usepackage{tabularray}
\SetTblrInner{rowsep=4pt}
\begin{document}
\begin{equation}\label{A_MEG_Blocchi}
A^{(\:\:)} \coloneqq
\Tonde{
\begin{tblr}{c|c}
\SetCell[c=2]{c} & \\
\cline{2-2}
\phantom{K} & K % <-- '\phantom{K}' is new
\end{tblr}}
=
\Tonde{
\begin{tblr}{ccc|ccc}
a_{11}^{(1)}&\cdots&\cdots&\cdots&\cdots&a_{1n}^{(1)} \\
0&\ddots&\ddots&\cdots&\cdots&\vdots \\
\vdots&\ddots&a_{k-1,k-1}^{(k-1)}&\cdots&\cdots&a_{k-1,n}^{(k-1)} \\
\cline[dashed]{1-3}\cline{4-6}
\SetCell[r=3,c=3]{c}\Scale[4]{$0$} & &
&a_{kk}^{(k)} & \cdots & a_{kn}^{(k)} \\
& & & \vdots&\ddots&\vdots\\
&&&a_{nk}^{(k)}&\cdots&a_{k+1,n}^{(k)}
\end{tblr}}
\end{equation}
\end{document}
答案3
以下是我要对 做的{pNiceArray}
事情nicematrix
。
\documentclass{book}
\usepackage{mathtools,stix}
\usepackage{nicematrix,tikz}
\begin{document}
\begin{equation}\label{A_MEG_Blocchi}
\renewcommand{\arraystretch}{1.6}
A^{(\:\:)} \coloneqq
\begin{pNiceMatrix}[margin=3pt,columns-width=5mm]
\\
& K
\CodeAfter
\tikz \draw (3-|2) |- (2-|3) ;
\end{pNiceMatrix}
=
\begin{pNiceMatrix}[margin=3pt,xdots/line-style=dotted,xdots/shorten=1pt]
a_{11}^{(1)}&\Cdots&&&&a_{1n}^{(1)} \\
0&\Ddots&&&&\Vdots \\
0&0&a_{k-1,k-1}^{(k-1)}&&\Cdots&a_{k-1,n}^{(k-1)} \\
\Block{3-3}<\Huge>{$0$} & & &a_{kk}^{(k)} & \Cdots & a_{kn}^{(k)} \\
& & & \Vdots&\Ddots&\Vdots\\
&&&a_{nk}^{(k)}&\Cdots&a_{k+1,n}^{(k)}
\CodeAfter
\line{2-1}{3-1}
\line{2-1}{3-2}
\line{3-1}{3-2}
\begin{tikzpicture}
\draw (1-|4) -- (last-|4) (4-|4) -- (4-|last) ;
\draw [dashed] (4-|1) -- (4-|4) ;
\end{tikzpicture}
\end{pNiceMatrix}
\end{equation}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。
答案4
我是这样解决我的问题的:
\begin{equation}\label{A_MEG_Blocchi}
A^{(\:\:)} \coloneqq
\Tonde{
\begin{array}{c|c}
\multicolumn{2}{c}{}\\
\cline{2-2}
\phantom{K} & K % <-- '\phantom{K}' is new
\end{array}}
=
\Tonde{\begingroup{
\begin{array}{ccc|ccc}
a_{11}^{(1)}&\cdots&\cdots&\cdots&\cdots&a_{1n}^{(1)} \\
0&\ddots&\ddots&\cdots&\cdots&\vdots \\
\vdots&\ddots&a_{k-1,k-1}^{(k-1)}&\cdots&\cdots&a_{k-1,n}^{(k-1)} \\[1mm]
\cline{4-6}
0&\cdots&0&a_{kk}^{(k)} & \cdots & a_{kn}^{(k)} \\[-7.5mm] \hdotsfor[0.75]{3}\\[-2.5mm]
\multicolumn{3}{c|}{\multirow{3}{*}{\Scale[4]{$0$}}}
&\vdots&\ddots&\vdots\\
&&&a_{nk}^{(k)}&\cdots&a_{k+1,n}^{(k)}
\end{array}}\endgroup}
\end{equation}
谢谢你,Mico!