答案1
{NiceArray}
以下是使用 的环境来实现此目的的一种方法nicematrix
。
{array}
该环境与经典环境(的)类似,array
但在表格的单元格、行和列下创建了 PGF/Tikz 节点。
因此,在构建主数组后,可以使用 Tikz 绘制任何您想要的规则。
\documentclass{article}
\usepackage{nicematrix,tikz}
\usetikzlibrary{calc}
\usepackage{amssymb} % \checkmark
\begin{document}
\[\setlength{\arraycolsep}{0pt}
\begin{NiceArray}{>{\rule[-2.8mm]{0pt}{8mm}}ccccccc}%
[
columns-width=8mm ,
corners = {NW,NE} ,
hvlines ,
code-before = \arraycolor{cyan!10}
]
& I & II & III & IV & V \\
A & 5 & [0] & 3 & 10 & 40 & \NotEmpty \\
B & 7 & 8 & 9 & 14 & 41 & {\scriptsize\checkmark}(5) \\
C & 11 & 15 & 16 & 17 & 42 \\
D & 12 & 18 & 19 & 20 & 31 & {\scriptsize\checkmark}(3) \\
E & 13 & 21 & 22 & 23 & 74 & {\scriptsize\checkmark}(1) \\
& \overset{\checkmark}{(4)} & & & \overset{\checkmark}{(2)} \\
\CodeAfter
\tikz \draw (2.5-|2) -- (2.5-|7)
(4.5-|2) -- (4.5-|7)
(2-|2.5) -- (7-|2.5)
(2-|6.5) -- (7-|6.5) ;
\end{NiceArray}\]
\end{document}
您需要多次编译(因为nicematrix
使用 PGF/Tikz 节点)。
答案2
我的新欢迎。经过多次改进,有一个表格供您使用马查/TikZ
这是一个快速的在线工具。它不是很容易创建,但我留给你把准确的数字放入单元格中。如果你看到代码,你就能找到对应的数字。
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb,xcolor}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,34) -- (167,34) -- (167,84) -- (117,84) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,34) -- (217,34) -- (217,84) -- (167,84) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,34) -- (267,34) -- (267,84) -- (217,84) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,34) -- (317,34) -- (317,84) -- (267,84) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,34) -- (367,34) -- (367,84) -- (317,84) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,84) -- (167,84) -- (167,134) -- (117,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (67,84) -- (117,84) -- (117,134) -- (67,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,84) -- (217,84) -- (217,134) -- (167,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,84) -- (267,84) -- (267,134) -- (217,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,84) -- (317,84) -- (317,134) -- (267,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,84) -- (367,84) -- (367,134) -- (317,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (367,84) -- (417,84) -- (417,134) -- (367,134) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (67,134) -- (117,134) -- (117,184) -- (67,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,134) -- (167,134) -- (167,184) -- (117,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,134) -- (217,134) -- (217,184) -- (167,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,134) -- (267,134) -- (267,184) -- (217,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,134) -- (317,134) -- (317,184) -- (267,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,134) -- (367,134) -- (367,184) -- (317,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (367,134) -- (417,134) -- (417,184) -- (367,184) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (67,184) -- (117,184) -- (117,234) -- (67,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,184) -- (167,184) -- (167,234) -- (117,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,184) -- (317,184) -- (317,234) -- (267,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,184) -- (367,184) -- (367,234) -- (317,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (367,184) -- (417,184) -- (417,234) -- (367,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,184) -- (217,184) -- (217,234) -- (167,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,184) -- (267,184) -- (267,234) -- (217,234) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (67,234) -- (117,234) -- (117,284) -- (67,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,234) -- (267,234) -- (267,284) -- (217,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,234) -- (217,234) -- (217,284) -- (167,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,234) -- (317,234) -- (317,284) -- (267,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,234) -- (167,234) -- (167,284) -- (117,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (367,234) -- (417,234) -- (417,284) -- (367,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,234) -- (367,234) -- (367,284) -- (317,284) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (67,284) -- (117,284) -- (117,334) -- (67,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,284) -- (167,284) -- (167,334) -- (117,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,284) -- (217,284) -- (217,334) -- (167,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,284) -- (267,284) -- (267,334) -- (217,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,284) -- (317,284) -- (317,334) -- (267,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,284) -- (367,284) -- (367,334) -- (317,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (367,284) -- (417,284) -- (417,334) -- (367,334) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (67,334) -- (117,334) -- (117,384) -- (67,384) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (117,334) -- (167,334) -- (167,384) -- (117,384) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (167,334) -- (217,334) -- (217,384) -- (167,384) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (217,334) -- (267,334) -- (267,384) -- (217,384) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (267,334) -- (317,334) -- (317,384) -- (267,384) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (317,334) -- (367,334) -- (367,384) -- (317,384) -- cycle ;
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ][fill={rgb, 255:red, 161; green, 250; blue, 253 } ,fill opacity=0.67 ] (367,334) -- (417,334) -- (417,384) -- (367,384) -- cycle ;
\draw (139,52.4) node [anchor=north west][inner sep=0.75pt] {$I$};
\draw (184,52.4) node [anchor=north west][inner sep=0.75pt] {$II$};
\draw (230,52.4) node [anchor=north west][inner sep=0.75pt] {$III$};
\draw (280,52.4) node [anchor=north west][inner sep=0.75pt] {$IV$};
\draw (334,52.4) node [anchor=north west][inner sep=0.75pt] {$V$};
\draw (84,101.4) node [anchor=north west][inner sep=0.75pt] {$A$};
\draw (83,151.4) node [anchor=north west][inner sep=0.75pt] {$B$};
\draw (83,205.4) node [anchor=north west][inner sep=0.75pt] {$C$};
\draw (83,252.4) node [anchor=north west][inner sep=0.75pt] {$D$};
\draw (84,299.4) node [anchor=north west][inner sep=0.75pt] {$E$};
\draw (133,340) node [anchor=north west][inner sep=0.75pt] {$\overset{\checkmark}{(4)}$};
\draw (283,340) node [anchor=north west][inner sep=0.75pt] {$\overset{\checkmark}{(2)}$};
\draw (134,102.4) node [anchor=north west][inner sep=0.75pt] {$5$};
\draw (181,102.4) node [anchor=north west][inner sep=0.75pt] {$\boldsymbol{[0]}$};
\draw (238,102.4) node [anchor=north west][inner sep=0.75pt] {$3$};
\draw (134,153.4) node [anchor=north west][inner sep=0.75pt] {$7$};
\draw (130,201.4) node [anchor=north west][inner sep=0.75pt] {$11$};
\draw (236,153.4) node [anchor=north west][inner sep=0.75pt] {$9$};
\draw (185,153.4) node [anchor=north west][inner sep=0.75pt] {$8$};
\draw (283,102.4) node [anchor=north west][inner sep=0.75pt] {$10$};
\draw (131,250.4) node [anchor=north west][inner sep=0.75pt] {$12$};
\draw (131,300.4) node [anchor=north west][inner sep=0.75pt] {$13$};
\draw (283,153.4) node [anchor=north west][inner sep=0.75pt] {$14$};
\draw (181,201.4) node [anchor=north west][inner sep=0.75pt] {$15$};
\draw (232,201.4) node [anchor=north west][inner sep=0.75pt] {$16$};
\draw (283,201.4) node [anchor=north west][inner sep=0.75pt] {$17$};
\draw (181,250.4) node [anchor=north west][inner sep=0.75pt] {$18$};
\draw (232,251.4) node [anchor=north west][inner sep=0.75pt] {$19$};
\draw (283,251.4) node [anchor=north west][inner sep=0.75pt] {$20$};
\draw (182,300.4) node [anchor=north west][inner sep=0.75pt] {$21$};
\draw (232,300.4) node [anchor=north west][inner sep=0.75pt] {$22$};
\draw (282,300.4) node [anchor=north west][inner sep=0.75pt] {$23$};
\draw (333,102.4) node [anchor=north west][inner sep=0.75pt] {$40$};
\draw (334,153.4) node [anchor=north west][inner sep=0.75pt] {$41$};
\draw (333,201.4) node [anchor=north west][inner sep=0.75pt] {$42$};
\draw (333,251.4) node [anchor=north west][inner sep=0.75pt] {$31$};
\draw (332,300.4) node [anchor=north west][inner sep=0.75pt] {$74$};
\draw (380,153.4) node [anchor=north west][inner sep=0.75pt] {$\checkmark(5)$};
\draw (380,251.4) node [anchor=north west][inner sep=0.75pt] {$\checkmark(3)$};
\draw (380,300.4) node [anchor=north west][inner sep=0.75pt] {$\checkmark(1)$};
\draw (118,111) -- (367,111) ;
\draw (118,209) -- (367,209) ;
\draw (142,85) -- (142,333) ;
\draw (342,85) -- (342,333) ;
\end{tikzpicture}
\end{document}