当我们在 revtex4-1 类中使用 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}
效果如下:
主要因为 revtex 给 tabcolsep 增加了额外的间距,可以通过下面的代码修复:
\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}
选自:https://tex.stackexchange.com/questions/102665/revtex4-1-and-colortbl-doesnt-fill-cells