I have the following code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\colorlet{mlightgray}{gray!20}
\begin{document}
\begin{tikzpicture}[cell/.style={rectangle,draw=black}, nodes in empty cells]
\matrix[
matrix of nodes,
row sep =-\pgflinewidth,
column sep = -\pgflinewidth,
nodes={anchor=center},
column 1/.style = {nodes={cell, minimum width=1cm, fill=mlightgray}},
column 2/.style = {nodes={cell, minimum width=2cm}},
column 3/.style = {nodes={cell, minimum width=2cm}},
row 1/.style={nodes={cell, minimum height=0.5, fill=mlightgray}},
row 2/.style={nodes={cell, minimum height=0.5}},
row 3/.style={nodes={cell, minimum height=0.5}},
row 4/.style={nodes={cell, minimum height=0.5}},
]
{ & 2 & 3 \\
1 & a & b \\
2 & c & d \\
3 & & e \\
};
\end{tikzpicture}
\end{document}
It produces this matrix:

It seems that I have used all the solutions mentioned in other threads: pgflinewidth and nodes={anchor=center}... but the borders still don't overlap...
Don't understand why the library makes overlapping so hard, which is a quite obvious need... Could anyone help?
In addition, I just want to always make the first row and the first column have mlightgray as background color, is there a way to avoid from repeating row .../.style={nodes={cell, minimum height=0.5}} many times?
Moreover, unlike the rows, when I tried to put minimum width=2 (instead of 2cm) for the columns, it didn't work well. Why do I have to put the unit for that width?


minimum width=2(instead of2cm) for a column? – SoftTimur Feb 03 '15 at 01:52