3

I want to make an itemized list such that I show an item, replace it with text, show next item, replace with text and so on.

This is what I have:

\begin{itemize}
    \item[1.] \alt<2>{$a\land b=b\land a$, $a\lor b=b\lor a$}{Commutativity}
    \item[2.] \alt<2-3>{$a\land(b\land c)=(a\land b)\land c$, $a\land(b\land c)=(a\land b)\land c$}{Associativity}
    \item[3.] \alt<2-4>{$p\land(q\lor r)=(p\land q)\lor(p\land r)$ and $p\lor(q\land r)=(p\lor q)\land(p\lor r$}{Distributivity}
    \item[4.] \alt<2-5>{$a\land a=a\lor a=a$}{Idempotence}
    \item[5.] \alt<2-6>{$a\land 1=a\lor 0=a$}{Identity for $\land$ and $\lor$}
    \item[6.] \alt<2-7>{$p\land\neg p=0$ and $p\lor\neg p=1$}{Law of Excluded Middle}
    \item[7.] \alt<2-8>{$\neg(p\land q) = \neg p\lor\neg q$ and $\neg(p\lor q) = \neg p\land\neg q$}{DeMorgan's Laws}
    \item[]\alt<2-9>{}{}
\end{itemize}

The problem is I want to switch each item at a time

user2154420
  • 308
  • 1
  • 4
  • 10

1 Answers1

4

If I understood your question correctly, the following should work (based on Joseph Wright's excellent answer to Relative overlay specification in beamer?).

\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Frame title}
\begin{enumerate}[<+->]
    \item \alt<2->{$a\land b=b\land a$, $a\lor b=b\lor a$}{Commutativity}
    \item<+(1)-> \alt<+(1)->{$a\land(b\land c)=(a\land b)\land c$, $a\land(b\land c)=(a\land b)\land c$}{Associativity}
    \item<+(1)-> \alt<+(1)->{$p\land(q\lor r)=(p\land q)\lor(p\land r)$ and $p\lor(q\land r)=(p\lor q)\land(p\lor r$}{Distributivity}
    \item<+(1)-> \alt<+(1)->{$a\land a=a\lor a=a$}{Absorption}
    \item<+(1)-> \alt<+(1)->{$a\land 1=a\lor 0=a$}{Identity for $\land$ and $\lor$}
    \item<+(1)-> \alt<+(1)->{$p\land\neg p=0$ and $p\lor\neg p=1$}{Law of Excluded Middle}
    \item<+(1)-> \alt<+(1)->{$\neg(p\land q) = \neg p\lor\neg q$ and $\neg(p\lor q) = \neg p\land\neg q$}{DeMorgan's Laws}
%    \item[]\alt<2-9>{}{}
\end{enumerate}
\end{frame}
\end{document}

I commented out the last (empty) item because I wasn't sure what you wanted to do with that. I also changed from an itemize to an enumerate environment.

erik
  • 12,673
  • Great answer! A manual specification of slide numbers in \item such as \item<1-> and \item<2-> is required for those in need of showing the next item at the same time as the text in the previous one is replaced. – dfernan Nov 12 '17 at 18:44