72

I created a presentation with Beamer, and I used Darmstadt theme.

But, this theme doesn't have the page number.

I know that I can insert the page number in Footline with:

\setbeamertemplate{footline}[frame number]

But, how can I insert the page number in "Navigation symbols", like this picture?

enter image description here

92

You can use something like

\addtobeamertemplate{navigation symbols}{}{%
    \usebeamerfont{footline}%
    \usebeamercolor[fg]{footline}%
    \hspace{1em}%
    \insertframenumber/\inserttotalframenumber
}

and use spaces, font and boxes to adjust the alignment of the numbers with the navigation symbols.

You can change the font/color just by altering the font/color for footline as in

\setbeamercolor{footline}{fg=blue}
\setbeamerfont{footline}{series=\bfseries}
  • 6
    Ok. But, this disable all icons in navigation bar. I modified your code to: \setbeamertemplate{navigation symbols}{% \insertslidenavigationsymbol \insertframenavigationsymbol \insertsubsectionnavigationsymbol \insertsectionnavigationsymbol \insertdocnavigationsymbol \insertbackfindforwardnavigationsymbol \hspace{1em}% \usebeamerfont{footline} \insertframenumber/\inserttotalframenumber% } – Anderson Oct 8 '13 at 20:43
  • I will see how to modify text color to black. – Anderson Oct 8 '13 at 21:03
  • 2
    @Anderson see the updated code: if you use \addtobeamertemplate instead of \setbeamertemplate you keep the symbols – Bordaigorl Oct 8 '13 at 21:49
  • 1
    I also just edited to suggest how to customise color and font (in a beamer idiomatic way) – Bordaigorl Oct 8 '13 at 21:54
  • 1
    To fix the vertical alignment of the page number, I used: \raisebox{1.2pt}[0pt][0pt]{\insertframenumber/\inserttotalframenumber}. – Steve Oct 11 '17 at 18:46
15

You can add the following code before \begin{document}:

\expandafter\def\expandafter\insertshorttitle\expandafter{%
  \insertshorttitle\hfill%
  \insertframenumber\,/\,\inserttotalframenumber}
  • So happy I found this comment. This does exactly what I needed, independent of the theme I use. My macro vocab however is small, and I'm stuck trying to merge it with another answer. My goal is to remove hyperref's linkcolor on \insertshorttitle in the footline in general, using something like \let\hyperlink\@secondoftwo. Is this an easy fix? – David de L. Apr 24 '18 at 19:13
  • Consider my comment above solved! – David de L. Apr 24 '18 at 19:47
  • Thanks for the answer, it worked! May I also ask you how can I flush it all the way right of the line? Thanks! – zyy Mar 4 at 23:45
7

Before \begin{document} you need to include:

\setbeamertemplate{sidebar right}{}
\setbeamertemplate{footline}{%
\hfill\usebeamertemplate***{navigation symbols}
\hspace{1cm}\insertframenumber{}/\inserttotalframenumber}

This should work to put the frame number beside the navigation bar, not sure how to put it inside of the navigation bar.

  • Ok. This works fine. But, I use "\logo" and "\setbeamertemplate{sidebar right}{}" disable the logo. – Anderson Oct 8 '13 at 20:42
  • so if you add something like \logo{\includegraphics[scale=0.2]{imageName.jpg} } after the above code then you get no logo? – codeAndStuff Oct 8 '13 at 20:51
  • Yes. My tex file has a \logo{\includegraphics[scale=.4]{logo-ic}} after your code, but don't show the logo. – Anderson Oct 8 '13 at 21:01
6

Actually, I want to supplenment MaxGraves's answer! (but I don't have enough reputation, sorry about that!)

My result will put the "page/total page" rightside and inside the navigation bar, instead of outside.

Note: \addtobeamertemplate{⟨element name⟩}{⟨pre-text⟩}{⟨post-text⟩}, hence you have to notice which bracket you put "page/total page" in. In my case, using Frankfurt theme, which have default navigation bar, put the followings before \begin{document} will show my results as the bottom.

\addtobeamertemplate{navigation symbols}{}{ \hspace{1em}    \usebeamerfont{footline}%
    \insertframenumber / \inserttotalframenumber }

The reason I use \hspace{1em} \usebeamerfont{footline} is for good-looking, the front makes "page/total page" not too close to navigation bar, and the latter is just make it as big as I hope, more clearly, I think....

the result

  • This looks like a subset of the accept one. Would like to explain more? For example why you keep \usebeamerfont but not \usebeamercolor. And why are there so many useless spaces? – Symbol 1 Jan 10 '15 at 7:08
1
 \setbeamertemplate{navigation symbols}
{  \insertslidenavigationsymbol 
insertframenavigationsymbol   
\insertsubsectionnavigationsymbol  
  \insertsectionnavigationsymbol
  \insertdocnavigationsymbol  
  \insertbackfindforwardnavigationsymbol 
 \hspace{1em}  
\usebeamerfont{footline} 
   \insertframenumber/\inserttotalframenumber }
 \setcounter{page}{1} 
\pagenumbering{arabic} 
%add this code before begin doc 
\begin{document}
  • 2
    Welcome to TeX - LaTeX! This seems to be a duplicate (with a missing `\` typo) of code in Anderson's comment to Bordaigorl's answer. That comment resulted in an a cleaner updated answer. In any case, code only answers are best combined with some text explanation. – Andrew Swann Sep 29 '15 at 6:46
1
\setbeamertemplate{page number in head/foot}[totalframenumber]
\beamertemplatenavigationsymbolsempty

\setbeamerfont{page number in head/foot}{size=\footnotesize}
  • 2
    Welcome to TeX.SE! Could you please extend your code snippet to a compilable and complete code? – user156344 Mar 11 at 11:47
  • 2
    Because the Darmstadt theme does not show any footline by default, you'll also have to set the footline template to make this work. – user36296 Mar 11 at 11:56

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.