\typeout{***This vertical space will be \the\textheight}
印刷
***此垂直空间将为 153.64488pt
是否可以\the\textheight
以毫米为单位打印?
答案1
在以下帮助下如何准确打印长度并由用户控制舍入?,这里有一种方法:
\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}
包括.log
The length \advertwidth is 63.50034mm.