I am trying to do a simple calculation with the tikz foreach, but it does something very suprising:
\documentclass{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{2pt}
\begin{document}
\begin{preview}
\def\radius{10}
\def\step{6}
\begin{tikzpicture}
\def\stepsize{\number\numexpr180/\step\relax}
\foreach \Angle in {0.5\stepsize,1.5\stepsize,...,180} {\node [right] at (\Angle:10) {\Angle};}
\end{tikzpicture}
\end{preview}
\end{document}
From this I would expect on ouput going from 15,45,…,180, but the output is the following.
This is a very,very small stepsize. If I write 0.5*\stepsize it tells me it is an illegal unit. Of course I could solve it by defining a half and a 1.5 step-size. Any ideas why this is happening?
Best Answer
The problem comes from the concatenation of
.5
and\stepsize
, that make.530
then1.530
.With
evaluate