1

I am having trouble coloring table cells. In the MWE below the color leaves white space at the right. Thinking that this may be due to internal length calculations I explicitly set the lenghts of multicolumns, taking into account tabcolsep values but the problem persists

\documentclass{article}
\usepackage{colortbl}
\usepackage{multirow}
\newcolumntype{C}[1]{>{\tiny\raggedright\arraybackslash}m{#1}}
\setlength{\tabcolsep}{0.200cm}
\begin{document}
\begin{tabular} { | C{4.500cm} |  C{4.334cm} | C{0.954cm} | C{0.954cm} | C{0.954cm} | C{0.954cm} |}\hline
\multicolumn{6}{|p{14.65cm}|}{\centering\cellcolor{blue}\textcolor{yellow}{\bfseries\footnotesize REQUIREMENTS}}\\\hline
%
\cellcolor{blue}&
\cellcolor{blue}&
\multicolumn{4}{p{5.016cm}|}{\centering\tiny\cellcolor{blue}\textcolor{yellow}{EDUCATION}} \\\cline{2-6}
%
\multicolumn{1}{|p{4.500cm}|}{\centering\multirow{-2}{*}{\tiny\cellcolor{blue}\textcolor{yellow}{AREA}}}&
\multicolumn{1}{p{4.334cm}|}{\centering\multirow{-2}{*}{\tiny\cellcolor{blue}\textcolor{yellow}{PROFILE}}}&
\centering\cellcolor{blue}\textcolor{yellow}{U}&
 \centering\cellcolor{blue}\textcolor{yellow}{P}& 
 \centering\cellcolor{blue}\textcolor{yellow}{I}& 
 \centering\arraybackslash\cellcolor{blue}\textcolor{yellow}{M} \\
%
\end{tabular}
\end{document}

1 Answer 1

1

You simply forgot to take into account the column separating spaces. The problem is solved with replacing the multicolumn specifier to c since you want a centred contents. I simplified your code, , systematically using the \rowcolor command, changed the colour to have more visible lines and used \hhline in the place of \cline. This being said, I'm unsure of the final result you're aiming at.

\documentclass{article}
\usepackage[table]{xcolor} 
\usepackage{hhline}
\usepackage{multirow}
\newcolumntype{C}[1]{>{\tiny\raggedright\arraybackslash}m{#1}}
\setlength{\tabcolsep}{0.200cm}

\begin{document}

\colorlet{blue} {cyan!40}

\begin{tabular} { | C{4.500cm} | C{4.334cm} | C{0.954cm} | C{0.954cm} | C{0.954cm} | C{0.954cm} |}\hline
\rowcolor{blue}\multicolumn{6}{|c|}{\textcolor{yellow}{\bfseries\footnotesize REQUIREMENTS}}\\\hline
% %p{14.65cm}
\rowcolor{blue}& &
\multicolumn{4}{c|}{\tiny\textcolor{yellow}{EDUCATION}} \\\hhline{|>{\arrayrulecolor{blue}}->{\arrayrulecolor{black}}|-----|}
\rowcolor{blue}%
\multirow{-2}{=}{\centering\tiny\textcolor{yellow}{AREA}}&
\multirow{-2}{=}{\centering\tiny\textcolor{yellow}{PROFILE}}&
\centering\textcolor{yellow}{U}&
 \centering\textcolor{yellow}{P}&
 \centering\textcolor{yellow}{I}&
 \centering\arraybackslash\textcolor{yellow}{M} \\%
 \end{tabular}

\end{document}

enter image description here

1
  • Thanks a lot Bernard, I have had this problem for a long time and tried several options. I think that I had taken into account the colsep, my calculation for the first multicolumn was 12.65 cm plus 0.2cm x 10 = 14.65 cm, this plus the two separations (0.2 cm x 2) of the single multicolumn gives 15.05 cm which is the width of the table
    – Richard
    Feb 27, 2020 at 18:41

You must log in to answer this question.

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