[Tex/LaTex] Which : \only or \onslide ? (Beamer)

beameroverlays

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?

Best Answer

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.