특정 텍스트의 오버레이 색상

특정 텍스트의 오버레이 색상
\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})

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}

결과:

여기에 이미지 설명을 입력하세요

답변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}

관련 정보