Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

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.

share|improve this question

migrated from stackoverflow.com Mar 9 '11 at 21:26

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 6 down vote accepted

From what I know of beamer:

\begin{frame}<92> means \begin{frame}<beamer:92|handout:1>

similarly

\only<5> means \only<beamer:5|handout:1>

In handout mode, if overlays do not contain specification for handout mode, all slides of a frame are the same and contain all overlay elements (except \alt for which it is the alternative one, I think but I am not sure). So printing one specific slide of a frame in handout mode does not make sense, unless overlays contain a specification for handout mode.

In the extreme case where you want the overlays to be the same in beamer and handout modes, you give an overlay specification for "all" modes.

\only<all:5>

So to do what you want:

\begin{frame}<handout:92>
...
\only<all:5-97>
...
\only<all:143>
...
\end{frame}

The following code demonstrates an easier solution for what you seem to be willing to do.

\documentclass[handout]{beamer}

\usepackage{tikz}

\begin{document}

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

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

\end{document}
share|improve this answer
    
This is definitely the cleanest solution and does work. I still haven't found where this behavior is documented in the manual however. –  Matthew Leingang Jan 24 '13 at 19:43

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!

share|improve this answer
    
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. –  Loop Space Apr 17 '10 at 15:47

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.

share|improve this answer
    
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 Apr 15 '10 at 14:20
    
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). –  Loop Space Apr 15 '10 at 14:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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