# How can I add the section in the headline of the default beamer template?

The default beamer template shows only the subsection in the headline. I would like it to show the section as well as the subsection. It can be done by changing the theme to infolines etc, but I prefer to use the default theme and just add the section name in the headline.

Here is how the original frame looks:

Here is how I want it:

MWE:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

%Modify theme
\setbeamertemplate{itemize items}[ball] %bullets in frames should be balls

\title{My title}
\author{My name}
\institute{My institute}
\date{\today}

\begin{document}

\maketitle

\begin{frame}{Outline}
\tableofcontents
\end{frame}

\section{Section 1}

\begin{frame}{Section 1}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}{Subsection 2.1}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\subsection{Subsection 2.2}
\begin{frame}{Subsection 2.2}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\end{document}

• But you are manually using the section as the frame title. Why? Will alll your frames have as title the title of the section? Jul 8 '15 at 14:06
• You are right. Very silly of me. I replaced \begin{frame}{Subsection 2.1} with \begin{frame}{\insertsection \hfill \insertsubsection}. This already heads in the correct direction. Thank you. It still does not put the subsection at the top right corner. And yes, all frames will have the title as title of section. Jul 8 '15 at 14:15
• See my answer for an automatic solution. Jul 8 '15 at 14:19

One possibility is to (re)define an appropriate template (the sensible candidates are headline or frame title) to use \insertsectionhead and \insertsubsectionhead:

The code:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

%Modify theme
\setbeamertemplate{itemize items}[ball] %bullets in frames should be balls

\leavevmode%
\end{beamercolorbox}%
}

\title{My title}
\author{My name}
\institute{My institute}
\date{\today}

\begin{document}

\maketitle

\begin{frame}{Outline}
\tableofcontents
\end{frame}

\section{Section 1}

\begin{frame}
\frametitle{Title for the frame}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}
\frametitle{Title for the frame}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\subsection{Subsection 2.2}
\begin{frame}
\frametitle{Title for the frame}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{frame}

\end{document}

• This works perfectly. I don't even need to add frame titles. Beautiful! Thank you very much for quick answer. I am unable to vote your answer up because my reputaion is <15 :( Jul 8 '15 at 14:23