I don't really understand exactly what you are trying to do, but the basic idea is to arrange your items as you'd like them if everything were shown. So if a
is a sub-item of b
, it needs to be an \item
in a list nested as part of the specification of b
e.g. a nested list, if b
is itself an \item
. Once you have that, add the overlay specifications you need. If you want alerted text separate from overlays, use \alert{}
as you have been. Otherwise, you can add it to the \item
overlay specification.
Since you want something pretty bespoke, just specify the slide numbers for each \item
. I wouldn't bother trying to define a default for the list in this kind of case, or try to use relative overlay specifications. It will just be too confusing, I think. If you stick to the numbers, it should be relatively straightforward, if a bit fiddly, to get the result you want.
This is an example. Since I don't completely understand your question and have no idea what to do with the fourth item and its sub-items, it will surely need modification. However, hopefully, it should be pretty straightforward to do that, even if you need a bit of trial-and-error.
\documentclass{beamer}
\begin{document}
\begin{frame}{Test}
Animation with beamer: learn
\begin{itemize}
\item<2,5-> \alert<5,8>{First item}% show on slide 2 and 5 onwards, alert only on 5 and 8
\begin{itemize}% these are sub-items - need a nested list
\item<6-| alert@6> sub-first item% show on slide 6 and later, alert on 6 only
\item<6-| alert@6> sub-second item
\end{itemize}
\item<4> Extra item% only on slide 4, never alert
\item<3,5-> \alert<5,8>{Second item}% show on slide 3 and 5 onwards, alert only on 5 and 8
\begin{itemize}% these are sub-items - need a nested list
\item<7-| alert@7> sub-first item% show on slide 7 and later, alert on 7 only
\item<7-| alert@7> sub-second item
\end{itemize}
\onslide<9->% no idea what to do here - let's just put it on the next slide with everything bar the extra item
\item \alert{Fourth item}
\begin{itemize}% sub-items follow parent by default, so this is all on slide 9 onwards (which is just slide 9 in this case)
\item sub-first item
\item sub-second item
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
You should read up on what is referred to as "overlay specification" within the beamer
user guide. Here is an excerpt (taken from section 3.10 Using Overlay Specifications):
The overlay specifications are given in pointed brackets. The specification <1->
means “from slide 1 on.” [...] beamer
automatically computes the number of slides needed for each frame. More generally, overlay specification are lists of numbers or number ranges where the start or ending of a range can be left open. For example -3,5-6,8-
means “on all slides, except for slides 4 and 7.”
Note the different use of frame and slide. Each frame may have multiple slides associated with it. The overlay specification is designed to identify the number of slides for each frame. There are verbatim overlay specifications, like \only
, \onslide
and some "optional arguments" to macros like \item
.
For itemize
(lists in general, and other structures like frame
), you can specify an incremental overlay specification <+->
that inserts the appropriate pause at possibly-sequential items, like lists. Read more about this in section 9.6.4 Incremental Specifications.
Best Answer
Like this? But I must admit, I am not sure which elements you want on which slides.