1

I want to present a ToC in Beamer which shows the previous items and grays out future items. I cannot quite get it to work however. Here is a MWA:

\documentclass{beamer}
\usetheme{Luebeck}
\setbeamercovered{transparent}
\usepackage{totcount} % Get the last number of a counter
\regtotcounter{section}
\newcounter{mytmp}
\begin{document}
\section{Section 1}
\frame{\tableofcontents}
\section{Section 2}
\subsection{2.1}
\frame{\tableofcontents[hideallsubsections]}
\section{Section 3}
\setcounter{mytmp}{\thesection}
\stepcounter{mytmp}
\frame{%
    \tableofcontents[sections={1-\thesection},hideallsubsections]
    \tableofcontents[sections={\themytmp-\totvalue{section}},currentsection]
}
\section{Section 4}
\frame{}
\section{Section 5}
\frame{}
\section{Section 6}
\frame{}
\section{Section 7}
\frame{}
\section{Section 8}
\frame{}
\subsection{8.1}
\frame{}
\subsection{8.2}
\frame{}
\section{Section 9}
\frame{}
\end{document}

The output is as follows:

  1. A standard ToC. Output from ToC in section 1

  2. A Toc using the hideallsubsections option. Why is the distance between items increased? How can it be fixed? Output from ToC in section 2

  3. A ToC nearly showing what I want to accomplish. Why is the distance between 3 and 4 so narrow? How can it be fixed? Once again, the hideallsubsections in the visible list messes up the distance between items. If all of this can be fixed, would it be possible to create at better solution, where \setcounter{mytmp}{\thesection} and \stepcounter{mytmp} don't need to be written every time, i.e. creating a new \mytableofcontents command which solves everything? Output from ToC in section 3

I have also tried surrounding the \tableofcontents command with \setbeamercovered{still covered={\opaqueness<1->{15}},again covered={\opaqueness<1->{100}}} and \setbeamercovered{still covered={\opaqueness<1->{15}},again covered={\opaqueness<1->{15}}}, alas without success. This works for itemize lists though!

5
+50

I think the following source code gives the results that you want:

\documentclass{beamer}
\usetheme{Luebeck}
\setbeamercovered{transparent}
\usepackage{totcount} % Get the last number of a counter
\regtotcounter{section}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
\makeatother
\AtBeginSection{%
\frame{%
  \tableofcontents[sections={1-\thesection},hideallsubsections]%
  \unskip\vskip0.5em
  \tableofcontents[sections={\the\numexpr\thesection+1\relax-\totvalue{section}},currentsection,hideallsubsections]
}}
\begin{document}
\frame{\tableofcontents[hideallsubsections]}
\section{Section 1}
\section{Section 2}
\subsection{2.1}
\section{Section 3}
\section{Section 4}
\section{Section 5}
\section{Section 6}
\section{Section 7}
\section{Section 8}
\subsection{8.1}
\subsection{8.2}
\section{Section 9}
\end{document}

I use \numexpr to do calculation, use etoolbox to patch beamer code.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.