About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account


5.7 Page Styles and Page Numbering

You may have noticed that the documents you have created have all had their page numbers automatically inserted at the foot of most of the pages[Page numbering “<n> of <m>]. If you have created the document that has gradually been modified over the previous few sections, you may have noticed that the title page has no header or footer, the table of contents starts on page 1, the abstract page has no page number, and the pages after the abstract start on page 1 and continue incrementally onwards from that point. All the page numbers are Arabic numerals. This can be changed using the command:

\pagenumbering{<style>}

where <style> can be one of:

arabic
Arabic numerals (1, 2, 3, ...)
roman
Lower case Roman numerals (i, ii, iii, ...)
Roman
Upper case Roman numerals (I, II, III, ...)
alph
Lower case alphabetical characters (a, b, c, ...)
Alph
Upper case alphabetical characters (A, B, C, ...)

Traditionally, the front matter (table of contents, list of figures etc) should have lower case Roman numeral page numbering, while the main matter should be in Arabic numerals[Page numbering by chapter].

Example:

\author{Me}
\title{A Simple Document}
\maketitle

\pagenumbering{roman}
\tableofcontents

\begin{abstract}
This is the abstract.
\end{abstract}

\pagenumbering{arabic}
\chapter{Introduction}

The scrbook class provides:

\frontmatter

which switches to lower case Roman numeral page numbering, and

\mainmatter

which switches to Arabic numeral page numbering. These two declarations also change the way the sectioning units, such as \chapter and \section, appear. The former, \frontmatter, suppresses the numbering (regardless of whether or not you've used the starred version of the sectioning commands). The latter, \mainmatter, switches the numbering back on (unless otherwise suppressed by using the starred sectioning commands). In addition, scrbook provides

\backmatter

which doesn't affect the page numbering but, like \frontmatter, suppresses the sectional unit numbering.

Note:

The abstract environment isn't defined by the scrbook class, as a book summary is usually incorporated into an introductory section.

Example:

\documentclass[12pt]{scrbook}

\title{A Simple Document}
\author{Me}

\begin{document}
\maketitle

\frontmatter
\tableofcontents

\chapter{Summary}
A brief document to
illustrate how to use \LaTeX.

\mainmatter

\chapter{Introduction}
\label{ch:intro}

\end{document}

The headers and footers can be changed using the command

\pagestyle{<style>}

Individual pages can be changed using

\thispagestyle{<style>}

Standard styles are:

empty
No header or footer.
plain
Header empty, page number in footer.
headings
Header contains page number and various information, footer empty.
myheadings
Header specified by user, footer empty.

If the myheadings style is used, the header information can be specified using:

\markboth{<left head>}{<right head>}

if the twoside option has been passed to the class file (default for scrbook), or

\markright{<right head>}

if the oneside option has been passed to the class file (default for scrartcl and scrreprt).

The scrreprt class file uses the empty style for the title and abstract pages and plain for the first page of each new chapter. By default the remaining pages are also plain, but these can be changed using the \pagestyle command. The scrbook class defaults to the headings style instead of plain.

[Alternative head- and footlines in LaTeX]The KOMA-Script bundle provides a way to define new page styles, but that's beyond the scope of this introductory tutorial. See the KOMA-Script documentation for further details if you are interested.

The A4 version of this book mostly uses the headings page style. If you look at it, you will see that the chapter number and title appear on the top left and the page number appears in the top right of most pages. The oneside option was used, so there is no difference between the formatting of odd and even numbered pages. Whereas the paperback version uses the twoside option, so the odd pages display the chapter number and title and the even pages display the current section header and title. The on-screen PDF version of this book uses a page style I defined myself that incorporates a navigation bar in the footer.

Exercise 14: Page Styles and Page Numbering

Try modifying your code so that it uses the scrbook class, \frontmatter and \mainmatter. Replace the abstract environment with an unnumbered chapter, as shown below. Again, changes made from the previous document are illustrated like this:


\documentclass[12pt]{scrbook}

\usepackage{datetime}

\pagestyle{headings}

\title{A Simple Document}
\author{Me}

\begin{document}

\maketitle

\frontmatter
\tableofcontents

\chapter{Summary}
A brief document to
illustrate how to use \LaTeX.

\mainmatter

\chapter{Introduction}
\label{ch:intro}

\section{The First Section}

This is a simple \LaTeX\␣document.
Here is the first paragraph.
The next chapter is Chapter~\ref{ch:another}
and is on page~\pageref{ch:another}.
The next section is Section~\ref{sec:next}.

% Rest of document unchanged but
% omitted for brevity.
\end{document}

(You can download or view the edited document.)


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs