I would like to modify the overlay specification that is passed to a custom command, but for some reason, < and > are interpreted as ¡ and ¿ when they are included in a new command.
MWE:
\documentclass[12pt,t,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc} % Ensure the correct input encoding
\usepackage{xstring}
% named colors
\definecolor{offwhite}{RGB}{249,242,215}
\definecolor{background}{RGB}{24,24,24}
\definecolor{hilight}{RGB}{255,69,0}
% use those colors
\setbeamercolor{titlelike}{fg=hilight}
\setbeamercolor{normal text}{fg=offwhite,bg=background}
\setbeamercolor{item}{fg=offwhite} % color of bullets
% define macros
\newcommand<>{\hilight}[1]{{\color#2{hilight} \textbf#2{#1}}}
\newcommand<>{\onlyhilight}[1]{%
\StrBetween{#2}{<}{>}[\spec]% Extract the number between < and >
\edef\modifiedspec{<\spec->}% Create the new overlay specification
% \edef\modifiedspec{<3->}% Create the new overlay specification
\only\modifiedspec{{\color#2{hilight} \textbf#2{#1}}}%
}
\newcommand{\test}{<5->}
\begin{document}
\begin{frame}{\textbf{Introduction}}
\vspace{60pt}
\begin{itemize}\itemsep10pt
\item<2-> \hilight<2>{First entry}, \onlyhilight<3>{second entry}, \onlyhilight<4>{third entry}, \onlyhilight<5>{fourth entry} \test
\end{itemize}
\end{frame}
\end{document}
\newcommand<>{\onlyhilight}[1]{\only#2{{\color#2{hilight} \textbf#2{#1}}}}
\only
has to be<#2->
(i.e. appended by a-
), because otherwise, the text will disappear again on the following slides. At the same time,#2
cannot include the-
, because then, the highlighting won't disappear on the following slides. The overlay specification therefore needs to be modified.-
\newcommand<>{\onlyhilight}[1]{\temporal#2{}{{\color#2{hilight} \textbf#2{#1}}}{#1}}