7

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.

  • 4
    I think you are after \alt: have a look on the manual for examples. – Claudio Fiandrino Jan 24 '14 at 10:10
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
    Though you could do \only<2>{\sout}{Stricken on 2nd slide} – Loop Space Jan 24 '14 at 13:05
  • @AndrewStacey Well, you're right, edited. – yo' Jan 24 '14 at 14:45
  • 1
    @tohecz Used your initial solution, but forgot to mark it as solved. Thanks. – abondoa Feb 19 '14 at 10:38

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.