特殊桌子-圆形边框

特殊桌子-圆形边框

您能帮我在 Latex 中创建这种类型的表格吗?

在此处输入图片描述

谢谢

答案1

只是在空闲时间玩玩。我希望 OP 能在下一个问题中提供一个 MME(如果有的话)^^ 在此处输入图片描述

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=.75,font=\sffamily]
\begin{scope}[shift={(-.5,.5)}]
\clip[draw,rounded corners] (-4,-3) rectangle (5,2);
\fill[cyan] (-4,-1) rectangle +(1,1);
\fill[magenta] (3,0) rectangle +(1,1);
\draw (-4,-3) grid (5,2); 
\draw[fill=white] (-2,-2) rectangle (3,1); 
\end{scope}
\fill (-4,0) circle(.1) (4,-1) circle(.1);
\path node{XXX}
(-2,2)   node{A} 
++(0:1)  node{B}
++(0:1)  node{C}
++(0:1)  node{D}
++(0:1)  node{E}
(-2,-2)  node{1}          
++(0:1)  node{2}
++(0:1)  node{3}
++(0:1)  node{4}
++(0:1)  node{5};
\end{tikzpicture}
\end{document}

答案2

我只会使用矩阵。只要您不在角落处绘制节点,您就会尊重矩阵节点的圆角。为了方便起见,我添加了一个快捷方式n来抑制绘制。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[n/.style={draw=none},font=\sffamily]
 \path node[matrix of nodes,draw,rounded corners,inner sep=-\pgflinewidth/2,nodes in empty
     cells,column sep=-\pgflinewidth,row sep=-\pgflinewidth,    
     cells={nodes={draw,sharp corners,minimum size=2em,anchor=center}}]
    { |[n]| &  & A & B & C & D & E &  & |[n]|\\
      &  & |[n]| & |[n]| & |[n]| & |[n]| & |[n]| & |[fill=red]| &   \\
     |[fill=blue!40]| \textbullet &  & |[n]| & |[n]| & |[n]| & |[n]| & |[n]| &  &   \\
      &  & |[n]| & |[n]| & |[n]| & |[n]| & |[n]| &  & \textbullet  \\
      |[n]| &  & 1 & 2 & 3 & 4 & 5 &  & |[n]|\\
     } node{XXX};    
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[n/.style={draw=none},font=\sffamily]
 \path node[matrix of nodes,draw,rounded corners=2ex,inner sep=-\pgflinewidth/2,nodes in empty
     cells,column sep=-\pgflinewidth,row sep=-\pgflinewidth,    
     cells={nodes={draw,sharp corners,minimum size=2em,anchor=center}}]
    { |[n]| &  & A & B & C & D & E &  & |[n]|\\
      &  & |[n]| & |[n]| & |[n]| & |[n]| & |[n]| & |[fill=red]| &   \\
     |[fill=blue!40]| \textbullet &  & |[n]| & |[n]| & |[n]| \makebox[0pt][c]{XXX} & |[n]| & |[n]| &  &   \\
      &  & |[n]| & |[n]| & |[n]| & |[n]| & |[n]| &  & \textbullet  \\
      |[n]| &  & 1 & 2 & 3 & 4 & 5 &  & |[n]|\\
     };      
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

具有(≥ 6.18)。您需要进行多次编译,因为{NiceTabular}在后台使用了 PGF/Tikz 节点。nicematrixnicematrix

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\renewcommand{\arraystretch}{1.8}
\begin{NiceTabular}
  [hvlines,rounded-corners,colortbl-like,columns-width=4mm]
  {ccccccccc}
& & A & B & C & D & E \\
& & \Block{3-5}{xxx} & & & & & \cellcolor{red} \\
\Block[v-center,fill=blue!50]{}{\textbullet} \\
& & & & & & & & \Block[v-center]{}{\textbullet} \\
& & 1 & 2 & 3 & 4 & 5 \\
\end{NiceTabular}

\end{document}

上述代码的输出

相关内容