0

When creating a beamer presentation for a course, it is often desirable to not display the whole text immediately, e.g. to let the audience think about some step of a proof. One thus uses \uncover or \visible to temporarily mask e.g. part of a sentence or formula.

However, if one hands out an article version of the presentation made with beamerarticle, this is not satisfactory, as per beamer manual, in article mode these commands have the same effect as \only and therefore do not reserve blank space for the audience to fill-in.


For example, here I want to display the exponent of a formula on the second slide, and not at all in the article version. It may not be the best example, but it is relevant because it is technically more complicated than hiding a word in plain text.

First slide : First slide

Second slide : Second slide

Article version : Article version


A possible workaround (given to me in response to my RFE on beamer Github repo) is to define

\newcommand<>\placehold[1]{%
   \setbox\@tempboxa\hbox{#1}%
   % Use the below definition if color goes wrong
   % \setbox\@tempboxa\hbox{\color@begingroup#1\color@endgroup}%
   \alt#2{\box\@tempboxa}{\hbox to \wd\@tempboxa{\hfill}}%
 }

This works as long as one hides a very small part of text which does not linebreak, but causes obvious problems for longer texts or if used in math mode.

  • You will get more upvotes if you include not only code snippets but a complete minimum working example. – Steven B. Segletes Feb 15 at 13:01
1

The idea is to duplicate the definition of \visible in article mode. It indirectly uses pgf's invisibility feature which, miraculously, seems to just work fine in article mode.

In presentation mode, \placehold is the same as \visible. In article mode, it always makes its parameter invisible, regardless of the overlay specification (the two \alt branches are the same). This allows to avoid the cumbersome \placehold<article:0|2->{reveal at slide 2} in favor of \placehold<2->{reveal at slide 2}.

\mode
<article>
\long\def\ysbeamer@reallymakeinvisible#1{\pgfsys@begininvisible #1\pgfsys@endinvisible}
\newrobustcmd*{\placehold}{\alt{\ysbeamer@reallymakeinvisible}{\ysbeamer@reallymakeinvisible}}

\mode
<presentation>
\newrobustcmd*{\placehold}{\alt{\beamer@fakeinvisible}{\beamer@reallymakeinvisible}}

\mode
<all>

The example in the question can thus be typeset in the following manner :

\begin{frame}
     \[|x_n-x_*|\leq\frac1K\,{\left(K\,|x_0-x_*|\right)}^{\placehold<2->{2^n}}\text{,}\]
\end{frame}

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.