Why does adding a \node in a \graph result in an endless loop?

I tried to insert a multipart node into a graph and failed in an endless loop. I know that this can happen, since TeX is a turing complete language. But I wonder why it happens whenever I place a \node inside a \graph.

Here is the minimal failing example:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
\graph {
\node
(n)
{ Foo
%should be a multipart node, but fails just as a plain node
};
}
\end{tikzpicture}
\end{document}


As far as I know, \graph is just a shortcut for some more basic tikz element. But why is it problematic to add a node? What is the fundamental problem here?

I am running lualatex 0.95.0 but the loop occurs as well with pdflatex and xelatex.

You are executing

\tikz@signal@path


Which is defined by

\def\tikz@signal@path{\tikz@signal@path}


Which makes a tight loop, and as it is tail recursive it uses up no stack or memory so will loop forever.

• Ok, that explains the loop. But how and why do I execute such a pointless expression? – choeger Feb 27 '17 at 9:26
• @choeger \tikz@signal@path is what latex3 code calls a quark (sometimes useful but dangerous if met in the wild.....) the intended use of these things are just as delimiting tokens in internal parsing and they are never supposed to be executed. Didn't have time to trace this morning exactly what goes wrong but usually when nesting fails it's due to unprotected use of \edef or a global setting in the inner call that beaks the outer one or.... – David Carlisle Feb 27 '17 at 9:29