0

In the following MWE, why is the second row not properly centered? And more confusingly, why does this problem go away if I delete the additional sections?

\documentclass{beamer}
\setbeamertemplate{subsection in toc}{\inserttocsubsection}

\begin{document}

\section{Section}
\begin{frame}
\begin{center}
\tableofcontents[sectionstyle=show/hide,subsectionstyle=show/show/hide]
\end{center}
\end{frame}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}

\section{Section}
\frame{}
\section{Section}
\frame{}
\section{Section}
\frame{}
\section{Section}
\frame{}
\end{document}

enter image description here

Bananach
  • 627

1 Answers1

1

based on Links in mindmap as table of contents in beamer - If you do the yourself, you can build it in any way you like

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees,shadows}

% total number of sections %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{totcount}
\newcounter{totalsection}
\regtotcounter{totalsection}

\AtBeginDocument{%
  \pretocmd{\section}{\refstepcounter{totalsection}}{}{}%
}%

% number of subsections per section %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xcntperchap}
\RegisterCounters{section}{subsection}
\newcounter{totalsubsection}
\setcounter{totalsubsection}{0}

% creating automatic label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% based on https://tex.stackexchange.com/a/386557/36296
\AtBeginSection[]{%
    \label{sec:\thesection}
    \begin{frame}
        \frametitle{Outline}
        \mindtoc    
    \end{frame}
    }
\AtBeginSubsection[]{\label{subsec:\thesection:\thesubsection}}
\newcounter{currentsub}
\newcounter{totsection}

\newcommand{\mindtoc}{%
    \centering%
    {%
        \usebeamerfont{section in toc}%
        \usebeamercolor[fg]{section in toc}%
        \setcounter{totsection}{\number\totvalue{totalsection}}%
            \hyperlink{sec:\thesection}{\nameref{sec:\thesection}}%
            \setcounter{currentsub}{\ObtainTrackedValueExp[\thesection]{section}{subsection}}%
            \par%
        }%
        {%
        \usebeamerfont{subsection in toc}%
        \usebeamercolor[fg]{subsection in toc}%
            \ifnum\thecurrentsub>0%
            \foreach \j in {1,...,\thecurrentsub}{%
                \hyperlink{subsec:\thesection:\j}{\nameref{subsec:\thesection:\j}}
            }%
        \fi%
    }%
}

\title{Some Title}

\begin{document}

\section{Section One}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}
\subsection{Subsection}
\frame{}

\section{Section}
\frame{}
\section{Section}
\frame{}
\section{Section}
\frame{}
\section{Section}
\frame{}   

\end{document}

enter image description here