5

What is the problem with this file?

\documentclass{article}
\usepackage{exsheets}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}

\begin{question}
\begin{tikzpicture}
\matrix (magic) [matrix of nodes]
  {
    8 & 1 & 6 \\
    3 & 5 & 7 \\
    4 & 9 & 2 \\
  };
\end{tikzpicture}
\end{question}

\end{document}

The compiler says

./mini.tex:16: Undefined control sequence.
<argument> \pgf@matrix@last@nextcell@options 
1
  • 1
    Workaround: use the ampersand replacement=\& and change all & into \&. Commented May 8, 2014 at 13:55

1 Answer 1

8

exsheets reads the body of the question environment as argument, hence you can't use &, but you can use ampersand replacement=\&.

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{exsheets}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{question}
\begin{tikzpicture}
\matrix (magic) [ampersand replacement=\&,matrix of nodes]
  {
    8 \& 1 \& 6 \\
    3 \& 5 \& 7 \\
    4 \& 9 \& 2 \\
  };
\end{tikzpicture}
\end{question}
\end{document}

enter image description here

2
  • +1: try to investigate if exsheet makes use of & for special purposes: it may indicate the cause of the problem. Commented May 8, 2014 at 14:09
  • exsheets doesn't use & for anything specific. What it does, though, is reading the environment body as macro argument. Maybe that's the cause...
    – cgnieder
    Commented May 8, 2014 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .