I want to generate a list called anglelist to generate a graph...
the prefered command for me is \edef\anglelist{\fullanglelist} but gives me an error.
But using \edef\anglelist{\fullanglelist} and \edef\anglelist{\fixedlist} wont give me any error.
My Question is "Would you tell me how should I make
\edef\anglelist{\fullanglelist}working?
Thanks, in advance. Following please have a look at the code I am talking about.
\documentclass[11pt]{article}
\usepackage{tikz}
\begin{document}
\newcount\nodes
\nodes=8
\newcount\hnodes
\hnodes=\nodes
\advance \hnodes by -1
\divide \hnodes by 2
%
\newcount\hnodesplus
\hnodesplus=\nodes
\advance \hnodesplus by 1
\divide \hnodesplus by 2
%
\newcount\initialstepsize
\initialstepsize=360
\divide \initialstepsize by \nodes
%
\newcount\initialremainder
\initialremainder=\initialstepsize
\multiply \initialremainder by -\nodes
\advance \initialremainder by 360
%
\newcount\hstep
\hstep=\initialstepsize
\divide \hstep by 2
\newcount\simplestep
\simplestep=\initialstepsize
\ifnum \initialremainder > 0%this makes angles a larger than expected.
\advance \simplestep by 1
\fi
\def\fullanglelister{%
\newcount\tempa
\newcount\tempb
\tempa=0
\tempb=0
%
\loop
\the\tempa\relax
\advance\tempa by \initialstepsize
\advance\tempb by \initialremainder
\ifnum\tempb > \hnodes% usually chosen to be 0, (better to be) \hnodes, or \nodes
\advance\tempa by 1
\advance\tempb by -\nodes
\fi
\ifnum \tempa < 360
,
\repeat}
\def\shortanglelister{0, \the\simplestep, ..., 359}
\def\fixedlist{0, 45, 90, 135, 180, 225, 270, 315}
\edef\anglelist{\shortanglelister}
%\edef\anglelist{\fullanglelister} % this one doesn't work!
%\edef\anglelist{\fixedlist} % but this works!
\begin{tikzpicture}
\foreach \angle in \anglelist
\node[rectangle,draw=black!50] (\angle) at (\angle:2) {\angle};
\foreach \from in \anglelist
\foreach \to in \anglelist
\path (\from) edge [->,bend right=\the\hstep,looseness=0.8] (\to);
\end{tikzpicture}
\fullanglelister
\shortanglelister
\fixedlist
\end{document}

\edef. – Joseph Wright Sep 19 '16 at 10:32\newcount\tempaand\newcount\tempbin the definition of\fullanglelister, you have to take into account that\edefonly expands macros, but does no assignment. – egreg Sep 19 '16 at 10:32\edef" ...unless you use tricks like\unexpandedor\expandonce. – Steven B. Segletes Sep 19 '16 at 10:41\edefor similar contexts. In LuaTeX things inside\directluaare different, and one might appeal to\csname...\endcnsamemaking undefined control sequences into\relaxfor 'special effects', but that is not general. – Joseph Wright Sep 19 '16 at 10:43\foreach\x in {0,45,...,359}to get same list you are preparing with\fullanglelister; it's not clear why going the hard way for writing the full list. – egreg Sep 19 '16 at 10:44\newcountinside the definition of\fullanglelisteras you do not want to allocate new registers every time you use the command. – David Carlisle Sep 19 '16 at 11:24\usepackage{xinttools}\edef\x{\xintListWithSep{, }{\xintSeq[45]{0}{359}}}– Sep 20 '16 at 11:45\usepackage{xintexpr}\edef\mylist{\xinttheexpr 0..[45]..359\relax}– Sep 20 '16 at 11:49