0
\documentclass{amsart}

\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}

\[
\begin{tikzcd}
\left< x, y \right>
\ar[r, "{{\left( \begin{array}{cc} a & b \\ c & d \end{array} \right)}}"]
&
\left< z,w \right>
\\
\end{tikzcd}
\]

\end{document}

generates the error message

Undefined control sequence.
\pgf@let@token ...{{\left ( \begin {array}{cc} a &
                                               b \\ c & d \end {array} \...

The problem is discussed in section 3.4 of the tikzcd manual at http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf. One solution is as follows: use the "ampersand replacement" option to tikzcd to use a different character for separating nodes in the commutative diagram. This leaves the ampersand available for use in the array in the arrow's label.

\documentclass{amsart}

\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}

\[
\begin{tikzcd}[ampersand replacement=\&]
\left< x, y \right>
\ar[r, "{{\left( \begin{array}{cc} a & b \\ c & d \end{array} \right)}}"]
\&                   %% Note replacement of & by \& here
\left< z,w \right>
\\ 
\end{tikzcd}
\]

\end{document}
  • 1
    Welcome to TeX.SX! Can you please expand the code snippets that you have posted to a full minimal working example. It is much easier to help you you if we can start with some compilable code that illustrates your problem. A MWE should start with a \documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. Ideally it should compile unless, of course, that is what you are asking about. – Andrew Jul 18 '17 at 23:39
  • Done. With solution. – Robert Bruner Jul 19 '17 at 0:15
1

Simple, (per section 3.4 of http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf):

add option to tikzcd, viz

\begin{tikzcd}[ampersand replacement=\&]

An example is in the text cited.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.