3

I am attempting to draw a single node with several loops, of various sizes, positions, and labels on them. I can do some rough work on it, although it has a few problems. I looked at the documentation for loops in the manual (52.4 Loops). This got me started by I don't know how to modify the options not discussed in that section.

Currently, I have the following MWE:

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}

    \tikzset{every loop/.style={min distance=10mm,looseness=10}}
    \begin{tikzpicture}
        \node [] (star) {$*$} ;
        \path[->] (star) edge [in=70,out=100,loop] node {$a$} ();
        \path[->] (star) edge  [in=0,out=30,loop] node {$b$} ();
       %\path[->] (star) edge [in=0,out=100,loop] node{$a \cdot b$} ();
        \path[->] (star) edge  [loop below] node {e} ();
    \end{tikzpicture}

\end{document}

Two things I want to do.

  1. Move the labels for "a" and "b" so that they're appropriately not cut off by the loop. I believe this is an artifact of the tikzset command, but I do not know how to get nice sized loops and good labels.
  2. I want to have a loop from where "a" starts to where "b" ends to be the composition of them. Naturally, this would be best if it is bigger and sort of encompasses the pair "a" and "b". This is the commented out path.

Any help is appreciated

  • For 1): use auto: node[auto] {b} – Gonzalo Medina Mar 5 '15 at 20:05
5
  1. Add auto to the node options.

  2. Instead of an edge, you can use a to path for a loop with a larger value for distance.

The code:

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}

    \tikzset{every loop/.style={min distance=10mm,looseness=10}}
    \begin{tikzpicture}
        \node [] (star) {$*$} ;
        \path[->] (star) edge [in=70,out=100,loop] node[auto] {$a$} ();
        \path[->] (star) edge  [in=0,out=30,loop] node[auto] {$b$} ();
        \path[->,draw] (star) to  [in=-10,out=110,loop,distance=4.5cm] node[auto] {$a\cdot b$} (star);
        \path[->] (star) edge  [loop below] node[auto] {e} ();
    \end{tikzpicture}

\end{document}

enter image description here

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.