8

Is there a command which is the reverse of \only?

E.g. if I want to strike out something in a table I want to strike out one cell in slide three like so:

... & \only<3->{Data}\reverseofonly<3->{\sout{Data}} & ...

I have tried with \invisible, but it reserves space, thus widening my table column since it has to reserve space for the striked out "Data" prior to slide 3.

1
  • 4
    I think you are after \alt: have a look on the manual for examples. Jan 24, 2014 at 10:10

1 Answer 1

10

For details, see beameruserguide.pdf, p. 86, paragraph \renewcommand<>

\documentclass{beamer}

\usepackage{ulem}

\renewcommand<>\sout[1]{\alt#2{\beameroriginal\sout{#1}}{#1}}

\begin{document}

\begin{frame}

\sout<1>{Striked on 1st slide}
\sout{Striked always}
\sout<2->{Striked on 2nd slide}

\end{frame}

\end{document}

Of course, you can simulate the same effect by using \alt directly, but it gets annoying:

\begin{frame}

\alt<1>{\sout{Striked on 1st slide}}{Striked on 1st slide}
\sout{Striked always}
\alt<2->{\sout{Striked on 2nd slide}}{Striked on 2nd slide}

\end{frame}

EDIT: As pointed out by Andrew Stacey, you can use directly

\only<2->{\sout}{Striked on 2nd slide}`

However, I don't like this notation myself: the text is not a 2nd parameter of \only, it's a 1st parameter of \sout.

3
  • 3
    Though you could do \only<2>{\sout}{Stricken on 2nd slide} Jan 24, 2014 at 13:05
  • @AndrewStacey Well, you're right, edited.
    – yo'
    Jan 24, 2014 at 14:45
  • 1
    @tohecz Used your initial solution, but forgot to mark it as solved. Thanks.
    – abondoa
    Feb 19, 2014 at 10:38

You must log in to answer this question.

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