0

I would like to create a new command, like \alert, but in other colours and if it was possible to combine it with the comand \pmb.

I mean in the first frame shows 2x+1 and after a click \pmb{2x+1} (in blue, for instance)

Thak you in advance

Bernard
  • 271,350
Sergio
  • 1
  • 1
    Welcome to TeX SX! What is your question about? – Bernard Dec 02 '18 at 23:25
  • 1
    Welcome to TeX.SX!! Can you please give a full minimal working example. Currently we have to guess what packages etc you are using (what is \pmb?), and this makes it really hard to help you. A MWE should start with a \documentclass command, have a minimal preamble and then \begin{document}...\end{document}. It is really difficult to help you without more information. Of course, you can't define your "new alert command" but your MWE should at least confirm whether or not you are using beamer, which you never actually say. –  Dec 02 '18 at 23:31
  • Does this help? –  Dec 03 '18 at 03:08
  • Note that \pmb{2x+1} is wider than 2x+1 – egreg Dec 06 '18 at 21:33

1 Answers1

3

You could define a command that uses alert, just in a different colour:

\documentclass{beamer}

\newcommand<>{\myalert}[1]{%
    \begingroup
        \setbeamercolor{alerted text}{fg=blue}%
        \alert#2{#1}%
    \endgroup
}

\begin{document}

\begin{frame}

\alert<1>{test}

\myalert<3-5>{sdf}

\end{frame}

\end{document}
  • For some reason, the color of myalert bleeds out from the group when using metropolis theme and ends up interfering on alertblock environment. One way to get around this problem is by calling an empty \alert{} right after \endgroup. Another way is by using \begingroup \alt#2{\usebeamercolor[fg]{example text}#1}{#1}% \endgroup instead. Even using \setbeamercolor{alerted text}{fg=orange} doesn't solve the problem. – Leone Jan 11 '22 at 03:01