我在 TikZ 中有以下矩阵:
代码如下:
\documentclass{article}
\usepackage{tikz,amssymb}
\usetikzlibrary{matrix,calc,fit}
\begin{document}
\tikzset{
circled/.style={draw,circle,inner sep=0pt},
highrow/.style={minimum height=.9cm},
}
\begin{tikzpicture}
\node[matrix of nodes] (tcm) {
{} &
$a_{00}$ & $\leqslant$ &
$a_{10}$ & $\leqslant$ &
$a_{20}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n0}$ \\
{} &
$a_{01}$ & $\leqslant$ &
$a_{11}$ & $\leqslant$ &
$a_{21}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n1}$ \\
{} &
$a_{02}$ & $\leqslant$ &
$a_{12}$ & $\leqslant$ &
$a_{22}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n2}$ \vspace{-5cm}\\
|[circled]| $+$ &
|[highrow]| $\vdots$ & {} &
$\vdots$ & {} &
$\vdots$ & {} &
$\ddots$ & {} &
$\vdots$ \\
{} &
$\sum\limits_{m=0}^\infty a_{0m}$ & {} &
$\sum\limits_{m=0}^\infty a_{1m}$ & {} &
$\sum\limits_{m=0}^\infty a_{2m}$ & {} &
$\cdots$ & {} &
$\sum\limits_{m=0}^\infty \lim\limits_{n\to\infty} a_{nm}$ \\
};
\node[fit=(tcm-5-1) (tcm-5-2) (tcm-5-3) (tcm-5-4) (tcm-5-5) (tcm-5-6) (tcm-5-7) (tcm-5-8) (tcm-5-9) (tcm-5-10),inner sep=0pt] (R5) {};
\draw (R5.north -| tcm.west) -- (R5.north -| tcm.east);
\end{tikzpicture}
\end{document}
第三行和第四行之间的垂直空间让我很困扰。第四行(带圆圈的加号后面的行)上方有大量垂直空间,我无法将其移除。据我所知,它row sep
只能同时适用于所有行——我无法仅在第四行中使用它。
OBS:问题的根源不在于minimum height
带圆圈的加号。当此最小高度设置为零时,第四行上方的垂直空间量异常。
答案1
“标准”tabular
调整有效\\[-4mm]
,例如,您可以使用 来减少两个连续行之间的空间。同样,\\[3em]
将增加3em
的空间。如果您这样做,那么您的图表将变成:
以下是完整代码(即 OP 的此单一调整):
\documentclass{article}
\usepackage{tikz,amssymb}
\usetikzlibrary{matrix,calc,fit}
\begin{document}
\tikzset{
circled/.style={draw,circle,inner sep=0pt},
highrow/.style={minimum height=.9cm},
}
\begin{tikzpicture}
\node[matrix of nodes] (tcm) {
{} &
$a_{00}$ & $\leqslant$ &
$a_{10}$ & $\leqslant$ &
$a_{20}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n0}$ \\
{} &
$a_{01}$ & $\leqslant$ &
$a_{11}$ & $\leqslant$ &
$a_{21}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n1}$ \\
{} &
$a_{02}$ & $\leqslant$ &
$a_{12}$ & $\leqslant$ &
$a_{22}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n2}$ \\[-4mm]
|[circled]| $+$ &
|[highrow]| $\vdots$ & {} &
$\vdots$ & {} &
$\vdots$ & {} &
$\ddots$ & {} &
$\vdots$ \\
{} &
$\sum\limits_{m=0}^\infty a_{0m}$ & {} &
$\sum\limits_{m=0}^\infty a_{1m}$ & {} &
$\sum\limits_{m=0}^\infty a_{2m}$ & {} &
$\cdots$ & {} &
$\sum\limits_{m=0}^\infty \lim\limits_{n\to\infty} a_{nm}$ \\
};
\node[fit=(tcm-5-1) (tcm-5-2) (tcm-5-3) (tcm-5-4) (tcm-5-5) (tcm-5-6) (tcm-5-7) (tcm-5-8) (tcm-5-9) (tcm-5-10),inner sep=0pt] (R5) {};
\draw (R5.north -| tcm.west) -- (R5.north -| tcm.east);
\end{tikzpicture}
\end{document}
答案2
额外的垂直空间来自于高度\vdots
,\ddots
正如你所看到的
\documentclass[tikz]{standalone}
\begin{document}
\tikz\node[inner sep=0pt,draw]{$\vdots$};
\end{document}
因此,我会使用$\smash{\vdots}$
隐藏点的高度和类似的样式strutsize/.style={text height=\ht\strutbox,text depth=\dp\strutbox}
来保留所需的垂直空间。
\documentclass{article}
\usepackage{tikz,amssymb}
\usetikzlibrary{matrix,calc,fit}
\begin{document}
\tikzset{
circled/.style={draw,circle,inner sep=0pt},
highrow/.style={minimum height=.9cm},
strutsize/.style={text height=\ht\strutbox,text depth=\dp\strutbox}
}
\begin{tikzpicture}
\node[matrix of nodes] (tcm) {
{} &
$a_{00}$ & $\leqslant$ &
$a_{10}$ & $\leqslant$ &
$a_{20}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n0}$ \\
{} &
$a_{01}$ & $\leqslant$ &
$a_{11}$ & $\leqslant$ &
$a_{21}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n1}$ \\
{} &
$a_{02}$ & $\leqslant$ &
$a_{12}$ & $\leqslant$ &
$a_{22}$ & $\leqslant$ &
$\cdots$ & $\leqslant$ &
$\lim\limits_{n\to\infty} a_{n2}$ \\
|[circled]| $+$ &
|[strutsize]| $\smash{\vdots}$ & {} &
$\smash{\vdots}$ & {} &
$\smash{\vdots}$ & {} &
$\smash{\ddots}$ & {} &
$\smash{\vdots}$ \\
{} &
$\sum\limits_{m=0}^\infty a_{0m}$ & {} &
$\sum\limits_{m=0}^\infty a_{1m}$ & {} &
$\sum\limits_{m=0}^\infty a_{2m}$ & {} &
$\cdots$ & {} &
$\sum\limits_{m=0}^\infty \lim\limits_{n\to\infty} a_{nm}$ \\
};
\node[fit=(tcm-5-1) (tcm-5-2) (tcm-5-3) (tcm-5-4) (tcm-5-5) (tcm-5-6) (tcm-5-7) (tcm-5-8) (tcm-5-9) (tcm-5-10),inner sep=0pt] (R5) {};
\draw (R5.north -| tcm.west) -- (R5.north -| tcm.east);
\end{tikzpicture}
\end{document}