[Tex/LaTex] In beamer, how to strike through an item after displaying

beameroverlaysstrikeout

In a beamer frame I have a item list

\begin{itemize}
\item<1-> World peace
\item<2-> Peace in our neighbourhood
\end{itemize}

How can I strike through the first item on the second (overlay) slide?

Slide 1:

  • World Peace

Slide 2:

  • World Peace
  • Peace in our neighbourhood

Best Answer

You can use the \only notation and the ulem package for strike through. The code would look like this:

\documentclass{beamer}
\usepackage{ulem}
\begin{document}
  \begin{frame}
    \begin{itemize}
      \item\only<1>{World peace}\only<2->{\sout{World peace}}
      \item<2-> Peace in our neighbourhood
    \end{itemize}
  \end{frame}
\end{document}

Update: Alternatively, you can use beamer's facilities to create an overlay aware version of the \sout command. That is done as follows:

\documentclass{beamer}
\usepackage{ulem}
\renewcommand<>{\sout}[1]{
  \only#2{\beameroriginal{\sout}{#1}}
  \invisible#2{#1}
}
\begin{document}
  \begin{frame}
    \begin{itemize}
      \item\only<1>{World peace}\only<2->{\sout{World peace}}
      \item<2-> Peace in our neighbourhood
      \item<3-> \sout<3>{Peace struck}
      \item<4-> Peace unstruck
    \end{itemize}
  \end{frame}
\end{document}

This basically states that the argument to \sout should be struck through on slides matching the overlay specifier and should be shown normally on slides that don't match it. I like this method a little better, because it is more concise in the slides itself. Note that it plays nicely together with the overlay specifier on the item. That is, if you were to remove the overlay specifier on \item<3-> the Peace struck would be shown without being struck through on slides 1 and 2 as well. The original method still works as well after the redefinition of \sout.