Page Styles and Page Numbering
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. [FAQ: Page If you have created the document that has gradually been modified over numbering “⟨n⟩ the previous few sections, you may have noticed that the title page has no of ⟨m⟩ž ] 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⟩ }
Definition
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.
[FAQ: Page numbering by chapter ]
Example:
↑ Input
\author{ Me } \title{
A Simple Document } \maketitle
\pagenumbering{ roman } \tableofcontents
\begin{ abstract } This is the abstract. \end{ abstract }
\pagenumbering{ arabic } \chapter{ Introduction }
↓ Input
The scrbook class provides: \frontmatter
Definition
which switches to lower case Roman numeral page numbering, and \mainmatter
Definition
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 com- mands). The latter, \mainmatter , switches the numbering back on (unless otherwise suppressed by using the starred sectioning commands). In addi- tion, scrbook provides
\backmatter
Definition
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 sum- mary is usually incorporated into an introductory section.
Example:
↑ Input
\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 }
↓ Input
The headers and footers can be changed using the command \pagestyle{ ⟨style⟩ }
Definition
Individual pages can be changed using \thispagestyle{ ⟨style⟩ }
Definition
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⟩ }
Definition
if the twoside option has been passed to the class file (default for scrbook), or
\markright{ ⟨right head⟩ }
Definition
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 remain- ing pages are also plain, but these can be changed using the \pagestyle command. The scrbook class defaults to the headings style instead of plain. [FAQ: Alternative
head- and
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.
This book mostly uses the headings page style and the scrbook class with the oneside option, so there is no difference between odd and even page headers, 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:
↑ Code
\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 } Here is the first paragraph. The next chapter is Chapter ~\ref{ ch:another }
% Rest of document unchanged but % omitted for brevity. \end{ document }
↓ Code
(You can download or view the edited document.)