
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}