3

In the following example the \section comand (and its argument) is ignored as expected. But not all the content of the frame: The text and the first \tikz are not printed but the unknown color gives two errors (as do also unknown commands) and the graphics appears on the page (eso-pic is needed to get this effect). A \stepcounter{section} in the frame is executed too.

I also tested the other way round: A \begin{frame}<article> in a beamer document: This doesn't work either. Is this a bug? (There is no problem if I use explicit \mode commands.)

\documentclass{scrartcl}
\usepackage{beamerarticle}
\usepackage{tikz}
\usepackage{eso-pic}
\newcommand\framegraphic[1]%
  {\AddToShipoutPictureFG
   {\AtPageCenter
    {\includegraphics[width=5cm]{#1}%
  }}}


\begin{document}
blabla

\section<presentation>{This section exists 
  \tikz\draw[color=unknowncolorA] (1,1)rectangle (0,0); 
 only in the presentation modes}

\begin{frame}<presentation>
  some text
 \tikz\draw[fill=red] (1,1)rectangle (0,0);
 \tikz\draw[color=unknowncolorB] (1,1)rectangle (0,0);
 \framegraphic{example-image-a}
\end{frame}

\end{document}
4

[Updated answer after full analysis]

Although the behaviour is perhaps not obvious, it is I think by design (certainly I'm extremely reluctant to alter it.). The relevant code lines in beamerbaseframe are

\long\def\beamer@@frame<#1>[#2]{%
  \global\let\insertframetitle=\@empty%
  \global\let\insertframesubtitle=\@empty%
  \beamer@slideinframe=1\relax%
  \refstepcounter{framenumber}%
  \beamer@slideinframe=0\relax%
  \beamer@anotherslidefalse%
  {\beamer@masterdecode{#1}}%
  \ifbeamer@anotherslide%
    \let\beamer@howtotreatframe\beamer@dosingleframe%
  \else% no slides in frame
    \let\beamer@howtotreatframe\beamer@donoframe%
  \fi%
  \beamer@slideinframe=1\relax%
  \beamer@howtotreatframe}

In particular, notice \beamer@donoframe: this is quite correctly set as the action to take. However, what's non-obvious is that 'gobbling' a frame works by typesetting it into a box which is not then used. For that reason we need the commands in the box to be defined.

Given that the way the beamer/beamerarticle split works really starts from the assumption that the document will 'somewhere' define everything, I think this is 'perhaps odd but intentional'.

  • 1
  • I think beamer intentionally processes excluded frames (through \beamer@donoframe, putting them into \beamer@tempbox) so that side effects can still happen. Regardless, the most obvious difference between \mode<handout>{\begin{frame}Text\end{frame} and \begin{frame}<handout>Text\end{frame} is the frame numbering in non-handout mode, so the two specifications aren't intended to produce the same result. – cyberSingularity Oct 4 '13 at 9:33
  • @cyberSingularity Yup, having thought about it properly you are spot on! – Joseph Wright Nov 27 '16 at 20:54

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.