I've have the following two pieces of code. The first one compiles; the second one doesn't. I don't understand why the second one fails. Could someone explain?
Example 1:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\matrix [column sep=0pt,every node/.style={draw,minimum size=2em}]
{
\node(m0) {a}; & \node(m1) {b}; & \node(m2) {c}; \\
};
\end{tikzpicture}
\end{document}
Example 2:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\def\usemygrid{%%
\matrix [column sep=0pt,every node/.style={draw,minimum size=2em}]
{
\node(m0) {a}; & \node(m1) {b}; & \node(m2) {c}; \\
};
}
\begin{tikzpicture}
\usemygrid
\end{tikzpicture}
\end{document}
This second example results in the following error:
! Undefined control sequence.
<argument> \pgf@matrix@last@nextcell@options
l.15 \usemygrid