beamer icon indicating copy to clipboard operation
beamer copied to clipboard

beamer \unskip fun breaks colortbl

Open josephwright opened this issue 7 years ago • 7 comments

With example

\documentclass{beamer}

\usepackage{colortbl}
\usepackage{hhline}
\usepackage{etoolbox}

\begin{document}
\begin{tabular}{|c|c|}
	\hhline{>{\arrayrulecolor{blue}}->{\arrayrulecolor{black}}-}
	Cell 1&Cell 2\tabularnewline 
	\hhline{->{\arrayrulecolor{blue}}-}
\end{tabular}
\makeatletter
\patchcmd\HH@loop
  {\arrayrulewidth\hfil}% search
  {\arrayrulewidth\hfil\kern\z@}% replace
  {}% success
  {\errmessage{Patching \string\HH@loop\space failed}}% failure
\makeatother
\begin{tabular}{|c|c|}
	\hhline{>{\arrayrulecolor{blue}}->{\arrayrulecolor{black}}-}
	Cell 1&Cell 2\tabularnewline 
	\hhline{->{\arrayrulecolor{blue}}-}
\end{tabular}
\end{document}

The lines come out wrong: this is due to some \unskip oddness in beamerbasecolor.sty. Changing the code is easy ... question is why are those lines there!

josephwright avatar Nov 30 '17 15:11 josephwright

I suspect this was 'tidying up' some stray spaces in the code ...

josephwright avatar Nov 30 '17 15:11 josephwright

BTW, introduced in current form more-or-less in 81ab64f50af7f528c369bdd044efef5d752d7749.

josephwright avatar Nov 30 '17 16:11 josephwright

What's the exact usage of these hooks?

louisstuart96 avatar Dec 01 '17 04:12 louisstuart96

On 1 December 2017 at 03:35, Louis Stuart [email protected] wrote:

So this \unskip token swallows \hfil in \leaders?

leaders internally are a kind of "decorated glue node" and \unskip removes the entire leaders node.

davidcarlisle avatar Dec 01 '17 07:12 davidcarlisle

In case this gets resolved eventually, please comment on the related questions https://tex.stackexchange.com/questions/404872/are-beamer-hhline-and-tablexcolor-incompatible and https://tex.stackexchange.com/q/404661/36296

ghost avatar Dec 08 '17 09:12 ghost

\cline has a similar problem, see https://tex.stackexchange.com/q/159378

Example:

\documentclass{beamer}
\usepackage{colortbl}

\begin{document}
\arrayrulecolor{red}

\leavevmode\bigskip\par
Before patch\par
\begin{tabular}{ccc}
  \hline
  a & b & c \\ \cline{2-2}
  a & b & c \\ \hline
\end{tabular}

\makeatletter
% patch from https://tex.stackexchange.com/a/159383, by Heiko Oberdiek
\patchcmd\@cline
  {\arrayrulewidth\hfill}% search
  {\arrayrulewidth\hfill\kern\z@}% replace
  {}% success
  {\errmessage{Patching \string\@cline\space failed}}% failure
\makeatother

\leavevmode\bigskip\par
After patch\par
\begin{tabular}{ccc}
  \hline
  a & b & c \\ \cline{2-2}
  a & b & c \\ \hline
\end{tabular}
\end{document}

image

muzimuzhi avatar Mar 28 '20 04:03 muzimuzhi

I guess this is still open on my side

https://tex.stackexchange.com/questions/404872/are-beamer-hhline-and-tablexcolor-incompatible#comment1009168_404903

davidcarlisle avatar Mar 28 '20 14:03 davidcarlisle