2

If I try to define a tree, with a child, inside a pic and later use this pic with a prefix, I get an error.

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{figure}
  \begin{tikzpicture}
    \tikzset {
      tree/.pic = {
        \coordinate (-root) child;
      }
    }
    \pic[draw] (t) {tree};
  \end{tikzpicture}
\end{figure}
\end{document}

ERROR: Package pgf Error: No shape named tt-root is known.

It works fine if I delete child from the pic or don't try to prefix the \pic command.

What am I doing wrong?

  • Welcome to TeX.SE! I'm afraid your question is a duplicate of this one, do you agree? –  Sep 12 '18 at 19:32
  • Indeed. It isn't straight forward to see, as my problem starts with a tree, and not the key to, but the issue seems to be the same. Thank you for the reference. Should I delete the question? – user170268 Sep 12 '18 at 19:37
  • I could also close it as a duplicate. Believe me, many top users have tried to solve it, but so far I am only aware of workarounds, some of which are of course very ingenious. Closing this question may be more appropriate since then the original one is easier to find. What do you think? –  Sep 12 '18 at 19:39
  • I defer to your judgement. Thank you for being great. – user170268 Sep 12 '18 at 19:41
  • Maybe you can solve the question.... ;-) I am always wondering about one very basic thing: the pgfmanual itself can be compiled without errors. So what is going on here? I tried to load all libraries, just like the pgfmanual does, hoping this would fix it, but it doesn't. –  Sep 12 '18 at 19:43

0 Answers0