3

The \includeonlyframe{...} does not work, when allowframebreaks is used together with label in \frame options. When removing label, it works fine. See MWE:

\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}

EDIT 8th April.

The code above compile perfect, but one don't get all the text from the tex document in the presentation [only 1 page (1/1)]. If one remove the label=one, and comment out \includeonlyframe{one}, one get two pages, with all the text now.

(Windows 7, MikTex 2.9, TeXnicCenter 2.2)

  • 1
    The use of this option is evil. (Beamer manual) – Johannes_B Apr 7 '15 at 16:20
  • 1
    The MWE above (currently with label) compiles alright for me, after adding the closing brace } at the end. What's the problem? – Herr K. Apr 7 '15 at 21:54
  • Thanks for the correction Herr. I've added some more text, explaining the problem. Do you get two pages in the presentation from this MWE above? – TobiasDK Apr 8 '15 at 6:33
  • 1
    For me the output is as expected. The label references only the first slide of every multi=slide frame. If you want to circumvent this, my suggestion would be to break the components of the frame manually into multiple frames, each with its own label. – Werner Jul 15 '15 at 14:16
  • @Werner But allowframebreaks is there to avoid the manual work. Why should label, for the first frame, render non-functional the former fuction? – Nikos Alexandris Dec 27 '15 at 13:20
2

(This is an explanation. I am not going to answer it. I gave an workaround, but I do not know if it will always work.)

In beamerbaseframe.sty line 417-493 one sees this decision tree

\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}

In short

  • test if \includeonlyframe includes this frame;
  • test if \includeonlylecture includes this lecture;
  • test if [lable=something] is given; if so
    • test if \beamer@whichframes (\begin{frame}<something>) is given; if so
      • test if [containsverbatim] is given;
      • test if [allowframebreak] is given;
      • test if [fragile] is given;
  • otherwise if no [lable=something] is given;
    • test if [fragile] is given;
    • test if [containsverbatim] is given;

Notice that \beamer@againname stores the label of the frame, so \ifx\beamer@againname\@empty tests whether you set [label=something] or not, corresponding to the third item above.

The problem is that when no [label=something] is given, Beamer does not test [allowframebreaks]. So no matter how Beamer treat that frame, it is not going to be \beamer@autobreakframe.


An immediate workaround is to add the \ifbeamer@autobreak-test manually. But the result is disappointing: surely Beamer now gives you two-page output, but you are no longer able to control its appearance by \includeonlyframes, and that makes labeling a frame meaningless.

This is because Beamer passes the negative result of \includeonlyframe-test by redefining \beamer@whichframes to be all:0, which is received only by the first branch. Ideally, the new decision tree should be like

  • test if \includeonlyframe includes this frame;
  • test if \includeonlylecture includes this lecture;
  • test if [lable=something] is given; if so
    • test if \beamer@whichframes (\begin{frame}<something>) is given; if so
      • test if [containsverbatim] is given;
      • test if [allowframebreak] is given;
      • test if [fragile] is given;
  • otherwise if no [lable=something] is given;
    • test if \beamer@whichframes (\begin{frame}<something>) is given; if so
      • test if [containsverbatim] is given;
      • test if [allowframebreak] is given;
      • test if [fragile] is given;

The following is an example combining [allowframebreak] and [label=something] and \includeonlyframes. But \againframe does not work. Probably it is the next question.

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.