
alerted text
에서 색상을 변경할 때 예상치 못한 동작이 발생했습니다 mathmode
. 특히 다시 호출될 alerted text.fg
때만 바뀌는 것 같습니다 . \alert
을 변경하면 \colorlet
내부 색상에만 영향을 줍니다 mathmode
.
여기에 예가 있습니다
\documentclass{beamer}
\begin{document}
\begin{frame}{Title}
$\begingroup\setbeamercolor{alerted text}{fg=blue}\alert{blue}\endgroup+\textcolor{alerted text.fg}{red}$ These should be \textcolor{alerted text.fg}{red}, \alert{red} and \textcolor{alerted text.fg}{red}
$\begingroup\setbeamercolor{alerted text}{fg=blue}\alert{blue}\endgroup\setbeamercolor{alerted text}{fg=red}+\textcolor{alerted text.fg}{red}$ These should be \textcolor{alerted text.fg}{red}, \alert{red} and \textcolor{alerted text.fg}{red}
$\begingroup\setbeamercolor{alerted text}{fg=blue}\alert{blue}\endgroup\setbeamercolor{alerted text}{fg=red}\colorlet{alerted text.fg}{red}+\textcolor{alerted text.fg}{red}$ These should be \textcolor{alerted text.fg}{red}, \alert{red} and \textcolor{alerted text.fg}{red}
$\begingroup\setbeamercolor{alerted text}{fg=blue}\alert{blue}\endgroup\setbeamercolor{alerted text}{fg=red}\alert{}+\textcolor{alerted text.fg}{red}$ These should be \textcolor{alerted text.fg}{red}, \alert{red} and \textcolor{alerted text.fg}{red}
\end{frame}
\end{document}
답변1
\setbeamercolor{}{}
.fg
자체는 아직 및 색상 을 생성하지 않으며 .bg
비머 색상이 사용될 때만 생성됩니다.
그러나 경고 색상을 앞뒤로 변경하는 대신 원하는 색상으로 더 많은 경고와 유사한 매크로를 만들거나 기본적 \structure
으로 파란색인 를 사용하면 됩니다.
\documentclass{beamer}
\setbeamercolor{foo}{fg=green}
\newenvironment<>{fooenv}{\begin{altenv}#1%
{\usebeamercolor[fg]{foo}\usebeamerfont{foo}\usebeamertemplate{foo text begin}}
{\usebeamertemplate{foo text end}}{\color{.}}{}\ignorespaces}{\ifhmode\unskip\fi\end{altenv}}
\newcommand<>{\foo}[1]{\begin{fooenv}#2\relax#1\end{fooenv}}
\begin{document}
\begin{frame}{Title}
$\structure{blue}+\textcolor{alerted text.fg}{red}$ These should be \textcolor{alerted text.fg}{red}, \alert{red} and \textcolor{alerted text.fg}{red}
$\foo{green}+\textcolor{alerted text.fg}{red}$ These should be \textcolor{alerted text.fg}{red}, \alert{red} and \textcolor{alerted text.fg}{red}
\end{frame}
\end{document}