# Text Overlays in Beamer

I am trying to use text overlays in Beamer. My working example is as follows:

\documentclass{beamer}
\begin{document}
\begin{frame}{Test}
Animation with beamer : learn
\only<1-3>{
\item First item
\item Extra item
\item Second item
}
\item<1-> sub-first item
\item<2-> sub-second item
\end{itemize}
\item<1-> sub-first item
\item<2-> sub-second item
\end{itemize}

\end{itemize}
\end{frame}
\end{document}

The presentation should like the following way:

Animation with beamer : learn

The points will animate one after another in this slide.

1. First item

2. Extra item

3. Second item

Next slide

This slide should start with the points "1. First item" and "3. Second item" highlighted. "2. Extra item" is not visible or removed. At the very end, the sub-items corresponding to the points 1 and 3 should start to animate one after another. The two sub-item for point 1 should animate, and after a little pause, the sub-items for point 3 should animate.

Animation with beamer : learn (position should not change as in the previous slide)

1. First item (highlighted) (It should be in the same position as in the first slide)

(only subitems should be animated)

a. sub-item

b. sub-item

1. Extra item (removed or not visible) (It should be in the same position as in the first slide)

2. Second item (highlighted) (It should be in the same position as in the first slide)

(obly subitems should be animated)

a. sub-item

b. sub-item

Learnt a little about overlays from my earlier question Animation with Beamer using ` \only '

Could not figure out the final result with the written example. Please help and suggest.

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