4

Since the last update, the following code does not compile anymore

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
UL
\arrow{r}{{\begin{tikzcd}1\arrow{r}{a}&2\end{tikzcd}}}
&UR
\\
DL
\arrow{r}
&DR
\end{tikzcd}
\end{document}

with the error message

Package pgf Error: No shape named tikz@f@2-2-1 is known.

The strange thing is that if there is only the first arrow, the code compile and gives the desired diagram.

Moreover, if I use the syntax\arrow[r, "{\begin{tikzcd}1\arrow{r}{a}&2\end{tikzcd}}"] for the first arrow, the code does not compile even with only one arrow. This time the error message is

TeX capacity exceeded, sorry [grouping levels=255]. \bgroup

Edit : the above code do not compile with pgf 3.0 and tikc-cd 0.9 (latest versions), but did compile with TeXLive 2013 and previous version of pgf and tikz-cd.

  • I don't think it's possible: tikz-cd uses a global naming scheme for nodes, so it gets confused by the reference to the same node in two places. – egreg Mar 5 '14 at 17:37
  • No errors with This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2013.12.2) on Ubuntu 13.04 – ferahfeza Mar 5 '14 at 17:37
  • @egreg It was possible ! But not after I updated pgf to version 3.0 (and maybe some update of tikz-cd too). N.B. I have pdfTeX, Version 3.1415926-2.5-1.40.14 too (TeX Live 2013/Mac) – Matsaya Mar 5 '14 at 17:42
  • @Matsaya You're right: I tried with TeX Live 2012 and the diagram is produced, although I'm not sure the result is what you'd want. So I guess that PGF 3.0 has broken it. – egreg Mar 5 '14 at 17:47
  • @Matsaya: Did you try with the latest tikz-cd (0.9, uploaded on CTAN 2014/03/02), that is built upon pgf 3.0? – Bernard Mar 5 '14 at 17:58
5

Since tikz-cd 0.9 and pgf 3.0 apparently broke the possibility to nest tikz-cd diagram (even in an other environment that uses &, see Luke Maurer comment) I came with this non-elegant and manual solution :

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
UL
\arrow{r}{
    \begin{tikzpicture}
        \node(1){1}; 
        \node(2)[right of=1]{2};
        \draw[->](1)--node{a} (2);
    \end{tikzpicture}}
%\arrow[r, "{\begin{tikzpicture}
%   \node(1){1}; 
%   \node(2)[right of=1]{2};
%   \draw[->](1)--node{a} (2);
%\end{tikzpicture}}"]
&UR
\\
DL
\arrow{r}
&DR
\end{tikzcd}
\end{document}

That is, it is still possible to use a tikzpicture environment in a \arrow (with either the old or the new syntax for the arrow).

I put this solution in case someone want a working solution, but I still hope that there is a more elegant way to do this.

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.