# \cline is in tables too thin (when using coloured cells)

I'm having an issue where \cline appears to be drawn under the fill for table colours.

### With \cline

(to remove the line above the cell I want blank)

The line is still there, only very very thin. This doesn't always display or print. Is there anything simple I can do to fix this?

Here's the source for my example:

\documentclass{article}

\usepackage[table]{xcolor}

%odd/eaven colours for tables
\rowcolors{2}{gray!10}{white}

%to change cells of the title row
\newcommand{\titlecol}{\cellcolor{gray!30}}

\begin{document}

\begin{table}[!ht]
\centering
\begin{tabular}{|l| c c | c c |}
\cline{2-5}
%\hline
\rowcolor{white} %first cell is excluded from the table
\multicolumn{1}{c|}{} & \multicolumn{2}{c|}{\titlecol Title1} & \multicolumn{2}{c|}{\titlecol Title2} \\
\hline
A & 0 & 1 & 2 & 3 \\
B & 0 & 1 & 2 & 3 \\
C & 0 & 1 & 2 & 3 \\
D & 0 & 1 & 2 & 3 \\
\hline
\end{tabular}
\caption{Caption.}
\label{mytable}
\end{table}

\end{document}

• What happens if you type \ \cline{2-5}? – Willem Van Onsem Feb 27 '14 at 22:46
• @CommuSoft I get an error: Misplaced \omit. \@cline #1-#2\@nil ->\omit – jozxyqk Feb 27 '14 at 22:48
• please read the colortbl documentation. cline is explicitly not supported. Use hhline instead. – David Carlisle Feb 27 '14 at 23:02

I found out the following: the line is not too thin, it is simply overwritten by the filled cells. Some pdf readers notice the small difference in y-value and paint the line, others don't.

A similar question has been asked here:

\cline doesn't work

I propose you solve this problem with one of the proposed methods as listed in the extended answer on this question.

There's also this, now I know what to search for: Colored tables and cline/hhline

This is what I ended up with (using \hhline{~|--|--|}):

I've only looked briefly, but it looks like this is what the characters in hline do:

• ~ no line for one cell
• | the corner between horizontal and vertical lines, although I'm not sure if I needed the middle one
• - the line for a cell

See the docs

\documentclass{article}

\usepackage[table]{xcolor}
\usepackage{hhline}

%odd/eaven colours for tables
\rowcolors{2}{gray!10}{white}

\newcommand{\titlecol}{\cellcolor{gray!30}}

\begin{document}

\begin{table}[!ht]
\centering
\begin{tabular}{|l| c c | c c |}
\hhline{~|*4{-}|}
%\cline{2-5}
%\hline
\rowcolor{white}
\multicolumn{1}{c|}{} & \multicolumn{2}{c|}{\titlecol Title1} & \multicolumn{2}{c|}{\titlecol Title2} \\
\hline
A & 0 & 1 & 2 & 3 \\
B & 0 & 1 & 2 & 3 \\
C & 0 & 1 & 2 & 3 \\
D & 0 & 1 & 2 & 3 \\
\hline
\end{tabular}
\caption{Caption.}
\label{mytable}
\end{table}

\end{document}