1

Possible Duplicate:
Problem with defining shortcuts for TikZ matrices.

I tried to use a tikz Matrix in a LaTeX document as the following:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \matrix{
    \node{a}; & \node{b}; \\
    \node{c}; & \node{d}; \\
    };
\end{tikzpicture}
\end{document}

Everything is ok. But when I tried to use it in a LaTeX command as the following:

\documentclass{article}
\usepackage{tikz}

\newcommand{\Foo}{
\begin{tikzpicture}
    \matrix{
    \node{a}; & \node{b}; \\
    \node{c}; & \node{d}; \\
    };
\end{tikzpicture}
}

\begin{document}
\Foo
\end{document}

It will report the following error:

!Package pgfbasematrix Error: Single ampersand used with wrong catcode.

Does anyone know how to solve this? thanks.

ocean
  • 981

0 Answers0