Beamer:为什么目录中的子部分没有正确居中

Beamer:为什么目录中的子部分没有正确居中

在以下 MWE 中,为什么第二行没有正确居中?更令人困惑的是,为什么如果我删除其他部分,这个问题就会消失?

\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

答案1

基于思维导图中的链接作为投影仪中的目录- 如果你自己动手,你可以按照你喜欢的任何方式构建它

\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

相关内容