наложение цветов определенного текста

наложение цветов определенного текста
\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}

Я пытаюсь сделать

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}.

Красный в третьем слайде наложения и обычный черный в четвертом, однако в четвертом он просто исчез совсем. Почему так?

решение1

Команда \only- выведет на экран следующее содержимоетолькона этом слайды, вы определяете. Так что вы \only<3>напечатаете предложение только на наложении 3. Оно невидимо на overly 4 и любом последующем. Таким образом, ваша проблема, не видеть текст.

Если вы хотите иметь специальную подготовку на наложении 3, но нормальный вид на любом другом наложении, используйте команду \alt. Если берет набор наложений (в вашем случае <3>и в первой паре фигурных скобок, вы можете определить, что должно произойти в этом наложении. На любом другом наложении используется содержимое второй пары фигурных скобок.

Смотритеруководство по проекторудля дальнейших команд, таких как \uncover, \invisible, \visible, ...

В вашем случае достаточно вызвать \color{red}оверлей 3. Как \colorи команда, все последующее будет красного цвета. Окрашивание автоматически закончится на окружающей среде (здесь: itemize).

(Я добавил пятый оверлей, для доказательства, который \color{green}не влияет ни на что вне среды. Если вам нужен больший контроль над командами, вы, конечно, можете использовать \textcolor{}или скопировать и вставить текст, как показано здесь: \alt<3>{\color{red} text}{pure uncolored text})

МВЭ:

\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}

Результат:

введите описание изображения здесь

решение2

Возможно, вам захочется использовать команду \alert

 \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}

Связанный контент