# How to avoid \cellcolor overflowing when changing the space in the column?

I reduced the space in the columns through the use of @{} in the column type:

\newcolumntype{M}{@{}c@{}}


The problem is that, when I combined this with the \cellcolor command, it overflows into the other columns. And if I remove the @{} space modification, then it sets it right.

So, how can I let the \cellcolor command now that I reduced the space of that column?

\documentclass{article}

\usepackage[table]{xcolor}
\usepackage{array}
\newcolumntype{M}{@{}c@{}}

\begin{document}
\pagestyle{empty}
\begin{table}
\begin{tabular}{l|M|c|M|M}
& a & b & c & d\\
a & \cellcolor{black!50} 90.6 & 10 & 0 & 0\\
b & 0 & \cellcolor{black!50} 90.0 & 10 & 10\\
c & 0 & 0 & 95 & \cellcolor{black!50} 5\\
d & 0 & 10 & 5.5 & 8\\
\end{tabular}
\end{table}
\end{document}


-

fake the columncolor:

\documentclass{standalone}

\usepackage[table]{xcolor}
\usepackage{array}
\newcolumntype{M}{@{}>{\columncolor{white}[0pt][0pt]}c@{}}

\begin{document}
\pagestyle{empty}
\begin{table}
\begin{tabular}{l|M|c|M|M}
& a & b & c & d\\
a & \cellcolor{black!50} 90.6 & 10 & 0 & 0\\
b & 0 & \cellcolor{black!50} 90.0 & 10 & 10\\
c & 0 & 0 & 95 & \cellcolor{black!50} 5\\
d & 0 & 10 & 5.5 & 8\\
\end{tabular}
\end{table}
\end{document}


However, you'll get problems with viewing the vertical lines. With some zoom values they will not be visible. Printing is no problem.

-
The problem with the lines is really annoying, the main idea is to have a really nice looking document, both printed and digital. Is there any other option to achieve the same goal? Some other package to color the tables? –  adn Jan 27 '12 at 11:12
it is a problem with the viewer and not with TeX! –  Herbert Jan 27 '12 at 11:39