3

I'd like to know how, on the same frame, show first the table of contents all shaded, and then by overlays increasingly revealing (unshading) each line of it.

So far I have this:

\begin{frame}{Outline}
  \tableofcontents[pausesections,pausesubsections,subsectionstyle=shaded]
\end{frame}

which at the beginning shows first section and hides rest of toc, then incrementally shows subsections shaded and sections unshaded.

thanks!

2

This is a proposal which only works if the table of contents fits in one frame. The idea is to first draw a "faded" table of contents, and then put a second one on top that gets successively uncovered.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}{Outline}
\begin{overlayarea}{\textwidth}{0.85\textheight}
\begin{tikzpicture}
\node at (0,0) {\begin{minipage}{\textwidth}
\setbeamertemplate{section in toc shaded}[default][50] 
\tableofcontents[sectionstyle=shaded,subsectionstyle=shaded]
\end{minipage}};
\node at (0,0) {\begin{minipage}{\textwidth}
\tableofcontents[pausesections,pausesubsections]
\end{minipage}};
\end{tikzpicture}
\end{overlayarea}
\end{frame}
\section{A section}
\subsection{A subsection}
\begin{frame}
\frametitle{A frame}
\begin{overlayarea}{\textwidth}{0.85\textheight}

\end{overlayarea}
\end{frame}
\subsection{Another subsection}
\begin{frame}
\frametitle{Another frame}
\begin{overlayarea}{\textwidth}{0.85\textheight}

\end{overlayarea}
\end{frame}
\section{Another section}
\subsection{Yet another subsection}
\begin{frame}
\frametitle{Yet another frame}
\begin{overlayarea}{\textwidth}{0.85\textheight}

\end{overlayarea}
\end{frame}
\end{document}
  • I like your answer better than mine. However: why can't you use \smash on \tableofcontents? I just tried and got an error. tikz seems like a big package to achieve the overlap here. – Jesse Knight Jan 18 '18 at 5:06
  • @JesseKnight Yes, loading TikZ only for this is an overkill. However, all of my attempts avoiding this so far have lead to unsatisfactory results. – user121799 Jan 18 '18 at 5:32
2

I have a solution, though it requires including a few packages.

We will create the table of contents one line at a time, using parts, since \tableofcontents[part=1] will create the TOC for some specified part of the document. This will allow us to use the overlay specifications features in beamer to unshade the lines one-at-a-time.

To separate the lines by section and subsection, we first prepend an empty \part{} call to both \section and \subsection commands using the \pretocmd command from the package etoolbox:

\pretocmd{\section}{\part{}}{}{}{}
\pretocmd{\subsection}{\part{}}{}{}{}

Next, we count the number of parts which are created in the document using the totvalue command from the totcount package:

\regtotcounter{part} % <- preamble
...
\totvalue{part} % <- the total number 

Finally, we use the \foreach command from the tikz package to loop through all the parts, and print the TOC for just this element, with an \uncover specification:

\begin{frame}{Outline}
  \setbeamercovered{transparent}
  \foreach\i in {1,...,\totvalue{part}}%
    {\uncover<\i->{\tableofcontents[part=\i,subsectionstyle=shaded]}}
\end{frame}

Personally, I think the double shading of subsections is too hard to see, but you can play around with it.

An entire MWE:

\documentclass{beamer}

\usepackage{etoolbox}
\usepackage{tikz}
\usepackage{totcount}

\regtotcounter{part}
\pretocmd{\section}{\part{}}{}{}{}
\pretocmd{\subsection}{\part{}}{}{}{}

\begin{document}

\begin{frame}{Outline}
  \setbeamercovered{transparent}
  \foreach\i in {1,...,\totvalue{part}}%
    {\uncover<\i->{\tableofcontents[part=\i,subsectionstyle=shaded]}}
\end{frame}

\section{Sec 1}
\subsection{Sec 1.1}
\subsection{Sec 1.2}
\section{Sec 2}
\subsection{Sec 1.1}
\subsection{Sec 1.2}
\begin{frame}
dummy
\end{frame}

\end{document}
1

You could move the all-shaded toc into a separate frame and decrease the framenumber to make them look like one frame:

\documentclass{beamer}

\begin{document}

{
    \setbeamercovered{transparent}
    \begin{frame}{Outline}
          \tableofcontents[
            currentsection
          ]
    \end{frame} 
    \addtocounter{framenumber}{-1}
    \begin{frame}{Outline}
          \tableofcontents[
            pausesections,
            pausesubsections,
          ]
    \end{frame}
}

\section{sec1}
\subsection{sub1}
\begin{frame}
content...
\end{frame}
\subsection{sub2}
\begin{frame}
content...
\end{frame}
\section{sec2}
\begin{frame}
content...
\end{frame}


\end{document}

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.