Consider this minimal working example:
\documentclass[a4paper]{amsart}
\usepackage{tikz}
\tikzset{graph/.style = {every node/.style = { draw,
shape = circle,
fill = black,
minimum size = 0.8mm,
inner sep = 0mm,
label distance = 0.8mm
}}}
\newcommand{\circumferencenode}[4][]{\node (#1#2) at (#4: #3) [label = #4: $#2$] {};}
\newlength{\gr} % graph radius
\setlength{\gr}{15mm}
\begin{document}
\begin{tikzpicture}[graph]
\circumferencenode{0}{\gr}{ 90}
\circumferencenode{1}{\gr}{ 30}
\circumferencenode{2}{\gr}{330}
\circumferencenode{3}{\gr}{270}
\circumferencenode{4}{\gr}{210}
\circumferencenode{5}{\gr}{150}
\draw (0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
\end{tikzpicture}
\vspace*{10mm}
\begin{tikzpicture}[graph]
\circumferencenode{02}{\gr}{ 90}
\circumferencenode{ 3}{\gr}{ 0}
\circumferencenode{ 4}{\gr}{270}
\circumferencenode{15}{\gr}{180}
\draw (02) -- (3) -- (4) -- (15) -- (02);
\end{tikzpicture}
\end{document}
This is what the output looks like:

As you can see, the second example is weird-looking. Something has gone wrong with the placement of nodes. I could ask why this is happening, but some experimentation shows that if the second picture is changed to the following:
\begin{tikzpicture}[graph]
\circumferencenode{02}{\gr}{90}
\circumferencenode{3}{\gr}{0}
\circumferencenode{4}{\gr}{270}
\circumferencenode{15}{\gr}{180}
\draw (02) -- (3) -- (4) -- (15) -- (02);
\end{tikzpicture}
or even to this:
\begin{tikzpicture}[graph]
\circumferencenode{02}{\gr} {90}
\circumferencenode {3}{\gr} {0}
\circumferencenode {4}{\gr}{270}
\circumferencenode{15}{\gr}{180}
\draw (02) -- (3) -- (4) -- (15) -- (02);
\end{tikzpicture}
then the problem disappears, and the second graph appears the way one would expect.
So the problem is apparently the leading spaces in the arguments to the macro. I could get rid of them and do just fine. However, it is pleasing to me to arrange the calls to the \circumferencenode macro the way I did originally, so that the numbers and the sets of braces are vertically aligned. So a better solution would be to find out how to strip leading and trailing spaces from macro arguments.
- Why does the original example not work properly?
- How can I strip leading and trailing spaces from the arguments to macros I define?

#2(the first mandatory parameter) which is used to name the node. So\circumferencenode{3}{\gr}{ 0}would be ok. – Peter Grill Dec 3 '12 at 9:12