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}