4

I have this code, adapted from the answer to this question:

%!TEX program = lualatex
\RequirePackage{luatex85}
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard,graphdrawing,arrows.meta,quotes}
\usegdlibrary{circular}
\begin{document}
\newcounter{countme}
\setcounter{countme}{0}
\newcommand*\countup{\stepcounter{countme}\thecountme}
\newcommand*\countset{\setcounter{countme}{0}}
\tikzset{%
  edge counter/.style={"\countup"},
}
\tikz[>=Stealth]{%
  \graph [simple necklace layout, grow=left, node sep=20mm, nodes={circle},  edge quotes center, edge quotes={fill=white, inner sep=1pt, font=\scriptsize}]
  {
    subgraph C_n [n=2, -!-];
    { [edges={edge counter}]
      1->2->[loop left] 2 ;
    }
  };
}
\end{document}

It makes this graph:

Heading

I am interested in making the loop larger. The manual I have (http://pgf.sourceforge.net/pgf_CVS.pdf) on p. 739, talks about the loop key as part of the topaths library. But the options are quite limited, and there seems to be nothing about sizing.

I don't need to use the loop key and am open to anything that works.

2

If you look in section 70.3 of the tikz/PGF 3.0.1a manual you will find some other options including distance. Adding distance=2cm produces:

enter image description here

You can also use looseness and the various bend to control the loop.

For completeness, here's the full code but I only only added the distance command:

\RequirePackage{luatex85}
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard,graphdrawing,arrows.meta,quotes}
\usegdlibrary{circular}
\begin{document}
\newcounter{countme}
\setcounter{countme}{0}
\newcommand*\countup{\stepcounter{countme}\thecountme}
\newcommand*\countset{\setcounter{countme}{0}}
\tikzset{%
  edge counter/.style={"\countup"},
}
\tikz[>=Stealth]{%
  \graph [simple necklace layout, grow=left, node sep=20mm, nodes={circle},  edge quotes center, edge quotes={fill=white, inner sep=1pt, font=\scriptsize}]
  {
    subgraph C_n [n=2, -!-];
    { [edges={edge counter}]
      1->2->[loop left,distance=2cm] 2 ;
    }
  };
}
\end{document}

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.