I want to create a table similar to one shown below. I know how to create a table using tabular environment but I don't know

  1. how to put these red horizontal lines that eliminate few of the entries in this table.
  2. how to group these lines with table so that incase size of table needs some adjustment, the lines also get adjusted automatically.

enter image description here

  • The \usepackage{soul} provides a way for striking out the sentences in latex. Go through with it for more details. – Mishra S May 10 '16 at 4:02
  • @Siba Mishra: Will it work through a table row? – Bernard May 10 '16 at 8:55
  • Could you post the code of what you've done so far? – Bernard May 10 '16 at 8:56
  • @Bernard you are right. I have heard about soul. But after writing the code, it's not perfectly working for a table. For striking out, every time, you have to use \st{} for each table cell. I am thinking how to define a macro for the same. – Mishra S May 10 '16 at 10:30
  • 1
    This post was very helpful: tex.stackexchange.com/questions/231880/… – celia Oct 11 '16 at 3:45

Since you seem to want to have shadows, it might be easier to draw the whole thing in TikZ.

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{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);
\foreach \X in {5,7,8,9}
{\draw[shadowed=red] (mat-\X-1.center -| mat.west) -- (mat-\X-3.center -| mat.east);}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.