4

I have a strange issue where my rowcolor command is overwriting the column separator in some PDF viewers. Acrobat (unfortunately) is the only one that has the rendering issue. The issue exists in both the rendered screen and printed version.

The Acrobat rendering follows:

Acrobat render

The rendering in TeXShop, MacOS Preview, and Ghostscript from a Postscript file is:

Other renders

With the other rendering engines, you can see that there seems to be a 1/2 line column separator, so I conceptually understand what is going on, but I do not know how to change my /rowcolor command to address the issue. I need to make sure that the /rowcolor command does not overwrite the table dividers, which are all 1pt.

\usepackage{booktabs,xcolor,siunitx,colortbl}
\definecolor{lightgray}{HTML}{EFEFEF}

\begin{tabular}{|c|c||c|c||c|c|}
\hline
48 & 72 & 24 & 3 & \(z_0\)& 36\\
\rowcolor{lightgray}
& 96 & & 4 & \(z_1\)& 36\\
\hline
\end{tabular}

To confirm the 1/2 width line issue, I threw in

\setlength{\arrayrulewidth}{1.5pt}

which made everything thicker so that the table rendered in Acrobat, but it really wasn't pleasant.

Any suggestions would be greatly appreciated.

7
+50

That's weird, and if we're lucky, David Carlisle of the colortbl package will stop by and clarify this. I'm not adept enough to go under the hood and fix the z-order of the rules vs fill color, which appears to be the root cause of the issue, but I have a dirty dirty hack that might be good enough for you:

A few notes: The block of TeX code (starting with \makeatletter) is this doublerulesep color fix, and will fill the space between the double vertical rules with the color you specify, and it allows different colors for each row.

I'm using the [table]{xcolor} option, because it supports rowcolors, which alternates row colors automatically.

To fix the irregular vertical separator issue, I just defined a color that's very near white, but isn't actually, to force all the rows to fill.

\usepackage[table]{xcolor}
\usepackage{booktabs,siunitx}

\makeatletter
\let\old@mkpream\@mkpream
\def\@mkpream{%
\ifx\CT@drsc@\relax\else\let\CT@drsc@ @\fi
\let\CT@arc@\relax
\old@mkpream}
\makeatother

\begin{document}

\definecolor{lightgray}{HTML}{EFEFEF}
\definecolor{nearwhite}{HTML}{FEFEFE}

\doublerulesepcolor{nearwhite}
\rowcolors{1}{nearwhite}{lightgray}
\begin{tabular}{|c|c||c|c||c|c|}
\hline
48 & 72 & 24 & 3 & \(z_0\)& 36\\
\doublerulesepcolor{lightgray}
& 96 & & 4 & \(z_1\)& 36\\
\hline
\end{tabular}
  • That worked great! Thank you for the detailed answer. I regret to say that I only know as much LaTeX as I must, so I have a really difficult time fighting through to an answer. I will commit those fixes to memory for the future. – b degnan Mar 29 '16 at 20:48

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.