Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The MWE below shows that the \cellcolor command doesn't properly fill a table cell in revtex4-1 where it would do so in a simple article. Can anyone help me get fills that extend to the boundaries of my cells in revtex4-1?

Difference between article and revtex colortbl

\documentclass{revtex4-1}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{ |c|l|l| } \hline
\rowcolor{red} A    & B     & C     \\ \hline
Hello World         & other     & \cellcolor{blue}stuff\\ \hline
\end{tabular}
\end{document}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

enter image description here

revtex inserts some extra \tabcolsep spaces and so add three lines to compensate:

\documentclass{revtex4-1}
\usepackage{colortbl}

\makeatletter

    \def\CT@@do@color{%
      \global\let\CT@do@color\relax
            \@tempdima\wd\z@
            \advance\@tempdima\@tempdimb
            \advance\@tempdima\@tempdimc
    \advance\@tempdimb\tabcolsep
    \advance\@tempdimc\tabcolsep
    \advance\@tempdima2\tabcolsep
            \kern-\@tempdimb
            \leaders\vrule
    %^^A                     \@height\p@\@depth\p@
                    \hskip\@tempdima\@plus  1fill
            \kern-\@tempdimc
            \hskip-\wd\z@ \@plus -1fill }
    \makeatother
    \begin{document}

    \begin{tabular}{ |c|l|l| } \hline
    \rowcolor{red} A    & B     & C     \\ \hline
    Hello World         & other     & \cellcolor{blue}stuff\\ \hline
    \end{tabular}
    \end{document}
share|improve this answer
    
Well played David, first prize to you. I'm gonna resign myself to the fact that these little tweaks will be out of my reach for quite some time. –  sven Mar 15 '13 at 17:45
2  
@sven such tweaks are easier if you've written the package and had something to do with the class that's in conflict. –  David Carlisle Mar 15 '13 at 18:31
    
This solution doesn't work if you wrap up the tabular environment into ruledtabular one that adds nice starting and opening double horizontal bars. –  user35545 Aug 22 '13 at 14:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.