I'm trying to use a foreach loop to draw a whole bunch of arrows in a tikzcd environment by using the foreach loop to specify coordinates but I can't get it to compile. Here's a minimal example of what I'm trying:
\documentclass{article}\usepackage{tikz-cd}\begin{document}\begin{tikzcd} A & B & C \\ \foreach \x in {2,3}{ \arrow[from=1-1, to=1-\x] }\end{tikzcd}\end{document}
Which should appear as an arrow from A to B and another from A to C. Instead I'm recieving this error:
ERROR: Undefined control sequence.
--- TeX said ---
pgf@sh@ns@\tikzcdmatrixname -1-\x
l.12 \end{tikzcd}
I think I could get it to work in a plain tikz environment but I'd like to use tikzcd if possible. Thanks for any help.