1

I want to have two itemizes, side-by-side, that appear along side each other and have the same alert as well.

So first slide is just the frame title, second slide is item1 from both lists with alert colors, third slide is item1 and item2 from both lists with the item2-s with alert colors etc.

The picture is the last side currently, unfortunately, the entire right hand list appears with item3 of the left hand list. I could do manual overlays, but can this be done automatically?

\documentclass{beamer}
\begin{document}
\frame{
    \frametitle{title}
    \begin{columns}

    \begin{column}{0.45\paperwidth}  %%<--- here
      \begin{itemize}[<+(1)-| alert@+(1)>]
        \item item1
        \item item2
        \item item3
      \end{itemize}
    \end{column}

    \begin{column}{0.45\paperwidth}  %%<--- here
      \begin{itemize}[<.(1)-| alert@.(1)>]
        \item item1
        \item item2
        \item item3
      \end{itemize}
    \end{column}

  \end{columns}
}
\end{document}

enter image description here

1
  • Sounds like the work of scontents.
    – user202729
    Nov 7 '21 at 14:32
1

Probably not the easiest way (and also maybe not the best way) to do this:

(Solution for inserting counter into itemize taken from here.)

\documentclass{beamer}

\usepackage{xpatch}
\newcounter{itemcntr}
\AtBeginEnvironment{itemize}{%
 \setcounter{itemcntr}{0}%
 \xapptocmd{\item}{\stepcounter{itemcntr}}{}{}%
}
\newcounter{itemscount}
\newcommand{\setitemscount}{%
 \setcounter{itemscount}{\arabic{itemcntr}}%
 \addtocounter{itemscount}{-1}%
}

\begin{document}
\frame{
    \frametitle{title}
    \begin{columns}

    \begin{column}{0.45\paperwidth}  %%<--- here
      \begin{itemize}[<+(1)-| alert@+(1)>]
        \item item1
        \item item2
        \item item3
        \item item4 
      \end{itemize}
    \end{column}
    
    \setitemscount

    \begin{column}{0.45\paperwidth}  %%<--- here
      \begin{itemize}[<+(-\theitemscount)-| alert@+(-\theitemscount)>]
        \item item1
        \item item2
        \item item3
        \item item4
      \end{itemize}
    \end{column}

  \end{columns}
}
\end{document}

What does this code do?

First, I load the xpatch package, since I want to add a counter to every itemize environment, which does not come with such a counter per default. Using \AtBeginEnvironment, I set the previously defined counter itemcntr to 0 and then append to each \item inside the itemize environment a \stepcounter macro to increase this counter by 1. This means that the counter itemcntr contains the number of items of the last itemize environment.

Then, I define another counter itemscount and a new macro \setitemscount which essentially only sets the new counter to the value of the counter itemcntr.

Now, when you call \setitemscount, the counter itemscount is set to the number of items of the last itemize environment. You can then use the value of this counter (accessible via \theitemscount) in the argument for the following itemize environment to synchronize the alters with [<+(-\theitemscount)-| alert@+(-\theitemscount)>]. This means that the items in this environment are selected x times earlier than the current step, where x is the number of the items of the previous environment. This way, both lists are synchronous.

enter image description here

enter image description here

enter image description here

2
  • Thanks! So itemize doesn't use a counter, but doesn't beamer use one for the overlays? Wouldn't it be possible to extract that info and use that instead of \theitemscount? Tbh, the whole thing with the new counters and stuff is a bit arcane for me so I only vaguely understand what is going on here :)
    – fbence
    Nov 10 '21 at 13:12
  • Yeah, this may be possible. But I don't really know how beamer sets those counters. To make it understandable, I will add some explanations to my code. Nov 10 '21 at 13:46

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.