You’ve spent hours wrestling with your thesis layout. The bibliography compiles, the equations look pristine, but when you open the PDF, the title page is stubbornly displaying a "1" at the bottom. You need to remove it, or perhaps start the numbering at "i" for the front matter while keeping the main text in Arabic numerals. Sound familiar?
For new users, numbering pages in LaTeX often feels like a black box. Unlike Word, where you click a button and magic happens, LaTeX requires you to understand how it manages page counters and styles under the hood. But here’s the good news: once you grasp these mechanisms, you have far more control than you would ever get in a word processor.
This guide is designed to be your definitive resource for latex page numbering. Whether you are a graduate student formatting a dissertation or a researcher preparing a journal article, we will walk through every common scenario—from the basics of default behavior to advanced customization using fancyhdr. No prior coding expertise is required; just follow the steps.
The Basics of LaTeX Page Numbering
Before we start hacking away at code, it’s essential to understand how LaTeX thinks about pages. In my 15 years of technical writing, I’ve found that most numbering issues stem from a fundamental misunderstanding of the relationship between the counter (the internal number) and the style (how that number appears).
Understanding Default Behavior
By default, LaTeX starts page numbering at 1 for the main text. However, this “main text” designation can be tricky. In classes like article, the very first page of your document is typically numbered automatically. In report or book classes, the title page usually doesn’t show a number at all, while the subsequent pages might start with Roman numerals or Arabic numerals depending on the class defaults.
The foundation of all this control lies in the concept of pagestyle. A pagestyle determines not just if a number appears, but where it sits and what it looks like.
Consider this simple distinction:
- Default Output: Your document starts with page 1 on the title page.
- Desired Output: Title page has no number; the first page of the abstract is page "i"; Chapter 1 starts at page "1".
To bridge this gap, you need to manipulate two things: the style (using \pagestyle) and the counter value (using \setcounter).
Using \pagestyle Commands
LaTeX provides three primary built-in page styles that handle numbering differently:
| Page Style | Description | Typical Use Case |
|---|---|---|
plain | Number appears at the bottom center. | Standard for most article documents. |
headings | Section title in header, number in footer. | Academic papers requiring running heads. |
empty | No header, no footer. | Title pages or pages where numbers are forbidden. |
You can apply these globally by placing \pagestyle{plain} in your preamble, or locally for a single page using \thispagestyle{empty}. |
In my experience, beginners often confuse \pagestyle with \pagenumbering. Remember: \pagestyle controls the appearance and position, while \pagenumbering controls the format (Roman, Arabic, alphabetic) of the number itself. Using them together is where the real power lies.
How to Start Page Numbering at 1
One of the most frequent pain points I encounter is the desire to start numbering at 1, only after a few preliminary pages. Or perhaps you want to skip the title page entirely. Let’s tackle these specific scenarios.
Skipping the Title Page
Imagine you’re writing a report. You want a clean cover page with your name and title, but absolutely no page number cluttering the bottom. By default, LaTeX might put a "1" there. How do we fix this?
The solution is elegant and simple: use \thispagestyle{empty} immediately after your title command.
\documentclass{article}
\begin{document}
% Your title setup
\title{My Thesis}
\author{John Doe}
\maketitle
% This suppresses the number on the title page specifically
\thispagestyle{empty}
% The next page will start numbering naturally
\section{Introduction}
Here is the start of my content...
\end{document}
Why does this work? \maketitle often sets the page style to plain internally. By calling \thispagestyle{empty} after \maketitle, you override that setting for just that single page. The counter still increments to 2 for the next page, but visually, the title page is number-less.
Pro Tip: If you are using the
bookorreportclass, the title page is usuallyemptyby default. But forarticleclass documents, you almost always need this explicit command.
Starting Numbering from a Specific Page
What if you need to start numbering at 1, but only on the third page? This is common in theses where the Abstract and Table of Contents precede the main body.
To achieve this, you need to manually reset the page counter. We use the \setcounter{page}{1} command. However, simply resetting the counter isn’t enough if you also want to change the format (e.g., from Roman to Arabic).
Here is the logic flow for a complex scenario:
- Write your front matter (Abstract, TOC).
- Insert a
\newpage. - Reset the counter:
\setcounter{page}{1}. - Change the numbering format:
\pagenumbering{arabic}.
Note that \pagenumbering automatically resets the page counter to 1 and changes the format. So, in many cases, just saying \pagenumbering{arabic} before your first chapter is sufficient. But if you need more granular control—like starting at page 5—you must combine it with \setcounter{page}{5}.
Implementing Custom and Mixed Page Numbering
Professional documents, especially theses and books, rarely use a single numbering style throughout. It is conventional to use Roman numerals (i, ii, iii) for the front matter and Arabic numerals (1, 2, 3) for the main text. Mastering latex custom page numbering is essential for meeting these academic standards.
Roman Numerals for Front Matter
If you are using the book or report class, LaTeX has built-in commands to handle this convention automatically: \frontmatter and \mainmatter.
\documentclass{book}
\begin{document}
\frontmatter
% This sets page numbering to lowercase Roman numerals
\title{My Book}
\maketitle
\tableofcontents
\mainmatter
% This switches to Arabic numerals and resets page counter to 1
\chapter{Introduction}
This is the main text.
\end{document}
When you use \frontmatter, LaTeX switches to Roman numerals. When you switch to \mainmatter, it switches to Arabic numerals and restarts the count at 1. This is the most robust method for book-like structures.
For article class documents, which don’t have these semantic commands, you have to do it manually:
% Start with Roman numerals
\pagenumbering{roman}
\tableofcontents
% Switch to Arabic for main text
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}
\section{Introduction}
Handling Appendices and Section Numbers
Sometimes, style guides require appendices to restart their own numbering sequence. For instance, Appendix A might start at page 1 again, or you might want section-specific numbering like "1-1" for Chapter 1, Page 1.
For simple appendix resets, you can place \pagenumbering{arabic} and \setcounter{page}{1} right before your appendix begins.
However, if you need complex dependencies—such as numbering figures relative to chapters, or handling intricate header layouts where the page number interacts with section numbers—you might need packages like chngcntr. While this is an advanced topic, understanding that the page counter is just a variable allows you to manipulate it freely. As one researcher noted in a Tex Stack Exchange thread, "The page counter is just a number; treat it like any other variable in your document flow."
Advanced Header and Footer Page Number Placement
So far, we’ve discussed what numbers appear. Now, let’s talk about where they appear. Standard LaTeX positions are fine, but often you need header footer page number latex customization to meet specific journal or university guidelines.
Positioning Page Numbers with Fancyhdr
The fancyhdr package is the industry standard for this task. It gives you precise control over headers and footers.
Here is a minimal working example that places the page number in the bottom right corner:
\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
% Clear default headers and footers
\fancyhf{}
% Place page number in the bottom right
\fancyfoot[R]{\thepage}
% Optional: Add chapter/section name to header
\fancyhead[L]{\leftmark}
\begin{document}
\section{First Section}
Text goes here...
\end{document}
In this code:
\fancyhf{}clears all existing header and footer content.\fancyfoot[R]{...}sets the right-side footer.\thepageis the macro that prints the current page number.
You can also use \fancyfoot[LO,RE]{\thepage} to place page numbers on the outside edges (left on odd pages, right on even pages), which is ideal for double-sided printing.
Troubleshooting Missing or Broken Page Numbers
If you’ve followed all the above steps and your page numbers are still missing, don’t panic. This is a common issue, often referred to as "overleaf latex page numbers not showing."
Here is my checklist for debugging:
- Check for
\pagestyle{empty}: Look through your code. Did you accidentally set the global style to empty? Sometimes a stray\pagestyle{empty}in a macro or package configuration can wipe out all numbers. - Conflicting Packages: Packages like
geometry(for margins) ordraftwatermarkcan sometimes interfere with header/footer positioning. Try commenting them out one by one to isolate the conflict. - Overriding Styles: If you use
fancyhdr, ensure you have called\pagestyle{fancy}. If you switch back to\pagestyle{plain}later in the document, it will revert to the default centered footer, which might look different than what you expect. - Title Page Confusion: Remember that
\maketitleoften overrides the global page style for the first page. If you want numbers on the second page but not the first, ensure you are using\thispagestyle{empty}rather than relying solely on global settings.
FAQ
How to remove page number from first page in LaTeX?
Use \thispagestyle{empty} immediately after your title command (e.g., \maketitle). This suppresses the header and footer for that specific page only, without affecting the page counter.
How to put Roman numerals for preface and Arabic for main text?
In book or report classes, use the \frontmatter command before your preface and \mainmatter before your first chapter. For article classes, manually switch using \pagenumbering{roman} for the front matter and \pagenumbering{arabic} with \setcounter{page}{1} for the main text.
Why is my page number missing in LaTeX?
Common causes include an accidental \pagestyle{empty} somewhere in your code, conflicts with packages like geometry or fancyhdr, or the default behavior of \maketitle in certain document classes. Check your preamble and recent code changes.
How to change page number starting number in LaTeX?
Use the \setcounter{page}{n} command, where n is the desired starting number. This is often combined with \pagenumbering{arabic} to ensure the format matches your needs.
Conclusion
Mastering numbering pages in latex is less about memorizing commands and more about understanding the flow of your document. By separating the concepts of counters (how many), formats (Roman vs. Arabic), and styles (where it appears), you can solve almost any layout challenge.
We’ve covered the basics of \pagestyle, how to skip pages, switch between numeral systems, and customize positions with fancyhdr. These tools will serve you well whether you are writing a short paper or a 200-page thesis.
I encourage you to experiment with the code snippets provided. Try breaking them and see how they respond—that’s the best way to learn. If you found this guide helpful, consider downloading our free LaTeX thesis template, which comes pre-configured with these exact settings. And if you have your own troubleshooting tips, share them in the comments below; the community learns best when we share our experiences.