I have a table and I want to highlight some cells with color with \cellcolor
.
However the horizontal alignment is distorted, as you can see in the image.
Can this be corrected with the current approach?
I didn't find any relevant information and a radically new approach would be preferably avoided.
I found only the workaround of adding a(n extra) ~
in the beginning of the non-highlighted cells of the same column. It works, but this is a workaround.
\documentclass{article}
\usepackage{array}
\usepackage{hhline}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\begin{document}
\begin{table}[h]
\footnotesize
\begin{center}
\caption{blah}
\label{fig:QResults}
\setlength{\tabcolsep}{1pt}
\begin{tabular}{|l|c|c|} \hhline{-|~|-}
\multicolumn{1}{|c|}{~~Features~~} & \multicolumn{1}{ c|}{} & ~~error~~ \\ \hhline{-|~|-}
\noalign{\smallskip} \hhline{-|~|-}
\cellcolor[gray]{0.8} {~~feat1~~} & {} & \cellcolor[gray]{0.8} {$1.49$} \\ \hhline{-|~|-}
{~~feat2~~} & {} & {$4.86$} \\ \hhline{-|~|-}
{~~feat3~~} & {} & {$4.67$} \\ \hhline{-|~|-}
\end{tabular}
\end{center}
\end{table}
\end{document}
~~
. I updated the 1st post with the same numbers on all rows, so that the effect it more visible.