# Latex - Beamer: Applies the \cancel command only a specified slides

In beamer, overlay specifications can be used to make certain text commands take effect at different times. For example, \alert<2> applies the alert command only on the second slide.

Is there an equivalent for the cancel command instead on the alert command ?

-
Take a look at my answer to this question: tex.stackexchange.com/questions/11571/… as there I defined an overlay-aware version of the cancel command. Does that do what you want? –  Loop Space Sep 21 '11 at 10:09
@Andrew Stacey: Great !!! This is exactly what I want :-) Thanks! –  Marco Sep 21 '11 at 11:53
I've copied my code so that it's easier to find: the questions are sufficiently different that I don't think this is a duplicate. It's just coincidence that my answer to that one involved the cancel stuff. –  Loop Space Sep 21 '11 at 12:04

(Although my answer at Uncover a multiline equation with beamer covers this case, the actual questions aren't duplicates so I'm copying the code here to make it easier for a casual "passer-by" to find it.)

Here's an overlay-aware version of the \xcancel command. I've written it as a wrapper rather than a replacement, but it wouldn't be hard to do the latter instead.

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{cancel}
\newcommand<>{\xxcancel}[1]{\alt#2{\xcancel{#1}\vphantom{#1}}{#1}}
\begin{document}

\begin{frame}
\begin{multline*}
S(1,\dots,s) = \underbrace{\sum_{m=1}^{m_t} (-1)^{m+1} \sum_{i_1<\dots<i_m} I(i_1,\dots,i_m)}_{\text{entropy estimate with correlation order}\, m_t} \\
\xxcancel<2->{{} + \underbrace{\sum_{m=m_t+1}^{s} (-1)^{m+1} \sum_{i_1<\dots<i_m} I(i_1,\dots,i_m)}_{\text{correlations of order higher than}\, m_t} }
\end{multline*}
\end{frame}

\end{document}

-