# Why are the in and out angles different in my bended edges?

Consider the following MWE:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\tikz \graph [nodes={empty nodes, fill, circle, inner sep=1pt, draw}]{
\foreach \i in {1,...,5} { a --[bend left={2*90/5-(\i-1)*90/5}] b; }
};
\end{document} The result looks quite elegant, but I actually want the in and out angle of the edges to be equal. It now seems that in=180 for all edges, although the description for /tikz/bend left=<angle> in the PGF manual states

This option sets out=<angle>,in=180-<angle>,relative. If no <angle> is given, the last given bend left or bend right angle is used.

What did I do wrong?

Here is how bend left is defined

\tikzoption{bend left}[]{%
\def\pgf@temp{#1}%
\ifx\pgf@temp\pgfutil@empty%
\else%
\def\tikz@to@bend{#1}%
\fi%
\let\tikz@to@out=\tikz@to@bend%
\c@pgf@counta=180\relax%
\edef\tikz@to@in{\the\c@pgf@counta}%
\tikz@to@switch@on%
\tikz@to@relativetrue%
}


As you can see, TikZ uses TeX's arithmetics to calculated the in factor. Therefore you cannot pass a mathematical expression to it.

Instead, you should do the arithmetics yourself, such as the following

  \tikz \graph [nodes={empty nodes, fill, circle, inner sep=1pt, draw}]{
\foreach \i in {1,...,5} {
a --[
/utils/exec={\pgfmathsetmacro\bendangle{2*90/5-(\i-1)*90/5}},
bend left=\bendangle
] b; }
}; # Update

@Ignasi suggests the following

\foreach \i [evaluate=\i as \bendangle using {2*90/5-(\i-1)*90/5}] in {1,...,5}
{ a--[bend left=\bendangle] b;}


And then I found the following works

\foreach \i [evaluate={\bendangle=2*90/5-(\i-1)*90/5;}] in {1,...,5}
{ a--[bend left=\bendangle] b;}


If you have \usetikzlibrary{math}, then the following also works

  \foreach \i in {1,...,5} {
a --[
evaluate={\bendangle=2*90/5-(\i-1)*90/5;},
bend left=\bendangle
] b; }


For the first case, the key is handled by /pgf/foreach/evaluate and then \pgffor@assign@@parse@old.

For the second case, the key is handled by /pgf/foreach/evaluate and then \pgffor@assign@@parse.

For the third case, the key is handled by /tikz/evaluate and then \tikz@math.

• or \foreach \i [evaluate=\i as \bendangle using {2*90/5-(\i-1)*90/5}] in {1,...,5}{ a--[bend left=\bendangle] b;} Mar 28 '17 at 17:35
• @Ignasi Interesting! I found evaluate={\bendangle=2*90/5-(\i-1)*90/5;} also works, and is compatible with \tikzmath. Mar 28 '17 at 17:46