![Beamer:隐藏注释时,幻灯片过渡仅依赖于幻灯片内容](https://linux22.com/image/250183/Beamer%EF%BC%9A%E9%9A%90%E8%97%8F%E6%B3%A8%E9%87%8A%E6%97%B6%EF%BC%8C%E5%B9%BB%E7%81%AF%E7%89%87%E8%BF%87%E6%B8%A1%E4%BB%85%E4%BE%9D%E8%B5%96%E4%BA%8E%E5%B9%BB%E7%81%AF%E7%89%87%E5%86%85%E5%AE%B9.png)
我制作了一个演示文稿,其中我大量使用了注释,并且幻灯片上的各个要点之间经常会有延迟,因为一个要点可能有多个与之相关的注释,因此需要多次单击才能到达下一个要点,因为每次单击都会在注释页面上显示另一个注释。
但是,在编译时不带注释,我希望它仅根据帧内容自动过渡。这非常棘手,因为我在幻灯片内容中硬编码了很多延迟。我添加了一个 MWE 来显示我的意思。
如果您在编译时带注释和不带注释(参见顶部的两个选项),您就会明白我的意思。带注释时,每次单击时,注释幻灯片或幻灯片本身都会发生变化。但是,不带注释时,通常需要多次单击才能继续,因为它要考虑 a) 多个注释或 b) 使用揭示命令在幻灯片本身中引入的延迟。
是否有一个编译选项可以让 Beamer 自动且智能地忽略任何不会导致幻灯片过渡的注释延迟和幻灯片内延迟,以便在没有注释的情况下进行编译时,您始终可以通过单击或向下翻页来实现幻灯片过渡?
我意识到在幻灯片本身中硬编码延迟是一个错误,但似乎笔记不应该有这种效果,而且由于我的演示文稿很长,我希望这可以通过一些 Beamer 黑客攻击或修补来自动完成。
谢谢。
梅威瑟:
% 1. NO NOTES
%\documentclass[]{beamer}
%% 2. DUAL-DISPLAY NOTES:
\documentclass[hyperref={bookmarks=true}]{beamer}
\usepackage{pgfpages}
\setbeameroption{show notes on second screen=left}
\usepackage[english]{babel}
\mode<presentation>{
\usetheme{Warsaw}
\setbeamercovered{transparent}}
\begin{document}
\begin{frame}{Introduction}{}
\begin{itemize}
\uncover<1->{\item Here is my first point}
\uncover<2->{\item Here is my second point}
\uncover<4->{\item With notes on, I would expect it to take two clicks to get here from the last point, since there are two notes. But with them off, I would expect it to take one click.}
\uncover<5->{\item This is my third point. I have four notes about this point, so with notes on, it should take three more clicks to get to the next slide. With them off, however, it should take one. }
\end{itemize}
\note[item]<1->{Here is a note about my first point}
\note[item]<2->{Here is a note about my second point}
\note[item]<3->{Here is \textbf{another} note about my second point}
\note[item]<4->{Here is a note about my third point}
\note[item]<5->{Here is the second of several more notes about my third point}
\note[item]<6->{Another one}
\note[item]<7->{And another}
\end{frame}
\begin{frame}{Another slide}{}
\begin{itemize}
\uncover<1->{\item Not much to say here}
\end{itemize}
\end{frame}
\end{document}
答案1
以下是适用于您发布的示例,但可能不适用于更复杂的叠加规范的方法。该方法有两个部分。第一部分是对叠加代码的一个小补充,它试图确定当前帧是否明确地提到,例如3
中的\uncover<3->
,或不提到,例如4
中的框架\uncover<4->
。如果明确提到,它会设置一个标志。该方法的第二部分是对 的一个小补充pgfpages
,富有想象力地称为pgfmorepages
(加拿大运输安全局和github),除其他外,它还引入了在发送页面时跳过页面的可能性。因此,它会查找代码第一部分设置的标志,如果找不到,它会忽略特定页面。
有一个问题。您无法使用该transparent
选项。这是因为它会进行一些前瞻性操作并询问“这会在一两帧内出现吗?”因此它会使用当前帧以外的其他帧号运行覆盖规范,这会搞乱测试。
另一个令人讨厌的地方是每个框架都必须以命令 开头\mentionedsetup
。这可以通过将其添加到其中一个模板中来实现自动化。
这是带有一些示例框架的代码。
%\url{http://tex.stackexchange.com/q/56990/86}
% 1. NO NOTES
\documentclass[]{beamer}
%% 2. DUAL-DISPLAY NOTES:
%\documentclass[hyperref={bookmarks=true}]{beamer}
\usepackage{pgfmorepages}
%\setbeameroption{show notes on second screen=left}
\makeatletter
\newif\if@mentioned
\@mentionedtrue
\pgfpagesdeclarelayout{1 on 1 with possible skip}
{
\def\pgfpageoptionborder{0pt}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=1,%
physical pages=1,%
first logical shipout=1,%
last logical shipout=1,%
current logical shipout=1,%
}
\pgfpagesphysicalpage{1}{
skip code={%
\if@mentioned
\pgfpagesshiptrue
\else
\pgfpagesshipfalse
\fi
}
}
\pgfpageslogicalpageoptions{1}
{%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight},%
}%
}
\pgfpagesuselayout{1 on 1 with possible skip}
\def\slidereferenced{%
\ifbeamer@inframe
\global\@mentionedtrue
\fi
}
\def\mentionedsetup{%
\ifnum\beamer@slideinframe=1
\global\@mentionedtrue
\else
\global\@mentionedfalse
\fi
}
\expandafter\let\csname
beamerx@\string\beamer@inframenote\endcsname\relax
\renewcommand<>{\beamer@inframenote}[2][]{}
\def\beamer@decodeuntil-#1,{%
\ifnum1<\beamer@minimum\global\beamer@minimum=1\fi%
\ifnum#1>\beamer@slideinframe\global\beamer@anotherslidetrue\beamer@localanotherslidetrue\fi%
\ifnum\beamer@slideinframe>#1\else\gdef\beamer@doifnotinframe{\beamer@doifinframe}\fi%
\ifnum\beamer@slideinframe=#1\relax\slidereferenced\fi%
\beamer@@decode}
\def\beamer@decodeto#1,{%
\ifnum#1<\beamer@minimum\global\beamer@minimum=#1\fi%
\ifnum#1>\beamer@slideinframe\global\beamer@anotherslidetrue\beamer@localanotherslidetrue\fi%
\ifnum#1>\beamer@slideinframe\else\gdef\beamer@doifnotinframe{\beamer@doifinframe}\fi%
\ifnum\beamer@slideinframe=#1\relax\slidereferenced\fi%
\beamer@@decode}
\def\beamer@decodebetween#1#2,{%
\ifnum#1<\beamer@minimum\global\beamer@minimum=#1\fi%
\ifnum#1>\beamer@slideinframe\global\beamer@anotherslidetrue\beamer@localanotherslidetrue\fi%
\ifnum#2>\beamer@slideinframe\global\beamer@anotherslidetrue\beamer@localanotherslidetrue\fi%
\ifnum#1>\beamer@slideinframe\else\ifnum#2<\beamer@slideinframe\else\gdef\beamer@doifnotinframe{\beamer@doifinframe}\fi\fi%
\ifnum\beamer@slideinframe=#1\relax\slidereferenced\fi%
\ifnum\beamer@slideinframe=#2\relax\slidereferenced\fi%
\beamer@@decode}
\def\beamer@decodeone#1,{%
\ifnum#1<\beamer@minimum\global\beamer@minimum=#1\fi%
\ifnum#1>\beamer@slideinframe\global\beamer@anotherslidetrue\beamer@localanotherslidetrue\fi%
\ifnum#1=\beamer@slideinframe\gdef\beamer@doifnotinframe{\beamer@doifinframe}\fi%
\ifnum\beamer@slideinframe=#1\relax\slidereferenced\fi%
\beamer@@decode}
\makeatother
\usepackage[english]{babel}
\mode<presentation>{
\usetheme{Warsaw}
% \setbeamercovered{transparent}
}
\begin{document}
\begin{frame}{Testing}
\mentionedsetup
\uncover<1->{hello}
\uncover<3->{world}
\uncover<5->{greetings}
\uncover<7->{earthlings}
\end{frame}
\begin{frame}{Introduction}{}
\mentionedsetup
\begin{itemize}
\item hello world
\uncover<1->{\item Here is my first point}
\uncover<2->{\item Here is my second point}
\uncover<4->{\item With notes on, I would expect it to take two
clicks to get here from the last point, since there are two notes. But
with them off, I would expect it to take one click.}
\uncover<5->{\item This is my third point. I have four notes about
this point, so with notes on, it should take three more clicks to get
to the next slide. With them off, however, it should take one. }
\end{itemize}
\note[item]<1->{Here is a note about my first point}
\note[item]<2->{Here is a note about my second point}
\note[item]<3->{Here is \textbf{another} note about my second point}
\note[item]<4->{Here is a note about my third point}
\note[item]<5->{Here is the second of several more notes about my
third point}
\note[item]<6->{Another one}
\note[item]<7->{And another}
\end{frame}
\begin{frame}{Another slide}{}
\begin{itemize}
\uncover<1->{\item Not much to say here}
\end{itemize}
\end{frame}
\end{document}
哦,我们必须重新定义该\note
命令。即使没有显示注释,该命令也会被处理。所以我们必须将其重新定义为 NO-OP,以确保不会读取生成的覆盖层。
这是上面的前几帧,显示第 2、4、6 帧被跳过。