2 Answers
2

The question of page size parameters is quite complicated. LaTeX2e introduced the parameters

\paperwidth
\paperheight

and the document class options to set the paper size. Previously the pagination parametes were tailored for US Letter paper and in Europe it was common to use document style options such as a4.sty.

This has actually no influence on the output, that in the days of DVI format was deferred to the printing driver. Typically one had also to pass an option to dvips for choosing the paper size (or set it in the configuration file of dvips).

With the advent of pdftex there was a problem: the PDF format must know in advance what paper format is to be used. So the new parameters \pdfpagewidth and \pdfpageheight were introduced. They are set when the pdflatex format is created. Indeed TeX Live and MiKTeX have preferences that are set at installation time for choosing the "normal" paper size. This has no influence on the default paper size for LaTeX, which always is letterpaper, so the a4paper option must be specified.

Thus a PDF created with pdflatex on a TeX Live where A4 is the default paper size, will output A4 paper format also when the document class option letterpaper is specified.

One can override the default setting by passing explicitly the paper dimensions to the parameters, say

\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}

for US Letter paper. However a better way is to say

\usepackage[letterpaper,pass]{geometry}

where the pass option tells the package to only set the paper size (that is, the value of the two above parameters). The package knows when the typesetting engine is pdflatex, latex, xelatex or lualatex and do the right thing.

The standard LaTeX classes have a limited knowledge of paper sizes:

letterpaper a4paper a5paper b5paper legalpaper executivepaper

while geometry knows much more. Also memoir knows many paper formats; this class and the geometry package allow for specifying arbitrary paper sizes (under the constraints of TeX, which doesn't manage dimensions larger than 16384pt, slightly less than 19 feet or 6 meters).

Thus the best way to set the paper format is with geometry (or memoir, that has a different model):

\usepackage{geometry}
\geometry{paperwidth=18cm, paperheight=24cm}

possibly adding other options for setting margin widths and so on; consult the manual. One can also specify imposition: if we want to print the format above on A4 paper for later cropping, it's possible to say

oging off topic here - but then it outlines with my main problemin researching: not everyone who writes beautiful code with maximum efficiency is able to document too. People writing manuals with a solid knowledge of the topic are even more rare. An answer like this stands out as an example. At least for me.
–
el_olmoJun 27 '12 at 22:38

@el_olmo I have to agree, even though I have had my own humble try at an answer that falls totally flat in comparison. Congratulations, egreg, for hitting the 100k reputation mark BTW. Deservedly so I would say.
–
ChristianJun 28 '12 at 10:46

The usual length controlling the page dimensions are called \paperwidth and \paperheight for reasons that elude me (especially since they are really not the stock paper dimensions but the page dimensions). You can set them directly but this will most probably ruin your page layout. As Peter mentioned, the usual way to change various layout-related lengths (not only document-wide but in newer versions also for parts of a document) is the geometry package and it has a very good documentation. With geometry comes a kind of auto-completion, where you only change some parameters and the rest is set automatically.

There is also the typearea package that is part of komascript but can be used independently. It features a quick way to set up a pleasing type area using a kind of grid layout.

A nice overview on page layout can be found in the first part of the memoir documentation (texdoc memman).