I like the Darmstadt theme in Beamer, but my presentation has to many sections for the headline. I tried to find an elegant solution, without success so far.
Do you know if it is possible to show only a part of the headline? My idea is to have a headline that shows as many sections as possible around (ie before and/or after) the current section.
Thank you for your help.
Cheers
Here is a MWE:
\documentclass{beamer}
\usetheme{Darmstadt}
\begin{document}
\section{Section 1}
\subsection{Subsection 1.1}
\begin{frame}{Frame 1.11}
...
\end{frame}
\begin{frame}{Frame 1.12}
...
\end{frame}
\begin{frame}{Frame 1.13}
...
\end{frame}
\subsection{Subsection 1.2}
\begin{frame}{Frame 1.21}
...
\end{frame}
\begin{frame}{Frame 1.22}
...
\end{frame}
\begin{frame}{Frame 1.23}
...
\end{frame}
\section{Section 2}
\begin{frame}{Frame 2}
...
\end{frame}
\section{Section 3}
\begin{frame}{Frame 3}
...
\end{frame}
\section{Section 4}
\begin{frame}{Frame 4}
...
\end{frame}
\section{Section 5}
\begin{frame}{Frame 5}
...
\end{frame}
\section{Section 6}
\begin{frame}{Frame 6}
...
\end{frame}
\section{Section 7}
\begin{frame}{Frame 7}
...
\end{frame}
\section{Section 8}
\begin{frame}{Frame 8}
...
\end{frame}
\section{Section 9}
\subsection{Subsection 9.1}
\begin{frame}{Frame 9.11}
...
\end{frame}
\begin{frame}{Frame 9.12}
...
\end{frame}
\begin{frame}{Frame 9.13}
...
\end{frame}
\subsection{Subsection 9.2}
\begin{frame}{Frame 9.21}
...
\end{frame}
\begin{frame}{Frame 9.22}
...
\end{frame}
\begin{frame}{Frame 9.23}
...
\end{frame}
\section{Section 10}
\begin{frame}{Frame 10}
...
\end{frame}
\section{Section 11}
\begin{frame}{Frame 11}
...
\end{frame}
\section{Section 12}
\begin{frame}{Frame 12}
...
\end{frame}
\section{Section 13}
\begin{frame}{Frame 13}
...
\end{frame}
\section{Section 14}
\begin{frame}{Frame 14}
...
\end{frame}
\section{Section 15}
\begin{frame}{Frame 15}
...
\end{frame}
\section{Section 16}
\subsection{Subsection 16.1}
\begin{frame}{Frame 16.11}
...
\end{frame}
\begin{frame}{Frame 16.12}
...
\end{frame}
\begin{frame}{Frame 16.13}
...
\end{frame}
\subsection{Subsection 16.2}
\begin{frame}{Frame 16.21}
...
\end{frame}
\begin{frame}{Frame 16.22}
...
\end{frame}
\begin{frame}{Frame 16.23}
...
\end{frame}
\section{Section 17}
\begin{frame}{Frame 17}
...
\end{frame}
\section{Section 18}
\begin{frame}{Frame 18}
...
\end{frame}
\section{Section 19}
\subsection{Subsection 19.1}
\begin{frame}{Frame 19.11}
...
\end{frame}
\begin{frame}{Frame 19.12}
...
\end{frame}
\begin{frame}{Frame 19.13}
...
\end{frame}
\subsection{Subsection 19.2}
\begin{frame}{Frame 19.21}
...
\end{frame}
\begin{frame}{Frame 19.22}
...
\end{frame}
\begin{frame}{Frame 19.23}
...
\end{frame}
\section{Section 20}
\begin{frame}{Frame 20}
...
\end{frame}
\end{document}
The following will show the current section +-2 sections. If you want more or less sections to be displayed, change the value of `\mymin=3` and `\mymax=3` [and add corresponding exception for first, second, second to last and last section].
\documentclass{beamer}
\usetheme{Darmstadt}
% based on the original definitions in beamerbasenavigation.sty
\makeatletter
\def\sectionentry#1#2#3#4#5{% section number, section title, page
%
\newcount\mymin%
\mymin=3
\ifnum\c@section=1%
\mymin=5
\fi%
\ifnum\c@section=2%
\mymin=4
\fi%
%
\newcount\mymax%
\mymax=3
\ifnum\c@section=\beamer@sectionmax%
\mymax=5
\fi%
\ifnum\c@section=\numexpr\beamer@sectionmax-1%
\mymax=4
\fi%
%
\ifnum\numexpr\c@section-#1<\mymax%
\ifnum\numexpr#1-\c@section<\mymin%
\ifnum#5=\c@part%
\beamer@section@set@min@width
\box\beamer@sectionbox\hskip1.875ex plus 1fill%
\beamer@xpos=0\relax%
\beamer@ypos=1\relax%
\setbox\beamer@sectionbox=
\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%
\hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}%
\else%
\hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}%
\fi%
}%
}%
\ht\beamer@sectionbox=1.875ex%
\dp\beamer@sectionbox=0.75ex%
\fi%
\fi%
\fi%
\ignorespaces%
}
\def\slideentry#1#2#3#4#5#6{%
%section number, subsection number, slide number, first/last frame, page number, part number
%
\newcount\mymin%
\mymin=3
\ifnum\c@section=1%
\mymin=5
\fi%
\ifnum\c@section=2%
\mymin=4
\fi%
%
\newcount\mymax%
\mymax=3
\ifnum\c@section=\beamer@sectionmax%
\mymax=5
\fi%
\ifnum\c@section=\numexpr\beamer@sectionmax-1%
\mymax=4
\fi%
%
\ifnum\numexpr\c@section-#1<\mymax%
\ifnum\numexpr#1-\c@section<\mymin%
\ifnum#6=\c@part\ifnum#2>0\ifnum#3>0%
\ifbeamer@compress%
\advance\beamer@xpos by1\relax%
\else%
\beamer@xpos=#3\relax%
\beamer@ypos=#2\relax%
\fi%
\hbox to 0pt{%
\beamer@tempdim=-\beamer@vboxoffset%
\advance\beamer@tempdim by-\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@ypos%
\advance\beamer@tempdim by -.05cm%
\raise\beamer@tempdim\hbox{%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\advance\beamer@tempdim by -\beamer@boxsize%
\advance\beamer@tempdim by 1pt%
\kern\beamer@tempdim
\global\beamer@section@min@dim\beamer@tempdim
\hbox{\beamer@link(#4){%
\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%
\else%
\fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
\fi%
\fi%
\fi%
\ignorespaces%
}
\makeatother
\begin{document}
\section{Section 1}
\subsection{Subsection 1.1}
\begin{frame}{Frame 1.11}
...
\end{frame}
\begin{frame}{Frame 1.12}
...
\end{frame}
\begin{frame}{Frame 1.13}
...
\end{frame}
\subsection{Subsection 1.2}
\begin{frame}{Frame 1.21}
...
\end{frame}
\begin{frame}{Frame 1.22}
...
\end{frame}
\begin{frame}{Frame 1.23}
...
\end{frame}
\section{Section 2}
\begin{frame}{Frame 2}
...
\end{frame}
\section{Section 3}
\begin{frame}{Frame 3}
...
\end{frame}
\section{Section 4}
\begin{frame}{Frame 4}
...
\end{frame}
\section{Section 5}
\begin{frame}{Frame 5}
...
\end{frame}
\section{Section 6}
\begin{frame}{Frame 6}
...
\end{frame}
\section{Section 7}
\begin{frame}{Frame 7}
...
\end{frame}
\section{Section 8}
\begin{frame}{Frame 8}
...
\end{frame}
\section{Section 9}
\subsection{Subsection 9.1}
\begin{frame}{Frame 9.11}
...
\end{frame}
\begin{frame}{Frame 9.12}
...
\end{frame}
\begin{frame}{Frame 9.13}
...
\end{frame}
\subsection{Subsection 9.2}
\begin{frame}{Frame 9.21}
...
\end{frame}
\begin{frame}{Frame 9.22}
...
\end{frame}
\begin{frame}{Frame 9.23}
...
\end{frame}
\section{Section 10}
\begin{frame}{Frame 10}
...
\end{frame}
\section{Section 11}
\begin{frame}{Frame 11}
...
\end{frame}
\section{Section 12}
\begin{frame}{Frame 12}
...
\end{frame}
\section{Section 13}
\begin{frame}{Frame 13}
...
\end{frame}
\section{Section 14}
\begin{frame}{Frame 14}
...
\end{frame}
\section{Section 15}
\begin{frame}{Frame 15}
...
\end{frame}
\section{Section 16}
\subsection{Subsection 16.1}
\begin{frame}{Frame 16.11}
...
\end{frame}
\begin{frame}{Frame 16.12}
...
\end{frame}
\begin{frame}{Frame 16.13}
...
\end{frame}
\subsection{Subsection 16.2}
\begin{frame}{Frame 16.21}
...
\end{frame}
\begin{frame}{Frame 16.22}
...
\end{frame}
\begin{frame}{Frame 16.23}
...
\end{frame}
\section{Section 17}
\begin{frame}{Frame 17}
...
\end{frame}
\section{Section 18}
\begin{frame}{Frame 18}
...
\end{frame}
\section{Section 19}
\subsection{Subsection 19.1}
\begin{frame}{Frame 19.11}
...
\end{frame}
\begin{frame}{Frame 19.12}
...
\end{frame}
\begin{frame}{Frame 19.13}
...
\end{frame}
\subsection{Subsection 19.2}
\begin{frame}{Frame 19.21}
...
\end{frame}
\begin{frame}{Frame 19.22}
...
\end{frame}
\begin{frame}{Frame 19.23}
...
\end{frame}
\section{Section 20}
\begin{frame}{Frame 20}
...
\end{frame}
\end{document}
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/keg5v.png