如何删除表格中的几个条目?

如何删除表格中的几个条目?

我想创建一个类似于下面显示的表格。我知道如何使用表格环境创建表格,但我不知道

  1. 如何放置这些红色水平线以消除此表中的几个条目。
  2. 如何将这些行与表格分组,以便当表格大小需要调整时,行也会自动调整。

在此处输入图片描述

答案1

因为你似乎想要有阴影,所以在 Ti 中绘制整个东西可能会更容易Z。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc,matrix,shadows.blur,decorations.pathreplacing}
\tikzset{shadowed/.style={decorate,decoration={
show path construction,
lineto code={
\draw[#1!50!gray,opacity=0.5] ([xshift=0.5ex,yshift=-0.25ex]\tikzinputsegmentfirst) -- ([xshift=0.5ex,yshift=-0.25ex]\tikzinputsegmentlast);
\draw[#1] (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
}}}}
\begin{document}
\begin{tikzpicture}[buffy/.style={circle,draw,inner sep=3pt,fill=#1,blur shadow}]
\matrix[matrix of nodes,nodes={align=center,anchor=center},row sep=4pt] (mat)
 {  $x_1$ & $x_2$ & $x_3$\\
   |[buffy=blue]| & |[buffy=blue]| & |[buffy=blue]|\\
   |[buffy=blue]| & |[buffy=blue]| & |[buffy=gray]|\\
   |[buffy=blue]| & |[buffy=gray]| & |[buffy=blue]|\\
   |[buffy=blue]| & |[buffy=gray]| & |[buffy=gray]|\\     
   |[buffy=gray]| & |[buffy=blue]| & |[buffy=blue]|\\   
   |[buffy=gray]| & |[buffy=blue]| & |[buffy=gray]|\\   
   |[buffy=gray]| & |[buffy=gray]| & |[buffy=blue]|\\   
   |[buffy=gray]| & |[buffy=gray]| & |[buffy=gray]|\\
    };
\path ($(mat-1-1.north east)!0.5!(mat-1-2.north west)$) coordinate (auxL)
 ($(mat-1-2.north east)!0.5!(mat-1-3.north west)$) coordinate (auxR)
 ($(mat-1-1.south west)!0.5!(mat-2-1.north west)$) coordinate (auxT);
\draw[shadowed=black] (auxL |- mat.north) -- (auxL |- mat.south)
(auxR |- mat.north) -- (auxR |- mat.south)
(auxT -| mat.west) -- (auxT -| mat.east);
\begin{scope}[thick]
\foreach \X in {5,7,8,9}
{\draw[shadowed=red] (mat-\X-1.center -| mat.west) -- (mat-\X-3.center -| mat.east);}
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容