I am using \cellcolor
to give a background to some cells. The cell color is partially coming over the border of the cell as you can see in the screenshot.
This is my LaTeX code for the table.
\usepackage[table]{xcolor}
\begin{table}[h]
\centering
\setlength{\tabcolsep}{12pt}
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{ l l l l}
\hline
\multicolumn{1}{|c|}{1} & \multicolumn{1}{c|}{47.5\% (52.5\%)} & \multicolumn{1}{c|}{37.4\% (41.3\%)} & \multicolumn{1}{c|}{26.8\% (29.6\%)} \\
\multicolumn{1}{|c|}{2} & \multicolumn{1}{c|}{70.9\% (74.3\%)} & \multicolumn{1}{c|}{61.5\% (68.2\%)} & \multicolumn{1}{c|}{51.4\% (57.5\%)} \\
\multicolumn{1}{|c|}{3} & \multicolumn{1}{c|}{72.1\% (76.0\%)} & \multicolumn{1}{c|}{65.4\% (69.8\%)} & \multicolumn{1}{c|}{54.7\% (59.8\%)} \\
\multicolumn{1}{|c|}{4} & \multicolumn{1}{c|}{{\cellcolor[gray]{.9}}72.1\% (77.1\%)} & \multicolumn{1}{c|}{62.6\% (67.0\%)} & \multicolumn{1}{c|}{52.5\% (55.9\%)} \\
\multicolumn{1}{|c|}{5} & \multicolumn{1}{c|}{70.9\% (76.0\%)} & \multicolumn{1}{c|}{60.3\% (65.4\%)} & \multicolumn{1}{c|}{51.4\% (54.2\%)} \\
\hline
\end{tabular}
\end{table}
How could I solve this?
Best Answer
For the record, I still wasn't happy with this since I wanted the table to appear well in any viewer. So I sort of went round the problem by using
\multicolumn{1}{>{\columncolor[gray]{.9}[9pt]}c|}{72.1\% (77.1\%)}
So the full code is:
to achieve this:
I'm happy with the result. Maybe it would be useful to someone else.