# Are beamer, hhline, and [table]{xcolor} incompatible?

The following example works as expected:

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{makecell, multirow}
\usepackage{hhline}

\begin{document}
\centering
\setlength\arrayrulewidth{2pt}
\arrayrulecolor{yellow}
\def\clinecolor{\hhline{>{\arrayrulecolor{yellow}}--%
>{\arrayrulecolor{gray}}-}}
\setlength\extrarowheight{2pt}
\begin{tabular}{ c | c | c }%
\rowcolor{gray}
\clinecolor
\rowcolor{gray}
\color{white} AAA   &   \color{white} BBB   &   \multirow{-2}{*}{\thead{CCC}}   \\
\hhline{>{\arrayrulecolor{yellow}}-|-|-}
\rowcolor{gray!25}
aaa                 &   bbb                 &   ccc                             \\
\hline
\rowcolor{gray!25}
ddd             &   eee                 &   fff
\end{tabular}
\end{document}


But the following not:

\documentclass[xcolor=table]{beamer}
\usepackage{makecell, multirow}
\usepackage{hhline}

\begin{document}
\begin{frame}
\frametitle{test}
\centering
\setlength\arrayrulewidth{2pt}
\arrayrulecolor{yellow}
\def\clinecolor{\hhline{>{\arrayrulecolor{yellow}}--%
>{\arrayrulecolor{gray}}-}}
\setlength\extrarowheight{2pt}
\begin{tabular}{ c | c | c }%
\rowcolor{gray}
\clinecolor
\rowcolor{gray}
\color{white} AAA   &   \color{white} BBB   &   \multirow{-2}{*}{\thead{CCC}}   \\
\hhline{>{\arrayrulecolor{yellow}}-|-|-}
\rowcolor{gray!25}
aaa                 &   bbb                 &   ccc                             \\
\hline
\rowcolor{gray!25}
ddd             &   eee                 &   fff                             \\
\hhline{|-|-|-|}
\end{tabular}
\end{frame}
\end{document}


Why are the in beamer rules so strangely misplaced? Is there some workaround?

as samcarter commented

\documentclass[xcolor=table]{beamer}
\usepackage{makecell, multirow}
\usepackage{hhline}
\makeatletter
\let\zz\reset@color
\def\reset@color{\kern\z@\zz}
\makeatother

\begin{document}
\begin{frame}
\frametitle{test}
\centering
\setlength\arrayrulewidth{2pt}
\arrayrulecolor{yellow}
\def\clinecolor{\hhline{>{\arrayrulecolor{yellow}}--%
>{\arrayrulecolor{gray}}-}}
\setlength\extrarowheight{2pt}
\begin{tabular}{ c | c | c }%
\rowcolor{gray}
\clinecolor
\rowcolor{gray}
\color{white} AAA   &   \color{white} BBB   &   \multirow{-2}{*}{\thead{CCC}}   \\
\hhline{>{\arrayrulecolor{yellow}}-|-|-}
\rowcolor{gray!25}
aaa                 &   bbb                 &   ccc                             \\
\hline
\rowcolor{gray!25}
ddd             &   eee                 &   fff                             \\
\hhline{|-|-|-|}
\end{tabular}
\end{frame}
\end{document}

• thank you very much! i'm curious, which package should have this patch? beamer? can we expect that it will be incorporate in it soon? – Zarko Dec 6 '17 at 17:48
• that isn't actually the right patch (but it's Ok and easiest to do in the document) beamer will probably change not to mess with \reset@font but also i'll probably change hhline and colortbl to protect themselves from the \unskip that beamer is adding. but no promise on an update this side of christmas. @Zarko – David Carlisle Dec 6 '17 at 18:27
• thank you for explanation. it is not rush for this solution ... i only wondering, why use of rules from booktabs hasn't this problem (see Bernard answer). – Zarko Dec 6 '17 at 18:59
• @Zarko because they are rules (and rules don't get removed by \unskip) but colortbl and hhline make interesting (brilliantly ingenious:-) use of \leaders and leaders are removed by \unskip. – David Carlisle Dec 6 '17 at 19:22
• @DavidCarlisle As far as I can see, the problem still exists. Am I right? (I realize you didn't say which christmas :)) – Martin J. Osborne yesterday

Use booktabs instead – more precisely set \above/belowrulesep to 0pt and use \midrule:

\documentclass[xcolor=table]{beamer}
\usepackage{makecell, multirow}
\usepackage{booktabs}

\begin{document}

\begin{frame}
\frametitle{test}
\centering
\setlength\arrayrulewidth{2pt}
\setlength\extrarowheight{2pt}
\setlength\belowrulesep{0pt}\setlength\aboverulesep{0pt}
\setlength\lightrulewidth{2pt}
\arrayrulecolor{yellow}
\begin{tabular}{ c | c | c }%
\rowcolor{gray}
\midrule
\rowcolor{gray}
\color{white} AAA & \color{white} BBB & \multirow{-2}{*}{\thead{CCC}} \\
\midrule
\rowcolor{gray!25}
aaa & bbb & ccc \\
\midrule
\rowcolor{gray!25}
ddd & eee & fff \\
\end{tabular}
\end{frame}

\end{document}


• good to know, that booktabs rule interact with colortbl ([table]{xcolor}) very diferently than standard \hline or \hhline. – Zarko Dec 6 '17 at 17:50