Document 488

The LaTeX fancyhdr package

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

The fancyhdr package is a page layout customizing package that replaces the fancyheadings package. It handles footers and headers efficiently, but also works with placement of floats. With the package, you can define headers and footers with multiple parts and on multiple lines, specify header and footer information, place rules in headers and footers, and use a header and footer width different from that of the text. Additionally, with the package you can use different headers and footers for even and odd pages, first pages of chapters, and pages containing floats. You can move the location of page numbers, increase the space used for headers and footers, and produce dictionary-style headers reflecting the first and last words on a page. You can also suppress headers and footers on selected pages. Fancyhdr also provides control over fonts and upper- and lowercase letters.

No package options are available. However, the package uses a simplified syntax for entering commands.

How to define the content of headers and footers

  1. Add the fancyhdr package to your document.
  2. Specify a new header and footer setup in the document preamble:
    1. From the Typeset menu, choose Preamble.
    2. Click the mouse in the entry area.
    3. On a new line, type \pagestyle{fancy}.
  3. Define the content of the header:
    1. On a new line, type \lhead{text} where text is the information you want left-justified in the header.
    2. On a new line, type \chead{text} where text is the information you want centered in the header.
    3. On a new line, type \rhead{text} where text is the information you want right-justified in the header.
    4. If you want a rule under the header, type \renewcommand{\headrulewidth}{x} where x is the point size of the rule you want.
      Note The text argument can contain TeX commands.
  4. Define the content of the footer:
    1. On a new line, type \lfoot{text} where text is the information you want left-justified in the footer.
    2. On a new line, type \cfoot{text} where text is the information you want centered in the footer.
    3. On a new line, type \rfoot{text} where text is the information you want right-justified in the footer.
    4. If you want a rule over the footer, type \renewcommand{\footrulewidth}{x} where x is the point size of the rule you want.
      Note The text argument can contain TeX commands.
  5. Choose OK.

How to define the content of different headers and footers for even and odd pages

Defining different headers and footers for double-sided documents increases the definitions, some for even (left) and others for odd (right) pages. You can occasionally combine definitions in the same command by specifying when they should appear. The package uses these settings:

Setting Prints on
E Even page
O Odd page
L Left
C Center
R Right
H Header
F Footer

  1. Add the fancyhdr package to your document.
  2. Specify a new header and footer setup in the document preamble:
    1. From the Typeset menu, choose Preamble.
    2. Click the mouse in the entry area.
    3. On a new line, type \pagestyle{fancy}.
    4. On a new line, type \fancyhf{} to clear all fields in the header and footer.
  3. Specify the header:
    1. On a new line, type \fancyhead[location]{text} where location specifies the page and field of the header and text specifies the information you want to appear.
      For example, the command \fancyhead[LE,RO]{\thepage} places the page number in the left field of the header on even (left) pages and in the right field of the header on odd (right) pages.
    2. Repeat step a as needed to specify the header fields on both even and odd pages.
  4. Specify the footer:
    1. On a new line, type \fancyfoot[location]{text} where location specifies the page and field of the footer and text specifies the information you want to appear.
    2. Repeat step a as needed to specify the footer fields on both even and odd pages.
  5. Choose OK.

The package documentation contains complete instructions and useful diagrams of LaTeX page layout elements. The installation program places this package in the TCITeX/TeX/LaTeX/contrib/fancyhdr directory.

Last revised 06/13/06

This document was created with Scientific WorkPlace.