I want to draw a circle using TIKZ and instead of manually placing the nodes and connecting the nodes I wanted to use loops as any sane person would. Now when I wrote these, the incoming edge seems to be going to some point slightly of the node instead of to its core.
In the example, I included a version with the path manually written out. I am losing my sanity here :D Anyone got any idea as to what is happening here? Any style critique is also very welcome!
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata}
\begin{document}
\begin{tikzpicture}[nodes=state]
\def \number {8}
\def \radius {2cm}
\def \degree {360/\number}
\foreach \s in {1,...,\number}
{
\node at ({\degree * (\s -1)}:\radius) (\s) {$u_\s$};
}
\foreach \s in {1,...,\number}
{
\pgfmathsetmacro\result{Mod( (\s), \number)+1}
\path (\s) edge[bend right = 15] (\result);
}
\end{tikzpicture}
\begin{tikzpicture}[nodes=state]
\def \number {8}
\def \radius {2cm}
\def \degree {360/\number}
\foreach \s in {1,...,\number}
{
\node at ({\degree * (\s -1)}:\radius) (\s) {$u_\s$};
}
\path (1) edge[bend right = 15] (2)
% edge (5)
(2) edge[bend right = 15] (3)
% edge (6)
(3) edge[bend right = 15] (4)
% edge (7)
(4) edge[bend right = 15] (5)
% edge (8)
(5) edge[bend right = 15] (6)
(6) edge[bend right = 15] (7)
(7) edge[bend right = 15] (8)
(8) edge[bend right = 15] (1)
;
\end{tikzpicture}
\end{document}
\pgfmathtruncatemacro\result{Mod( (\s), \number)+1}
to drop.0
at the end of the number.\foreach \s [evaluate=\s as \result using {int(Mod( (\s), \number)+1)}]in {1,...,\number} { \path (\s) edge[bend right = 15] (\result); }
also works.