41
votes

Assume I have some sections within my latex-beamer presentation. Some of these sections contain subsections, others do not. So it looks very weird in the table of contents.

How can I suppress subsections in the table of contents?

3
I had the same question, and the answer below did the trick. I could add that the reason one would want subsections in the first place when they are going to be absent in the table of contents, is that all subsections of the current section are displayed in the border of the slides, which is quite useful for the audience. However with many subsections they may clutter the table of contents. I would have thought that \tableofcontents would have an option 'hidesubsections', but this seems not the case.Marc van Leeuwen

3 Answers

48
votes

To keep a specific subsection out of the index use: \subsection*{...}

To remove all subsections from the TOC only, use: \tableofcontents[hideallsubsections] (added from another answer)

42
votes

To hide subsections use the pretty self-explanatory:

\tableofcontents[hideallsubsections]

5
votes

The same as in the other two answers can also be achieved using \setcounter{tocdepth}{1}, before (or after) \begin{document}: try to compile the following code, then delete or comment the line marked with %%% and compile again (once, or twice if necessary) to see the difference.

\documentclass{beamer}
\usetheme{Goettingen}

\setcounter{tocdepth}{1} %%%

\begin{document}

\frame{\tableofcontents}

\section{First}
\begin{frame}
  A
\end{frame}

\section{Second}
\subsection{One only}
\begin{frame}
  B
\end{frame}

\end{document}

At the same way as using \tableofcontents[hideallsubsections], the subsections disappear in the frame where the \tableofcontents is, but not in the sidebar (if present in the theme you use). The same, again, with local use of starred \subsection*{Subsection Title}.