3

The following example works as expected:

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{makecell, multirow}
    \renewcommand\theadfont{\normalsize\bfseries\color{white}}
    \renewcommand{\theadgape}{}
\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}
\multicolumn{2}{c|}{\thead{AAA -- BBBB}}    &                                   \\
    \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}

Enter image description here

But the following not:

\documentclass[xcolor=table]{beamer}
\usepackage{makecell, multirow}
    \renewcommand\theadfont{\normalsize\bfseries\color{white}}
    \renewcommand{\theadgape}{}
\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}
\multicolumn{2}{c|}{\thead{AAA -- BBBB}}    &                                   \\
    \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}

Enter image description here

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

6

enter image description here

as samcarter commented

\documentclass[xcolor=table]{beamer}
\usepackage{makecell, multirow}
    \renewcommand\theadfont{\normalsize\bfseries\color{white}}
    \renewcommand{\theadgape}{}
\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}
\multicolumn{2}{c|}{\thead{AAA -- BBBB}}    &                                   \\
    \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
  • 1
    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
  • 1
    @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
3

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

\documentclass[xcolor=table]{beamer}
\usepackage{makecell, multirow}
\usepackage{booktabs}
\renewcommand\theadfont{\normalsize\bfseries\color{white}}
\renewcommand{\theadgape}{}

\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}
    \multicolumn{2}{c|}{\thead{AAA -- BBBB}} & \\
    \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} 

enter image description here

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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