I have created a rather complicated table with some columns that I want to color. For the table, I chose the booktabs
and tabularx
packages. For coloring the columns, I use colortbl
.
The problem that I have is that \midrule
s show a white space, and the result does not please me at all. Here is a MWE:
\documentclass[a5paper]{article}
\usepackage{xcolor}
\usepackage{booktabs,colortbl,tabularx}
\begin{document}
\pagestyle{empty}
\begin{table*}[!htb]
\centering
\begin{tabularx}{4cm}{>{\columncolor{gray}}cX>{\columncolor{gray}}c}
\toprule
1&2&3\\
\midrule
one&two&three\\
one&two&three\\
\cmidrule{2-3}
one&two&three\\
\midrule
un&deux&trois\\
\bottomrule
\end{tabularx}
\caption{caption}
\end{table*}
\end{document}
Looking around I found that booktabs
supports colortbl
in its latest version. However, it seems that it only supports colored horizontal lines.
I tried not using booktabs
and replacing midrule
s for hline
s. My huge table looks too crowded (once you booktab, you never go back, I guess).
My question is: is it possible to achieve a correct coloring in midrule
s ? Since I fear that the response is no: what low-cost recommendation do you have in order to color the columns of my table?
(When I say low-cost, I mean that I do not want to re-write my table contents)
Best Answer
There's no way to do this given the way
booktabs
inserts space between above and below its rules. As Herbert notes inthe comments, it's not clear that rules and colours are really a logical combination. So probably the best you can do is to increase the row height and set the space above and below the rules to 0.The middle table still looks marginally better than the third one.