I'd like to highlight a couple of columns in a table I have. I'm using booktabs
in order to access better horizontal rules, however this also has the side effect of introducing extra (uncoloured) space around the horizontal rules. Replacing \toprule
and \bottomrule
eliminates this unwanted/uncoloured space---is there any way I can persuade xcolor
(colortbl
) to colour this space as well?
MWE
\documentclass{article}
\usepackage{siunitx} % Formatting for units
\usepackage{booktabs} % Better formatting for tables
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % Use colour!
\begin{document}
\renewcommand{\arraystretch}{1.1}
\sisetup{table-format=1.4,table-sign-mantissa}
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}lS[table-format=2,table-sign-mantissa]S[table-format=2.4,table-sign-mantissa]S*{2}{>{\columncolor{pink}}S}*{5}{S}S[table-format=1,table-sign-mantissa]@{}}
\toprule
$x$ & -2 & -1.9 & -1.8 & -1.7 & -1.6 & -1.5 & -1.4 & -1.3 & -1.2 & -1.1 & -1\\
$\mathrm{f}(x)$ & -19 & -12.2610 & -6.8957 & -2.6986 & 0.5142 & 2.9063 & 4.6218 & 5.7871 & 6.5117 & 6.8895 & 7\\
\bottomrule
\end{tabular}
\end{document}