For stylistic reasons (I have everything in blocks), I'd like to have my TOC in a block too, but without having to typset it manually for all sections.
I was surprised that the standard tikz TOC produces garbage when inserted into a block.
Therefore, I tried several methods of building an approximation to the behaviour I'd like (basically like itemize/enumerate), but while I managed to hack something reasonably similar together for the sections, I was unable to get the subsections right at all.
First, I thought it only boils down to knowing exactly which skips to use and how to get them (took me ages to figure the \global stuff out; thanks to https://tex.stackexchange.com/a/43005/42225 and https://tex.stackexchange.com/a/119738/42225), but now I'm finding other strange behaviour (indendation changes for things that are defined exactly the same; can't change font size or color in subsection, etc.), which is why I turn to you, dear TeX.SX.
In the MWE below is a "reference solution" that I'd like to achieve with the standard TOC-functionality. Ideally, they should match exactly, but a few pt's here or there won't hurt anyone. ;-)
\documentclass[10pt]{beamer}
\usepackage[english]{babel}
\usepackage{enumerate}
\usepackage{xparse}
\usetheme{Darmstadt}
\NewDocumentCommand{\mytoc}{O{}}{
\begin{frame}{Test}
\begin{block}{Table of Contents}
\vskip 6pt % shouldn't be hardcoded...
\tableofcontents[#1]
\end{block}
\end{frame}
}
%\AtBeginSection{%
% \mytoc[currentsection]
%}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{frame}{Reference}
\begin{block}{Table of Contents}
\begin{enumerate}[1.]
\item Motivation
\item Construction
\item The Method
\item Improvements
\item Applications
\begin{enumerate}[\theenumi.1.]
\item One
\item Two
\item Three
\end{enumerate}
\end{enumerate}
\end{block}
\end{frame}
\begin{frame}{Na\"ive version}
\begin{block}{Doesn't work}
\tableofcontents
\end{block}
\end{frame}
\setbeamertemplate{section in toc}{\item[\inserttocsectionnumber.]\inserttocsection}
\begin{frame}{Trying to use itemize}
\begin{block}{Doesn't work}
\begin{itemize}
\tableofcontents
\end{itemize}
\end{block}
\end{frame}
\newlength{\itemsepEnumi}
\newlength{\labelsepEnumi}
\newlength{\parsepEnumi}
\newlength{\topsepEnumi}
\newlength{\partopsepEnumi}
\newlength{\leftmarginEnumi}
\newlength{\itemsepEnumii}
\newlength{\labelsepEnumii}
\newlength{\parsepEnumii}
\newlength{\topsepEnumii}
\newlength{\partopsepEnumii}
\newlength{\leftmarginEnumii}
\newlength{\partopsepEnumz} % z=zero
\begin{frame}{Data Collection}
\begin{block}{Relevant Values} % see tex.stackexchange.com/a/94949/42225
\begin{enumerate}[1.]
\item \texttt{itemsep}: \the\itemsep \global\itemsepEnumi =\itemsep
\global\labelsepEnumi =\labelsep
\item \texttt{parsep}: \the\parsep \global\parsepEnumi =\parsep
\item \texttt{topsep}: \the\topsep \global\topsepEnumi =\topsep
\item \texttt{partopsep}: \the\partopsep \global\partopsepEnumi =\partopsep
\item \texttt{leftmargin}: \the\leftmargin \global\leftmarginEnumi=\leftmargin
\begin{enumerate}[\theenumi.1.]
\item \texttt{itemsep}: \the\itemsep \global\itemsepEnumii =\itemsep
\global\labelsepEnumii =\labelsep
\global\parsepEnumii =\parsep
\global\topsepEnumii =\topsep
\item \texttt{partopsep}: \the\partopsep \global\partopsepEnumii =\partopsep
\item \texttt{leftmargin}: \the\leftmargin \global\leftmarginEnumii=\leftmargin
\end{enumerate}
\end{enumerate}
\global\partopsepEnumz=\partopsep
\end{block}
\end{frame}
\begin{frame}{Data Collection -- Successful}
\begin{block}{Relevant Values}
\begin{enumerate}[1.]
\item \texttt{itemsep}: \the\itemsepEnumi
% \item \texttt{labelsep}: \the\labelsepEnumi
\item \texttt{parsep}: \the\parsepEnumi
\item \texttt{topsep}: \the\topsepEnumi
\item \texttt{partopsep}: \the\partopsepEnumi
\item \texttt{leftmargin}: \the\leftmarginEnumi
\begin{enumerate}[\theenumi.1.]
\item \texttt{itemsep}: \the\itemsepEnumii
% \item \texttt{labelsep}: \the\labelsepEnumii
% \item \texttt{parsep}: \the\parsepEnumii
% \item \texttt{topsep}: \the\topsepEnumii
\item \texttt{partopsep}: \the\partopsepEnumii
\item \texttt{leftmargin}: \the\leftmarginEnumii
\end{enumerate}
\end{enumerate}
%\texttt{partopsep}: \the\partopsepEnumz
\end{block}
\end{frame}
\setlength{\leftmarginEnumii}{33.3334pt} % how to add skips?
\setbeamertemplate{section in toc}{\leavevmode\leftskip=\leftmarginEnumi%
\llap{\inserttocsectionnumber.\hspace{\labelsepEnumi}} % why is this automatically blue?
{\color{black}\smash[b]{\inserttocsection}}\par\vskip\itemsepEnumi}
\setbeamertemplate{section in toc shaded}{\leavevmode\leftskip=\leftmarginEnumi%
{\color{gray}\llap{\inserttocsectionnumber.\hspace{\labelsepEnumi}}\smash[b]{\inserttocsection}} \par\vskip\itemsepEnumi\vskip\parsepEnumi}
\setbeamertemplate{subsection in toc}{\leavevmode\leftskip=\leftmarginEnumii%
\llap{%\usetemplate{itemize 2 item} % can't set color/fontsize?!
\inserttocsectionnumber.\inserttocsubsectionnumber.\hspace{\labelsepEnumii}}
{\color{black}\smash[b]{\inserttocsubsection}} \par\vskip\itemsepEnumii \vskip\parsepEnumii}
\setbeamertemplate{subsection in toc shaded}{\leavevmode\leftskip=\leftmarginEnumii%
{\color{gray}\llap{\inserttocsectionnumber.\inserttocsubsectionnumber.\hspace{\labelsepEnumii}}\smash[b]{\inserttocsubsection}} \par\vskip\itemsepEnumii\vskip\parsepEnumii}
\begin{frame}{Trying to Use Skips}
\begin{block}{Doesn't work}
\vskip\partopsepEnumz % is this the right set/combination of skips?
\vskip\partopsepEnumi
\vskip\topsepEnumi
\tableofcontents
\end{block}
\end{frame}
\begin{frame}{Reference}
\begin{block}{Table of Contents}
\begin{enumerate}[1.]
\item Motivation
\item Construction
\item The Method
\item Improvements
\item Applications
\begin{enumerate}[\theenumi.1.]
\item One
\item Two
\item Three
\end{enumerate}
\end{enumerate}
\end{block}
\end{frame}
\begin{frame}{Indentation changes from \texttt{section} to \texttt{section shaded}?!}
\begin{block}{Table of Contents}
\vskip 6pt
\tableofcontents
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Motivation}
\mytoc[currentsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Construction}
\mytoc[currentsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Method}
\mytoc[currentsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Improvements}
\mytoc[currentsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Applications}
\subsection{One}
\mytoc[currentsection,currentsubsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Two}
\mytoc[currentsection,currentsubsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Three}
\mytoc[currentsection,currentsubsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{Something}
\begin{block}{Something}
Something
\end{block}
\end{frame}
\end{document}

\def...instead of\set..., resp. defining an own stylemy tocinstead of overwriting existing styles) were very useful to achieve the desired appearance. So thanks again for that! – Axel Oct 27 '14 at 10:41