# Strange disappearing colored rules in beamer

I have received a booktabs bug report of \cmidrules that disappear when coloured rules are used inside beamer (together with colortbl). The problem can be illustrated with the following simple code and looks like an interaction between the beamer colour setup and \leaders. In the normal Latex classes the code is fine.

I know to little about the inner workings of beamer and hope there is someone here who can help or that can give a workaround. Note that the colour need to be grouped inside booktabs to prevent leaking.

EDIT: In an e-mail Michael Palmer suggested the addition of a \kern at the end of the grouping. This seems to work but the question is WHY?

Note: The standard tabular \cline also disappears inside beamer when the line color is set with the \arrayrulecolor of the colortbl package. So this is now also David Carlisle's problem :-)

Beamer class

\documentclass{beamer}

\begin{document}
\begin{frame}
INSIDE BEAMER CLASS\par\smallskip
\tfillA{2cm}{A}{B}: Works fine without colour\par
\tfillB{2cm}{A}{B}: Works fine with ungrouped colour\par
\tfillC{2cm}{A}{B}: Rule disappears with grouped colour\par
\tfillD{2cm}{A}{B}: Rule reappears with kern at end ?????
\end{frame}
\end{document}

Article class

\documentclass{article}
\usepackage{xcolor}

\begin{document}
INSIDE ARTICLE CLASS\par\smallskip
\tfillA{2cm}{A}{B}: Works fine without colour\par
\tfillB{2cm}{A}{B}: Works fine with colour  everywhere\par
\tfillC{2cm}{A}{B}: Works fine with grouped colour
\end{document}

-
this also works: \makebox[#1]{#2{\color{red}\hrulefill}#3} I suppose a problem with \leaders –  Herbert Feb 20 at 15:05
@Herbert: The problem is that the \cmidrule in booktabs (and the standard \cline) uses \leaders internally. The colortbl package has the same problem inside beamer –  Danie Els Feb 20 at 15:14
the definition of \hrulefill also uses the \kern\z@. I have no idea why it is important for beamer. –  Herbert Feb 20 at 15:22
\null also works. –  bloodworks Feb 20 at 15:29
a \kern after \leaders is usually to protect it from \unskip As for the note I might look but colortbl documentation says not to use \cline so any behaviour is user error. –  David Carlisle Feb 20 at 21:10
show 1 more comment