The <handout:O>
syntax tells beamer
to remove something from a slide in the handout version. It can also be used to tell beamer
to put things on different slides in the handout
version. Thus saying <handout:2>
says "make sure that there is a second slide in the handout version and put this on it.". Thus:
\documentclass[handout]{beamer}
\begin{document}
\begin{frame}
\begin{theorem}
There are infinitely many primes.
\end{theorem}
This has many ramifications:
\begin{overlayarea}{\textwidth}{0.3\textheight}
\only<2|handout:1>{\begin{corollary}Corollary 1\end{corollary}}
\only<3|handout:2>{\begin{corollary}Corollary 2\end{corollary}}
\only<4|handout:3>{\begin{corollary}Corollary 3\end{corollary}}
\end{overlayarea}
\end{frame}
\end{document}
In my opinion, the cleanest approach here is to make \AtBeginSection
work in a beamerarticle
. The reason why it doesn't is that the \AtBeginSection
macro works by defining hooks to be executed at the beginning of theses sections. In article mode, however, the \section
macro as defined by the document class is used, so these hooks are never executed.
To overcome this, a redefinition of the \section
macro is necessary. This is a bit complicated because it calls \@startsection
internally, so simply adding the hook to the end of the macro won't work. Instead, a complete "wrapper" around the original command is necessary:
\mode<article>
\usepackage{xparse}
\makeatletter
\expandafter\let\expandafter\originalsection\expandafter=\csname @orig\string\section\endcsname
\RenewDocumentCommand{\section}{ D<>{} s o m }
{
\alt<#1>
{
\IfBooleanTF {#2}
{
\originalsection*{#4}
%\beamer@atbeginsections % breaks because section* is also used e.g. in the TOC
}
{
\IfNoValueTF {#3} { \originalsection{#4} } { \originalsection[#3]{#4} }
\beamer@atbeginsection
}
}
{
\beamer@secgobble
}
}
\makeatother
\mode<all>
Insert this code into the preamble of your document, after having loaded beamerarticle
. What it does is to save the original, beamer
-free meaning of the \section
macro stored in the macro with the "weird" name @orig\section
to \originalsection
. Afterwards, \section
is redefined to execute the original sectioning command and the hook \beamer@atbeginsection
afterwards. As \section
has a starred and non-starred version, an optional argument and an (optional) overlay specification, I used xparse
which allows you to define such macros in a very convenient way.
Now you can use \AtBeginSection
as usual to insert the section start frames. As you probably don't want them to actually show up in article mode, you should use \begin{frame}<article:0>
for these (the frame number is still incremented). Additionally, you need to \def\insertsection{}
because this command is unknown to beamerarticle
and would result in an error otherwise.
Note that using the optional argument of \AtBeginSection
to define a hook for starred sections won't work (the line executing it is commented out in the above code). The reason is that \section*
is also used for the table of contents etc., where such inserts would result in an error message.
Output of your MWE using the above code
In presentation mode (click on the image to see it full-size):

In article mode:

For completeness, the full source that produced the above results can be found on pastebin.com.
Edit: The xparse
package I used to redefine \section
relies on the experimental LaTeX3 kernel. If it is not available, you can use this plain LaTeX2e solution instead:
\mode<article>
\makeatletter
\expandafter\let\expandafter\originalsection\expandafter=\csname @orig\string\section\endcsname
\def\sectionwithhook{\@ifstar\@sectionwithhook\@@sectionwithhook}
\newcommand{\@sectionwithhook}[1]{\originalsection*{#1}}
\newcommand{\@@sectionwithhook}[2][]{\beamer@ifempty{#1}{\originalsection{#2}}{\originalsection[#1]{#2}}\beamer@atbeginsection}
\renewcommand<>{\section}{\alt#1{\sectionwithhook}{\beamer@secgobble}}
\makeatother
\mode<all>
This replaces the whole code given above, achieving the same as the \RenewDocumentCommand
with some helper macros.
Best Answer
You do need to tell
beamer
what you want to appear in each frame of thehandout
version. You can use\onslide
specifications to do this so that you do not need to modify the existing overlay specifications at all. (I'm not sure this is what you want - probably not.)The following code modifies your MWE so that, in
presentation
mode, there would actually be 10 slides within the frame. These are then placed on slides 1 or 2 of thehandout
. This is a waste of code: if you only want to show slide 5 and slide 10, you do not need two\againframe
but only one. But, anyway, with the two:More efficiently with only one repeat:
I'm not sure how this could apply to
article
mode since then there are no frames or slides.