# How to collect all parts in Beamer?

I would like to use \tableofcontents to get contents of all the parts in beamer including only the names of parts, not including sections and subsections, how should I do?

• I'm not sure that I understand what you want. Could you please edit your question to include a minimal working example (MWE)? Having a small, complete document that will compile makes it a lot easier for us to copy it into our text editors and work with it, as well as to see exactly what it is you are trying to do. – Andrew Uzzell Nov 23 '12 at 10:30

Here's something to get you started, but note that it does not fit in with beamer's styles and the entries in the list of parts are not hyperlinked:

\documentclass{beamer}
\usepackage{lipsum}

% for the list of parts
\makeatletter
\AtBeginPart{%
\frame{\partpage}%
}
\newcommand{\parttableofcontents}{\@starttoc{parttoc}}
\newcommand{\beamer@partintoc}[3]{#2\par}
\makeatother

% for slides to announce the start of a new section
\AtBeginSection[]% do nothing for \section*
{\frame{\sectionpage}}

\begin{document}
\frame{\frametitle{List of parts}\parttableofcontents}
\part{one}
\section{a section}
\frame{\lipsum[1]}
\section{another section}
\frame{\lipsum[2]}
\part{two}
\section{yet another section}
\subsection{subsection}
\frame{\lipsum[3]}
\end{document}


As far as I can tell, the key to improving the prettiness of the answer given by cyberSingularity is to get a better definition for \beamer@partintoc. I have no time to cook one up right now, I should have been in bed twenty minutes ago but I accidentally ended up spending over an hour on this thing. But beamer's definition of the analogous command for subsections is below, as well as the one for subsecsections. By noting the differences between them, it should be possible to work backwards and figure out what the one for parts should look like.

\def\subsectionintoc{}
\long\def\beamer@subsectionintoc#1#2#3#4#5#6{%
\ifnum\c@tocdepth>1%
\ifnum#5=\beamer@showpartnumber%
{%
\beamer@saveanother%
\gdef\beamer@todo{}%
\beamer@slideinframe=#1\relax%
\expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
\ifbeamer@pausesubsections\pause\fi%
\beamer@tempcount=#6%
\edef\inserttocsectionnumber{\the\beamer@tempcount}%
\def\inserttocsubsectionnumber{#2}%
\beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@css\else\beamer@toc@oss\fi}%
{%
\def\beamer@breakhere{\\}%
\beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
{subsection in toc}%
}%
}}%
\beamer@restoreanother%
}
\beamer@todo%
\fi\fi%
}


And now for subsub:

\def\subsubsectionintoc{}
\long\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{%
\ifnum\c@tocdepth>2%
\ifnum#6=\beamer@showpartnumber%
{
\beamer@saveanother%
\gdef\beamer@todo{}%
\beamer@slideinframe=#1\relax%
\expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
\ifbeamer@pausesubsections\pause\fi%
\beamer@tempcount=#7%
\edef\inserttocsectionnumber{\the\beamer@tempcount}%
\def\inserttocsubsectionnumber{#2}%
\def\inserttocsubsubsectionnumber{#3}%
\beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@csss\else\beamer@toc@osss\fi}%
{%
\def\beamer@breakhere{\\}%
\beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\ifnum\c@subsubsection=#3\beamer@toc@csss\else\beamer@toc@osss\fi\else\beamer@toc@oosss\fi\else\beamer@toc@ooosss\fi}
{subsubsection in toc}%
}%
}}%
\beamer@restoreanother%
}
\beamer@todo%
\fi\fi%
}

• This isn't a real answer. Should I have made it a community wiki, maybe? – Mark Oct 11 '16 at 6:25