# colortbl stepping on midrules in booktabs

I'm using booktabs and colortbl. I'm get a very annoying problem of the color table overlapping a horizontal rule. Maybe pixel snapping problem or something, but I can't make it go away. And I appreciate that rules and color in the same table are typographically suspect, but let's please pretend otherwise for a moment.

Here's my MWE:

\documentclass{article}

\usepackage[table]{xcolor}
\usepackage{tabulary}
\usepackage{booktabs}

\begin{document}
\begin{center}

\newcolumntype{G}{>{\columncolor{gray!15}[0.9\tabcolsep]}C}
\newcommand{\mythickrule}{\specialrule{1em}{0em}{0em}}
\newcommand{\whiterow}{\rowcolor{white}[0.9\tabcolsep]}

\begin{table}
\begin{tabulary}{\linewidth}{LG} \mythickrule
\whiterow foo            & stuff \\ \mythickrule
bar                      & stuff \\ \mythickrule
\end{tabulary}
\end{table}
\end{center}
\end{document}


Here's out it looks for me. Notice the little nubs and cutouts. How do I clean this up so colors and rules are flush?

Coloring columns in a table with colortbl and booktabs

-

The nubs are mainly due to the 0.9\tabcolsep rather than covering all of it, the other change I made is to put a white rule behind the white cells rather than leaving them, as then any overlap of the black rules is the same for the white and grey cells.

\documentclass{article}

\usepackage[table]{xcolor}
\usepackage{tabulary}
\usepackage{booktabs}

\begin{document}
\begin{center}

\newcolumntype{G}{>{\columncolor{gray!15}[\tabcolsep]}C}
\newcommand{\mythickrule}{\specialrule{1em}{0em}{0em}}
\newcommand{\whiterow}{\rowcolor{white}[\tabcolsep]}

\begin{table}
\begin{tabulary}{\linewidth}{>{\columncolor{white}[\tabcolsep]}LG}
\mythickrule
\whiterow foo            & stuff \\ \mythickrule
bar                      & stuff \\ \mythickrule
\end{tabulary}
\end{table}
\end{center}
\end{document}

-
Thanks David. Your answer solves the problem as posed, but unfortunately my actual table was much nastier. As a clarification, is cell color overlapping the rule a correctable issue in the colortbl package? – srking Jul 23 '12 at 3:53
It depends why it overlaps. If it overlaps because you are using some fancy rule thing that is doing negative spacing to adjust spacing around rules, then adjusting the order of the rules and negative spacing can fix it, but the most common cause is that tex is trying to align two rules exactly adjacent but the final pdf rendering has to snap them to pixel boundaries and so depending on the order of events they can snap different ways and be a couple of pixels out. – David Carlisle Jul 23 '12 at 8:40
The easiest way to try to avoid that is as I suggested here to always (or never) use coloured panels if they are adjacent to another panel or rule then the rounding artifacts are hopefully the same in each case so end up with straight lines. – David Carlisle Jul 23 '12 at 8:40