can anyone please explain why is the following code not working?
Code: Select all
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\width{2.5}
\def\unit{0.5*\width}
\foreach \p in {0,\unit,...,\width}
\draw (\p,0) -- (\p,1);
\end{tikzpicture}
\end{document}
Code: Select all
! Illegal unit of measure (pt inserted).
<to be read again>
*
l.13 \draw (\p,0) -- (\p,1);
? x