Beamer 中的 TOC 讲座

Beamer 中的 TOC 讲座

我有一个大型的 Beamer 演示文稿,分为 10 个讲座。每个讲座都有部分。有没有办法在幻灯片中创建一种仅包含讲座的目录?

\documentclass[handout,11pt]{beamer}

\begin{document}
 \begin{frame}{All lectures}
%    \tableofLectures  as a list of all lectures
\end{frame}

\lecture{Lecture1}{lec1}
    \section{1}
    \section{2}
 \lecture{Lecture2}{lec2}
    \section{1}
 \section{2}
\lecture{Lecture3}{lec3} 
    \section{1}
 \section{2}
\end{document}

答案1

\addtocontents{toc}{...}您可以通过在定义中添加 via 将讲座名称添加到目录中\lecture

\documentclass{beamer}

\setbeamercolor{lecture in toc}{parent=structure}

\makeatletter
\long\def\beamer@lecture[#1]#2#3{%
  \beamer@savemode
  \mode<all>%
  \refstepcounter{lecture}%
  \def\beamer@currentlecturelabel{#3}%
  \@onelevel@sanitize\beamer@currentlecturelabel
  \def\beamer@lecturename{#2}%
  \def\beamer@shortlecturename{#1}%
  \ifx\beamer@onlylecture\@empty
  \else
    \expandafter\beamer@if@in@clist@TF\expandafter\beamer@onlylecture
      \expandafter{\beamer@currentlecturelabel}%
      {\beamer@inlecturetrue}%
      {\beamer@inlecturefalse}%
  \fi
  \beamer@atbeginlecture
  \beamer@resumemode
  \addtocontents{toc}{%
    \protect\usebeamercolor[fg]{lecture in toc}%
    \vfill%
    #2%
  }
}
\makeatother

\title{Some Title}

\begin{document}

\begin{frame}
    \setcounter{secnumdepth}{-1}
  \tableofcontents[sectionstyle=hide/hide,subsectionstyle=hide/hide/hide]
\end{frame}

\lecture{Lecture1}{lec1}
\section{Section 1}
\subsection{Subsection 1a}
\frame{}
\subsection{Subsection 1b}
\frame{}
\subsection{Subsection 1c}
\frame{}

\section{Section 2}
\frame{}

\lecture{Lecture2}{lec2}
\section{Section 3}
\subsection{Subsection 3a}
\frame{}
\subsection{Subsection 3b}
\frame{}
\subsection{Subsection 3c}
\frame{}

\end{document}

在此处输入图片描述


编辑:

为了防止讲座出现在正常目录中,可以创建自定义讲座列表(lol简称:)

\documentclass{beamer}

\setbeamercolor{lecture in toc}{parent=structure}

\makeatletter
\long\def\beamer@lecture[#1]#2#3{%
  \beamer@savemode
  \mode<all>%
  \refstepcounter{lecture}%
  \def\beamer@currentlecturelabel{#3}%
  \@onelevel@sanitize\beamer@currentlecturelabel
  \def\beamer@lecturename{#2}%
  \def\beamer@shortlecturename{#1}%
  \ifx\beamer@onlylecture\@empty
  \else
    \expandafter\beamer@if@in@clist@TF\expandafter\beamer@onlylecture
      \expandafter{\beamer@currentlecturelabel}%
      {\beamer@inlecturetrue}%
      {\beamer@inlecturefalse}%
  \fi
  \beamer@atbeginlecture
  \beamer@resumemode
  \addtocontents{lol}{%
    \protect\usebeamercolor[fg]{lecture in toc}%
    #2%
    \vfill%
  }
}

\AtEndDocument{%
  \clearpage
  \if@filesw
      \newwrite\tf@lol
      \immediate\openout\tf@lol\jobname.lol\relax
    \fi
}

\makeatother

\usepackage{multicol}

\AtBeginSection[]{
    \begin{frame}
        \frametitle{Agenda}
        \begin{multicols}{2}
                \tiny
                \tableofcontents[currentsection,hideothersubsections]
        \end{multicols}
    \end{frame}
    \frame{\sectionpage} 
}

\title{Some Title}

\begin{document}

\begin{frame}
\vfill
\IfFileExists{\jobname.lol}{\input{\jobname.lol}}{}
\end{frame}

\lecture{Lecture1}{lec1}
\section{Section 1}
\subsection{Subsection 1a}
\frame{}
\subsection{Subsection 1b}
\frame{}
\subsection{Subsection 1c}
\frame{}

\section{Section 2}
\frame{}

\lecture{Lecture2}{lec2}
\section{Section 3}
\subsection{Subsection 3a}
\frame{}
\subsection{Subsection 3b}
\frame{}
\subsection{Subsection 3c}
\frame{}

\end{document}

相关内容