LaTeX page numbering

Posted: 29th June 2009 by Tim in LaTeX
Tags: , , , , , ,

Getting the page numbering right in LaTeX documents may not seem like a big deal, but it’s frustrating when it’s all wrong. Here’s a brief summary on how to get it sorted.

For starters, page numbers will appear on all pages which have a page style of plain, headings or myheadings (ie: anything other than empty). You can set the page style at any point by typing \pagestyle{type} or \thispagestyle{type}. \pagestyle will set the style for all pages from that point onwards, whereas \thispagestyle will only set the current page.

By default, page numbers start from the first page (often the title page) and are displayed in arabic numbers (ie: 1, 2, 3 …). This counter can be set manually at any time using the \setcounter{page}{number} command, where number is the new page number you’d like. Note that this can result in duplicate page numbers.

To change the type of page numbering, the \pagenumbering{style} command is the way to go. style may one of the following:

  • arabic – Arabic numerals
  • roman – Lowercase roman numerals
  • Roman – Uppercase roman numerals
  • alph – Lowercase letters
  • Alph – Uppercase letters

Numbering styles will be reflected in the table of contents and other page references.

So, time for an example. If we wanted to create a document which had a foreward on page i, table of contents on page ii, table of tables on page iii and the first section on page 1, we would have the following:

% preliminaries %
\title{Example Document}
\author{Tim Murphy ---}

% front matter %

% display page numbers in the headings. Start with roman numerals %

% page i %
Foreward described here ...

% page ii %

% page iii %

% set the page numbers to be arabic, starting at page 1 %

% page 1 %
\section{The First Section}
The details of the first section ...


  1. tux25 says:

    Nice article and website !

    I have a question for you :

    If I would like the pages numerations in the bottom of the page and without the sections names…

    For the bottom I think I need modified that : “\pagestyle{headings}”

    Someone can help me ?

  2. Tim says:

    Hi tux25,

    You probably want to use the fancyhdr package for that. Have a look at this post for details on how to do this.

    Hope that helps.

  3. Vijay says:

    Shouldn’t you be using frontmatter, mainmatter, etc.? I forget if those only exist in “book”/”memoir”, though. Maybe “article”s not what you want?

  4. Tim says:

    Hi Vijay,

    Frontmatter is only available in book-type documents. You will get an “undefined control sequence” or similar error if you try to use it in articles.

    There are many scenarios where changing the page number is desired, both in book and article style documents.

  5. Daniel says:

    hi all…
    I use the geometry package and have small margins…
    but, my page numbers are too close to the text….

    Is there a way to move the page numbers down on the page ?
    I couldn’t find this any where …

  6. Tim says:

    Hi Daniel,

    If you use the fancyhdr package (see this post for an example of how to use it) then you can change the distance between the footer and the text. You can do this by changing the \footskip value (30pt by default).

    For example,


    should give you more space between the text and the footer.

  7. Sanjay says:

    What can be done if I want to have the page number with three digit precision, for example, the first page must appear as 001, the next as 002, the tenth page as 010… and so on…

  8. L says:

    This helped me out a lot, thanks a bunch

  9. Julia says:

    Very helpful! Finally managed to sort out my page numbering properly! Thank you!

  10. eilaf says:

    I had a problem with numbering the first pages of my thesis using Roman numbers

    I want to use Roman numbering for abstract , TOC, list of figures and list of tables!!

    When I write the code
    /pagenumbering {roman}

    It show that the document still use Arabic numbers not Roman???

  11. Tim says:

    Hi Eilaf,

    Without seeing your code I can’t really help you much. I would suggest copying the example above and adding your content in there to see if that works. If you’re still having issues, post a minimum working example in here and we’ll see what we can do.

  12. Sissy says:

    Thanks for the tip! However, it doesn’t seem to work if you decide to be picky (like me), and do
    \footer{}{Page \thepage of \numpages}

    The idea being to get “Page I of IV”, “Page II of IV”, and etc. What I _actually_ get is “Page I of 4″, “Page II of 4″, etc. Also, LaTeX recommends compiling a second time to get references (equations, etc.) correct. When I LaTeX it a second time, I get an error.

    Short version: Is it possible to make the \pagenumbering command work with \numpages?

    Thanks! :)

  13. Sissy says:

    Oh! I forgot to add that \numpages is part of the exam class. I didn’t realize that. Maybe this is a bug in the exam class instead…

  14. Sherilyn says:

    I made a table of contents in word 2007 and uploaded it to amazon for kindle. When I see the table of contents, the page numbers are not right justified. The page numbers are right next to the heading like this Chipotle21 21 is the page number. It looks like this in the copy before I upload it Chipotle………………………………………………………………21
    Can you tell me what I did wrong. Are there some codes in the background that I don’t see?

  15. dale says:

    Thats’ helpful. Thanks.

  16. obrousse says:

    to Sissy

    I did something like that some years ago
    maibe you can try:
    \footer{}{Page \thepage of \pageref{lastpage}}
    instead of your:
    \footer{}{Page \thepage of \numpages}

    You then just need to set the label “lastpage” just before the end of your document (or roman numbered part) like that:

    As I didn’t did this again I can be wrong but google will help you tu correct me ^^.

  17. radu says:

    awesome, 10x

  18. christiana says:

    I am using document class{book} and on even numbered pages , the number appears on the left whereas on the odd numbered pages, the number appears on the right. In addition, when a new chapter begins, the number on this page appears on the bottom.
    How can I arrange the page numbers to appear always on the right?

    Thank you in advance

  19. Carly says:

    Hi there,

    I followed your (very helpful) directions, and it worked like a charm! Thanks for that! I just have one issue: In the inside top of every page, it says “Contents”. While that looks nice, I’d prefer not to have it. How do I get rid of it?



  20. Vincent says:

    Is it possible to have the \section* in the table of contents?


  21. Fabian says:

    Great site! Have trying to figure out how to do exactly this.

    Thanks a bunch

  22. arjun says:

    Now i made one thesis report using latex. the document has page numbers 1-120. However, want I want is the pages to be:i-ix, followed by pages 1-120. what i do?

  23. anon says:

    The document i am preparing have the roman numbering for title and toc page etc, while numerals start from the first chapter as described here. The TOC is listing the page reference correctly, but the bibliography also has page reference link, but these are erroneous, they point to original page count not the page numerals as ‘assigned’. Hence when we click on these page link in bibliography it goes to wrong page. How to correct this, any suggestion?
    Thanks in advance.