Beamer:清单索引

Beamer:清单索引

我在 Beamer 演示文稿中将几个词条分布在不同的幻灯片上。这些词条的外观我之前已经定义过了,并且没有编号。

在这些词条开始之前,我想在额外的幻灯片上插入它们的概述/索引,并且应该有编号的词条(但这并不重要,只列出而不编号也可以)。我不知道如何实现它们——我尝试了一下,label但没有用。

目前我意识到了这一点,同时在枚举环境中复制索引幻灯片上的词条。这不是很优雅。

我希望我能让大家理解这个问题。顺便问一下:我如何在这里声明代码块?每行开头有四个空格——对于较长的代码块来说,这有点麻烦。

\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath,amssymb}
\usepackage{xcolor}

\author{Max Mustermann}
\title{Title}

\newcommand{\hervor}[1]{\textbf{\textcolor{blue}{#1}}}
\newcommand{\lipsum}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

\frametitle{This should be the index}
\begin{enumerate}
  \item Blah blah
  \item Foo bar
\end{enumerate}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

\frametitle{Theorys}
\hervor{Blah blah}
\lipsum
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

\frametitle{Theorys}
\lipsum
\hervor{Foo bar}
\lipsum

\end{frame}

\end{document}

答案1

这是一个可能的基本解决方案;其思路是使用 kernel\@starttoc命令生成一个带有.lof扩展名的新“列表”。该\hervor命令现在在文档中排版其参数,并将新列表的信息添加到文件中.loh。通过发出以下命令生成列表\listofhervors

\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath,amssymb}
\usepackage{xcolor}

\newcounter{hervor}

% this commands typesets the text in the document with the given format
% and also adds it to the .loh file
\newcommand{\hervor}[1]{%
  \textbf{\textcolor{blue}{#1}}%
  \stepcounter{hervor}%
  \addcontentsline{loh}{section}{%
    \protect\makebox[1cm][l]{\protect\usebeamercolor[fg]{enumerate item}\thehervor.\hfill}#1\par}%
}

\newcommand{\lipsum}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}

% the command that will generate the new list
\makeatletter
\newcommand\listofhervors{\@starttoc{loh}}
\makeatother

\author{Max Mustermann}
\title{Title}

\begin{document}

\begin{frame}
\frametitle{This is the index}
\listofhervors
\end{frame}

\begin{frame}
\frametitle{Theorys}
\hervor{First relevant text}
\lipsum
\end{frame}

\begin{frame}
\frametitle{Theorys}
\lipsum\ \hervor{Second relevant text}\lipsum
\end{frame}

\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容