I would like to create a gray cmidrule a la booktabs. I have created a gray midrule gmidrule (extends entire table width) with different tighter space via
\newcommand{\gmidrule{\arrayrulecolor{lightgray}\specialrule{\lightrulewidth}{0.4\aboverulesep}{0.6\belowrulesep}\arrayrulecolor{black}}
Now, I would like to apply a light gray color, and identical separation as shown above, for a cmidrule (partial rule), and call this variation gcmidrule.
First issue is that the cmidrules are staggered. I would like to resolve this, but also adust the above and below rule sep.
\documentclass{article}
\usepackage{xparse}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\newcommand{\gmidrule}{\arrayrulecolor{lightgray}\specialrule{\lightrulewidth}{0.4\aboverulesep}{0.6\belowrulesep}\arrayrulecolor{black}}
\NewExpandableDocumentCommand{\gcmidrule}{ O{} D(){} m }{%
%% I would like to reduce the distance here as well, but the midrules are staggered
\arrayrulecolor{lightgray}%
\cmidrule{#3}%
% \cmidrule#1{#3}% supposed to be like this, but causes error. I'll worry about this later
\arrayrulecolor{black}%
}
\begin{document}
\begin{tabular}{lllll}\toprule
a & b & c & d & e \\\gmidrule
a & b & c & d & e \\\gcmidrule{1-2}\gcmidrule{4-5} % notice the stagger
a & b & c & d & e \\\bottomrule
\end{tabular}
\end{document}
Update:
This question is slightly helpful in that it helps align the cmidrules, however it does not adjust the above and below sep: How to omit vertical realignment when using cmidrule in different colors?
%% added this
% Correct for \cmidrule colour adjustment/vertical skip
\newcommand{\corcmidrule}[1][0pt]{% \corcmidrule[<len>]
\\[\dimexpr-\normalbaselineskip-\belowrulesep-\aboverulesep-#1\relax]%
}
%% add this in gcmidrule
\corcmidrule%
Still staggered, and adjusting the [0pt] still leaves staggered.


