The following example does not compile:
\documentclass[tikz]{standalone}
\usetikzlibrary{graphs,matrix}
\begin{document}
\begin{tikzpicture}
\matrix(M)[matrix of nodes]{ 1 & 2 \\};
\graph{\foreach \x in {1} {(M-1-\x) -- (M-1-2)}};
\end{tikzpicture}
\end{document}
Log file:
Runaway argument?
M\pgf@stop \iftikz@lib@graph@use@list \let \tikz@lg@temp \pgfutil@empty \ETC.
! File ended while scanning use of \tikz@lib@graph@use@list@grap.
<inserted text>
\par
<*> test-graph.tex
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I created an even more minimal MWE.
As it seems is the dash (
-) in the node name causing the problem.Workaround
\graph{({M-1}) -- (M2)};I fixed the bug but your example still won't work because you can't use
\foreachinside\graph.Thank you for your work, that's already progress.
Note that the manual explicitly states that \foreach can be used as a
<chain specification=""> in graphs:
§19.3.2 Syntax of Group Specifications has a paragraph titled "Using
foreach".</chain>
Best wishes,
I see. Looks like we have to fully expand the node name. I wonder what other bugs that will introduce.
Fixed https://sourceforge.net/p/pgf/git/ci/13a03d9a6cd87ba1dbec291bd2c85fc1c292a8a1/