Home > tikz pgf > TikZ multiple loops on one node

TikZ multiple loops on one node

March 5Hits:0
Advertisement

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

Answers

  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}

TikZ multiple loops on one node

Tags:tikz pgf

Related Articles

  • TikZ multiple loops on one node

    TikZ multiple loops on one nodeMarch 5

    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

  • tikz - Multiple nodes with same content

    tikz - Multiple nodes with same contentJanuary 20

    I would like to know how to place multiple nodes with same content in TikZ. I've made a macro for it, but I think that it could have a different approach. \usepackage{tikz} \usepackage{bm} \newcommand{\cross}{% node {\LARGE\bm{$\times$}}% } \begin{do

  • Tikz fit variable number of nodes

    Tikz fit variable number of nodesApril 26

    I would like to draw a rectangle or ellipse over some nodes I am drawing with tikz. I know how to do that if the number of nodes is fixed: I just enumerate them. I was wondering if there is a way to do that if I have a variable number of nodes? Curre

  • TikZ \foreach loop with macro-defined listFebruary 25

    I have a small problem with the TikZ \foreach loop whenever the list, over which we loop, is defined my a macro. The following code example will show my problem: \documentclass{scrartcl} \usepackage[utf8]{inputenc} \usepackage{tikz} \begin{document}

  • Append two lists for TikZ foreach loopMay 23

    How can I make a TikZ foreach loop iterate over two lists consecutively? I had hoped that in my code below, the expression \firstlist,\secondlist would evaluate to 2,3,5,7,1,4,6, but it doesn't work. I have tried mild variants, like {\firstlist,\seco

  • TikZ Self Loops Style Question

    TikZ Self Loops Style QuestionNovember 1

    I have a question on how to "style" the self loops in my diagram. Here is my preamble: \documentclass[letterpaper]{tufte-handout} % Additional LaTeX Packages \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsthm} % LaTeX TikZ Graphics Pac

  • Retain coordinate value in tikz foreach loop

    Retain coordinate value in tikz foreach loopApril 9

    I would like to retain a computed coordinate value from one step of a tikz foreach loop to the next. In the code below, I would like the increment in the y-value to depend on the previous y-value, which I am denoting \lasty. Is there a way to retain

  • Tikz: foreach loop ignores part of the edges

    Tikz: foreach loop ignores part of the edgesJanuary 20

    I would like to draw some more or less advanced grid, using three consecutive (non-nested) foreach loops. For unknown reasons, the third loop seems to be ignored... Here is the code: \begin{tikzpicture} \node at (22,3) (F) {$F$}; \foreach \i in {0,..

  • How can I draw two loops above a node?

    How can I draw two loops above a node?December 26

    How can I draw two loops above a node? Here is my code: \path (r) edge[loop above] node[left=1pt] {3} (r); \path (r) edge[out=140, in=50, looseness=0.8, loop] node[above=3pt] {4} (r); How can I make the 2nd loop bigger, so that I get more space in be

  • Multiple loops with / without sticky posts and different post limitsMarch 7

    I am having trouble with multiple loops and sticky posts in wordpress. The first loop I just want all the sticky posts. <?php query_posts(array('post__in'=>get_option('sticky_posts'), 'cat' => '-15,-17, -5, -2')) ?> <?php if ( have_posts()

  • Multiple loops on the same page removing post tags

    Multiple loops on the same page removing post tagsMarch 9

    I am trying to use two loops on my page, one to get the current page's content and so on, and another to get all of the posts of a specific category. When I do that, all of the tags for the current page disappears. Here is my code, Loop one: <?php if

  • Wordpress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next pageApril 30

    Hey everyone. I'm not sure if what I'm experiencing is a result of a bug (due to the recent upgrade to 3.1.2) or poor coding. Ever since i upgraded to version 3.1.2 ive been experiencing a problem with two loops on my index page. Here's what I've got

  • Tikz and alignment with two nodes on the same lineSeptember 28

    Another minimal example: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[draw=black,% rounded corners=2pt,% rectangle,% bottom color=black!80!white] (A) {node aligned on left margin}; \node[draw=black,% rounded co

  • Page with Multiple Loops Breaking PaginationJanuary 19

    I made a customized index.php so that I have multiple loops on the same page so that the content can be displayed differently. I got this to work, however the pagination is broken. Despite several hours of Googling and trying all sorts of things, I c

  • Multiple Loops That Pull Pages (Child/Grandchild) While Styling the First Entry

    Multiple Loops That Pull Pages (Child/Grandchild) While Styling the First EntryFebruary 22

    This is either something really simple that I've orchestrated into a complex problem or it really is a complex problem. I've decided to use pages to display information. If I go to a page called Houston, I want to see the subpages of Houston, but als

  • Basic multiple loops only displaying first loopMarch 6

    I'm trying to set up multiple loops on a page. The first loop will display the latest four blog posts, and the second loop below it will display the latest eight blog posts with pagination. I set up the template below but only the first four blog pos

  • How to speed up a wordpress function with multiple loops?

    How to speed up a wordpress function with multiple loops?April 25

    I am a PHP novice and wrote this function. It is an alphabetical navigation which shows only the letter that have posts in both that letter and the currently filtered "genero" taxonomy term. I use multiple taxonomy queries to find "artistas

  • How to specify a Tikz coordinate relative to a node?

    How to specify a Tikz coordinate relative to a node?May 24

    is there a simple idiom (one not using the calc library) to specify a Tikz coordinate relative to a node? Something like \coordinate (x) [right=of A]; instead of \node (x) [draw=none, right=of A]{};? Thanks --------------Solutions------------- \docum

  • TIKZ-PGF: Align two text-nodes to the left

    TIKZ-PGF: Align two text-nodes to the leftAugust 11

    I want to draw two text nodes in tikz-figure where the text is aligned left and not centered: \documentclass{article} \usepackage{tikz} \begin{document} \begin{figure} \begin{tikzpicture} \node at (1.0, 2.0) {veeeeeeeeeeery long text node}; \node at

  • TikZ: text along path as node

    TikZ: text along path as nodeOctober 10

    I'm using the decorations library to put bended text along a path. That works fine. However, I'd like to have the bended text as a node, so that I can later use it as a reference (for instance to draw a line to it). Is that possible? How do I define

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.397 s.