收縮 ToC AtBeginSection 投影儀

收縮 ToC AtBeginSection 投影儀

考慮這個 MWE:

\documentclass{beamer}


\AtBeginSection[]{%
\begin{frame}<beamer>
\frametitle{Outline}
    \begin{minipage}{.25\textwidth}
        \tableofcontents[currentsection, hideothersubsections] % removing hideothersubsections solves the problem
    \end{minipage}
    \hfill
    \begin{minipage}{.55\textwidth}
        \begin{centering}
            \insertsectionhead
        \end{centering}

    \end{minipage}
\end{frame}
}

\begin{document}
\begin{frame}[shrink]{ToC}
\tableofcontents
\end{frame}

\section[aa]{AA}
\begin{frame}{A}
a   
\end{frame}

\section[bb]{BB}
\begin{frame}{B}
b
\end{frame}

\section{CC}
\begin{frame}{C}
c
\end{frame}

\section{DD}
\begin{frame}{D}
d
\end{frame}

\section[ee]{EE}
\begin{frame}{E}
e
\end{frame}

\section[ff]{FF}
\begin{frame}{F}
f
\end{frame}

\section[gg]{GG}
\begin{frame}{G}
g
\end{frame}


\section[hh]{HH}
\begin{frame}{H}
h
\end{frame}


\section[ii]{II}
\subsection[iii]{III}
\subsection[iv]{IV}
\subsection[v]{V}
\begin{frame}{I}
i
\end{frame}
\end{document}

我可以透過選擇將目錄放入一頁中shrink;但是每個部分開頭的目錄不適合一頁(一個部分解決方案是刪除hideothersubsections以便所有小節都將展開)。

我想要的是:

在每個部分的開頭,當前部分將位於頁面的中間,其所有子部分將被展開。只有少數相鄰部分(部分)可見,這些部分中的任何子部分都不會展開。

任何幫助將不勝感激。

答案1

下面顯示目前部分周圍的 +- 2 個部分。如果您想要更多或更少的部分,可以調整此數字。

\documentclass{beamer}

\newcounter{start}
\newcounter{stop}

\AtBeginSection[]{%
\setcounter{start}{\thesection}
\setcounter{stop}{\thesection}
\ifnum\value{section}>1
    \ifnum\value{section}=2
        \addtocounter{start}{-1}%
    \else%
        \addtocounter{start}{-2}%
    \fi%
\fi%
\addtocounter{stop}{2}
\begin{frame}<beamer>
\frametitle{Outline}
    \begin{columns}[c]
        \begin{column}{.25\textwidth}
            \tableofcontents[sections=\thestart-\thestop, subsectionstyle=show/show/hide] % removing hideothersubsections solves the problem
    \end{column}
    \hfill
    \begin{column}{.55\textwidth}
        \begin{centering}
            \insertsectionhead
        \end{centering}
    \end{column}
  \end{columns}
\end{frame}
}

\begin{document}
\begin{frame}[shrink]{ToC}
\tableofcontents
\end{frame}

\section[aa]{AA}
\begin{frame}{A}
a   
\end{frame}

\section[bb]{BB}
\begin{frame}{B}
b
\end{frame}

\section{CC}
\begin{frame}{C}
c
\end{frame}

\section{DD}
\begin{frame}{D}
d
\end{frame}

\section[ee]{EE}
\begin{frame}{E}
e
\end{frame}

\section[ff]{FF}
\begin{frame}{F}
f
\end{frame}

\section[gg]{GG}
\begin{frame}{G}
g
\end{frame}


\section[hh]{HH}
\begin{frame}{H}
h
\end{frame}


\section[ii]{II}
\subsection[iii]{III}
\subsection[iv]{IV}
\subsection[v]{V}
\begin{frame}{I}
i
\end{frame}
\end{document}

相關內容