[Tex/LaTex] How to ‘center’ ‘page number’ in beamer slides


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

\setbeamertemplate{footline}[page number]

Then the page numbers will appear at bottom right.

Is it possible to put the page numbers at the bottom center? considering that I also have other content (e.g. title, section) at bottom right and bottom left?

For example, I want to put \insertsection, \insertshorttitle, and page number into each header of the slides. How could I make one on the left, one on the right and one in the middle?

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

I tried to center the title by \insershorttitle[center], but it doesn't work.

Best Answer

This template produces centered page numbers in the footline:

\defbeamertemplate{footline}{centered page number}
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
\setbeamertemplate{footline}[centered page number]

It's similar to the original template. The method is using \hspace*{\fill} before and after the numbers. (\hfill at the end instead would not help.)

Here's a complete example centering the title in the frame middle together with text in the left and in the right corner. It shows how you could use \makebox or \llap and \rlap to change a text's width to 0pt, thus allowing centering of other text.

\defbeamertemplate{headline}{my header}{%
\setbeamertemplate{headline}[my header]
\title{Presentation Title}
\section{Test Section}

This is a test.

alt text