Possible Duplicate:
Problem with defining shortcuts for TikZ matrices.

I'm getting a the following error using subfloat and tikz matrix together: ERROR: Package pgfbasematrix Error: Single ampersand used with wrong catcode. Commenting out the subfloat lines results in no errors. Thanks in advance for any suggestions.

%% For drawing

%% For subfloat

%% Drawing
  \node (A) at (0,0) [nd] {}; % Lower Left
  \node (B) at +(1,0) [nd] {}; % Lower Right
  \node (C) at +(0.5,0.75) [nd] {}; % Top
  \draw[#1] (A)--(B);
  \draw[#2] (A)--(C);
  \draw[#3] (B)--(C);
  \node [below] at +(0.5,-0.1) {\footnotesize (#4)};
  \node (A) at (0,0) [nd] {}; % Lower Left
  \node (B) at +(1,0) [nd] {}; % Lower Right
  \node (C) at +(0.5,0.75) [nd] {}; % Top
  \draw[#1] (A)--(C);
  \draw[#2] (B)--(C);
  \node [below] at +(0.5,-0.1) {\footnotesize (#3)};

  \begin{tikzpicture}[nd/.style={circle,draw,fill=black!50,inner sep=2pt}]    
    \matrix[column sep=0.4cm, row sep=0cm]
      \directedwedge{\linkba}{\linkba}{i} &
      \directedwedge{\linkab}{\linkba}{ii} &
      \directedwedge{\linkab}{\linkab}{iii} \\
      \directedwedge{\linkaba}{\linkab}{iv} &
      \directedwedge{\linkaba}{\linkba}{v} &
      \directedwedge{\linkaba}{\linkaba}{vi} \\

  \begin{tikzpicture}[nd/.style={circle,draw,fill=black!50,inner sep=2pt}]    
    \matrix[column sep=0.4cm, row sep=0cm]
      \directedtriangle{\linkab}{\linkba}{\linkba}{a} &
      \directedtriangle{\linkab}{\linkba}{\linkab}{b} &
      \directedtriangle{\linkaba}{\linkba}{\linkba}{c} &
      \directedtriangle{\linkaba}{\linkab}{\linkba}{d} \\
      \directedtriangle{\linkaba}{\linkab}{\linkab}{e} &
      \directedtriangle{\linkaba}{\linkaba}{\linkba}{f} &
  \caption{All different directed wedges and triangles}


marked as duplicate by Loop Space, Reinstate Monica - M. Schröder, Paulo Cereda, percusse, Stefan Kottwitz Oct 3 '12 at 19:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • This looks like the same problem as at tex.stackexchange.com/q/1111/86 Could you try that and see if it fixes it for you? – Loop Space Oct 3 '12 at 18:17
  • Yes, that fixed it. Thank you for the pointer. – tgkolda Oct 3 '12 at 18:36
  • Okay, then we'll close this as a duplicate of that one to help others who might have the same problem. – Loop Space Oct 3 '12 at 19:03

Browse other questions tagged or ask your own question.