# beamer/beamerarticle: mode specification for frame doesn't work as expected

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]%
{\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}

-

Taking a look through the code, I think this has to be regarded as a bug (the general situation is that overlay specs should work with mode statements, as seen for the \section command here). Browsing the code, I think that there is no allowance made for a frame being entirely omitted:

\long\def\beamer@@frame<#1>[#2]{%
\global\let\insertframetitle=\@empty%
\global\let\insertframesubtitle=\@empty%
\beamer@slideinframe=1\relax%
\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}


(Till doesn't give us a lot of comments!)

I will need to think about how to switch the mode correctly here: presumably the 'gobble' mode should get activated.

-
I'll also need to check that this isn't something Vedran or I broke. There is a reason Till moved on from maintaining the beamer code! –  Joseph Wright Aug 30 '13 at 8:11
Yes tweaking beamer is quite challenging. Btw: I was looking for a way to disable frames in beamerarticle by default, added \def\frame{\@ifnextchar<\beamer@frame{\beamer@frame<presentation>}} and so tumbled over the problem. –  Ulrike Fischer Aug 30 '13 at 8:22
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