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]

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}%
}
\setbeamertemplate{headline}[my header]

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

share|improve this question
    
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
add comment

1 Answer 1

up vote 5 down vote accepted

This template produces centered page numbers in the footline:

\defbeamertemplate{footline}{centered page number}
{%
  \hspace*{\fill}%
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
  \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}
%
\defbeamertemplate{headline}{my header}{%
\vskip1pt%
\makebox[0pt][l]{\,\insertsection}%
\hspace*{\fill}\insertshorttitle\hspace*{\fill}%
\llap{\insertpagenumber\,/\,\insertpresentationendpage\,}
}
\setbeamertemplate{headline}[my header]
%
\title{Presentation Title}
\begin{document}
\section{Test Section}
\begin{frame}{}
\centering
$\star$

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

alt text

share|improve this answer
    
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
add comment

Your Answer

 
discard

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.