Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When inserting page numbers into beamer slides, I usually use:

\setbeamertemplate{footline}[page number]

Is it possible to do this for headline, something like:

\setbeamertemplate{headline}[page number]
share|improve this question
Have you tried \insertframenumber? –  Matten Dec 1 '10 at 11:07
It seems that \insertframenumber only shows the current page number, but I also want the total page number (excluding appendix). –  Li Wang Dec 1 '10 at 23:34

1 Answer 1

up vote 3 down vote accepted

Sure, it's not installed by default, but you do something like this:

\defbeamertemplate{headline}{page number}{%
    \setbeamertemplate{footline}[page number]%
\setbeamertemplate{headline}[page number]

Since the footline template is set inside the group it's not affected by your global theme. You can have a regular footline that's something else like infolines--although I assume you don't want that one because it's already got the page number in it.

This does seem to clobber the headline in some of the fancier themes. So you might try instead \addtobeamertemplate:

    \setbeamertemplate{footline}[page number]%
    \setbeamercolor{page number in head/foot}{use=headline,fg=headline.fg,bg=headline.bg}
}{% don't add anything after
share|improve this answer
Both methods work perfectly:) Thank you very much! Strangely, the colours of the page numbers in these two methods are different (grey vs. dark) –  Li Wang Dec 1 '10 at 23:44
@user2015: Notice that in the second example I played around with the color by setting the beamer-color page number in head/foot to be the same as that of headline –  Matthew Leingang Dec 2 '10 at 0:35
I see:) The second method is much more flexible then. Thank you very much! –  Li Wang Dec 2 '10 at 5:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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