特定文字的疊加顏色

特定文字的疊加顏色
\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 上列印該句子。因此你的問題是看不到文字。

如果您想在覆蓋 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}

相關內容