0

I have an item list in a tcolorbox here in the beamer.

\begin{tcolorbox}[title=item list 1]
    \begin{itemize}[<+->]
           \item 1a
           \item 1b
           \item 1c
    \end{itemize}
\end{tcolorbox}

The items 1a, 1b, 1c in item list 1 is shown one by one.

Suppose I want another item list on the same frame in a tcolorbox replacing the previous one after uncovering all the items in list 1. The second list is also uncovered one item by one item.

\begin{tcolorbox}[title=item list 2]
    \begin{itemize}[<+->]
           \item 2a
           \item 2b
           \item 2c
    \end{itemize}
\end{tcolorbox}

I know I can use environment like \only<n> to control the sequence, but that means I have to manually label every item in list 1 and 2 with \item<n>. This becomes really time-consuming when the two lists are long (and for my case, the list contains nesting). Is there any way to treat the item list as a whole when specifying the number in \only<n>. For example,

\begin{frame}{Two lists}


\only<1>{
% first list, expecting the items display one by one
% second list doesn't appear before the first list completely shown
\begin{tcolorbox}[title=item list 2]
    \begin{itemize}[<+->]
           \item 2a
           \item 2b
           \item 2c
    \end{itemize}
\end{tcolorbox}
}

\only<2>{
% second list, expecting the items display one by one
\begin{tcolorbox}[title=item list 2]
    \begin{itemize}[<+->]
           \item 2a
           \item 2b
           \item 2c
    \end{itemize}
\end{tcolorbox}
}
\end{frame}

Currently, when I use this the code above, beamer would only show the first item in list 1 and the first 2 item in list 2. I understand that it treats the 1 and 2 in \only<n> as the number of items in both item lists.

Any idea to implement this without manually counting each item and labelling it?

1 Answer 1

1

Instead of just 1 or 2 you could specify a range of overlays on which each tcolorbox should be visible. You can for example say <-3> to indicate that the first tcolorbox should be present on all overlays including the 3rd, and <4-> for the second tcolorbox to be present on all overlays starting from the 4th.

\documentclass{beamer}

\usepackage{tcolorbox}

\begin{document}
    
\begin{frame}{Two lists}

\begin{onlyenv}<-3>
  \begin{tcolorbox}[title=item list 1]
    \begin{itemize}[<+->]
           \item 1a
           \item 1b
           \item 1c
    \end{itemize}
  \end{tcolorbox}
\end{onlyenv}

\begin{onlyenv}<4->
  \begin{tcolorbox}[title=item list 2]
    \begin{itemize}[<+->]
           \item 2a
           \item 2b
           \item 2c
    \end{itemize}
  \end{tcolorbox}
\end{onlyenv}

\end{frame}

    
\end{document}

enter image description here

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.