I am using this answer to automate uncovering lines of an align. However, I would like to alert on uncovering.
I don't know expl3 and my attempts to hack the answer referenced above have failed: I've tried adapting that answer to wrap the \onslide
in \alert<+>{}
as follows:
\alert<+>{\onslide<+->{ ##1 \\ }}
But I get an error:
! Extra }, or forgotten \endgroup.
I've also tried putting the \alert<+>{}
on the inside:
\tl_put_right:Nn \l_tmpa_tl { \onslide<+->{ \alert<+>{ ##1 } } \\ }
But I get the same error:
! Extra }, or forgotten \endgroup.
A more robust solution than hardcoding \alert
inside would be to be able to set the overlay policy at a higher level. I mention this in a comment in my example below. But if that's not possible, I would be happy with a hardcoded \alert
.
Example showing current behavior. I would like the align behavior in the example to be similar to the itemize behavior.
\documentclass{beamer}
\let\oldalign\align
\let\endoldalign\endalign
% https://tex.stackexchange.com/a/611688/12212
\ExplSyntaxOn
\NewDocumentEnvironment{myalign}{+b}
{
\tl_set:Nn \l_tmpa_tl { \begin{oldalign} }
\seq_set_split:Nnn \l_tmpa_seq { \\ } {#1}
\seq_map_inline:Nn \l_tmpa_seq
{
\tl_if_empty:nF { ##1 }
{
\tl_put_right:Nn \l_tmpa_tl { \onslide<+->{ ##1 \\ } }
}
}
\tl_put_right:Nn \l_tmpa_tl { \notag \end{oldalign} \vskip-1.5em }
\l_tmpa_tl
} { }
\ExplSyntaxOff
\newenvironment{overlayalign}
{
\renewenvironment{align}{%
\begin{myalign}
}{%
\end{myalign}
}
}
{
}
\begin{document}
\begin{frame}[<alert@+|+->]
% I generally prefer the alert, but it would be nice to be able to change to
% the following, and align adapts (i.e., would not alert), just like itemize:
%\begin{frame}[<+->]
I would like behavior similar to itemize:
\begin{itemize}
\item one
\item two
\item three
\end{itemize}
\begin{overlayalign}
\begin{align}
abc & = def \\
& = ghi \\
& = jkl \\
& = 0. \\
\end{align}
\end{overlayalign}
\end{frame}
\end{document}
Best Answer
Here is an approach using L3 programing layer