19. Defining page size, margins and layout

You use several packages and settings in the project stylesheet to define the page size, margins and layout of the document. This topic goes through each of the settings to give you an idea of how this is done.

This should be done before customizing headers and footers,

## Setting the page size

Page size is defined when the LaTex document class, in this case `book`. In this example, the page size is defined as A4 which in the stylesheet is set as mm values: 210mm x 295mm. Alternately, you can use `letterpaper` for US letter size. Using the `book` class, this command sets the page size to A4, the base font size to 11pt and pagination to double-sided.

## Using the geometry package

The `geometry` package defines page dimensions. It provides many arguments but I only used the following two arguments:

• `vcentering` which sets vertical auto-centering
• `dvips` which writes the paper size in the dvi output

The `dvips` option is superceded if `pdflatex` is used but is necessary to generate a correct PostScript bounding box under standard LaTeX.

The `\geometry` command sets the `papersize` precisely, where

• `papersize` determines the size of the paper, which in this case is 210mm by 295mm.
• `total` defines the bounding box for the content area of the document. It is 160mm x 185mm, which results in pleasing margins.

## Defining offsets for headers and footers

You need to allow space for the headers and footer on the page. This can be done using the package `geometry` to define the offsets for headers and footers between the body text and the footers.

For example, use the following commands for an A4 page size.

## Defining text flow size

The height of the text flow on each page is defined using `textheight`. The original setting for text height was 24.5. The following command changes it to 23.5cm.

The width of the text flow is defined using `textwidth`. The original setting for text height was 16cm. The following changes it to 15cm.

## Defining the distance between text flow and headers and footers

The command `footskip` defines the distance between the footer and the text flow.

The commands `headheight` and `headsep` define the distance between the header and the text flow.

## Paragraph settings

You can indent the first line of paragraphs using the `paarindent` command. If you set the indentation to 0cm then the paragraphs do not have an indentation.

You can set the spacing between paragraphs in points using `\parskip`. In the following example, the distance is set to 3 pts.

Line spacing is determined by these commands. In the following example, line spacing is set to 1.5 using the `\setspace` package. Options are commented out.

Alternately, you can use the command `\baselinestretch` but you can adjust the command using `\renewcommand`.

Click to continue.