Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've got a comprehension question: are the commands \pageheight and \pagewidth only available if the layout package is loaded?

Are there any more simple ways to alter page height and width?

I find it a bit hard to figure out, if it is just my error, or if something doesn't work, and I spend a lot of time figuring out: 'is this not so well explained or am I just too… whatever?'.

share|improve this question
2  
I would recommend you use the geometry package. So \usepackage[paperwidth=<length>,paperheight=<length>}]{geometry}. –  Peter Grill Jun 27 '12 at 19:19

2 Answers 2

up vote 16 down vote accepted

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

\usepackage{geometry}
\geometry{a4paper, layoutwidth=18cm, layoutheight=24cm}
share|improve this answer
    
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_olmo Jun 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. –  Christian Jun 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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.