# To display the lengths in millimeters by default [duplicate]

All my length are in millimetres and the command \the\mylength outputs a length in points. Idem with the \layout from the package layout.

How can I display all theses lengths in millimetres (more easily understandable than the points).

• You can't do it with \the unless you change the source code of TeX and recompile it. There are other questions dealing with the problem of showing length in different units of measure. Apr 24 '14 at 12:59
• @egreg: The duplicate does not explain, how to reconfigure package layout. Apr 24 '14 at 13:50
• @HeikoOberdiek I'll add it as an example application. Apr 24 '14 at 13:57

There are many ways to convert a dimen with unit pt to another unit such as mm, see How do I convert pt/in/cm/mm to em/ex as they are defined at a given point in the document?, for example.

The following document prints the layout values of package layout's \layout in mm using e-TeX:

\documentclass{article}
\usepackage{layout}

\makeatletter
\renewcommand*{\lay@value}[2]{%
\strip@pt\dimexpr0.351459\dimexpr\csname#2\endcsname\relax\relax mm%
}
\makeatother

\begin{document}
\layout
\end{document}


• Is the number 0.351459 a conversion factor purely? because google says 1 pt=0.352778 mm.
– kaka
Mar 28 '16 at 23:40
• @kaka TeX's pt: 1 in = 2.54 mm = 72.27 pt, conversion factor = 0.351459. TeX's bp = 1 in = 2.54mm = 72 bp, conversion factor = 0.352778. The points in PostScript or PDF are TeX's bp. TeX uses the slightly smaller points as unit for displaying lengths. Mar 29 '16 at 4:42