Next: , Previous: , Up: Page styles   [Contents][Index]

18.3 \pagestyle



Declaration that specifies how the page headers and footers are typeset, from the current page onwards.

A discussion with an example is below. Note first that the package fancyhdr is now the standard way to manipulate headers and footers. New documents that need to do anything other than one of the standard options below should use this package. See its documentation on CTAN.

Values for style:


The header is empty. The footer contains only a page number, centered.


The header and footer is empty.


Put running headers and footers on each page. The document style specifies what goes in there; see the discussion below.


Custom headers, specified via the \markboth or the \markright commands.

Some discussion of the motivation for LaTeX’s mechanism will help you work with the options headings or myheadings. The document source below produces an article, two-sided, with the pagestyle headings. On this document’s left hand pages, LaTeX wants (in addition to the page number) the title of the current section. On its right hand pages LaTeX wants the title of the current subsection. When it makes up a page, LaTeX gets this information from the commands \leftmark and \rightmark. So it is up to \section and \subsection to store that information there.

  ... \section{Section 1} ... \subsection{Subsection 1.1} ...
\section{Section 2}
\subsection{Subsection 2.1}
\subsection{Subsection 2.2}

Suppose that the second section falls on a left page. Although when the page starts it is in the first section, LaTeX will put ‘Section 2’ in the left page header. As to the right header, if no subsection starts before the end of the right page then LaTeX blanks the right hand header. If a subsection does appear before the right page finishes then there are two cases. If at least one subsection starts on the right hand page then LaTeX will put in the right header the title of the first subsection starting on that right page. If at least one of 2.1, 2.2, …, starts on the left page but none starts on the right then LaTeX puts in the right hand header the title of the last subsection to start, that is, the one in effect during the right hand page.

To accomplish this, in a two-sided article, LaTeX has \section issue a command \markboth, setting \leftmark to ‘Section 2’ and setting \rightmark to blank. And, LaTeX has \subsection issue a command \markright, setting \rightmark to ‘Subsection 2.1’, etc.

Here are the descriptions of \markboth and \markright:


Sets both the right hand and left hand heading information for either a page style of headings or myheadings. A left hand page heading left-head is generated by the last \markboth command before the end of the page. A right hand page heading right-head is generated by the first \markboth or \markright that comes on the page if there is one, otherwise by the last one that came before that page.


Sets the right hand page heading, leaving the left unchanged.

Unofficial LaTeX2e reference manual