122

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

tparker
  • 719
Anderson
  • 2,333
  • 4
  • 17
  • 19

6 Answers6

148

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}
Bordaigorl
  • 15,135
  • 8
    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 08 '13 at 20:43
  • I will see how to modify text color to black. – Anderson Oct 08 '13 at 21:03
  • 2
    @Anderson see the updated code: if you use \addtobeamertemplate instead of \setbeamertemplate you keep the symbols – Bordaigorl Oct 08 '13 at 21:49
  • 1
    I also just edited to suggest how to customise color and font (in a beamer idiomatic way) – Bordaigorl Oct 08 '13 at 21:54
  • 7
    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
  • 1
    How do you avoid getting the frame numbers on the title page? – Mibi Jan 29 '20 at 10:07
24

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

\expandafter\def\expandafter\insertshorttitle\expandafter{%
  \insertshorttitle\hfill%
  \insertframenumber\,/\,\inserttotalframenumber}
egreg
  • 1,121,712
Vall
  • 241
  • 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? – ddelange Apr 24 '18 at 19:13
  • Consider my comment above solved! – ddelange 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 04 '19 at 23:45
12

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 08 '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 08 '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 08 '13 at 21:01
8

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

lin
  • 81
  • 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 07: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.se]! 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 06:46
1
\setbeamertemplate{page number in head/foot}[totalframenumber]
\beamertemplatenavigationsymbolsempty

\setbeamerfont{page number in head/foot}{size=\footnotesize}