\typeout{***This vertical space will be \the\textheight}
prints
***This vertical space will be 153.64488pt
Is it possible to print \the\textheight
in mm?
With some help from How to print a length accurately and with user-controlled rounding?, here is a way:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
% https://tex.stackexchange.com/a/123283/5764
\DeclareExpandableDocumentCommand { \printlengthas } { m m }
{ \dim_to_decimal_in_unit:nn {#1} { 1 #2 } #2 }
\ExplSyntaxOff
\begin{document}
\newlength{\advertwidth}
\setlength{\advertwidth}{2.5in}
\printlengthas{\advertwidth}{in}
\printlengthas{\advertwidth}{mm}
\typeout{The length \string\advertwidth\space is \printlengthas{\advertwidth}{mm}.}
\end{document}
The .log
includes
The length \advertwidth is 63.50034mm.
Wouldn't this be much easier?
\documentclass{article}
\usepackage{lengthconvert}
\begin{document}
\Convert[unit = mm]{\textheight}
\end{document}
EDIT: Oh, I see, this is not a typeout
...
\textheight = 1564.90157mm = 156.490157cm
!! Possibly there is inconsistency between recent l3 packages and lengthconvert.sty.
Oct 2, 2015 at 13:44