tags:

views:

344

answers:

3

I have a beamer frame with about 150 slides on it. I want article and handout mode to only show frame 92.

Reading section 8.6.2 of the beamer manual it seems like I should be able to do something like

\begin{frame}<handout:92>
...
\end{frame}

but that seems to have no effect--all 150 slides are set in handout mode, overlaying (making the result unreadable).

I have gotten the effect I want by taking all commands within the frame that have an overlay specification and adding "| handout:0" to make them not appear in handout mode. Annoying, but works. But for my 150-slide frame the different slides are generated by a PGF \foreach loop so I can't code slide 92 differently from the rest.

But can I do this at the frame's overlay specification?

Edit: It seems that the frame's overlay spec really acts differently from other commands. If I only do

\begin{frame}<92>...\end{frame}

then I get only slide 92 in beamer mode but all slides in article or handout mode.

Edit 2: Thanks to Andrew for his experimentation. In the end I went a brute-force approach: I added | handout:0 to all overlay specifications in the slide. then I did:

\only<handout> {
\pgfmathsetmacro{\n}{92} % \n was the loop counter in the \foreach block
% copy of loop code
}

Edit 3: See my answer below.

+2  A: 

I presume that the count of 150 refers to the main presentation version of the document (the "beamer" version). If so, what you're seeing is the fact that when beamer produces the handout (and article and trans) versions of the pages then it collapses the slides considerably. So when you ask for slide "92" in the handout version, then it looks for slide 92 with respect to the count used for the handout. But that's not slide "92" in the beamer version because the collapse has already happened.

In the beamer user guide, I found a section on including a copy of the presentation slide into the article version. It's section 21.2.3 in my version. I recommend that you look at that for the details, but the basic idea is as follows:

  1. Add a label to the frame: \begin{frame}[label=myfantasticframe]
  2. Then use the command \includeslide{myfantasticframe<92>} in the document

There's some details about filenames and beamerjobname in the user guide.

You could try that command in the handout mode, but I'm not convinced it would work quite as expected. A quick experiment didn't work, but that doesn't mean that it doesn't!


Update: Okay, the experiment didn't work. What goes wrong is that the array that contains the "label => pagenumber" settings is different in presentation modes to article mode. In presentation mode, the labels are "beamer@hyperlinklabel". In article mode, they are "beamer@slidelabel". So when in article mode, it reads in the array of labels => pagenumbers from the corresponding beamer version, it saves the array as "beamer@slideX => N" and so when it comes to look it up again, it looks for "beamer@slideX". But if we try to do this in handout mode, it reads in the array of labels and saves it as "beamer@hyperlinkX" but when it comes to look up the label, it looks for "beamer@slideX", which doesn't exist. So one needs to tell the handout mode to look for the right index in the array. Since these "label => pagenumber" arrays are probably used for something else as well, it is probably best to keep the array for the current document ("handout" version) separate from that for the document we are trying to reference. Therefore the macro to modify is the \setjobnamebeamerversion. Here's a hack that, in my limited testing, works:

\documentclass[handout]{beamer}

\makeatletter
\def\setjobnamebeamerversion#1{%
  \def\jobnamebeamerversion{#1}%
  {\makeatletter
  \def\beamer@slide##1##2{\expandafter\gdef\csname
    beamer@slide##1\endcsname{##2}}
  \@input{\jobnamebeamerversion.snm}}
}
\makeatother

\usepackage{tikz}

\begin{document}

\begin{frame}[label=test]
\foreach \t in {1,...,10}
{
\only<\t>{This is frame \t}
}
\end{frame}

\mode<handout>
\begin{frame}
\setjobnamebeamerversion{testbox.beamer}
\includeslide{test<2>}
\end{frame}

\begin{frame}[label=moretest]
The previous slide was the beamer version of frame \ref{test}. Incidentally, this is frame \ref{moretest}.
\end{frame}
\mode
<all>
\end{document}

For this to work properly, first link it to both 'testbox.beamer.tex' and 'testbox.handout.tex'. Then save it without the 'handout' version and pdflatex the beamer symlink a couple of times. Then add the 'handout' option and pdflatex the handout version.

Note that this is an exact copy of the corresponding slide from the beamer version. So if you have anything set up differently between the two (navigation symbols, colours) then they will appear as in the beamer version, not the handout version.

Andrew Stacey
thanks for explaining the collapsing. So by default there's only one slide in handout and article modes? If I create a second slide for handout mode by explicitly saying \only<handout:2> does that mean I get a second slide in handout mode?I also looked in beamerexample1.tex (distributed with beamer) and it seems to strongly suggest that the only way to suppress stuff from the handout/article modes is to exclude it at the \only's and note in the frame's overlay spec.Interesting workaround with \includeslide. I'll see if it works.
Matthew Leingang
My understanding is that that is correct. Namely, that handout (and article) has one slide per frame by default but that anything that only makes sense if an _n_th slide is there forces the creation of the necessary slides (note that this can be subtle: \alt<-3>{x}{y} does not force the existence of slide 4, as far as I know).
Andrew Stacey
A: 

OK, I think I've found a much simpler way. This works:

\begin{frame}
\foreach \n  in {1,...,10} {
    \pgfmathtruncatemacro{\oneifnisfive}{\n==5}
    \only<\n| handout:\oneifnisfive>{Slide \n\par}
}
\end{frame}

The \pgfmathtruncatemacro line sets oneifnisfive to 1 if \n is 5 and 0 otherwise. Then we build an overlay specification on-the-fly.

In beamer mode, all slides are included. In handout mode, most things are relegated to "slide" 0, which means they get suppressed. Except when \n is 5, then the text goes onto handout "slide" 1, which means you see it. Eureka!

Matthew Leingang
Excellent! After doing my experiments then I started wondering if something like that might work, but without knowing exactly what your code was like it was difficult to guess.
Andrew Stacey