# Package pgfbasematrix Error: Single ampersand used with wrong catcode

Similar questions with different MWEs have been asked. The tikzcd code:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& \arrow{dl}{g}B \\
C& D
\end{tikzcd}
\end{document}


gives the error message:

! Package pgfbasematrix Error: Single ampersand used with wrong catcode. See the pgfbasematrix package documentation for explanation. Type H for immediate help. l.7 & \arrow{dl}{g}B\\ 

The code compiles if I replace the first & with A&, or if I replace both &s with \pgfmatrixnextcell. A clean solution would be much appreciated.

• For me, your code compiles and produces an image. – Steven B. Segletes Jul 19 '16 at 9:46
• The version of LaTeX I am using is: This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) restricted \write18 enabled. Although the dates seems old, it comes with a newish version of Ubuntu, so maybe it has not changed much recently. – Glasby Jul 19 '16 at 11:55
• @Glasby TeX Live 2013 is really old and much has changed in the meantime. – egreg Jul 19 '16 at 13:16
• Thanks all. Changing to TeX Live 2016 fixed this and other problems. Using stable operating systems, alas can mean that you have outdated versions of TeX Live which can give rise to compilation errors. – Glasby Jul 21 '16 at 3:13

I get the error if I compile with TeX Live 2012. The version I have of tikz-cd in my TeX Live 2013 is dated 2014/03/08, so perhaps your TeX Live/Debian 2013 still has the old version dated 2010/10/13.

The current tikz-cd is dated 2014/10/30.

You can solve the issue by adding an empty object:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
{} & \arrow{dl}{g}B \\
C & D
\end{tikzcd}
\end{document}