# Why is 1 cm in tikzmath 28.5 cm long in a tikzpicture?

I define in tikzmath a variable of 1 cm.

\tikzmath{
\oneCm = 1cm;
}

If I draw a line whose length is 1cm, and a second line whose length is \oneCm, they are not of the same length!
It's about 28.5 times bigger. Why?

MWE

\documentclass[tikz]{standalone}

\usepackage{tikz}
\usetikzlibrary{math}

\tikzmath{
\oneCm = 1cm;
}

\begin{document}
\begin{tikzpicture}
\draw[red,thin] (0, 0) -- ++(1cm,0) node[right]{1cm};
\draw[blue,thin] (0, 10pt) -- ++(\oneCm,0) node[right]{oneCm};
\draw[green,thin] (0, -10pt) -- ++(28.5cm,0) node[right]{28.5cm};
\end{tikzpicture}
\end{document}

The result from tikzmath will be in pt:

\documentclass[tikz]{standalone}

\usetikzlibrary{math}

\tikzmath{
\oneCm=1cm;
}

\begin{document}
\begin{tikzpicture}
\draw[red,thin] (0, 0) -- ++(1cm,0) node[right]{1cm};
\draw[blue,thin] (0, 10pt) -- ++(\oneCm pt,0) node[right]{oneCm};
\draw[green,thin] (0, -10pt) -- ++(28.5cm,0) node[right]{28.5cm};
\end{tikzpicture}
\end{document}

• Strange, but correct! Thx Commented May 19 at 11:57
• @JosephMarie Quote from the tikz manual: "As was explained earlier, the parser commands like \pgfmathparse will always return a result without units in it and all dimensions that have a unit like 10pt or 1in will first be converted to TEX points (pt) and, then, the unit is dropped." Commented May 19 at 12:08
• pgfmath is limited in range by using length registers (which is why I call it a dancing bear). 1pt is the middle of the range. While 1cm is the default for tikz, it can be changed using [scale=...] etc. Commented May 19 at 14:17
• @JohnKormylo scale doesn't do that. You can change the unit, but you need to say e.g. x=??,y=??. scale scales things after,
– cfr
Commented May 19 at 14:52