28

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

3 Answers 3

23

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.

22

I know that this topic is old, but I've tried Roelof Spijker's solution and it has a small drawback. Ideed, the following code:

\documentclass{beamer}
\usepackage{ulem}
\renewcommand<>{\sout}[1]{
  \only#2{\beameroriginal{\sout}{#1}}
  \invisible#2{#1}
}
\begin{document}
  \begin{frame}
    \begin{itemize}
      \item \sout<2>{World Peace} \onslide<2>{World War}
    \end{itemize}
  \end{frame}
\end{document}

would give the following result on slide 2:

  • World Peace                            World War

with a big blank corresponding to an invisible "World Peace". In addition, one may have issues with a long item text because of this blank.

I think the following macro would be more suitable:

\documentclass{beamer}
\usepackage{ulem}
\renewcommand<>{\sout}[1]{\alt#2{\beameroriginal{\sout}{#1}}{#1}}

which actually results in

Slide 2:

  • World Peace World War
0

Neither of the previous solutions were really satisfying me so... here is mine:

\documentclass{beamer}
\usepackage{ulem}
\renewcommand<>{\sout}[1]{
  \temporal#2{\invisible{#1}}{#1}{\beameroriginal{\sout}{#1}}
}
\begin{document}
  \begin{frame}
    \begin{itemize}
      \item\sout<+>{World peace}
      \item\sout<+>{Peace in our neighbourhood}
      \item\sout<+>{Peace in my house}
      \item\sout<+>{Peace in my head}
    \end{itemize}
  \end{frame}
\end{document}

animation

If you need this more often you might want to define a new command to replace \item:

\documentclass{beamer}
\usepackage{ulem}
\renewcommand<>{\sout}[1]{
  \temporal#2{\invisible{#1}}{#1}{\beameroriginal{\sout}{#1}}
}

\newcommand<>{\sitem}[1]{
  \item\sout#2{#1}
}

\begin{document}
  \begin{frame}
    \begin{itemize}
      \sitem<+>{World peace}
      \sitem<+>{Peace in our neighbourhood}
      \sitem<+>{Peace in my house}
      \sitem<2,4>{Peace in my head}
      \item<+->{Peace in my head}
      \item<+> Another point
      \item<+> Another another point
    \end{itemize}
  \end{frame}
\end{document}

animation of \sitem

You must log in to answer this question.

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