You are on page 1of 6

11/17/2017 Beamer - How to customise the header of a frankfurt slide?

- TeX - LaTeX Stack Exchange

Beamer - How to customise the header of a frankfurt slide?

I use the following options:

\usetheme{Frankfurt}
\setbeamercolor{section in head/foot}{fg=black, bg=white}

and this yields a slide which looks like this:

Is it possible

to bring 'Section 1' and 'Section 2' closer together?


to draw a separation line before the frame title ?

{beamer} {header-footer}

edited May 22 '12 at 19:01 asked May 22 '12 at 18:56


Claudio Fiandrino Marco
49k 10 141 270 1,523 5 17 31

2 Answers

Sure. You can redefine the headline template; I produced the separation line by using
a beamercolorbox of .75ex height and using the upper separation line head color
previously set.

Instead of using \insertnavigation , I used \insertsectionnavigationhorizontal which


allows for more control. I used the red color, since you didn't provide complete
information on the color schema used in your code snippet.Feel free to change the
settings according to your needs:

\documentclass{beamer}
\usetheme{Frankfurt}

\setbeamercolor{section in head/foot}{fg=black, bg=white}


\setbeamercolor{frametitle}{fg=red, bg=white}
\setbeamercolor{upper separation line head}{bg=red}

\makeatletter
\setbeamertemplate{headline}
{%
\pgfuseshading{beamer@barshade}%
\ifbeamer@sb@subsection%
\vskip-9.75ex%
\else%
\vskip-7ex%
\fi%
\begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
\insertsectionnavigationhorizontal{\paperwidth}{}{\hfill\hfill}
\end{beamercolorbox}%
\ifbeamer@sb@subsection%
\begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}\insertsubsectionhead
\end{beamercolorbox}%
\fi%
\begin{beamercolorbox}[colsep=1.5pt,ht=.75ex]{upper separation line head}
\end{beamercolorbox}
}%
\makeatother

https://tex.stackexchange.com/questions/56946/beamer-how-to-customise-the-header-of-a-frankfurt-slide 1/6
11/17/2017 Beamer - How to customise the header of a frankfurt slide? - TeX - LaTeX Stack Exchange

\begin{document}

\section{Section One}

\begin{frame}
\frametitle{Test Frame One}
test
\end{frame}

\section{Section Two}

\begin{frame}
\frametitle{Test Frame Two}
test
\end{frame}

\end{document}

As Claudio Fiandrino mentions in his comment, using


\insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1fill}{\hskip0pt plus1fill}

https://tex.stackexchange.com/questions/56946/beamer-how-to-customise-the-header-of-a-frankfurt-slide 2/6
11/17/2017 Beamer - How to customise the header of a frankfurt slide? - TeX - LaTeX Stack Exchange
instead of

\insertsectionnavigationhorizontal{\paperwidth}{}{\hfill\hfill}

will produce centered sections in the navigation bar.

The previous approach has a disadvantage: the indicators for subsections are no
longer included. To recover the indicators and to get the section titles closer, a
redefinition of \insertnavigation will be needed:

\documentclass{beamer}
\usetheme{Frankfurt}

\setbeamercolor{section in head/foot}{fg=black, bg=white}


\setbeamercolor{frametitle}{fg=red!70!black, bg=white}
\setbeamercolor{upper separation line head}{bg=red!70!black}

\makeatletter
\def\insertnavigation#1{%
\vbox{{%
\usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
\beamer@xpos=0\relax%
\beamer@ypos=1\relax%
\hbox to #1{\hskip.3cm\setbox\beamer@sectionbox=\hbox{\kern1sp}%
\ht\beamer@sectionbox=1.875ex%
\dp\beamer@sectionbox=0.75ex%
\hskip.3cm%
\global\beamer@section@min@dim\z@
\dohead%
\beamer@section@set@min@width
\box\beamer@sectionbox\hfill\hskip.3cm}%
}}}

\setbeamertemplate{headline}
{%
\pgfuseshading{beamer@barshade}%
\ifbeamer@sb@subsection%
\vskip-9.75ex%
\else%
\vskip-7ex%
\fi%
\begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
\insertnavigation{\paperwidth}
\end{beamercolorbox}%
\ifbeamer@sb@subsection%
\begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}\insertsubsectionhead
\end{beamercolorbox}%
\fi%
\begin{beamercolorbox}[colsep=1.5pt,ht=.75ex]{upper separation line head}
\end{beamercolorbox}
}%
\makeatother

