NilsHaldenwang
NilsHaldenwang

Reputation: 3667

How to suppress subsections in the table of contents in latex-beamer?

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?

Upvotes: 47

Views: 46270

Answers (4)

randompast
randompast

Reputation: 693

You could also selectively suppress using itemize and \only.

\begin{itemize}
    \item[]<1->Introduction (show on all)
    \only<2>{\begin{itemize}
        \item[]<2>Show on 2
        \item[]<2>Show on 2
    \end{itemize}}
    \item[]<1->Show on all
    \only<3-4>{\begin{itemize}
        \item[]<3-4>Show on 3 and 4
        \begin{itemize}
            \item[]<4>Show on 4
        \end{itemize}
        \item[]<3-4>Show on 3 and 4
        \begin{itemize}
            \item[]<4>Show on 4
        \end{itemize}
    \end{itemize}}
\end{itemize}

Upvotes: -1

MattAllegro
MattAllegro

Reputation: 7375

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}.

Upvotes: 5

ypnos
ypnos

Reputation: 52387

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)

Upvotes: 58

Alexander Gladysh
Alexander Gladysh

Reputation: 41473

To hide subsections use the pretty self-explanatory:

\tableofcontents[hideallsubsections]

Upvotes: 43

Related Questions