# Combining \rowcolor and \cmidrule [duplicate]

I want to shade the heading of my table. It all worked fine until I started using \cmidrule. This is my output:

Is there a way to shade the white space between the first and second row?

The code below redefines the toprule and midrule commands to account for the heading's shading.

\documentclass{article}

\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{colortbl}

%%%%%% Set up the coloured tables %%%%%
\colorlet{tablerowcolor}{gray!10} % Table row separator colour = 10% gray
\newcommand{\rowcol}{\rowcolor{tablerowcolor}}

% The top-most line of a table
\newcommand{\topline}{\arrayrulecolor{black}\specialrule{0.1em}{\abovetopsep}{0pt}%
\arrayrulecolor{black}}

% The line between the headings and the table body
\arrayrulecolor{black}\specialrule{\lightrulewidth}{0pt}{0pt}%
\arrayrulecolor{white}\specialrule{\belowrulesep}{0pt}{0pt}%
\arrayrulecolor{black}}

%%%%%END: Set up the coloured tables %%%%%

\begin{document}
\begin{tabular}{ccc}
\topline
\headcol      & A & B\\ \cmidrule{2-3}
\headcol Blue & Red & Yellow\\ \midline
1 & 2 & 3 \\ \bottomrule
\end{tabular}

\end{document}


## marked as duplicate by Werner, karlkoeller, Jesse, OSjerick, lockstepJan 23 '14 at 6:54

• – Werner Jan 23 '14 at 4:24
• If it solved the problem, we could close this one as a duplicate. – Werner Jan 23 '14 at 4:41
• See comment below answer - this is not a duplicate – Aubrey Blumsohn May 30 at 12:22

The white space can be filled in using the \specialrule{<wd>}{<abovespace>}{<belowspace>} command. The modified table:

\begin{tabular}{ccc}
\topline