Menu

#500 [graphs] dashes in node names causes weird error message

TeX Live 2019
closed-fixed
graphs (1)
5
2019-01-24
2019-01-10
No

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.

Discussion

  • Stefan Pinnow

    Stefan Pinnow - 2019-01-10

    I created an even more minimal MWE.

    \documentclass[tikz]{standalone}
    \usetikzlibrary{graphs}
    \begin{document}
        % works
        \begin{tikzpicture}
            \node (M1) at (0,0) {a};
            \node (M2) at (1,0) {b};
            \graph{(M1) -- (M2)};
        \end{tikzpicture}
    
        % doesn't work
        \begin{tikzpicture}
            \node (M-1) at (0,0) {a};
            \node (M2)  at (1,0) {b};
            \graph{(M-1) -- (M2)};
        \end{tikzpicture}
    \end{document}
    

    As it seems is the dash (-) in the node name causing the problem.

     
    • Henri Menke

      Henri Menke - 2019-01-18

      Workaround \graph{({M-1}) -- (M2)};

       
  • Henri Menke

    Henri Menke - 2019-01-18

    I fixed the bug but your example still won't work because you can't use \foreach inside \graph.

     
    • Gábor Braun

      Gábor Braun - 2019-01-18

      I fixed the bug but your example still won't work because you can't use
      \foreach inside \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,

      Gábor
      
       
      • Henri Menke

        Henri Menke - 2019-01-18

        I see. Looks like we have to fully expand the node name. I wonder what other bugs that will introduce.

         
  • Henri Menke

    Henri Menke - 2019-01-21
    • status: open --> closed-fixed
     
  • Henri Menke

    Henri Menke - 2019-01-24
    • assigned_to: Henri Menke
    • Group: v1.0 (example) --> TeX Live 2019
     
MongoDB Logo MongoDB