特定文本的覆盖颜色

特定文本的覆盖颜色
\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 上打印该句子。它在第 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}

相关内容