3

Here is a minimum example that does not work

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
    \begin{graph}{
        1 -> 2;
        3 -> 3;
        };
    \end{graph}
\end{tikzpicture}
\end{document}

I'm trying to get 3 to loop to itself.

1 Answer 1

5

Just tell tikz that you want a loop:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
    \graph{
        1 -> 2;
        3 ->[loop below] 3;
     };
\end{tikzpicture}
\end{document}

This produces:

enter image description here

If just write 3 -> [loop] 3; then the loop goes over node 1.

2
  • Thanks Andrew. And sorry, I did look through the manual but somehow never managed to find that!
    – Henry
    Sep 22, 2014 at 21:07
  • @Henry No need to apologise as it doesn't seem to be in the manual:)
    – user30471
    Sep 22, 2014 at 21:11

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.