Cell not completely colored

As some other people over here, I have some troubles having the cells of my table colored properly. I read many threads about this on the forum, but all problems I could find were related to the combination of \makecell and \colortbl.

In my case, I am not using \makecell at this place (I have use the package on other places so I have it loaded) and still have the same problem. But as I am not using this command, the given solutions do not work for me.

The problem is the white gap in the cell with letter "A"

My MWE:

\documentclass[11 pt, a4paper, oneside, openany]{book}

\usepackage[table, svgnames]{xcolor}
\usepackage{array}
\usepackage{multirow}
\usepackage{makecell}

\begin{table}[H]
\centering
\caption{Risico-inschatting en -analyse}
\label{tabelRisico-inschatting}
\begin{tabular}{|>{\columncolor{LightSteelBlue}\arraybackslash}c|>{\centering\arraybackslash}m{0.5cm}|>{\centering\arraybackslash}m{0.5cm}|>{\centering\arraybackslash}m{0.5cm}|>{\centering\arraybackslash}m{0.5cm}|>{\columncolor{LightSteelBlue}\arraybackslash}c|l|}
\hline
\rowcolor{SteelBlue}&\multicolumn{4}{|c|}{\textbf{Risico-inschatting}}&&\\
\cline{2-5}
\cellcolor{SteelBlue}\multirow{-2}{1.3cm}{\centering\textbf{Risico- Nr.}} & \cellcolor{SteelBlue}\textbf{S} & \cellcolor{SteelBlue}\textbf{F} & \cellcolor{SteelBlue}\textbf{O} & \cellcolor{SteelBlue}\textbf{A} & \cellcolor{SteelBlue}\multirow{-2}{1.3cm}{\centering\textbf{Risico- index}} & \cellcolor{SteelBlue}\multirow{-2}{6cm}{\textbf{Risico-evaluatie}}\\
\hline
1&2&2&3&1&5&Zeer ernstig gevaar. Vereist ontwerpmaatregel.\\
\hline
\end{tabular}
\end{table}


Could someone please help me get rid of this white gap? Thanks a lot

• you have forced the width of the SFOA columns but the Risico-inschatting heading is wider than that by the amount shown in white – David Carlisle Sep 30 '19 at 10:33

With your code I can't reproduce table as you show in the question. After clean-up your code, corrected a widths of multirow cells and considering @DavidCarlisle comment, I got:

(red lines indicate page layout). As you can see, your table is much wider the text width.

\documentclass[11 pt, a4paper, oneside, openany]{book}

\usepackage[table, svgnames]{xcolor}
\usepackage{multirow, makecell}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{table}[ht]
\centering
\caption{Risico-inschatting en -analyse}
\label{tabelRisico-inschatting}
\begin{tabular}{|>{\columncolor{LightSteelBlue}\centering}p{11mm}|
*{4}{>{\centering\arraybackslash}m{0.55cm}|}
>{\columncolor{LightSteelBlue}\centering}p{14mm}|
l|}
\hline
\rowcolor{SteelBlue}
& \multicolumn{4}{|c|}{\textbf{Risico-inschatting}} &   &   \\
\cline{2-5}
\rowcolor{SteelBlue}
\multirow{-2}{=}{\centering\textbf{Risico Num.}}
& \textbf{S}    & \textbf{F}    & \textbf{O}    & \textbf{A}
& \multirow{-2}{=}{\centering\textbf{Risico- index}}
& \multirow{-2}{*}{\textbf{Risico-evaluatie}}\\
\hline
1 & 2 & 2 & 3 & 1 & 5 & Zeer ernstig gevaar. Vereist ontwerpmaatregel.\\
\hline
\end{tabular}
\end{table}
\end{document}


You should ensure that the last column is a p type. For example, column specification defined as:

    \begin{tabular}{|>{\columncolor{LightSteelBlue}\centering}p{11mm}|
*{4}{>{\centering\arraybackslash}m{5.4mm}|}
>{\columncolor{LightSteelBlue}\centering}p{14mm}|
>{\raggedright\arraybackslash}p{\dimexpr\linewidth-11mm%
-5.4mm-5.4mm-5.4mm-5.4mm-14mm
-14\tabcolsep-9\arrayrulewidth}|
}


than table will looks as follows:

Note, with background colour in tables, you are faced with pdf-viewer artefacts. Not all rules will be visible, unless you zoom in to 200 to 300 per cent!

You may of course use cals to typeset this table. Then you avoid the PDF-viewer artefact, where rules disappears under the cell colouring. I added the package caption to have nice caption spacing, and also decreased the margins using geometry. In addition, I reduce the fontsize two grades.

In my opinion, it is better to remove all rules except the horizontal rule under Risico-inchatting when you are colourising the background of the cells.

\documentclass[11 pt, a4paper, oneside, openany]{book}
\usepackage{cals, url, caption}
\usepackage{geometry}
\usepackage[svgnames]{xcolor}
\RequirePackage[T1]{fontenc}

\let\nc=\nullcell                                                  % Shortcuts
\let\sc=\spancontent

\begin{document}

\begin{table}
\caption{Risico-inschatting en -analyse\label{tabelRisico-inschatting}}

\begin{calstable}[c]

% Defining columns relative to each other and relative to the margins
\colwidths{{\dimexpr(\columnwidth)/32*4\relax}
{\dimexpr(\columnwidth)/32*2\relax}
{\dimexpr(\columnwidth)/32*2\relax}
{\dimexpr(\columnwidth)/32*2\relax}
{\dimexpr(\columnwidth)/32*2\relax}
{\dimexpr(\columnwidth)/32*4\relax}
{\dimexpr(\columnwidth)/32*16\relax}
}
% The tabular fills the text area if sum of all columns is 6

% Set up the tabular
\makeatletter
\def\cals@framers@width{0.4pt}   % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0.4pt}
\def\cals@bgcolor{}
\def\cals@AtBeginCell{\vfil}

\def\blue{\ifx\cals@bgcolor\empty     % "Switch" to turn on and off colour
\def\cals@bgcolor{SteelBlue}
\else \def\cals@bgcolor{} \fi}
\def\lblue{\ifx\cals@bgcolor\empty     % "Switch" to turn on and off colour
\def\cals@bgcolor{LightSteelBlue}
\else \def\cals@bgcolor{} \fi}

% R1H1
\brow
\blue\nc{lrt}
\nc{ltb}
\nc{tb}
\nc{tb}
\nc{rtb}\alignC\sc{Risico-inschatting}
\nc{lrt}
\nc{lrt}
\erow
%R2H2
\brow
\nc{lrb}\alignC\sc{\vfill Risico- Nr.}
\cell{S}
\cell{F}
\cell{O}
\cell{A}
\nc{lrb}\alignC\sc{\vfill Risico- index}
\nc{lrb}\alignL\sc{\vfill Risico-evaluatie}\blue
\erow
\mdseries}
\tfoot{\lastrule\strut}
%R4B1
\brow
\lblue\alignC\cell{1}\lblue
\cell{2}
\cell{2}
\cell{3}
\cell{1}
\lblue\cell{5}\lblue
\alignL\cell{Zeer ernstig gevaar. Vereist ontwerpmaatregel.}
\erow
\makeatletter
\end{calstable}
\end{table}

\end{document}

• Thank you for editing my answer! Regarding to bad visible lines in colored tables I wait on your solution with cals package :-) . +1! – Zarko Sep 30 '19 at 15:27
• @Zarko Thank you! – Sveinung Sep 30 '19 at 15:43