MWE (copied from TikZ manual):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}
\tikzmath{
int \x;
for \k in {0,10,...,350}{
if \k>260 then { let \c = orange; } else {
if \k>170 then { let \c = blue; } else {
if \k>80 then { let \c = red; } else {
let \c = green; }; }; };
{
\path [fill=\c!50, draw=\c] (\k:0.5cm) -- (\k:1cm) --
(\k+5:1cm) -- (\k+5:0.5cm) -- cycle;
};
};
}
\end{tikzpicture}
\end{document}
This gives me the following error message:
! Undefined control sequence.
\tikz@math@if@@doifelse ...gfmathfloatparseactive
\pgfmathfloattofixed {\pgf...
l.19 }
I have the same problem with other code that uses if
in tikzmath
and this also applies to TeX files that used to compile without problems some time ago. Is the current (MiKTeX) version of TikZ broken?
I'm using MikTeX 2.9 on Windows 10, packages have been updated a few minutes ago, just in case.
UPDATE: Just to make this clearer - even this simple tikzmath
code gives the same error message.
\tikzmath{
\x = 42;
if \x == 42 then {
{\fill (0,0) circle (1cm);};
};
}
\x
, which was declared inint \x;
, is not used here either.\x
is not the problem. The error message occurs wheneverif
is used. See my update.\x
was the problem. This was just to substantiate something is odd here.