# Editing partly Beamer header (with existing theme content)

## MWE :

Considering the following minimal working example :

\documentclass{beamer}
\usetheme{CambridgeUS}

\begin{document}

\section{Section1}
\subsection{Subsection1}
\begin{frame}
\end{frame}

\subsection{Subsection2}
\begin{frame}
\end{frame}

\end{document}


## Question :

I would like to remove the automatic content placed on header right (the subsection content) and place there instead some dots counting how many slides remain for the current section. By dots I mean :

• the number of dots tells how much slides we have for the section (not considering the pauses!) ;
• if they are white full, we read the slides
• if it is empty :
1. empty in white, we are reading it ;
2. if they are empty grey, we didn't read them yet.

## It seems that it exists already :

I have seen these kind of dots on some other themes like Frankfurt :

I guess it can be exploited, but I am not expert enough in latex to do it.

## Example of the expected display :

On this example, we have 6 pages for this Section1, and we are currently on the second page for this section.

(Of course the background doesn't have to be black, it's just a bad edit made by hand)

## Summary :

How can I place these dots instead of the subsection on this CambridgeUS theme ? Is this possible to integrate the Frankfurt code regarding these dots inside CambridgeUS theme ?

• does tex.stackexchange.com/a/162786/36296 help? – user36296 Sep 3 '14 at 14:51
• Thank you for your answer. I have seen this post, however, I do not understand how I can apply it to perform what I am looking for. Could you please explain me how I can insert these part of code into CambridgeUS theme in order to get the display given above ? – enigmator Sep 3 '14 at 14:55

This is an alternative approach that tries to embed the actual mini frame navigation from the Frankfurt theme into the Cambridge theme. It requires major surgery and I'd suggest to make a custom theme with it.

First we need to set the miniframes color, I picked the darkred color from the beaver theme to match the rest of the theme.

\setbeamercolor{mini frame}{fg=darkred}

Now the tricky part: we are going to take the code from \insertsubsectionnavigationhorizontal, remove its own \slideentry macro and add the one taken from the beamerbasenavigation.sty file. Since my etoolbox fu is not good enough I'll just post the whole modified \slideentry. For code readability etc. this should be placed in another file or done with etoolbox.

\def\insertsubsectionnavigationhorizontal#1#2#3{%
\hbox to #1{{%
\beamer@currentsubsection=0%
\def\sectionentry##1##2##3##4##5{}%
\def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
\ifnum##2>\beamer@currentsubsection%
\box\beamer@sectionbox\hskip1.875ex plus1fill%
\hbox to 0pt{%
\global\beamer@section@min@dim\beamer@tempdim
\usebeamerfont{mini frame}%
\ifnum\c@section=##1%
\ifnum\c@subsection=##2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=##3%
\usebeamertemplate{mini frame}%\beamer@minislidehilight%
\else%
\usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
\fi%
\else%
\usebeamercolor{mini frame}%
%\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
\else%
\usebeamercolor{mini frame}%
%\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
}%
\hskip-10cm plus 1fil%
}%
\fi\fi\fi\ignorespaces
}%
#2\hskip.3cm\setbox\beamer@sectionbox=\hbox{}%
\box\beamer@sectionbox\hfil\hskip.3cm%
#3
}}
}


The last step is to re-set the headline template so that it calls our customized horizontal miniframes navigation:

    \setbeamertemplate{headline}
{
\leavevmode%
\hbox{%
\end{beamercolorbox}%
\end{beamercolorbox}}%
\vskip0pt%
}


## Result.

It works exactly as the Frankfurt miniframe nav. since it actually is the Frankfurt miniframe nav.

## Full MWE.

\documentclass{beamer}
\usetheme{CambridgeUS}

\setbeamercolor{mini frame}{fg=darkred}

\makeatletter
\hbox to #1{{%
\beamer@currentsubsection=0%
\def\sectionentry##1##2##3##4##5{}%
\def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
\ifnum##2>\beamer@currentsubsection%
\box\beamer@sectionbox\hskip1.875ex plus1fill%
\hbox to 0pt{%
\global\beamer@section@min@dim\beamer@tempdim
\usebeamerfont{mini frame}%
\ifnum\c@section=##1%
\ifnum\c@subsection=##2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=##3%
\usebeamertemplate{mini frame}%\beamer@minislidehilight%
\else%
\usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
\fi%
\else%
\usebeamercolor{mini frame}%
%\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
\else%
\usebeamercolor{mini frame}%
%\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
}%
\hskip-10cm plus 1fil%
}%
\fi\fi\fi\ignorespaces
}%
#2\hskip.3cm\setbox\beamer@sectionbox=\hbox{}%
\box\beamer@sectionbox\hfil\hskip.3cm%
#3
}}
}
\makeatother

{
\leavevmode%
\hbox{%
\end{beamercolorbox}%
\end{beamercolorbox}}%
\vskip0pt%
}

\begin{document}
\section{Section 1}
\subsection{Subsection1}
\frame{S1s1f1}
\frame{S1s1f2}

\subsection{Subsection2}
\frame{S1s2}

\subsection{Subsection3}
\frame{S1s3}

\section{Section 2}
\subsection{Subsection1}
\frame{S2s1}

\subsection{Subsection2}
\frame{S2s2}

\subsection{Subsection3}
\frame{S2s3}

\subsection{Subsection4}
\frame{S2s4}
\end{document}


• thank you for your answer. Yes that's exactly what I am looking except that it displays the full number of slides (and not the ones of the current section), as you mentioned in your "Drawbacks" section. Whenever you find a solution for this, please let us know =) – enigmator Sep 4 '14 at 13:16
• @enigmator I will :) That is actually a "feature" of the Frankfurt theme, so when you import the slideentry macro from that theme you get that too... – Nico Boni Sep 4 '14 at 13:20
• Did you figured out a solution about that ? – enigmator Sep 5 '14 at 13:13
• @enigmator see the edited answer, it should work fine now. – Nico Boni Sep 5 '14 at 20:13

\documentclass[compress]{beamer}
\usetheme{CambridgeUS}
\useoutertheme{miniframes}
\useoutertheme{split}
%\usecolortheme{whale}

\makeatletter

\newcount\beamer@xoff
\newcount\beamer@prev@section
\newcount\beamer@prev@miniframes
\beamer@xoff=0
\beamer@prev@section=0
\beamer@prev@miniframes=0

\hbox to #1{{%
\beamer@currentsubsection=0%
\def\sectionentry##1##2##3##4##5{}%
\def\slideentry##1##2##3##4##5##6{%
\ifnum##1>\beamer@prev@section%
\beamer@xoff=##3\relax%
\beamer@prev@miniframes=0\relax%
\fi
\ifnum##6=\c@part\ifnum##1=\c@section%
\ifnum##2>\beamer@currentsubsection%
\beamer@xoff=0\relax%
\beamer@currentsubsection=##2%
\box\beamer@sectionbox\hskip1.875ex plus1fill%
\ifnum\beamer@prev@miniframes>0\relax%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by \beamer@prev@miniframes%
\ifnum##2>1%
\else
\fi
\else
\beamer@tempdim=0pt%
\fi
\setbox\beamer@sectionbox=
\ifnum\c@subsection=##2%
\ht\beamer@sectionbox=1.875ex%
\dp\beamer@sectionbox=0.75ex%
\else%
\beamer@prev@miniframes=##3%
\fi%
\beamer@xpos=##3\relax%
\hbox to 0pt{%
\beamer@tempdim=0.5pt%
\raise\beamer@tempdim\hbox{%
\ifnum##2>0%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\else%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\fi%
\usebeamerfont{mini frame}%
\ifnum\c@section=##1%
\ifnum\c@subsection=##2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=##3%
\usebeamertemplate{mini frame}%
\else%
\usebeamertemplate{mini frame in current subsection}%
\fi%
\else%
\usebeamercolor{mini frame}%
\usebeamertemplate{mini frame in other subsection}%
\fi%
\else%
\usebeamercolor{mini frame}%
\usebeamertemplate{mini frame in other subsection}%
\fi%
}}}\hskip-10cm plus 1fil%
}\fi\fi%
\else%
\fakeslideentry{##1}{##2}{##3}{##4}{##5}{##6}%
\fi\fi%
\beamer@prev@section=##1%
\ignorespaces}%
#2\hskip.3cm\setbox\beamer@sectionbox=\hbox{}%
\box\beamer@sectionbox\hfil\hskip.3cm%
#3}}}

\ifbeamer@compress

{%
\leavevmode%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{palette tertiary}%
\end{beamercolorbox}%
\end{beamercolorbox}%
}

\else

\fi

\makeatother

% This is to enable the feature
\setbeamertemplate{footline}[infolines theme]

\begin{document}

\section{Section1}

\begin{frame}
\end{frame}

\begin{frame}
\end{frame}

\end{document}

• Thank you, It's quite that apart from 2 details : if you try with 2 sections, you will notice that they are all written in the left header (I simply want the current section). Also regarding the dots, it doesn't seem to be the same rles as on Frankfurt theme, which is 1) full+color for already read slides, 2) empty+color for current slide, 3) empty for all last pages not read. On the code you propose me, we only have the full dot for the current slide. You see what I mean? – enigmator Sep 3 '14 at 18:23