+3 votes
221 views
in Office by (242k points)
reopened
LaTeX: Formatting page numbers - this is how it works

1 Answer

+4 votes
by (1.6m points)
 
Best answer

Specify the position of the page number in the header or footer
So the counting of the page numbers does not start until the second page
How to combine Roman and Arabic numerals in LaTeX

There are some formatting commands for page numbers in LaTeX that you should definitely know..

image image

Page numbers should not be consecutive in every document or start on page 1. If you have directories before your own content, these are mostly declared with Roman numerals as the page number. The position of the page number is also relevant for some papers or reports. We'll show you everything you need to know about page numbers in LaTeX in this post.

Specify the position of the page number in the header or footer

By default, LaTeX inserts the page number in the middle of the footer. This is not always the requirement of the document and the page number should be displayed in a different position. The import of the package scrlayer-scrpage helps here . In order to be able to customize the header or footer, you have to import the package scrlayer-scrpage . We also use the scrheadings page style . You can also use \ clearpairofpagesstyles to delete all previously defined placeholders for the document class. Simply enter the two commands in the preamble of your LaTeX document:

\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}

\clearpairofpagestyles

Note : The scrlayer-scrpage package has been an integral part of KOMA-Script since 2013 (version 3.12 or higher) - no import has to take place here

In order to get the page number displayed in the desired position, the command \ pagemark must be inserted either inside, in the middle or outside in the header or footer. There are some things to note about this:

\ihead{Kopfzeile innen}
\chead{Kopfzeile Mitte}
\ohead{Kopfzeile außen}
\ifoot{Fußzeile innen}
\cfoot{Fußzeile Mitte}
\ofoot{Fußzeile außen}

Replace the text in the curly brackets with \ pagemark accordingly. You can also insert a text in front of it like "Page". If you want the page number with "Seite" in front of it in the bottom right of the footer, enter \ ofoot {page \ pagemark} in the preamble.

So the counting of the page numbers does not start until the second page

Often one does not want to generate the page number 1 directly on the first page, but only from page 2 or page 3. To achieve this, the command \ thispagestyle {empty} must first be entered on the empty pages . On the page where the count should start, enter \ setcounter {page} {1} . A minimal example:

\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
\thispagestyle{empty}
Hier steht Ihr Text.
\newpage
\setcounter{page}{1}
Hier steht Ihr Text.
\end{document}

In this way, the number of pages does not start until the second page. Of course, you can expand the whole thing as you wish and combine it with the formatting shown from the previous instructions..

How to combine Roman and Arabic numerals in LaTeX

The content should not always begin directly with Arabic numerals. Here, too, there is a remedy in LaTeX: The number style is changed using the commands \ pagenumbering {roman} and \ pagenumbering {arabic} . The whole thing again as an example for understanding:

\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
\pagenumbering{roman}
\section{Verzeichnisse}
Ihr Text.
\clearpage
\pagenumbering{arabic}
\tableofcontents
\section{Text}
Ihr Text.
\end{document}

The directories begin with Roman page numbers and then the actual content with Arabic lines. Again, you can combine what you have learned from the other instructions with this approach.


...