
Recebi esse comportamento inesperado quando mudo a cor para alerted text
in mathmode
. Em particular, alerted text.fg
parece mudar apenas quando \alert
é chamado novamente. Mudar com \colorlet
afeta apenas a cor interna mathmode
.
Aqui um exemplo
\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}
Responder1
\setbeamercolor{}{}
em si ainda não cria as cores .fg
e .bg
, elas só são criadas quando a cor do projetor é usada.
Mas, em vez de alterar a cor do alerta para frente e para trás, você pode criar mais macros semelhantes a alertas com a cor que desejar - ou simplesmente usar \structure
, que é azul por padrão.
\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}