When using \cellcolor
in a booktabs
table, I find that the output is not really appealing:
I don't really care that the colored cell does not touch the lines above and below (cf. Coloring columns in a table with colortbl and booktabs), but what I find ugly is that the \cellcolor
command looks bad in combination with the shortened \midrule
of its header. I was originally going to ask how to simply shorten the \cellcolor
in a similar way, but I guess the output would still not be very appealing since the 3
would not be centered in its background anymore.
So, here's the more basic question: what is a best practice here to make things look appealing? I do like the booktabs
style, and I have a few tables in which I'd like to highlight some cells. Note that I'm not dead set on using backgrounds for the highlighting, but I can't think of a better means: using bold seems to communicate that the highlighted values are more important (while in fact they are error cases), using italics they'd be too little obvious.
Here is the corresponding MWE:
\documentclass{article}
\usepackage{booktabs}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{ccccc}
\toprule
\multicolumn{2}{c}{a} & \multicolumn{3}{c}{b} \\
\cmidrule(lr){1-2}\cmidrule(lr){3-5}
1 & 2 & \cellcolor[gray]{0.9}3 & 4 & 5 \\
\bottomrule
\end{tabular}
\end{document}
\cmidrule
s in question an option for you? For instance, in the example you give, could you live with issuing the commands\cmidrule(r){1-2}\cmidrule{3-5}
, which will trim the first cmidrule on the right and leave the length of the second cmidrule unchanged?a
's mid rule would be trimmed whileb
's would not be.