colortbl: \rowcolor in tables with \begin{tabular}{@{}ccc@{}}
\documentclass[a4paper,12pt]{article}
\usepackage{colortbl}
\newcolumntype{C}{c<{\kern\tabcolsep}@{}}
\begin{document}
\begin{tabular}{@{}CCc@{}}\hline
\rowcolor[gray]{.9}[0pt][0pt] a & b & c \\\hline
\end{tabular}
\end{document}
From the userguide of the colortbl
package (which provides the commands \columncolor
and \rowcolor
):
\rowcolor
takes the same argument forms as\columncolor
. It must be used at the start of a row. If the optional overhang arguments are not used the overhangs will default to ... \tabcolsep ... [emphasis added]
Here, the length \tabcolsep
is (half) the width of the intercolumn white space, and equals 6pt by default. However, specifying the \rowcolor
command as
\rowcolor[gray]{.9}[][] % empty contents resolve to 0[pt]
will not produce what you're after either, I'm guessing, because this will leave white gaps in the table's two interior columns. The colortbl
package doesprovides a \cellcolor
command, but unfortunately this command doesn't take left- or right-hand trimming options, so you'd be back where you started out with.
In short, if you insist on using the \rowcolor
command, you're probably best served by omitting the @{}
specifiers at the far left and far right of the tabular
specification.