Summary: can I get a table with narrow columns (about 5 mm), a normally sized capital letter in some cells and some of the cells coloured (filled by a pattern would also work)?
Full question:
I'm trying to create a table with fairly narrow columns (5 mm), in which some cells are gray. Some of the cells (though never any gray cell, if that matters) will contain a single capital letter. In order to keep the column narrow and the letters in default font sice, I'm taking away the column separation by defining each column as @{} m{5mm} @{}. This works well; together with a small \vspace I can get the letters centered vertically and with \centering{} also horizontally.
Problem is, when I try to fill in a single cell using \cellcolor, the colour actually extends to the sides over the cell borders. The command \columncolor has an option for overhang, but as far as I can see, \cellcolor doesn't have this. Is there a way around it?
My code so far:
\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{tabular}{| @{} m{5mm} @{} | @{} m{5mm} @{} | @{} m{5mm} @{} |@{} m{0pt} @{} }
\hline
& \vspace{.75mm}\centering{E} & \vspace{.75mm}\centering{C} &\\
\hline
\vspace{0.75mm}
\centering{P} & \cellcolor{gray!50} & &\\
\hline
\vspace{0.75mm}
\centering{M} & & &\\
\hline
\end{tabular}
\end{document}
Notes on the example:
1) The 0 mm column to the far right is there since the rightmost column, for some reason, cannot contain a \centering. If there's a better solution to this, I'm all ears.
2) The \vspace{0.75mm} is only in order to make the cells square (or very close to square).
Possible workaround: I have thought about instead of using \cellcolor, to insert a grey picture, stretched to the right dimensions, in each cell. This works except for creating a small white gap under the picture, before the \hline. I can move up the line by using \[-1.3 mm], but if I do that on the last line the vertical lines between each column protrudes under the bottom. Either solution would be OK, I have long ago given up the thought of elegant code...
\centering
all over the place, instead place>{\centering\arraybackslash}m{5mm}
in your preamble instead ofm{5mm}
for those columns. The colouring does stick out because the cell colours do expect the padding you suppress. There should be enough other questions on here dealing with that (I won't search for those now, as I have to leave).