3

Can you help me with creating this type of table in Latex ?

enter image description here

Thank you

2
  • 2
    Welcome to TEX.SE! What you tray so far? It seems, that is simpler draw image than table.
    – Zarko
    Feb 15, 2020 at 11:58
  • What is the use of this table ?
    – projetmbc
    Feb 15, 2020 at 13:38

3 Answers 3

3

Just for fun in my free time. I hope OP would provide a MME in the next question (if any) ^^ enter image description here

\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}
1

I would just use a matrix. As long as you do not draw the nodes at the corners, you will respect the rounded corners of the matrix node. For your convenience I added a shortcut n which suppresses the draw.

\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}

enter image description here

Or

\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}

enter image description here

0

With {NiceTabular} of nicematrix (≥ 6.18). You need several compilations because nicematrix uses PGF/Tikz nodes under the hood.

\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}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .