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?

  • maybe related: chat.stackexchange.com/transcript/41?m=41452490#41452490 ??? – user36296 Dec 6 '17 at 14:37
  • @samcarter, yes, it seems that my question is related to the same problem. means, that i (we) should wait on fix in beamer. hopefully this will happen soon :-). btw, my question is based on one one similar question where i try to help, but i was surprised that solution done for article doesn't work in beamer. – Zarko Dec 6 '17 at 15:35
  • related bug report: github.com/josephwright/beamer/issues/434 – user36296 Dec 8 '17 at 9:23
  • @samcarter, please see my answer on similar question tex.stackexchange.com/questions/404661/…, in it i was faced with \hhline coloring problem (border of lines is still visible). so far i havent time to investigate, what is going on (is this only viewer artifact?). eventually i will ask new question about his. – Zarko Dec 8 '17 at 9:37
  • I put a comment there - my guess would be viewer artefact. – user36296 Dec 8 '17 at 9:45
5

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
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.