[Tex/LaTex] Scan a cell of a table with lines


Is there any way in latex to scan a cell of a table with horizontal, vertical, diogonal with lines?

I want similar thing as in below figure.



Best Answer

Something like this. matrix of nodes is used where a table style is defined then each node can have its own pattern given with coloring capability. A special pattern called mixed is defined as a macro taking two cell-position arguments

enter image description here


  matrix of nodes,
  row sep=-\pgflinewidth,
  column sep=-\pgflinewidth,
  nodes={draw,rectangle,text width=2cm,align=center},
  text depth=1.5ex,
  text height=4.5ex,
  nodes in empty cells

\foreach \i in {1,2,...,11}
\draw[] ([xshift=\i mm]mat-#1-#2.south west) -- ([xshift=\i mm]mat-#1-#2.north west);
\fill[pattern=horizontal lines]([xshift=11 mm]mat-#1-#2.south west)-- (mat-#1-#2.north east)--(mat-#1-#2.south east);
\fill[pattern=north east lines]([xshift=11 mm]mat-#1-#2.south west)-- (mat-#1-#2.north east) -- ([xshift=11 mm]mat-#1-#2.north west);


% the matrix entries
\matrix (mat) [table]
 \node[pattern=fivepointed stars,pattern color=green,]{};  &   & 
 \node[pattern=crosshatch dots,pattern color=red]{};       &  &  \\
   &   \node[pattern=dots,pattern color=blue]{};           &  &
  \node[pattern=north west lines,pattern color=red]{};  &        \\
   &   &\node[pattern=north east lines,pattern color=brown]{};  &  
      \node[pattern=horizontal lines]{}; &                       \\
   & \node[pattern=bricks,pattern color=red]{};  &  &
      \node[pattern=vertical lines,pattern color=red]{}; 
   &                                                             \\

Related Question