61

In beamer v3.0 guide (slide 121) , I've found:

In case of subtle differences in the heights of replacements, overlayarea and overprint environments can be used.

But it's not clear to me.

What are differences between \only and \onslide in Beamer ?

How to decide, which to choose in particular case?

1 Answer 1

71

In short, \only<>{} does not render the braced material at all except on the named slides, while \onslide<> renders the material until the next \onslide, sort of like an \item, but, on the off slides, covers it (according to the preference given in \setbeamercovered; i.e. transparent or invisible). There are other alternatives, for example, \uncover<>{}, which functions like \only but acts like \onslide; i.e. takes a specific chunk of text and covers or uncovers it as appropriate.

There are some circumstances where they work differently. For example, using \onslide in one of the amsmath equation environments (I have found) produces horrible bugs:

\usepackage{amsmath}
...
\begin{align*}
 a & \onslide<+-> b % Bad
 a & \uncover<+->{b}% Good
\end{align*}

Presumably this is because align does what the manual calls "wicked things" in processing its contents.

You also ask about the overlayarea and overprint environments; these are fancy versions of \uncover and \onslide respectively, that reserve the space for an entire sequence of uncoverings. The overprint environment does so automatically but only allows you to uncover in an "itemized" fashion by using \onslide successively, and the overlayarea environment requires you to say exactly the size of the overlay area but allows you to use any Beamer constructs inside; it will then produce the requisite number of slides with various material appearing in that area (including necessary empty space) on each one.

3
  • 2
    Why are there 4 ways to write same thing-- \only, \onslide, \uncover, \visible ? (are there instances where onslide works but others fail?) Dec 18, 2019 at 11:09
  • one can use aligned instead of align
    – minmax
    Jul 29, 2020 at 0:31
  • @CyriacAntony The principle difference is between commands like \only that only render the content at all on the specified slides, vs commands like \uncover that always render the content but only make it visible on the specified slides. Can make a big difference to layout, especially if for some reason reveals are occurring in "the wrong order". The other differences are more subtle imo.
    – cooperised
    Sep 6, 2021 at 8:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .