I wanted to use a pie chart in my document and tried this code example: http://www.texample.net/tikz/examples/pie-chart/
Now this seems to work perfectly with integer values but as for floating point I get errors.
Using this code
\begin{tikzpicture}[scale=3]
\newcounter{a}
\newcounter{b}
\foreach \p/\t in {1.5/type Windows, 10/type Linux}
{
\setcounter{a}{\value{b}}
\addtocounter{b}{\p}
\slice{\thea/100*360}
{\theb/100*360}
{\p\%}{\t}
}
\end{tikzpicture}
I get this error:
Package calc Error: `.' invalid at this point. See the calc package documentation for explanation. Type H for immediate help. … l.17 }
So I took a look into the documentation but could not find anything about this. I have also found this question here but using \real{1.5}
and also just {1.5}
did not help.
Best Answer
Counters only accept integer values.
You can use PGF tools or
expl3
: