Document 381

How to specify header/footer information for typesetting

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

LaTeX automatically creates headers and footers from the information in the typesetting specifications and the section headings in your document. You can override the headers and footers that are created automatically by adding the fancyhdr package and making some changes to your document.

Specifying header/footer information for the entire document

By modifying the preamble of your document with TeX commands, you can specify the header/footer information for the entire document. These instructions explain how to specify a header that has the title of the work on the right and a footer that has the author's name on the left and the page number on the right. You can modify the commands in step 4 to create the header and footer you want.

  1. Add the fancyhdr package to your document.
  2. From the Typeset menu, choose Preamble.
  3. Click the mouse in the entry area.
  4. At the end of the entry area, add new lines to specify the content of the right, center, and middle areas of the header and footer (any information beginning with % is a comment and is not necessary):

    \pagestyle{fancy}

    \lhead{} %Leave the left of the header empty

    \chead{} %Leave the center of the header empty

    \rhead{Title of This Document} %Display this text on the right of the header

    \lfoot{By Author} %Display this text on the left of the footer

    \cfoot{} %Leave the center of the footer empty

    \rfoot{Page:\ \thepage} %Print the page number in the right footer

    \renewcommand{\headrulewidth}{0pt} %Do not print a rule below the header

    \renewcommand{\footrulewidth}{0pt} %Do not print a rule above the footer

  5. Choose OK.

Specifying header/footer information for selected pages

Occasionally, the typesetting specifications override the page style for certain pages, especially exceptional pages such as the title page or the first page of a chapter or section. Instead of specifying the headers and footers for the entire document, you can specify them for a particular page by placing TeX commands in the body of the document instead of the preamble. As for the above instructions, you can modify the commands in step 3 as necessary.

  1. Add the fancyhdr package to your document.
  2. Place the insertion point on the page for which you want to specify header/footer information.
  3. Enter an encapsulated TeX field containing these lines to specify the content of the right, center, and middle areas of the header and footer (any information beginning with % is a comment and is not necessary):

    \thispagestyle{fancy}

    \lhead{} %Leave the left of the header empty

    \chead{} %Leave the center of the header empty

    \rhead{Title of This Document} %Display this text on the right of the header

    \lfoot{By Author} %Display this text on the left of the footer

    \cfoot{} %Leave the center of the footer empty

    \rfoot{Page:\ \thepage} %Print the page number in the right footer

    \renewcommand{\headrulewidth}{0pt} %Do not print a rule below the header

    \renewcommand{\footrulewidth}{0pt} %Do not print a rule above the footer

  4. Choose OK.

Last revised 01/19/06

This document was created with Scientific WorkPlace.