2

I'm using \draw with parameters "out" and "in" to make loops on a node. I'd like to label these loops, but I'm having a difficult time figuring out how to do this. None of the examples of labeled edges or loops I've found via search use the out/in parameters.

Here is a minimal working example.

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\node at (0,0) (0) {node};

\draw [->] (0) to [out=135,in=45,looseness=8] (0);
\draw [->] (0) to [out=300,in=30,looseness=8] (0);
\draw [->] (0) to [out=240,in=150,looseness=8] (0);

\node at (0,1.4) {label 1};
\node at (1.8,-.4) {label 2};
\node at (-1.8,-.4) {label 3};


\end{tikzpicture}
\end{document}

enter image description here

Notice I've labeled the loops simply by adding new nodes and fine-tuning their positions to match the loops. Of course, this is less than desirable if I want to change the position of the central node.

Thanks in advance!

3

You basically just need to place node [<options>] {<text>} immedately after to[<options>].

(Note that the minimal class should in general not be used, article is better. See Why should the minimal class be avoided?)

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\node at (0,0) (0) {node};

\draw [->] (0) to [out=135,in=45,looseness=8] node[above] {label1} (0);
\draw [->] (0) to [out=300,in=30,looseness=8] node[right] {label2} (0);
\draw [->] (0) to [out=240,in=150,looseness=8] node[below left] {label3} (0);

\end{tikzpicture}
\end{document}
  • Perfect. I thought it was something this simple. Just couldn't get the right syntax. Thanks again. – Jared Feb 19 '18 at 21:31

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.