I have a table which I want to fill with multiple colors, each cell possibly different from another. Which means, I can't make use of e.g. \columncolor
(as in this post).
While the table without any colors looks just fine (code at the end):
…the table with one or more filled cells overwrites the table grid.
So my question is: Is there a way to, for example, redraw the grid after filling the cells or something?
EDIT: added complete code instead of code fragments
Relevant LaTeX code:
\documentclass[11pt]{article}
\usepackage{color}
\usepackage{colortbl}
\usepackage{multirow}
\newlength{\Oldarrayrulewidth}
% Cline redefining to add line thickness
\newcommand{\Cline}[2]{%
\noalign{\global\setlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
\noalign{\global\setlength{\arrayrulewidth}{\Oldarrayrulewidth}}
}
\definecolor{intnull}{RGB}{213,229,255}
\definecolor{inteins}{RGB}{128,179,255}
\definecolor{intzwei}{RGB}{42,127,255}
\definecolor{intdrei}{RGB}{0,85,212}
\definecolor{intvier}{RGB}{0,51,128}
\definecolor{intfunf}{RGB}{0,34,85}
\begin{document}
% Empty table
\begin{tabular}{*{5}{!{\vrule width 1.5pt}p{1.5cm}}!{\vrule width 1.5pt}l}
\centering 4 &
\centering 10 &
\centering 24 &
\centering 48 &
\centering 72 &\\ \Cline{1.5pt}{0-4}
& & & & & Optic tectum \\ \Cline{1.5pt}{3-5}
& & & & & Retina \\ \Cline{1.5pt}{3-5}
& & & & & Myomeres \\ \Cline{1.5pt}{0-4}
& & & & & Arches \\ \Cline{1.5pt}{0-4}
\end{tabular} \\
\hspace*{1cm}
% Partically filled table
\begin{tabular}{*{5}{!{\vrule width 1.5pt}p{1.5cm}}!{\vrule width 1.5pt}l}
\centering 4 &
\centering 10 &
\centering 24 &
\centering 48 &
\centering 72 &\\ \Cline{1.5pt}{0-4}
& \cellcolor{intnull} & & \cellcolor{intvier} & & Optic tectum \\ \Cline{1.5pt}{3-5}
& \cellcolor{intnull} & & \cellcolor{intnull} & & Retina \\ \Cline{1.5pt}{3-5}
& \cellcolor{intnull} & & \cellcolor{intdrei} & & Myomeres \\ \Cline{1.5pt}{0-4}
& \cellcolor{inteins} & & \cellcolor{inteins} & & Arches \\ \Cline{1.5pt}{0-4}
\end{tabular}
\end{document}
Best Answer
Please don't just post fragments of code that can not be run, always post complete small documents.
The fix should be exactly as in the other question. As documented
colortbl
is incompatible with\cline
, you need to use\hhline
instead. The fact that the cell backgrounds are different colours is irrelevant to the problem of\cline
including negative spacing so that it comes under the colour.