# How to achieve links in a part ToC in a beamer presentation?

I red \tableofcontents from \part commands in Beamer, and it was very helpful. However, I wanted the part titles to be links pointing to the pages the part began. The example without this works just fine:

    \documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,decorations.pathreplacing}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{kerkis}

\makeatletter
\AtBeginPart{%
}
%% number, shortname, page.
\providecommand\beamer@partintoc[3]{%
\ifnum\c@tocdepth=-1\relax
% requesting onlyparts.
\makebox[6em]{Part #1:} #2
\par
\fi
}
\define@key{beamertoc}{onlyparts}[]{%
\c@tocdepth=-1\relax
}
\makeatother%

\begin{document}

\title[Short Title]{Long Title}
\subtitle[Short Subtitle]{Long Subtitle}
\date{\today}
\author{Tom B.}
\subject{Math. Questions.}

\begin{frame}[t]
\titlepage
\end{frame}

\begin{frame}[t]
\frametitle{Overview}
\tableofcontents[onlyparts]
\end{frame}

\part{Beginners}

\begin{frame}[t,shrink=0]
\frametitle{\insertpart}
\tableofcontents[subsectionstyle=hide]
\end{frame}

\section[Nat Num]{Natural Numbers}

\begin{frame}[t]
\frametitle{\insertsection}
\tableofcontents[sectionstyle={show/hide}]
\end{frame}

\frame{easy example for calculating with natural numbers...}

\subsection{Subtract}

\frame{easy example for calculating with natural numbers...}

\end{document}


I thought I just use \ref and \label to achieve this. So I changed one line:

\makebox[6em]{Part #1:} \ref{#2}


And I added one other after the \part command (and I thought about using \AtBeginPart for automation):

\part{Beginners}
\label{\insertpart}


But if I compile this (MikTeX 2.9, pdfTeX 3.1415926-1.40.11), I get 74 errors. Could anyone be so kind to explain to me why, and even better, tell me how to fix it, or provide an alternative to achieve linked parts?

Edit: Hmm, the problem appears to be \includepart. When I use

\makebox[6em]{Part #1:} \textcolor{green!30!blue}{\hyperlink{#2}{#2}}


and

\frame{\partpage \hypertarget{Beginners}{}}


instead it works. As I don't intend to put lots of parts, it is not too much of a pain to set them manually, but it is not very neat. Also, it seems to clash whenever I use \insertpart. The beamer manual states that it is a useful command for \partpage, so probably you can only use \insertpage when redefining \partpage?

-

Would this solution be ok?

\begin{frame}
\frametitle{Outline}
\tableofcontents
\tableofcontents[part=1]
\tableofcontents[part=2]
%....
\end{frame}

-

Ok, I got it, it was not that involving after all:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{hyperref}

\makeatletter
\AtBeginPart{%
}
%% number, shortname, page.
\providecommand\beamer@partintoc[3]{%
\ifnum\c@tocdepth=-1\relax
% requesting onlyparts.
\par
\fi
}
\define@key{beamertoc}{onlyparts}[]{%
\c@tocdepth=-1\relax
}
\makeatother%

\newcommand{\nameofthepart}{}
\newcommand{\nupart}[1]%
{   \part{#1}%
\renewcommand{\nameofthepart}{#1}%
\frame{\partpage \hypertarget{\nameofthepart}{}}%
}

\begin{document}

\title[Short Title]{Long Title}
\subtitle[Short Subtitle]{Long Subtitle}
\date{\today}
\author{Tom B.}
\subject{Math. Questions.}

\begin{frame}[t]
\titlepage
\end{frame}

\begin{frame}[t]
\frametitle{Overview}
\tableofcontents[onlyparts]
\end{frame}

\nupart{Beginners}


Basically all I had to do was creating a \nupart command that provides a macro containing the chapter name at a later point. It also automatically inserts the hyperlink, so the linking is achieved by simply using \nupart instead of \part.