beamer
offers you this possibility out of the box, using the sectionstyle
, subsectionstyle
keys for the \tableofcontents
.
If you want, at the beginning of each each section, to have a table of contents showing only the current section with its subsections, all you need is
currentsection,
sectionstyle=show/hide,
subsectionstyle=show/show/hide
so, the following lines
\AtBeginSection[]
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[
currentsection,
sectionstyle=show/hide,
subsectionstyle=show/show/hide
]
\end{frame}
}
will do exactly what you need. A complete example:
\documentclass{beamer}
\AtBeginSection[]
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[
currentsection,
sectionstyle=show/hide,
subsectionstyle=show/show/hide
]
\end{frame}
}
\begin{document}
\section{Test Section One}
\begin{frame} test\end{frame}
\subsection{Test Subsection One One}
\begin{frame} test\end{frame}
\subsection{Test Subsection One Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection One Three}
\begin{frame} test\end{frame}
\section{Test Section Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two One}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame} test\end{frame}
\section{Test Section Three}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three One}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three Three}
\begin{frame} test\end{frame}
\end{document}
The ToC for the first section:
The ToC for the second section:
The ToC for the third section:
If what you want is to have, at the beginning of each subsection, a ToC showing the current section and subsection and all other subsections for the current section shaded, then the specification would change to
currentsection,
sectionstyle=show/hide,
subsectionstyle=show/shaded/hide
And the ToC will be produced using
\AtBeginSubsection[]
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[
currentsection,
sectionstyle=show/hide,
subsectionstyle=show/shaded/hide
]
\end{frame}
}
A complete example:
\documentclass{beamer}
\AtBeginSubsection[]
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[
currentsection,
sectionstyle=show/hide,
subsectionstyle=show/shaded/hide
]
\end{frame}
}
\begin{document}
\section{Test Section One}
\begin{frame} test\end{frame}
\subsection{Test Subsection One One}
\begin{frame} test\end{frame}
\subsection{Test Subsection One Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection One Three}
\begin{frame} test\end{frame}
\section{Test Section Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two One}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame} test\end{frame}
\section{Test Section Three}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three One}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame} test\end{frame}
\subsection{Test Subsection Three Three}
\begin{frame} test\end{frame}
\end{document}
An image of the ToC for the second subsection of the first section:
An image of the ToC for the third subsection of the third section:
This can be done using a redefinition of \insertverticalnavigation
to suppress a conditional (the lines commented out as marked using % NEW in the code below):
\documentclass{beamer}
% beamer theme
\usetheme{Marburg}
% redefinition of \insertverticalnavigation to get the desired highlighting for
% sections in the sidebar
\makeatletter
\def\insertverticalnavigation#1{%
\vbox{%
\def\sectionentry##1##2##3##4##5{%
\ifnum##5=\c@part%
\def\insertsectionhead{##2}%
\def\insertsectionheadnumber{##1}%
\def\insertpartheadnumber{##5}%
\hbox{{%
\usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
\hyperlink{Navigation##3}{%
\ifnum\c@section=##1%
%\ifnum\c@subsection=0\relax% NEW
{\usebeamertemplate{section in sidebar}}%
%\else%% NEW
\ifx\beamer@nav@css\beamer@hidetext%
{\usebeamertemplate{section in sidebar}}%
\else%
{\usebeamertemplate{section in sidebar shaded}}%
\fi%
%\fi%% NEW
\else
{\usebeamertemplate{section in sidebar shaded}}%
\fi}}}%
\beamer@currentsubsection=0\relax\fi}%
\def\slideentry##1##2##3##4##5##6{}%
\def\beamer@subsectionentry##1##2##3##4##5{%
\ifnum##1=\c@part%
\def\insertpartheadnumber{##1}%
\def\insertsectionheadnumber{##2}%
\def\insertsubsectionheadnumber{##3}%
\def\insertsubsectionhead{##5}%
\beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
{\hbox{{%
\usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
\hyperlink{Navigation##4}{%
\ifnum\c@section=##2%
\ifnum\c@subsection=##3%
\ifnum\c@subsubsection=0\relax%
{\usebeamertemplate{subsection in sidebar}}%
\else%
{\usebeamertemplate{subsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsection in sidebar shaded}}%
\fi}}}%
}%
\fi}%
\def\beamer@subsubsectionentry##1##2##3##4##5##6{%
\ifnum##1=\c@part%
\def\insertpartheadnumber{##1}%
\def\insertsectionheadnumber{##2}%
\def\insertsubsectionheadnumber{##3}%
\def\insertsubsubsectionheadnumber{##3}%
\def\insertsubsubsectionhead{##6}%
\beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
{\hbox{{%
\usebeamerfont{subsubsection in sidebar}\usebeamercolor[fg]{subsubsection in sidebar}%
\hyperlink{Navigation##5}{%
\ifnum\c@section=##2%
\ifnum\c@subsection=##3%
\ifnum\c@subsubsection=##4%
{\usebeamertemplate{subsubsection in sidebar}}%
\else
{\usebeamertemplate{subsubsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsubsection in sidebar shaded}}%
\fi%
\else%
{\usebeamertemplate{subsubsection in sidebar shaded}}%
\fi}}}%
}%
\fi}%
%\beamer@currentsubsection=0\relax%
\dohead%
}%
}
\makeatother
% german spelling
\usepackage[english,ngerman]{babel}
% set font encoding
\usepackage[T1]{fontenc}
% math stuff
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
% set fonts
\usepackage{xltxtra}
\usefonttheme{professionalfonts}
%\setsansfont[
%BoldFont={Helvetica Neue Medium},
%ItalicFont={Helvetica Neue Italic},
%BoldItalicFont={Helvetica Neue Medium Italic},
%Ligatures=TeX
%]{Helvetica Neue Light}
%\setmonofont[Scale=0.9]{Menlo Regular}
% slide numbers in the bottom right corner
\addtobeamertemplate{footline}{%
\hfill\usebeamertemplate***{navigation symbols}
\insertframenumber{}\hspace{3mm}\vspace{2mm}}{}
% removes navigation bar
\beamertemplatenavigationsymbolsempty
% color definitions
\definecolor{konzeBlue}{RGB}{45,170,250}
\definecolor{konzeBlueLight}{RGB}{116,199,252}
\definecolor{mainTextColor}{RGB}{80,80,80}
\definecolor{titleTextColor}{RGB}{120,120,120}
\makeatletter
% title page
\setbeamercolor{title}{fg=titleTextColor}
\setbeamercolor{author}{fg=mainTextColor}
\setbeamercolor{date}{fg=mainTextColor}
% sidebar
\setbeamertemplate{sidebar canvas right}[vertical shading][top=konzeBlue,bottom=konzeBlue]
\setbeamercolor{author in sidebar}{fg=white}
\setbeamercolor{section in sidebar}{fg=white}
\setbeamercolor{section in sidebar}{bg=konzeBlueLight}
\setbeamerfont{section in sidebar}{size=\tiny}
\setbeamerfont{section in sidebar}{series=\bfseries}
\setbeamercolor{subsection in sidebar}{fg=white}
\setbeamercolor{subsection in sidebar}{bg=konzeBlueLight}
\setbeamerfont{subsection in sidebar}{series=\tiny}
% slide number
\setbeamercolor{footline}{fg=white}
% frame
\setbeamercolor{frametitle}{fg=titleTextColor}
\makeatother
\title{Something}
\author{Max Mustermann}
\date{\today}
\begin{document}
\color{mainTextColor}
\section{Test section one}
\begin{frame}
test
\end{frame}
\subsection{Test subsection}
\begin{frame}
test
\end{frame}
\subsection{Test subsection}
\begin{frame}
test
\end{frame}
\section{Test section two}
\begin{frame}
test
\end{frame}
\subsection{Test subsection}
\begin{frame}
test
\end{frame}
\subsection{Test subsection}
\begin{frame}
test
\end{frame}
\end{document}
I commented out the lines using the Helvetica fonts since I don't have that font in my system, but that's irrelevant for the solution.
Best Answer
You can set the
section in toc
andsection in toc shaded
colors appropriately:If "other" sections should not be shaded, you can add
A complete example: