1

I have an incrementally uncovered itemized list (code below).

How can I prevent the text of the 3rd item from being dyed in the alert colour? I would like to just have the item symbol's colour changed.

\documentclass{beamer}

\begin{document}
\begin{frame}{Items}
  \begin{itemize}[<+->]
    \item A
    \item B
    \item<+-| alert@+-> CCCCC
    \item D
  \end{itemize}
\end{frame}

\end{document}
3
  • It may not be optimal, but \item<+-| alert@+-> \textcolor{black}{CCCCC} would do. Aug 30 '17 at 14:35
  • Does the solution have to be automatic? Otherwise \color{black}CCCCC might be a workaround. Aug 30 '17 at 14:35
  • Thanks, @Steven and @samcarter, \color{black} is what I am currently using as a workaround. Of course, an automatic solution would be desirable.
    – AlexG
    Aug 30 '17 at 14:54
2

You can define your own action environment or redefine the alert action.

\documentclass{beamer}
% defining new action environment
\newenvironment{checkenv}{\only{\setbeamercolor{itemize item}{fg=green}}}{}
% redefining alert action
\renewenvironment{alertenv}{\only{\setbeamercolor{itemize item}{fg=red}}}{}

\begin{document}
\begin{frame}{Items}
  \begin{itemize}[<+->]
    \item A
    \item<+-| check@+-> B
    \item<+-| alert@+-> CCCCC
    \item D
  \end{itemize}
\end{frame}

\end{document}

enter image description here

Edit: as suggested by samcarter

Simply redefining the alert action as shown above will basically disable the \alert command. With the etoolbox package \AtBeginEnvironment can be used to only change it for the itemize environment. But of course, \alert won't work inside the environment.

\documentclass{beamer}
\usepackage{etoolbox}% not necessary with up-to-date beamer versions
% defining new action environment
\newenvironment{checkenv}{\only{\setbeamercolor{itemize item}{fg=green}}}{}
% redefining alert action only for itemize
\AtBeginEnvironment{itemize}{%
\renewenvironment{alertenv}{\only{\setbeamercolor{itemize item}{fg=red}}}{}}

\begin{document}
\begin{frame}{Items}
  Alert working outside itemize, \alert{before}
  \begin{itemize}[<+->]
    \item A alert \alert{not working} inside itemize
    \item<+-| check@+-> B
    \item<+-| alert@+-> CCCCC
    \item D
  \end{itemize}
  and \alert{after} it.
\end{frame}

\end{document}

enter image description here

3
  • 2
    Great Idea! May I suggest \AtBeginEnvironment{itemize}{\renewenvironment{alertenv}{\only{\setbeamercolor{itemize item}{fg=red}}}{}}? This will leave the \alert command usable for the rest of the document. Aug 30 '17 at 21:25
  • @samcarter added this to my answer. Thanks.
    – Mike
    Aug 30 '17 at 21:53
  • @samcarter Thanks for the edit. Just updated beamer.
    – Mike
    Aug 30 '17 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.