# tikzcd arrow with array in label

\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}

• 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. – user30471 Jul 18 '17 at 23:39
• Done. With solution. – Robert Bruner Jul 19 '17 at 0:15

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