\begin{document}

\section{Section One}
\subsection{Test Subsection One One}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}
\subsection{Test Subsection One Two}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}

\section{Section Two}
\subsection{Test Subsection Two One}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}

https://tex.stackexchange.com/questions/56946/beamer-how-to-customise-the-header-of-a-frankfurt-slide 3/6
11/17/2017 Beamer - How to customise the header of a frankfurt slide? - TeX - LaTeX Stack Exchange
\subsection{Test Subsection Two Two}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}

\section{Section Three}
\subsection{Test Subsection Three One}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame}
\frametitle{Test Frame}
test
\end{frame}

\end{document}

edited May 22 '12 at 21:03 answered May 22 '12 at 19:29


Gonzalo Medina
361k 32 1170
1464

You were faster than me in answering. :) Why not using


\insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1fill}{\hskip0pt plus1fill} to
make the sections centered in the navigation bar? Claudio Fiandrino May 22 '12 at 19:34

@ClaudioFiandrino I initially thought so, but I am not sure about the OP's intent; I'll add your suggestion
to my answer. Gonzalo Medina May 22 '12 at 19:38

Great! Is it normal that the navigation circles have disappeared? Marco May 22 '12 at 19:43

@Marco: yes, it's normal! This is the only drawback of this method. Do you want them anyway?
Claudio Fiandrino May 22 '12 at 19:48

@Claudio Fiandrino: I would have liked them... is it difficult to make them reappeared? Marco May 22
'12 at 19:51

Also a little hackish (or pragmatic if you allow me to sell it :P) version is to reduce the
length of the beamercolorbox that holds the navigational items. I actually copy pasted
the headline definition from the smoothbars theme and added a 0.5 factor. You can
adjust how much they should spread out depending on the size/number of sections. I
just copied the line solution from Gonzalo's answer.

https://tex.stackexchange.com/questions/56946/beamer-how-to-customise-the-header-of-a-frankfurt-slide 4/6
11/17/2017 Beamer - How to customise the header of a frankfurt slide? - TeX - LaTeX Stack Exchange

\documentclass{beamer}
\usetheme{Frankfurt}
\setbeamercolor{upper separation line head}{bg=red}
\setbeamercolor{section in head/foot}{fg=black, bg=white}
\setbeamercolor{frametitle}{fg=red, bg=white}

\makeatletter
\setbeamertemplate{headline}
{%
\pgfuseshading{beamer@barshade}%
\ifbeamer@sb@subsection%
\vskip-9.75ex%
\else%
\vskip-7ex%
\fi%
\begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
\insertnavigation{0.5\paperwidth} % <======= Added 0.5 here
\end{beamercolorbox}%
\ifbeamer@sb@subsection%
\begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}\insertsubsectionhead
\end{beamercolorbox}%
\fi%
\begin{beamercolorbox}[colsep=1.5pt,ht=.75ex]{upper separation line head}
\end{beamercolorbox}

}%

\makeatother

\begin{document}
\section{Introduction}
\subsection{Subintro1}
\begin{frame}{Introduction}
Important Intro
\end{frame}
\subsection{Subintro2}
\begin{frame}{Dummy frame 1}{Subtitle} \end{frame}
\section{Main Course}
\subsection{Main}
\begin{frame}{Dummy frame 2} \end{frame}
\subsection{Course}
\begin{frame}{Dummy frame 3} \end{frame}
\section{Dessert}
\subsection{Wine}
\begin{frame}{Dummy frame 2} \end{frame}
\subsection{Coffee}
\begin{frame}{Dummy frame 3} \end{frame}
\end{document}

https://tex.stackexchange.com/questions/56946/beamer-how-to-customise-the-header-of-a-frankfurt-slide 5/6
11/17/2017 Beamer - How to customise the header of a frankfurt slide? - TeX - LaTeX Stack Exchange

answered May 22 '12 at 20:37


percusse
126k 10 233 450

1 Looking at the section titles, it should be a "Yummy frame" ;-) Gonzalo Medina May 22 '12 at 21:25

2 @GonzaloMedina Argh, how did I miss that window of opportunity? :-) percusse May 22 '12 at 21:33

@percusse: +1, thanks! Marco May 23 '12 at 5:30


https://tex.stackexchange.com/questions/56946/beamer-how-to-customise-the-header-of-a-frankfurt-slide 6/6

You might also like