这是我正在尝试构建的表格。如何使用 Ti 完成钾Z?
更新
这是我正在使用的代码。但现在我需要删除外边框(如上图所示)。如何删除外边框?
\begin{tikzpicture}
\tikzset{%
square matrix/.style={
matrix of nodes,
column sep=-\pgflinewidth,
row sep=-\pgflinewidth,
nodes in empty cells,
nodes={draw,
minimum size=#1,
anchor=center,
align=center,
inner sep=0pt
},
column 1/.style={nodes={fill=lightgray!30}},
row 1/.style={nodes={fill=lightgray!30}},
},
square matrix/.default=1.2cm
}
\matrix[square matrix] (A)
{
& 0 & 2 & 4 & 6 & 8 & $\cdots$\\
0 & 0 & 2 & 4 & 6 & 8 & $\ddots$\\
2 & 2 & 4 & 6 & 8 & $\ddots$ & \\
4 & 4 & 6 & 8 & $\ddots$ & & \\
6 & 6 & 8 & $\ddots$ & & & \\
8 & 8 & $\ddots$ & & & & \\
$\vdots$ & $\ddots$ & & & & & \\
};
\draw (A-1-1.north west)--(A-1-1.south east);
\node[below left=2mm and 2mm of A-1-1.north east] {$k$};
\node[above right=2mm and 2mm of A-1-1.south west] {$j$};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-3-2) (A-2-3)}] {};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-4-2) (A-2-4)}] {};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-5-2) (A-2-5)}] {};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-6-2) (A-2-6)}] {};
\end{tikzpicture}
结果如下。
答案1
快速删除外边框:在其上方用背景颜色绘制一个矩形:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning,fit}
\begin{document}
\begin{tikzpicture}
\tikzset{%
square matrix/.style={
matrix of nodes,
column sep=-\pgflinewidth,
row sep=-\pgflinewidth,
nodes in empty cells,
nodes={draw,
minimum size=#1,
anchor=center,
align=center,
inner sep=0pt
},
column 1/.style={nodes={fill=lightgray!30}},
row 1/.style={nodes={fill=lightgray!30}},
},
square matrix/.default=1.2cm
}
\matrix[square matrix] (A)
{
& 0 & 2 & 4 & 6 & 8 & $\cdots$\\
0 & 0 & 2 & 4 & 6 & 8 & $\ddots$\\
2 & 2 & 4 & 6 & 8 & $\ddots$ & \\
4 & 4 & 6 & 8 & $\ddots$ & & \\
6 & 6 & 8 & $\ddots$ & & & \\
8 & 8 & $\ddots$ & & & & \\
$\vdots$ & $\ddots$ & & & & & \\
};
\draw (A-1-1.north west)--(A-1-1.south east);
\node[below left=2mm and 2mm of A-1-1.north east] {$k$};
\node[above right=2mm and 2mm of A-1-1.south west] {$j$};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-3-2) (A-2-3)}] {};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-4-2) (A-2-4)}] {};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-5-2) (A-2-5)}] {};
\node[
inner sep=-4pt,
draw=black,
very thick,
dashed,
rounded corners=0.5em,
rotate fit=45,
fit={(A-6-2) (A-2-6)}] {};
\draw[white,ultra thick] (A-1-1.north west) rectangle (A-7-7.south east);
\end{tikzpicture}
\end{document}