# 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}{%
\vskip1pt%
\insertsection%
\insertshorttitle%
\setbeamertemplate{footline}[page number]%
\usebeamertemplate{footline}%
}


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

-
Perhaps tell us the used theme or post a minimal example. – Stefan Kottwitz Dec 2 '10 at 1:02
I just added an example. I guess I need to rewrite this question? Because my actual usage is a little more complex? – Li Wang Dec 2 '10 at 5:44
Generally, please try to add compilable small examples. I've edited my answer to show a solution for this headline. – Stefan Kottwitz Dec 2 '10 at 13:47
Got the idea, I will always add a small example when I am asking question in the future. Thank you! – Li Wang Dec 2 '10 at 21:06

This template produces centered page numbers in the footline:

\defbeamertemplate{footline}{centered page number}
{%
\hspace*{\fill}%
\insertpagenumber\,/\,\insertpresentationendpage%
\hspace*{\fill}\vskip2pt%
}
\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.

\documentclass{beamer}
%
\vskip1pt%
\makebox[0pt][l]{\,\insertsection}%
\hspace*{\fill}\insertshorttitle\hspace*{\fill}%
\llap{\insertpagenumber\,/\,\insertpresentationendpage\,}
}
%
\title{Presentation Title}
\begin{document}
\section{Test Section}
\begin{frame}{}
\centering
$\star$

This is a test.
\vfill
\end{frame}
\end{document}


-
Thank you for reply:) It seems that if put some content (e.g. section name) on the left of the footline, the position of the page number will be changed based the length of the content on the left? Is it possible to make the page number just in the middle, regardless of the length of the content on the left? – Li Wang Dec 2 '10 at 5:48
The complete example is perfect:) Thank you very much! – Li Wang Dec 2 '10 at 21:08