I'm having some newby difficulty with beamer. Doing a simple presentation, I cannot get the total number of pages in the lower right to be anything but 1. Help!

Here you go:

\usepackage{amsmath}                % want AMS fonts
\usepackage{amssymb}                            % use AMS symbols
\mode<presentation> {
    \setbeamertemplate{navigation symbols}{}

% For typesetting bold math (not \mathbold)
\title[CSCI-155]{Instructions as the Language of Computers}
\author{Prof. Rob Marano}
\date{Week 4}



\frametitle{Review - Underlying principles of hardware design}
    \item Simplicity favors regularity
    \item Smaller is faster
    \item Make the common case fast
    \item Good design demands good compromise

  • 1
    I tried your code and compiled it at least three times. The total frames (pages) are shown correctly, without any problem. – Masroor Sep 26 '13 at 6:12
  • That is really strange. I am running LaTeX on a Mac... – Rob Marano Sep 26 '13 at 6:30
  • Does that mean you compile several times and do not get the total number of pages correct? I tried your code in an Ubuntu machine. – Masroor Sep 26 '13 at 6:32
  • If you are compiling it several times, and still do not get the total pages correct, do you think you could include your .aux file in the question, at least the last four/five lines which ends with something like \@writefile{nav}{\headcommand {\def \inserttotalframenumber {2}}}. – Masroor Sep 26 '13 at 6:42
  • RIGHT ANSWER with multiple compilations. I set Latexian to run with 3 runs, and it works just fine. Now, the ultimate question, "Why does it have to run more than once?" – Rob Marano Sep 26 '13 at 6:52

You have to compile your document at least twice. Otherwise LaTeX doesn't know what the total number of pages is.

This is due to the mechanism how labels or other counters and references, e.g. page numbers, are handled. The compiler first has to read the individual records and write their number to an auxiliary file. In a second run, the compiler can read the auxiliary file together with the main file and determine structures like the total number of pages, labels, bibliographies or links between different parts of the document, e.g. between the table of contents and the individual sections.

Depending on the content, even more than two runs can be necessary in order to compile a document completely. For more information about this subject see the post Understanding how references and labels work by @Werner.

You might also have a look at Tools for automating document compilation for a list of tools available that automatically call the compiler as often as necessary for the individual document to be compiled completely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.