在 \frame 选项中标记,在 beamer 中禁用 allowframebreaks

在 \frame 选项中标记,在 beamer 中禁用 allowframebreaks

当选项中与一起使用\includeonlyframe{...}时,不起作用。删除后,它可以正常工作。请参阅 MWE:allowframebreakslabel\framelabel

\documentclass{beamer}
\includeonlyframes{one}
\usepackage{lmodern}
\begin{document}
\begin{frame}[allowframebreaks,label=one]{Test}
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
\end{frame}
\end{document}

编辑于 4 月 8 日。

上述代码编译完美,但无法获取演示文稿中 tex 文档中的所有文本 [仅 1 页 (1/1)]。如果删除label=one,并注释掉\includeonlyframe{one},则可获得两页,其中包含所有文本。

(Windows 7,MikTex 2.9,TeXnicCenter 2.2)

答案1

(这是一个解释。我不会回答这个问题。我给出了一个解决方法,但我不知道它是否总是有效。)

beamerbaseframe.sty第 417-493 行中,我们可以看到这棵决策树

\def\beamer@@@@frame<#1>[#2]{%
  \framewidth\textwidth
  \beamer@savemode%
  \def\beamer@mode{\mode<all>}%
  \def\beamer@frametemplate{}%
  \def\beamer@againname{}%
  \def\beamer@undolabels{}%
  \def\beamer@cramped{}%
  \def\beamer@displaybreak{}%
  \setbox\beamer@footins=\box\voidb@x%
  \beamer@autobreakcount=0\relax%
  \beamer@autobreaklastheight=16000pt%
  \beamer@zoomcount=0\relax%
  \beamer@containsverbatimfalse%
  \beamer@isfragilefalse%
  \beamer@autobreakfalse%
  \beamer@shrinkfalse%
  \beamer@plainframefalse%
  \global\advance\beamer@zoomframecount by1\relax%
  \csname beamer@dosecondmode\beamer@defaultdosecondmode\endcsname%
  \ifbeamer@centered\setkeys{beamerframe}{c}\else\setkeys{beamerframe}{t}\fi%
  \setkeys{beamerframe}{environment=frame}%
  \setkeys{beamerframe}{#2}%
  \beamer@frametemplate%
  \ifbeamer@noframenumbering%
    \beamer@noframenumberingfalse%
  \else%
    \stepcounter{framenumber}%do not set \label here - it interferes with AtBegin*
  \fi%
  {\let\@elt\beamer@savecounter\beamer@overlaycounterresets}
  \gdef\beamer@framestartpage{}%
  \gdef\beamer@whichframes{#1}%
  \ifx\beamer@framerestriction\@undefined\else% restriction stuff
    \expandafter\beamer@checkifinlist\beamer@framerestriction\relax%
  \fi%
  \ifbeamer@inlecture%
  \else%
    \gdef\beamer@whichframes{all:0}%
  \fi%
  \ifx\beamer@againname\@empty%
    \beamer@slideinframe=0\relax%
    \beamer@anotherslidefalse%
    {\beamer@masterdecode{\beamer@whichframes}}%
    \ifbeamer@anotherslide%
%%       \beamer@slideinframe=2\relax%
%%       \def\beamer@doifnotinframe{}%
%%       \def\beamer@doifinframe{\let\beamer@howtotreatframe\beamer@doseveralframes}%
%%       \beamer@anotherslidefalse%
%%       {\beamer@masterdecode{\beamer@whichframes}}%
%%       \ifbeamer@anotherslide%
        \let\beamer@howtotreatframe\beamer@doseveralframes%
%%       \else% single slide in frame
%%         \let\beamer@howtotreatframe\beamer@dosingleframe%
%%       \fi%
%%       \beamer@donow%
      \ifbeamer@containsverbatim%
        \let\beamer@howtotreatframe\beamer@dosingleframe%
      \fi%
      \ifbeamer@autobreak%
        \let\beamer@howtotreatframe\beamer@autobreakframe%
      \fi%
      \ifbeamer@isfragile%
        \let\beamer@howtotreatframe\beamer@doexternalframe%
      \fi%
    \else% no slides in frame
      \let\beamer@howtotreatframe\beamer@donoframe%
    \fi%
  \else% again mode
    \let\beamer@howtotreatframe\beamer@doseveralframes%
    \ifbeamer@isfragile%
      \let\beamer@howtotreatframe\beamer@doexternalframe%
    \fi%
    \ifbeamer@containsverbatim
      \let\beamer@howtotreatframe\beamer@dosingleframe
    \fi
  \fi%
  \beamer@howtotreatframe}

简而言之

  • 测试是否\includeonlyframe包含此框架;
  • 测试是否\includeonlylecture包含该讲座;
  • 测试是否[lable=something]给定;如果是
    • 测试是否给出了\beamer@whichframes( \begin{frame}<something>);如果是
      • 测试是否[containsverbatim]给出;
      • 测试是否[allowframebreak]给出;
      • 测试是否[fragile]给出;
  • 否则,如果没有[lable=something]给出;
    • 测试是否[fragile]给出;
    • 测试是否[containsverbatim]给出;

注意,这里\beamer@againname存储了框架的标签,所以\ifx\beamer@againname\@empty测试一下你是否设置了[label=something],对应上面的第三项。

问题是,当[label=something]给出 否 时,Beamer 不会测试[allowframebreaks]。因此,无论 Beamer 如何处理该框架,它都不会\beamer@autobreakframe


一个直接的解决方法是手动添加\ifbeamer@autobreak-test。但结果令人失望:Beamer 现在确实为您提供了两页输出,但您不再能够通过 控制其外观\includeonlyframes,这使得标记框架变得毫无意义。

\includeonlyframe这是因为 Beamer通过将 -test的负面结果重新定义\beamer@whichframes为 来传递all:0,该结果仅由第一个分支接收。理想情况下,新的决策树应该是这样的

  • 测试是否\includeonlyframe包含此框架;
  • 测试是否\includeonlylecture包含该讲座;
  • 测试是否[lable=something]给定;如果是
    • 测试是否给出了\beamer@whichframes( \begin{frame}<something>);如果是
      • 测试是否[containsverbatim]给出;
      • 测试是否[allowframebreak]给出;
      • 测试是否[fragile]给出;
  • 否则,如果没有[lable=something]给出;
    • 测试是否给出了\beamer@whichframes( \begin{frame}<something>);如果是
      • 测试是否[containsverbatim]给出;
      • 测试是否[allowframebreak]给出;
      • 测试是否[fragile]给出;

下面是将[allowframebreak][label=something]和组合在一起的示例\includeonlyframes。但是\againframe不起作用。这大概就是下一个问题了。

\documentclass{beamer}
\usepackage{lipsum}
\makeatletter
\def\beamer@@@@frame<#1>[#2]{%
  \framewidth\textwidth
  \beamer@savemode%
  \def\beamer@mode{\mode<all>}%
  \def\beamer@frametemplate{}%
  \def\beamer@againname{}%
  \def\beamer@undolabels{}%
  \def\beamer@cramped{}%
  \def\beamer@displaybreak{}%
  \setbox\beamer@footins=\box\voidb@x%
  \beamer@autobreakcount=0\relax%
  \beamer@autobreaklastheight=16000pt%
  \beamer@zoomcount=0\relax%
  \beamer@containsverbatimfalse%
  \beamer@isfragilefalse%
  \beamer@autobreakfalse%
  \beamer@shrinkfalse%
  \beamer@plainframefalse%
  \global\advance\beamer@zoomframecount by1\relax%
  \csname beamer@dosecondmode\beamer@defaultdosecondmode\endcsname%
  \ifbeamer@centered\setkeys{beamerframe}{c}\else\setkeys{beamerframe}{t}\fi%
  \setkeys{beamerframe}{environment=frame}%
  \setkeys{beamerframe}{#2}%
  \beamer@frametemplate%
  \ifbeamer@noframenumbering%
    \beamer@noframenumberingfalse%
  \else%
    \stepcounter{framenumber}%do not set \label here - it interferes with AtBegin*
  \fi%
  {\let\@elt\beamer@savecounter\beamer@overlaycounterresets}
  \gdef\beamer@framestartpage{}%
  \gdef\beamer@whichframes{#1}%
  \ifx\beamer@framerestriction\@undefined\else% restriction stuff
    \expandafter\beamer@checkifinlist\beamer@framerestriction\relax%
  \fi%
  \ifbeamer@inlecture%
  \else%
    \gdef\beamer@whichframes{all:0}%
  \fi%
  \ifx\beamer@againname\@empty%
    \beamer@slideinframe=0\relax%
    \beamer@anotherslidefalse%
    {\beamer@masterdecode{\beamer@whichframes}}%
    \ifbeamer@anotherslide%
%%       \beamer@slideinframe=2\relax%
%%       \def\beamer@doifnotinframe{}%
%%       \def\beamer@doifinframe{\let\beamer@howtotreatframe\beamer@doseveralframes}%
%%       \beamer@anotherslidefalse%
%%       {\beamer@masterdecode{\beamer@whichframes}}%
%%       \ifbeamer@anotherslide%
        \let\beamer@howtotreatframe\beamer@doseveralframes%
%%       \else% single slide in frame
%%         \let\beamer@howtotreatframe\beamer@dosingleframe%
%%       \fi%
%%       \beamer@donow%
      \ifbeamer@containsverbatim%
        \let\beamer@howtotreatframe\beamer@dosingleframe%
      \fi%
      \ifbeamer@autobreak%
        \let\beamer@howtotreatframe\beamer@autobreakframe%
      \fi%
      \ifbeamer@isfragile%
        \let\beamer@howtotreatframe\beamer@doexternalframe%
      \fi%
    \else% no slides in frame
      \let\beamer@howtotreatframe\beamer@donoframe%
    \fi%
  \else% again mode
    \let\beamer@howtotreatframe\beamer@doseveralframes%
    \ifbeamer@isfragile%
      \let\beamer@howtotreatframe\beamer@doexternalframe%
    \fi%
    \ifbeamer@containsverbatim
      \let\beamer@howtotreatframe\beamer@dosingleframe
    \fi
    \beamer@slideinframe=0\relax%
    \beamer@anotherslidefalse%
    {\beamer@masterdecode{\beamer@whichframes}}%
    \message{^^J^^J \beamer@againname:\beamer@whichframes ^^J^^J}
    \ifbeamer@anotherslide%
      \message{^^J^^J \beamer@againname:I am Here ^^J^^J}
      \ifbeamer@autobreak%
        \let\beamer@howtotreatframe\beamer@autobreakframe%
      \fi%
    \fi
  \fi%
  \beamer@howtotreatframe
}

\includeonlyframes{two}

\begin{document}

\frame[allowframebreaks,label=one]{{Test one}\lipsum}

\frame[allowframebreaks,label=two]{{Test two}\lipsum}

\end{document}

答案2

此问题已在提交中修复e2267ba-- 非常感谢@amonakov!

它应该包含在 beamer v3.72 或更新版本中。

相关内容