Here is a minimal working example:
\documentclass{article}
\begin{document}
\newdimen\somelength
\somelength=1pt
\begin{picture}(0,0)
\put(\somelength,0){Some text}
\end{picture}
\end{document}
The above code compiles successfully on Linux (on WSL 2 Ubuntu and on my laptop running Deepin Linux), but not on Windows. On Windows 10 the compiler gives an error message:
Illegal unit of measure (pt inserted). \put(\somelength,0){3}
I tried pdfLaTeX and XeLaTeX, and they both work on Linux, while giving the same error message on Windows. I tried adding
\setlength{\unitlength}{1pt}
before the picture environment, but I still got the error message. But if I change
\put(\somelength,0){Some text}
to
\put(3,0){Some text}
it works just fine. It seems that the \put command doesn't accept variables as its coordinates.
[EDIT]
As it turns out, the problem was actually caused by me using an older version of TeX (before Oct 2020), and in that version only numbers are allowed as coordinates, so something like
\put(1.2em,1.5ex){text}
would result in an error. However, in later versions it became valid (which is why I have been using it for so many times), and updating TeX would solve the problem. It has nothing to do with different operating systems.
\putwith a dimension that has a unit. But\putexpects a value without unit at this position. If you type\put(1pt,0){Some text}, this should output the same error. – Jasper Habicht Jul 07 '22 at 14:17\put. – Jasper Habicht Jul 07 '22 at 14:20\putexpected just a number. The code was changed to acceptetexlength expressions. (ltnews 32). – campa Jul 07 '22 at 15:33