I have started using tikz-cd
and it seems there is a problematic interaction with toggles. In particular, when I try to add a second "column" to the diagram, the code breaks. More specifically, this
\documentclass{article}
\usepackage{etoolbox}
\usepackage{tikz-cd}
\newtoggle{mytoggle}
\toggletrue{mytoggle}
\begin{document}
Hello
\iftoggle{mytoggle}{
\begin{tikzcd}
X
\end{tikzcd}
}{goodbye}
\end{document}
works, while if I replace the line X
with X & Y
, my code will not compile and I get a bunch of "undefined control sequence. }{goodbye}" and a "package pgf Error: Single ampersand used with wrong catcode. }{goodbye}". Any tips?