1
\documentclass{beamer}
\mode<presentation>
\usepackage{amsfonts,amsmath,amssymb,graphicx,xcolor}
\newtheorem{thm}{Theorem}
\begin{document}
\title{...} 

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}
    \begin{thm}
        $\sqrt{2}$ is irrational.
    \end{thm}\pause
    \begin{proof}
        The proof is by contradiction.\pause

     \begin{itemize}
        \item\only<3>{\textcolor{red}{Suppose, for a contradiction, that $\sqrt{2}$ is rational. 
 That is, there are coprime integers $a$ and $b$ such that $\sqrt{2}=\frac{a}{b}.$}}\pause

        \item\only<4>{\textcolor{red}{$\sqrt{2}$}}
     \end{itemize}
    \end{proof}
\end{frame}
\end{document}

I'm trying to make

Suppose, for a contradiction, that $\sqrt{2}$ is rational.
That is, there are coprime integers $a$ and $b$ such that \sqrt{2}=\frac{a}{b}.

Red in the third slide of the overlay and regular black in the fourth, however in the fourth it has just disappeared altogether. Why is this?

1

The \only-command will print the following content only on that slides, you define. So your \only<3> will print the sentence only on overlay 3. It is invisible on overly 4 and any following. Thus your problem, of not seeing the text.

If you want to have some special preparation on overlay 3 but normal appearance on ever other overlay, use the \alt command. If takes the set of overlays (in your case <3> and in the first pair of braces, you can define what should happen in that overlay. On any other overlay, the content of the second pair of braces is used.

See the beamer manual for further commands like \uncover, \invisible, \visible, ...

In your case, it is sufficient, to call \color{red} on overlay 3. As \color is a command, everything following will be in red color. The coloring will end automatically at the surrounding environment (here: itemize).

(I added a fifth overlay, to proof, that \color{green} does not affect anything outside the environment. If you want more control over the commands, you can of course use \textcolor{} or copy and paste the text, as shown here: \alt<3>{\color{red} text}{pure uncolored text})

MWE:

\documentclass{beamer}
\mode<presentation>
\usepackage{amsfonts,amsmath,amssymb,graphicx,xcolor}
\newtheorem{thm}{Theorem}
\begin{document}
\title{...} 

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}
    \begin{thm}
        $\sqrt{2}$ is irrational.
    \end{thm}\pause
    \begin{proof}
        The proof is by contradiction.\pause

     \begin{itemize}
     \item\alt<3>{\color{red}}{} Suppose, for a contradiction, that
       $\sqrt{2}$ is rational.  That is, there are coprime integers
       $a$ and $b$ such that $\sqrt{2}=\frac{a}{b}.$\pause

        \item\alt<4>{\color{red}}{\color{green}}$\sqrt{2}$
     \end{itemize}
     \only<5>{Easy Peasy!}
    \end{proof}
\end{frame}
\end{document}

Result:

enter image description here

|improve this answer|||||
1

You might want to use the \alert command

 \documentclass{beamer}
 \mode<presentation>
 \usepackage{amsfonts,amsmath,amssymb,graphicx,xcolor}
 \newtheorem{thm}{Theorem}
 \begin{document}
 \title{...} 

 \begin{frame}
     \titlepage
 \end{frame}

 \begin{frame}
     \begin{thm}
         $\sqrt{2}$ is irrational.
     \end{thm}\pause
     \begin{proof}
         The proof is by contradiction.\pause

          \begin{itemize}
             \item\alert<3>{Suppose, for a contradiction, that $\sqrt{2}$ is rational. That is, there are coprime integers $a$ and $b$ such that $\sqrt{2}=\frac{a}{b}.$}\pause

                 \item\alert<4>{$\sqrt{2}$}
          \end{itemize}
     \end{proof}
 \end{frame}
 \end{document}
|improve this answer|||||

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.