Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
Quick answer: LaTeX numbers pages automatically. You change the number format with \pagenumbering{...}, set or restart the counter with \setcounter{page}{n}, and control where (or whether) the number prints with a page style: \pagestyle{...} for the rest of the document, \thispagestyle{...} for one page. This page puts those commands in one recipe table for theses and journal manuscripts.
Ask CASRAI · free to tryQuestion about this guide? Ask CASRAI answers with linked sources. 2 free questions a day, no account.
What page numbering is used for in research writing
Theses usually number front matter (abstract, contents, lists) in roman numerals and restart at 1 in Arabic for the main text. Journal manuscripts may need a plain running number or none at all, depending on the submission system. Before changing anything, check the journal’s manuscript format requirements or your university thesis template, since these decide the style and position, not LaTeX. If you submit LaTeX source to a preprint server, see arXiv submission.
Install or access
Page numbering is part of core LaTeX; no package is needed for \pagenumbering, \setcounter or \pagestyle. Packages used below are fancyhdr (custom headers and footers; documented on CTAN) and lastpage (provides \pageref{LastPage} for the total page count). You can run LaTeX locally through a distribution such as TeX Live or in an online editor such as Overleaf; see LaTeX and Overleaf for collaborative writing.
Recipe table: goal, command and scope
| Goal | Command | Scope |
|---|---|---|
| Arabic numbers (1, 2, 3) | \pagenumbering{arabic} |
From this point on; resets the counter |
| Lowercase or uppercase roman | \pagenumbering{roman} / \pagenumbering{Roman} |
From this point on; resets the counter |
| Letters (a, b; A, B) | \pagenumbering{alph} / \pagenumbering{Alph} |
From this point on; resets the counter |
| Set the current page to a specific number | \setcounter{page}{3} |
Current page onward |
| Add to or step the counter | \addtocounter{page}{1} / \stepcounter{page} |
Current page onward |
| Hide numbers on every following page | \pagestyle{empty} |
Current and following pages |
| Hide the number on one page only | \thispagestyle{empty} |
Current page only |
| Centred number in the footer | \pagestyle{plain} |
Default for the article and report classes |
| Number in a chosen footer position | \fancyhf{} then \fancyfoot[R]{\thepage} |
With \pagestyle{fancy} |
| “Page x of y” | \fancyfoot[R]{Page \thepage of \pageref{LastPage}} |
Needs the lastpage package |
Sources: Overleaf documentation, “Page numbering” and “Headers and footers” (see Sources below).
Step-by-step: a thesis with roman front matter and arabic body
- Right after
\begin{document}, set the front-matter style:\pagenumbering{roman}. - Place the abstract, table of contents and lists after it. They are numbered i, ii, iii and so on.
- Where the main text starts, switch with
\pagenumbering{arabic}. This resets the counter, so the first body page is 1. - In the
bookclass you can use\mainmatterinstead: it restarts the counter and switches to Arabic numbers. - Compile twice if you use
\pageref{LastPage}, so the total page count resolves.
How do I start page numbering after the table of contents?
Put \pagenumbering{arabic} (or \mainmatter in a book) immediately after the contents and list pages. Because \pagenumbering resets the counter, the next page becomes 1. To continue from a different number instead, use \setcounter{page}{n}.
How do I put the page number in the footer?
The default plain page style already prints a centred page number in the footer. To choose the position, load fancyhdr, use \pagestyle{fancy}, clear the defaults with \fancyhf{}, then set a location with \fancyfoot[L]{\thepage}, \fancyfoot[C]{\thepage} or \fancyfoot[R]{\thepage}. \fancyhf{} clears all header and footer entries.
How do I hide page numbers in LaTeX?
Use \thispagestyle{empty} to hide the number on a single page, for example a chapter opening page. Use \pagestyle{empty} to hide it on the current and all following pages. The empty style produces no headers or footers at all, so it also removes any header text. The emptypage package suppresses page numbers on empty pages.
How do I remove the page number on the first page only?
Place \thispagestyle{empty} on that page. Because it affects only the current page, later pages keep their numbers.
Do page numbers go on the left or right?
It depends on the document. LaTeX’s default plain style centres the number in the footer; with fancyhdr you can place it left, centre or right in the header or footer. Which position is correct is set by the journal’s author instructions or your institution’s thesis rules, not by LaTeX, so follow those.
What about PageMaker?
This page covers LaTeX only; page numbering in Adobe PageMaker is a separate tool and is not covered here.
Output and how to read it
After compiling, check the PDF in this order: the first page (is the number hidden if intended), the last front-matter page (roman numerals), and the first body page (Arabic, restarted at 1). A total-pages footer such as “Page 3 of 40” resolves correctly only after a second compile.
Troubleshooting
- A number still appears on a chapter page: apply
\thispagestyle{empty}on that page; it affects only the current page. - Body text does not start at 1: call
\pagenumbering{arabic}where the body starts; it resets the counter, and a\setcounterplaced before it is overwritten. - Unwanted header or footer content: call
\fancyhf{}first; it clears all header and footer entries. - “Page ?? of ??”: compile again so the references resolve.
Free alternatives and where to run it
| Tool | What it is |
|---|---|
| TeX Live | Free, open-source LaTeX distribution with core LaTeX and CTAN packages such as fancyhdr |
| TeXstudio | Free, open-source desktop editor for writing and compiling LaTeX locally |
| Overleaf | Browser-based LaTeX editor with online documentation for page numbering, headers and footers |
FAQ
How do I create a page number in the footer?
Use the default plain style for a centred number, or fancyhdr with \fancyhf{} and \fancyfoot[R]{\thepage} for a chosen position.
How do I show the total number of pages?
Load lastpage and use \pageref{LastPage} in the footer, for example \fancyfoot[R]{Page \thepage of \pageref{LastPage}}.
Sources
- Overleaf documentation: Page numbering, checked 2026-11-07.
- Overleaf documentation: Headers and footers, checked 2026-11-07.
- CTAN: fancyhdr package, checked 2026-11-07.
Related: horizontal lines in LaTeX.







