I'm a Canadian based in Berlin, Germany. My day job is a Technical Writer in the API space. I write about topics such as technology, usability, creative writing and Canadian history. All views mine. I tweet at @glennjlea. Read more about me here or at LinkedIn.
Site version: 3.0

Page headers and footers in LaTeX are defined by the \pagestyle and \pagenumbering commands.

• \pagestyle defines the general contents of the headers and footers, such as where the page numbers will be printed.

• \pagenumbering defines the format of the page number.

Using the fancyhdr package, you can create customized headers and footers. I have added this to the stylesheet so it can be applied to all chapters in the project.

To make the headers and footers more useful, use the fancyhdr package. The package fancyhdr is used with the page style fancy.

Rather than using standard header provided by default, using this package to have different headers and footers for odd and even pages, different headers and footers for chapter pages and control over font sizes, and so on.

The following commands defines the headers and footers of the document.

These commands are explained below.

Note: Information about the fancyhdr package is available here.

### Font definitions

In the first command I defined the font as 9 pt Helvetica. This is defined using the short form phv. The text of the headers and footers use the titlepagecolor for the background,

The titlepagecolor which has been defined elsewhere in the stylesheet as:

### Injecting chapter and section text into the header

The text of a chapter heading is injected into the header using \chaptermark. \thechapter pulls in the chapter number. Similarly, the text of the section heading is pulled in using \sectionmark. The macro thesection pulls in the number of the section.

### Eliminating horizontal lines

I didn’t want to have a decorative line to separate the header from the body text so I eliminated using the 0pt value for header and footer rule width.

I wanted the footer to have only a page number and a copyright notice on each page.

## Inserting fancyhead into the root file

After defining the headers and footers in the stylesheet, you insert the header into the root file after the \frontmatter environment command as follows.

It is important where you place this command. The LaTeX typesetter needs to know how to build the headers and footers before any geometry is defined. After calling the \fancyhead command, you can go ahead and input your files, and so forth.

The following shows the resulting pages with headers and footers.

Sample chapter page with header and footer.

Sample even page.