在其他地方使用 beamer TOC 样式

在其他地方使用 beamer TOC 样式

如何beamer在其他幻灯片中使用目录样式?例如,使枚举更大、更粗等。理想情况下,我想做类似的事情

\begin{frame}{My Outline}
  \styleframeastoc % NOT working, obviously.
  \begin{enumerate}
     ...
  \end{enumerate}
\end{frame}

背景

我想定义自己的大纲,每个标题下面都有一句话来解释我将在该部分中涵盖的内容。例如:

  1. 第一种方法

    这是一个非常简单直接的方法,但只有在理想世界中才有效。

  2. 第二种方法

    对第一种方法进行改进……

  3. ...

我认为最简单的方法是不是为此,使用实际的 TOC 机制,而是“手动”插入相应的幻灯片(无论如何只有 5 个左右的部分)。

答案1

你可以做类似的事情:

\documentclass{beamer}
\setbeamertemplate{section in toc}[sections numbered]

\newcommand{\injecttext}[1]{%
    \vskip-2\baselineskip
    \setlength{\leftskip}{1.2em}
    #1\par
    \setlength{\leftskip}{0em}
}

\begin{document}

\begin{frame}
\tableofcontents
\end{frame}


\begin{frame} 
\tableofcontents[sections=1] 
\injecttext{blabla1 blabla1 blabla1 blabla1 blabla1 blabla1 blabla1 blabla1 blabla1 blabla1 blabla1} 
\tableofcontents[sections=2] 
\injecttext{blabla2} 
\tableofcontents[sections=3] 
\injecttext{blabla3} 
\end{frame}

\section{bla}\frame{}
\section{test}\frame{}
\section{blub}\frame{}

\end{document}

在此处输入图片描述

[但是,如果你在一页上挤入超过 9 个部分,则对齐可能会不正确]

答案2

OP 不太可能仍然需要这些信息。但他们可能是正在寻找投影仪 TOC 布局的研究人员。

TOC命令定义如下

\def\beamer@tableofcontents[#1]{%
  \def\beamer@toc@cs{show}%
  \def\beamer@toc@os{show}%
  \def\beamer@toc@css{show}%
  \def\beamer@toc@oss{show}%
  \def\beamer@toc@ooss{show}%
  \def\beamer@toc@csss{show}%
  \def\beamer@toc@osss{show}%
  \def\beamer@toc@oosss{show}%
  \def\beamer@toc@ooosss{show}%
  \beamer@showpartnumber=\c@part%
  \beamer@pausesectionsfalse%
  \beamer@pausesubsectionsfalse%
  \def\beamer@tocsections{<*>}%
  \setkeys{beamertoc}{firstsection=1}%
  \setkeys{beamertoc}{#1}%
  \vspace*{-.5em}{\makeatletter%
    \pause[0]%
    \@input{\jobname.toc}%
    \vfill}%
  }

所有目录项的存储位置\jobname.toc如下

\beamer@endinputifotherversion {3.36pt}
\beamer@sectionintoc {1}{A}{1}{0}{1}
\beamer@subsectionintoc {1}{1}{A1}{1}{0}{1}
\beamer@subsubsectionintoc {1}{1}{1}{A1i}{1}{0}{1}
\beamer@subsubsectionintoc {1}{1}{2}{A1ii}{1}{0}{1}
\beamer@subsectionintoc {1}{2}{A2}{1}{0}{1}
\beamer@subsubsectionintoc {1}{2}{1}{A2i}{1}{0}{1}
\beamer@subsubsectionintoc {1}{2}{2}{A2ii}{1}{0}{1}
\beamer@sectionintoc {2}{B}{1}{0}{2}
\beamer@subsectionintoc {2}{1}{B1}{1}{0}{2}
\beamer@subsubsectionintoc {2}{1}{1}{B1i}{1}{0}{2}
\beamer@subsubsectionintoc {2}{1}{2}{B1ii}{1}{0}{2}
\beamer@subsectionintoc {2}{2}{B2}{1}{0}{2}
\beamer@subsubsectionintoc {2}{2}{1}{B2i}{1}{0}{2}
\beamer@subsubsectionintoc {2}{2}{2}{B2ii}{1}{0}{2}

每行对应一个目录项。例如\beamer@subsubsectionintoc {2}{1}{2}{B1ii}{1}{0}{2}{2}第 2 节、{1}第 1 小节、{2}第 2 小节、{B2ii}是标题、以及{1}{0}{1}代表其他内容。

因此,要以 TOC 格式排版列表,可以这样写:

\documentclass{beamer}
\begin{document}

\makeatletter
\def\fakeTOC#1{%
  \def\beamer@toc@cs{show}%
  \def\beamer@toc@os{show}%
  \def\beamer@toc@css{show}%
  \def\beamer@toc@oss{show}%
  \def\beamer@toc@ooss{show}%
  \def\beamer@toc@csss{show}%
  \def\beamer@toc@osss{show}%
  \def\beamer@toc@oosss{show}%
  \def\beamer@toc@ooosss{show}%
  \beamer@showpartnumber=\c@part%
  \beamer@pausesectionsfalse%
  \beamer@pausesubsectionsfalse%
  \def\beamer@tocsections{<*>}%
  \setkeys{beamertoc}{firstsection=1}%
  \setkeys{beamertoc}{}%
  \vspace*{-.5em}{%
    \beamer@endinputifotherversion {3.36pt}%
    #1%
    \vfill%
  }%
}
\def\TOCsec#1{%
    \beamer@sectionintoc{0}{#1}{0}{0}{0}%
}
\def\TOCsubsec#1{%
    \beamer@subsectionintoc{0}{0}{#1}{0}{0}{0}%
}
\def\TOCsubsubsec#1{%
    \beamer@subsubsectionintoc{0}{0}{0}{#1}{0}{0}{0}%
}
\makeatother

\frame{
    \fakeTOC{%
        \TOCsec{fake sec A}
        \TOCsubsec{fake subsec A-1}
        \TOCsubsubsec{fake subsubsec A-1-i}
        \TOCsubsubsec{fake subsubsec A-1-ii}
        \TOCsubsec{fake subsec A-2}
        \TOCsubsubsec{fake subsubsec A-2-i}
        \TOCsubsubsec{fake subsubsec A-2-ii}
        \TOCsec{fake sec B}
        \TOCsubsec{fake subsec B-1}
        \TOCsubsubsec{fake subsubsec B-1-i}
        \TOCsubsubsec{fake subsubsec B-1-ii}
        \TOCsubsec{fake subsec B-2}
        \TOCsubsubsec{fake subsubsec B-2-i}
        \TOCsubsubsec{fake subsubsec B-2-ii}
    }
}

\section{true sec A}
\subsection{true subsec A-1}
\subsubsection{true subsec A-1-i}
\subsubsection{true subsec A-1-ii}
\subsection{true subsec A-2}
\subsubsection{true subsubsec A-2-i}
\subsubsection{true subsubsec A-2-ii}
\section{true sec B}
\subsection{true subsec B-1}
\subsubsection{true subsubsec B-1-i}
\subsubsection{true subsubsec B-1-ii}
\subsection{true subsec B-2}
\subsubsection{true subsubsec B-2-i}
\subsubsection{true subsubsec B-2-ii}

\frame{
    \tableofcontents
}

\end{document}

相关内容