# revtex4-1 and colortbl doesn't fill cells

TeX - LaTeX Asked by sven on December 12, 2020

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?

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 inserts some extra tabcolsep spaces and so add three lines to compensate:

documentclass{revtex4-1}
usepackage{colortbl}

makeatletter

[email protected]@[email protected]{%
[email protected]@colorrelax
@[email protected]
[email protected]@tempdimb
[email protected]@tempdimc
[email protected]
[email protected]
[email protected]
[email protected]
%^^A                     @[email protected]@[email protected]
[email protected]@plus  1fill
[email protected]
[email protected] @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}

Correct answer by David Carlisle on December 12, 2020

The problem is still present with the class revtex-4.2.

With the environment {NiceTabular} of nicematrix (similar to {tabular} of array), you have directly the output you want. In fact, the output is better than with the class article because the rules won't seem to vanish in some PDF viewers at some levels of zoom (as in the picture of the OP).

documentclass{revtex4-2}
usepackage{nicematrix}
begin{document}
begin{NiceTabular}{ |c|l|l| }[colortbl-like] hline
rowcolor{red} A    & B     & C     \ hline
Hello World         & other     & cellcolor{blue}stuff\ hline
end{NiceTabular}
end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes).

Answered by F. Pantigny on December 12, 2020

## Related Questions

### Footnotes without numbering and without horizontal rule

1  Asked on November 14, 2020 by mr-gold

### Why does short-format apply to indefinite articles and how to avoid that?

0  Asked on November 14, 2020

### Text going past page

0  Asked on November 14, 2020 by palestina

0  Asked on November 14, 2020 by mattia-galanti

### How to change the main font in ClassicThesis without altering anything else

0  Asked on November 12, 2020 by user223464

### Spurious blank row with longtable and expl3 map function

1  Asked on November 12, 2020 by aejh

### How to increase size of rectangle and circle in node and vertical lines inside the rectangle

1  Asked on November 11, 2020 by mubashir-sheheryar

### What alternatives are there to allrunes for displaying futhark?

1  Asked on November 11, 2020 by jwodder

### Easy way to refer to local examples and equations without labeling them

1  Asked on November 11, 2020 by stefan-mller

### Hyphenation character makes Hebrew words disappear in HarfTeX

0  Asked on November 11, 2020 by kazi-bcsi

### Safe footnotemarks and automatically call footnotetext with tcolorbox

2  Asked on November 11, 2020 by manuel-schmidt

### page numbering : reference and appendix ( fix: same title)

0  Asked on November 11, 2020 by jang-lee

### curved lower arrow?

2  Asked on November 10, 2020

### Is it possible to include the short caption of a figure/table in the marker text of the endfloat package?

1  Asked on November 10, 2020 by m-n

0  Asked on November 10, 2020 by struggles

### How might one create a nice looking table in Latex?

4  Asked on November 10, 2020 by exploring

1  Asked on November 9, 2020

### counterwithin not work with custom counters

1  Asked on November 9, 2020 by rabbittac

### Dedicated method of enumerating above minipages

1  Asked on November 9, 2020

### Using raisebox to change nested underlining

0  Asked on November 9, 2020 by latexerexetal