I want to highlight one row and one column in a table. The column is no problem. However, the colour panels of the outermost left and right cell in the row overhang the table's borders if I use @{}
in the tabular
definition.
\documentclass{scrartcl}
\usepackage{colortbl,booktabs}
\begin{document}
\begin{table}[h]
\setlength{\aboverulesep}{0pt} % align \bottomrule nicely to coloured cell
\setlength{\belowrulesep}{0pt} % align \toprule nicely to coloured cell
\setlength{\extrarowheight}{.75ex} % make up for lost ruleseps
\begin{tabular}{@{}c>{\columncolor[gray]{.9}}cc@{}} \toprule
a & b & c \\
d & e & f \\
\rowcolor[gray]{.9} g & h & i \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
The problem is obvious:
Using \rowcolor[gray]{.9}[0pt][0pt]
to reduce overhang is not an option as the row would then not be fully highlighted anymore.
What I tried so far
Redefining the highlighted row like the following prints
[0pt]
into the cell and doesn't work, although it was suggested here.\rowcolor[gray]{.9}\cellcolor{white}\cellcolor[gray]{.9}[0pt] g & h & i \\
Redefining the highlighted row like this also doesn't work:
\rowcolor[gray]{.9}[0pt][0pt] g & \cellcolor[gray]{.9} h & i \\
The middle cell stays highlighted like there was only
\rowcolor[gray]{.9}[0pt][0pt]
defined…
Is there any other possibilty to trim the colour panels to align with \bottomrule
to the left and to the right?