I used Tikz library graphs to draw a graph, that is:


Here's my code

    \graph  {
     "$x_1$" -> {
        "$x_2$" -> "$x_3$",
        "$x_4$" -> "$x_5,x_8$" 
     } -> "$x_6,x_7$"

However the arrow body miraculously disappeared:

How can I deal with it?

  • 1
    When I compile the code in the context of a minimal document I get a short arrow. It is shorter than the other arrows in the diagram, but it does not consist of only the arrowhead. Can you please combine the snippets into a full example document with \documentclass a preamble and \begin{document}...\end{document} that reproduces the issue (tex.meta.stackexchange.com/q/228/35864). An MWE makes sure that we are all talking about the same thing. It might also help if you could upload your .log file to a text-sharing website like pastebin.com – moewe May 26 at 3:48
  • In addition to @moewe's comment you can just increase the distance between the nodes, try e.g. \begin{tikzpicture} \graph[grow right=2cm] { "$x_1$" -> { "$x_2$" -> "$x_3$", "$x_4$" -> "$x_5,x_8$" } -> "$x_6,x_7$" }; \end{tikzpicture}. – marmot May 26 at 4:12

You can always increase the distances between the nodes. In the current graph this can be achieved by adjusting the grow right key.

\foreach \X in {1,1.1,...,2,1.9,1.8,...,1.1}
\path (-0.3,0.3) rectangle (6.6,-1.4); % only for the animation
    \graph[grow right=\X cm]  
     "$x_1$" -> {
        "$x_2$" -> "$x_3$",
        "$x_4$" -> "${x_5,x_8}$" 
     } -> "${x_6,x_7}$"

enter image description here

  • Wow it very nice...a spring code :-). Very very good. – Sebastiano May 26 at 6:27

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.