3

It seems that the [containsverbatim] option when applied to a frame prevents beamer from generating intermediate slides if text animation is wanted in it. Only the first step of the animation is printed as a result.

Sample code:

\documentclass{beamer}
\begin{document}
 \begin{frame}[containsverbatim]
  \frametitle{Tests anim}
  blah
  \pause
  blah²
 \end{frame}
\end{document}

My question then comes in two parts:

  1. Is this a bug or did I miss something?
  2. If it's a bug, is there a workaround?
  • 1
    I have the feeling that containsverbatim is an old option that is now deprecated (it doesn't appear in the manual); probably it's [fragile] that you need. – egreg May 13 '12 at 19:16
  • I feel really stupid right now but I'm not sure I found the correct, up to date documentation. I'd really appreciate a pointer towards the manual you use, just to be sure I'm working on an healthy basis. Sorry to have to ask that :( – Mog May 13 '12 at 19:28
  • If you have a Unix system, then the shell command texdoc beamer will present you the manual; see texdoc.net/texmf-dist/doc/latex/beamer/doc/beameruserguide.pdf for an online version. – egreg May 13 '12 at 19:37
9

The common approach to typeset frames with verbatim content is the fragile option, which works well with overlays:

\documentclass{beamer}
\begin{document}

\begin{frame}[fragile]
  \frametitle{Tests anim}
  blah
  \pause
  blah
\end{frame}

\end{document}

I hardly remember the containsverbatim option and my beamer manual (v3.10) does not mention it. The only reference I found for it is in the ChangeLog of the beamer class:

2004-02-18 Till Tantau , Version 2.00

Added:

- Added a containsverbatim option to the \frame command. Should be
    used instead of the old \frame<all:1> (which is, however, still
    supported). 

So the observed effect is not a bug, but a feature :-), as \frame<all:1> is the syntax in beamer to suppress all, but the first slide from a frame. The option name containsverbatim seams to be pretty misleading; however, given how beamers overlay mechanism works (by scanning the frame content multiple times, which does not work well together with verbatim environments), I guess it was just the way to typeset verbatim contents.

Later, Till added the more powerful fragile option:

2004-10-11 Till Tantau

Version 3.01:

Added:
- Option "fragile" that allows the use of
  overlays together with verbatims. *Extremely* useful.

The fragile option works by externalizing the frame's code into an own file (with suffix .vrb) and the overlay mechanism works by reading this file multiple times, which plays nicely together with verbatim contents. Of course, this is a lot slower than the containsverbatim approach, which therefore was kept and documented under the additional (and better understandable) option name fragile=singleslide. Section §8.1 (page 61) of the beamer user guide explains it in detail.

  • Thanks for the reply :) At first, it didn't compile, and with a strange error to add to my despair. But I removed indentation before \begin{frame} and \end{frame} to replicate the exact conditions of your answer and now it runs. Is that normal for such a command to avoid identation in such a restrictive manner? – Mog May 13 '12 at 19:43
  • to be specific, only the \end{frame} part needs no space beforehand °_o – Mog May 13 '12 at 19:44
  • @Mog: Yes. beamer typesets these slides by moving them to an exernal file first (with extension .vrb). It needs a line with only the \end{frame} to reliably detect the end of the current frame for this mechanism. The beamer user guide §8.1 describes all the details. – Daniel May 13 '12 at 19:51
  • I just figured that there is also a fragile=singleframe option, which behaves exactly like the (undocumented) containsverbatim. Maybe that is now the official (much better understandable) name for it. – Daniel May 13 '12 at 19:52
  • 1
    @Daniel Excellent answer! – egreg May 13 '12 at 22:25

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.