TeX - LaTeX Asked by blueberryfields on June 2, 2021
I’m trying to add HTML code based color to my table, like so:
usepackage[table]{xcolor}
begin{tabular}{ |>{columncolor[HTML]{F2FAF8}}c| p{11cm} |}
hline
CELL 1 & CELL 2 hline
CELL 1 & CELL 2 hline
CELL 1 & CELL 2 hline
end{tabular}
however, the cells seem to overflow on top of the hline, like so:
How do I prevent this from happening?
UPDATE in response to comments:
I tried:
setlength{arrayrulewidth}{1pt}
begin{tabular}{ |>{columncolor[HTML]{F2FAF8}}c| p{11cm} |}
hline
CELL 1 & CELL 2 hline
CELL 1 & CELL 2 hline
CELL 1 & CELL 2 hline
end{tabular}
no go:
I claim this is a problem with the dvi driver bleeding the coloured panels too far, but I see the same with dvipng
You can compensate by over-printing an uncoloured table over the top so the rules are on top of the colour not adjacent.
Compare
and
documentclass{standalone}
usepackage[table]{xcolor}
begin{document}
deffoo#1{begin{tabular}{ |>{#1}c| p{11cm} |}
hline
CELL 1 & CELL 2 hline
CELL 1 & CELL 2 hline
CELL 1 & CELL 2 hline
end{tabular}}
foo{columncolor[HTML]{F2FAF8}}llap{foo{}}
end{document}
Correct answer by David Carlisle on June 2, 2021
The package nicematrix
has tools which has been designed to address that kind of problem. With that package, the rules won't seem to disappear in some PDF viewers at some levels of zoom.
documentclass{article}
usepackage{nicematrix,xcolor}
begin{document}
begin{NiceTabular}{>{columncolor[HTML]{F2FAF8}}cp{11cm}}[colortbl-like,hvlines]
CELL 1 & CELL 2
CELL 1 & CELL 2
CELL 1 & CELL 2
end{NiceTabular}
end{document}
You need several compilations (because nicematrix
uses PGF/Tikz nodes under the hood).
Answered by F. Pantigny on June 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP