[Tex/LaTex] Beamer — changing the title in the navigation bar dynamically

beamerframe-titlemini-framesnavigation

Is there a way to change the title of the entire presentation in the navigation bar dynamically?

Now:

enter image description here

Needed:

enter image description here

All 6 of 6 circles should be shown in navigation bar, not only 3 of 6 for current section!

Here is my code:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{color}
\usepackage{mathpazo}
\usepackage{tikz}
\usepackage{pgfplots}

\useoutertheme[subsection=false, shadow]{miniframes}
\useinnertheme{default}
\usefonttheme{serif}

\setbeamerfont{title like}{shape=\scshape}
\setbeamerfont{frametitle}{shape=\scshape}
\setbeamercolor*{lower separation line head}{bg=black!10} 
\setbeamercolor*{normal text}{fg=black, bg=white} 
\setbeamercolor*{alerted text}{fg=red} 
\setbeamercolor*{example text}{fg=black} 
\setbeamercolor*{structure}{fg=black} 
\setbeamercolor*{palette tertiary}{fg=black, bg=black!5} 
\setbeamercolor*{palette quaternary}{fg=black, bg=black!5} 

\beamertemplatenavigationsymbolsempty

\begin{document}

% The miniframe circles should not be splitted in two groups (if possible)

\section*{Title 1} % <-- Only this title should be visible in the first section
\subsection*{}

\begin{frame}\end{frame}
\begin{frame}\end{frame}
\begin{frame}\end{frame}

\section*{Title 2} % <-- ...and only this title in the second section
\subsection*{}

\begin{frame}\end{frame}
\begin{frame}\end{frame}
\begin{frame}\end{frame}

\end{document}

The simple way to do so is probably to set the title of the presentation equal to subsection title — is this possible?

Best Answer

You can use the following code somewhere between \documentclass{beamer} and \begin{document}:

\usepackage{etoolbox}
\makeatletter
\beamer@compresstrue
\patchcmd{\insertnavigation}{\hskip-1.875ex plus-1fill}{}{}{}
\apptocmd{\partentry}{\beamer@xpos=0\relax}{}{}
\def\sectionentry#1#2#3#4#5{% section number, section title, page
  \ifnum#5=\c@part%
  \hbox{\def\insertsectionhead{#2}%
    \def\insertsectionheadnumber{#1}%
    \def\insertpartheadnumber{#5}%
    {%
      \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
      \ifnum\c@section=#1%
        \rlap{\hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}}%
      \fi}%
  }%
  \fi\ignorespaces}
\makeatother

headline for the example document, with all six mini frames shown

The tricks used to get all the mini frames while displaying only the current section title are similar to what was used in Beamer infolines outer theme with miniframe bullets only for the current section:

  • For simplicity, all mini frames are displayed in one line using the compress option:

    \beamer@compresstrue
    
  • Remove the filling space to left align the navigation bar:

    \patchcmd{\insertnavigation}{\hskip-1.875ex plus-1fill}{}{}{}
    
  • Reset the mini frames position at the start of each part, as this will not be done at the beginning of each section any more to create a continuous line of mini frames:

    \apptocmd{\partentry}{\beamer@xpos=0\relax}{}{}
    
  • Rewrite the \sectionentry macro to not reset the mini frames position and to only show the current section title. The important thing here is to wrap the title in \rlap so that it does not take up any space, otherwise there would be a gap in the line of mini frames:

    \def\sectionentry#1#2#3#4#5{...}