1

Possible Duplicate:
Unknown error using tikz matrix of nodes in beamer

I'm trying to write a beamer document with tikz math diagrams. This code how gives me a " Single ampersand used with wrong catcode." error.

\documentclass{beamer}
\usepackage{tikz}\usetikzlibrary{arrows,matrix,shapes,snakes}
\begin{document}
\begin{frame}
\begin{tikzpicture}
    \matrix (m) [matrix of math nodes]
    {X & Y \\ A & B \\};
\end{tikzpicture}
\end{frame}
\end{document}

Any clues why?

(by the way, the reason I'm writing this document is for personal notes to prepare a talk. I'm only interested in the fact that text is big and the formatting is designed for a schematic text. As I don't really care about the individual slides (i.e. the frame commands), do you have any tips for good alternatives?)

  • 3
    \begin{frame}[fragile] – Alain Matthes Jul 01 '12 at 16:31
  • 3
    or ampersand replacement=\& in matrix and use \& instead of & – Ignasi Jul 01 '12 at 16:34
  • 1
    thanks guys, both seem to work. is there any reason why one would be preferable? – donkey kong Jul 01 '12 at 16:52
  • The two methods are given in this question http://tex.stackexchange.com/questions/15093/unknown-error-using-tikz-matrix-of-nodes. Perhaps you question is a duplicate. – Alain Matthes Jul 01 '12 at 17:21
  • You need a wizard to compare the two methods. A lot of similar problems with beamer are solved with fragilebut in this special case with tikz and a matrix, ampersand replacement=\& is the common method. I think you need to memorize the two methods. – Alain Matthes Jul 01 '12 at 17:26
  • thanks everyone. I had searched before asking the question, but apparently not deeply enough. may the tex lords lay waste on this question. – donkey kong Jul 01 '12 at 21:58

0 Answers0