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

Example Table

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.



%%%%%% Set up the coloured tables %%%%%
\colorlet{tableheadcolor}{gray!25} % Table header colour = 25% gray
\colorlet{tablerowcolor}{gray!10} % Table row separator colour = 10% gray

% The top-most line of a table

% The line between the headings and the table body

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

\headcol      & A & B\\ \cmidrule{2-3}
\headcol Blue & Red & Yellow\\ \midline
1 & 2 & 3 \\ \bottomrule 


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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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

\headcol      & A & B\\
 \arrayrulecolor{tableheadcolor} \specialrule{6pt}{0pt}{-6pt} \arrayrulecolor{black}
 \headcol Blue & Red & Yellow\\
1 & 2 & 3 \\
  • Instead of 6pt use \newlength{\clinegapskip} \setlength{\clinegapskip}{3\cmidrulesep} \addtolength{\clinegapskip}{\cmidrulewidth} -- but I agree that the answer proposed as a duplicate is not the correct answer to this question (the linked answer applies only to colored columns not rows where the calculation is totally different) – Aubrey Blumsohn May 30 at 12:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.