TCM
UoC crest

LaTeX and A4 paper

For reasons lost in the depths of history, LaTeX has two concepts of page size. One is used for determining the page layout, the other for the final request for a particular media size. If one is not careful, these can be different. In particular, LaTeX classes always default to US letter, whereas TeX (in Europe) is generally set up to default to A4. TeX distributions, such as TeX Live, do not set all defaults to the same size. This may be to discourage people from relying on defaults which are likely to vary depending on which side of the Atlantic one is sitting.

US letter paper is about 6mm wider than A4. This rarely matters. It is also about 17mm shorter than A4, which can push page numbers very close to the bottom of pages.

Things Going Wrong

\documentclass{article}
\usepackage{graphicx}

\begin{document}

Hello.

\end{document}

This innocent-looking document is quite confusing. If converted to PDF using dvipdfm, then one gets A4 paper. A slightly abbreviated demonstration of this is:

$ latex test.tex 
Output written on test.dvi (1 page, 220 bytes).
$ dvipdfm test.dvi
$ pdfinfo test.pdf 
Page size:      595.28 x 841.89 pts (A4)
However, if one chooses to use pdflatex, the result is different:
$ pdflatex test.tex 
Output written on test.pdf (1 page, 11118 bytes).
$ pdfinfo test.pdf 
Page size:      612 x 792 pts (letter)

(Note that in the absence of the graphicx package, both of the above will produce A4 output.)

The Solution

The most robust solution is:

Note that using the a4wide package is not a solution at all. If you wish to use this (ancient) package, it should be used in combination with the a4paper class option as above. Note also that geometry with no other options does change one's layout, and is similar to a4wide.

\documentclass[a4paper]{article}
\usepackage{graphicx}

\begin{document}

Hello.

\end{document}

More detail

For a better view of what is happening, one can try a test document such as:

\documentclass[a4paper]{article}
\usepackage{graphicx}

\begin{document}

Text width: \the\textwidth

Paper width: \the\paperwidth

PDF page width: \the\pdfpagewidth

\end{document}

This gives a text width of 345pt. When used with a4wide this increases to 424pt, and when used with geometry it is 418pt. If one omits all packages and uses the class option a5paper, then trouble is clearly visible as the resulting document has a paper width of 421pt (A5), but a PDF page width of 597pt (A4). If one omits the class option too, then the paper width is set to 614pt (US letter), but the PDF page width remains A4.