Others have asked about getting length as a number; the solutions there (using \strip@pt
to remove the units, or using \number
to convert to an integer number of sp
units) work fine for a regular length but not for one with skip/glue (as described in What is glue stretching?).
For example, the following
\documentclass{article}
\begin{document}
\newlength\testlength
\setlength\testlength{10pt plus 2pt minus 1pt}
length: \the\testlength\par
\textbackslash strip@pt: \csname strip@pt\endcsname\testlength\par
\textbackslash number: \number\testlength\par
\end{document}
prints:
length: 10.0pt plus 2.0pt minus 1.0pt
\strip@pt: 10 plus 2.0pt minus 1.0pt
\number: 655360