0

The following code gives an error

\documentclass{beamer}
\begin{document}
\begin{frame}
\mode
<presentation>
some text

\mode
<article>

\begin{exampleblock}{Exemple}
tttttt
\end{exampleblock}

\mode
<all>


\end{frame}
\end{document}

It seems to be related to the exampleblock : if I replace it with a block, there is no error. But due to the \mode specification, beamer is supposed to be in gobbling state when reading that line. Plus, if I remove the \mode specifications, there is also no error.

I suspect this is a bug in beamer. I just upgraded via tlmgr to the latest version : it still happens.

However, maybe I am doing something wrong ?

If this is indeed a bug, how could I workaround it until it is corrected ?

(one might wonder why I use blocks in article mode ; this is because I am not going to be able to show a whole series of examples in the presentation but I still want to have them all in the beamerarticle version, and I want consistency of appearance there)

0

The solution requieres format and systax modifications.

First, \mode, should be followed by the desired mode, <presentation> or <article>, and immediately the text inside {}.

That's exactly the reason you are getting an "Extra }, or forgotten \endgroup" error.

When beamer typesets your text, it is always in one of the following five modes:

  • beamer is the default mode.
  • second is the mode used when a slide for an optional second screen is being typeset.
  • handout is the mode for creating handouts.
  • trans is the mode for creating transparencies.
  • article is the mode when control has been transferred to another class, like article.cls. Note that the mode is also article if control is transferred to, say, book.cls.

In addition to these modes, beamer recognizes the following names for modes sets:

  • all refers to all modes.
  • presentation refers to the first four modes, that is, to all modes except for the article mode.

Here is the working code.

\documentclass{beamer}

\begin{document}
\begin{frame}
\mode<presentation>{some text}

\mode<article>{
\begin{exampleblock}{Exemple}
  tttttt
\end{exampleblock}}

 \mode<all>{\begin{exampleblock}{Exemple}
  tttttt
 \end{exampleblock}}

\mode<all>{Some text for example purposes}
\end{frame}
\end{document}

The result is

enter image description here

  • 1
    Thanks for suggesting the "first flavor" of \mode, it is a workaround. However, your answer is strange as is seems to disregard the existence of the "second flavor" of \mode that I used, and which, if I read the manual correctly, should also work. Plus, the error is not a result of the sole usage of that, because it does not appear when the block is a plain block instead of an exampleblock. – ysalmon Aug 5 at 7:50

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.