\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ll}
\toprule\rowcolor{gray}Head1 & Head2\\ % <-- Should have gray
background
\midrule
A & B\\
\bottomrule
\end{tabular}
\end{document}
Any help is much appreciated!
> [ problem with booktabs and xcolor ]
When I opened the booktabs manual I noticed there was a \specialrule
command which requires the width of the rule you want to typeset.
Reading a bit further, I found that there were also commands for the
default widths of the different rules. Putting it all together I got
the following.
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ll}
\specialrule{\heavyrulewidth}{0pt}{0pt}
\rowcolor{gray}Head1 & Head2\\ % <-- Should has gray background
\specialrule{\lightrulewidth}{0pt}{0pt}
A & B\\
\bottomrule
\end{tabular}
\end{document}
Regards,
Marc van Dongen
\begin{tabular}{ll}
\specialrule{\heavyrulewidth}{0pt}{0pt}
\arrayrulecolor{red}
\specialrule{\belowrulesep}{0pt}{0pt}
\rowcolor{red}Head1 & Head2\\
\specialrule{\aboverulesep}{0pt}{0pt}
\arrayrulecolor{black}
\specialrule{\lightrulewidth}{0pt}{0pt}
\arrayrulecolor{white}
\specialrule{\belowrulesep}{0pt}{0pt}
\arrayrulecolor{black}
A & B\\
\bottomrule
\end{tabular}
Now I just have to learn how to define an environment that would
automatically prepend this to all tables! :-)
\renewcommand{\arraystretch}{1.4} works well with your table
(without the extra red and white rules). It would not be so
good if the table contained taller material.
Some folks manage the separation between rules and text by
inserting empty rows (in the appropriate color). such rows
would have to contain something invisible with a little
height to produce the separation.
Dan
To reply by email, change LookInSig to luecking
>On Tue, 25 Aug 2009 09:22:43 -0700 (PDT), Alexander Lembach
><al...@gmx.de> wrote:
>
>>Thank you Marc! Though this doesn't exactly do what I need (the vspace
>>after the toprule and before and after the midrule is too small), this
>>was a good advice since I can make that space via appropriately
>>colored specialrule, like this:
...
>
>Some folks manage the separation between rules and text by
>inserting empty rows (in the appropriate color). such rows
>would have to contain something invisible with a little
>height to produce the separation.
Oops. I was partly in plain TeX mode when I wrote that.
I forgot that LaTeX puts a strut on each line, empty or
not. So an empty line is way too much space. There is
probably some internal command (\@arstrut) one can
modify to get around that (or some package that will do
it for you, but that is beyond my knowledge. (Although
a cellspace package has appeared recently that might
have some relevance.)