# Accuracy of distance measures in geometry

In the following MWE, I set the distance from the edge of the paper to the body text to be 25mm.

\documentclass[a4paper]{article}
\usepackage[showframe, paper = a4paper, tmargin = 25mm]{geometry}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}


Yet both when I inspect the paper at full size in a pdf viewer like Evince and when I print the paper, I get 27mm when I measure with a ruler. Why? Is geometry inaccurate?

• How exactly are you measuring? – daleif Sep 2 '15 at 16:34
• @daleif The distance from the edge of the paper to the rule set by showframe. – Sverre Sep 2 '15 at 16:35
• There is some consistency here. When I follow this procedure to give me 16mm from the paper edge to the top rule of the header, I measure 18mm with a ruler. So the paper edge always seems to be 2mm further away from the header and body text than expected. – Sverre Sep 2 '15 at 16:38
• Measured how, on screen, print, where exactly does tmargin go? Edge of paper to edge of text box? Note that printing is often hit by a scaling artifact in the PDF previewer. – daleif Sep 2 '15 at 16:40
• Is your printer setting put to "Fit to margins", thereby shrinking the page? – Werner Sep 2 '15 at 16:41

tikz claims it is 25mm:

\documentclass[a4paper]{article}
\usepackage[showframe, paper = a4paper, tmargin = 25mm]{geometry}
\usepackage{lipsum,tikz}

\begin{document}

\tikz[overlay,remember picture] \draw[<->,red] (current page.north) --++(0,-25mm)node[midway]{25mm};
\lipsum
\end{document}


• Nice! Could you please elaborate? Are you drawing an arrow that's 25mm long, and then you visually see that the arrow heads touch the edges? – Sverre Sep 2 '15 at 16:55
• He he, that was what I was just going to do, – daleif Sep 2 '15 at 16:56
• Yes. You naturally have to trust the length calculations of tikz (I do). – Ulrike Fischer Sep 2 '15 at 16:56
• So - you're drawing a 25mm arrow that starts from the paper edge, right, and then you see where it ends up? (In this case at the showframe rule) – Sverre Sep 2 '15 at 16:58
• @daleif: I have a lot of training with such arrows. I'm placing them everywhere to check distances ;-) – Ulrike Fischer Sep 2 '15 at 16:58

Let's see. The first line of your output is 6.94444pt high (TeX told me so, it's the largest height of the characters in the line, which is ‘d’), which is preceded by glue deriving from \topskip in the amount of 3.05556pt, because

6.94444 + 3.05556 = 10

and 10pt is the standard value of \topskip for a ten point size document.

The distance from the paper edge to the first baseline is 25mm plus \topskip. Since 3.05556pt = 1.074mm, the distance from the paper edge to the top of the ‘d’ is 26.074mm.

On the other hand, if you measure the top of the opening ‘L’, which is just 6.83331pt, you have to add 0.11113pt = 0.039mm and you get 26.113mm.

If you measure from the top of ‘o’, which is 4.30554pt=1.513mm high, you get

25 + 1.074 + 1.513 = 27.587

millimeters.

So it's just a matter of deciding how you do the measurement.

If you set \topskip=0pt, say after \begin{document} in Ulrike's code, you get

so indeed the distance is measured from the paper edge to the top of the highest character on the line.

\documentclass[a4paper]{article}
\usepackage[showframe, paper = a4paper, tmargin = 25mm]{geometry}
\usepackage{lipsum,tikz}

\begin{document}
\topskip=0pt

\tikz[overlay,remember picture] \draw[<->,red] (current page.north)
--++(0,-25mm)node[midway]{25mm};
\lipsum
\end{document}


Of course, changing TeX's model just to comply with silly specifications is wrong, but sometimes needed.

Why does TeX use \topskip? Because in this way the position of the first baseline on the page will not depend on the line's contents (unless it's unusually large in height), which is not guaranteed if \topskip is set to zero.

• I understand, but you seem to be assuming here that I got 27mm by measuring from the paper edge to some character in the first line of the body text. I didn't. I measured from the paper edge to the rule given by showframe, which, as I understand you, includes \topskip. I can't explain why I get 27mm when measuring with a ruler when tikz says it's 25mm, but I do ... – Sverre Sep 2 '15 at 17:32
• @Sverre Check your printer and the print settings: sometimes printer drivers assume that A4 paper doesn't fit on A4 paper (the one of Adobe Reader used to). I'll remove the answer if you think it doesn't help. – egreg Sep 2 '15 at 17:36
• i checked all the settings I could find. But I'm actually very pleased that you guys are showing me that geometry gets it right. If the editor or the publisher complains, then I know I'm in the right (I was given permission to typeset my contribution for a book after I witnessed the horror of the first proofs handed to me a few days ago). – Sverre Sep 2 '15 at 17:38
• @Sverre: Measures on a print out are never accurate. Paper in a printer can move a bit. Print the example with the arrow (you can add some more, or rulers to get a better impression). – Ulrike Fischer Sep 2 '15 at 17:38
• @Sverre Try measuring the text width and height, that should be 147mm and 236.4mm respectively. If you find 135.2mm and 217.5mm, then you know that your printer scales down the PDF at 92%. – egreg Sep 2 '15 at 17:46