答案1
这很大程度上取决于你想如何创建表,但你可以使用纯粹的 Ti钾Z:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix, fit}
\begin{document}
\begin{tikzpicture}
\matrix[
matrix of nodes,
draw,
inner sep=0pt,
every node/.style={
circle,
inner sep=0pt,
align=center,
text width=1em,
text height=0.8em,
text depth=0.2em,
font=\sffamily
}] (m) {
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
};
\node[
inner sep=0pt,
draw=red,
thick,
rounded corners=0.5em,
rotate fit=45,
fit={(m-2-2) (m-5-5)}] {};
\end{tikzpicture}
\end{document}
答案2
与和 TikZ{NiceMatrix}
一起使用nicematrix
。
\documentclass{article}
\usepackage{nicematrix,tikz}
\usetikzlibrary{fit}
\begin{document}
\renewcommand{\arraystretch}{1.2}
$\begin{NiceMatrix}
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
\CodeAfter
\tikz
\node [
inner sep=2.5pt,
draw=red,
thick,
rounded corners=5pt,
rotate fit=45,
fit = {(2-2) (5-5)}
] {} ;
\end{NiceMatrix}$
\end{document}