4
\documentclass[border=20pt]{standalone}

\usepackage[thinlines]{easytable}
\usepackage[table]{xcolor}
\begin{document}

\huge
\begin{TAB}(e,2cm,2cm){|c:c:c:c:c|}{|c:c:c:c:c|}
 \cellcolor{black}1 & 2 & 3 & 4 & 5 \\
6 & 7 &   &   &   \\
  &   &   &   &   \\
  &   &   &   &   \\
  &   &   &   &     
\end{TAB}
\end{document}

Taken from A table with square cells

But the background color for \cellcolor{black}1 is not coming up.

1
  • 1
    The TAB environment is completely independent on tabular, so \cellcolor has nothing to hook at.
    – egreg
    Commented Jul 14 at 8:12

2 Answers 2

4

I suggest the newer tabularray package:

mwe

\documentclass[border=10pt]{standalone}
\usepackage{xcolor,tabularray}
\begin{document}
\begin{tblr}{
colspec ={|[gray] Q|[dashed] Q|[dashed] Q|[dashed] Q|[dashed] Q|[1pt]},
rowspec={|[gray]Q|[dotted]Q|[1.5pt]},
cell{1}{1} = {olive9,fg=red},}
1 & 2 & 3 & 4 & 5 \\
6 & 7 &   &   &   \\
\end{tblr}
\end{document}
4

For information, here is a way to create that table with {NiceTabular} of nicematrix.

All the style of rules provided by TikZ are available.

\documentclass[border=20pt]{standalone}
\usepackage{xcolor}
\usepackage{nicematrix,tikz}

\newcolumntype{I}{|[tikz=dashed]}
\newcommand{\DashedLine}{\Hline[tikz=dashed]}
  
\begin{document}

\huge
\begin{NiceTabular}{|>{\rule[-5mm]{0pt}{2cm}}cIcIcIcIc|}[columns-width=2cm,color-inside]
\Hline
 \cellcolor{black}1 & 2 & 3 & 4 & 5 \\
\DashedLine
6 & 7 \\
\DashedLine
\\
\DashedLine
\\
\DashedLine
\\
\Hline
\end{NiceTabular}

\end{document}

Output of the above code

2
  • Not working with TeXMaker/Windows.
    – Vinod
    Commented Jul 15 at 14:15
  • TexMaker is only a text editor specialized in LaTeX... Since you are under Windows, your TeX distribution is probably MiKTeX. In that case, I thinck you should update your LaTeX distribution by unsing the application "MiKTeX console". Commented Jul 15 at 14:26

You must log in to answer this question.

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