Animation in beamer: nested lists

Beamer has the [<+->] option for lists which makes each item appears separately. However, it also make items in nested lists appear separately too. How do I make each nested list appear as a whole?

E.g.,

\begin{itemize}[<+->]
\item A
\begin{itemize}
\item A1
\item A2
\end{itemize}
\item B
\begin{itemize}
\item B1
\item B2
\end{itemize}
\end{itemize}


each item appears separately (IOW, 6 slides are created). I want all As to appear simultaneously and all B appear simultaneously (IOW, two slides in PDF).

PS. I would rather avoid the explicit <i-> annotation.

• Does the PS mean that you would rather avoid adding [<1->] to the two inner \begin{itemize}? – nickie Apr 22 '15 at 21:04
• yes, exactly!.. – sds Apr 22 '15 at 21:04
• Or you can just \pause – Mark Apr 23 '15 at 4:27
• @Mark: yes, but I want to issue a single command to handle the situation, not one command per item. – sds Apr 23 '15 at 10:52

I don't believe you can. In the documentation (Beamer User Guide, v.3.33, section 12.1 on p.110) it says "The ⟨default overlay specification⟩ is inherited by subenvironments. Naturally, in a subenvironment you can reset it locally by setting it to <1->." I may be wrong and there may be a hack around it, but it seems that this was the intended behaviour.

I suggest that you define your own innerItemize environment:

\newenvironment{innerItemize}{%
\begin{itemize}[<1->]%
}{%
\end{itemize}%
}

\begin{itemize}[<+->]
\item A
\begin{innerItemize}
\item A1
\item A2
\end{innerItemize}
\item B
\begin{innerItemize}
\item B1
\item B2
\end{innerItemize}
\end{itemize}


If you insist on your original code, you could hack the itemize environment to use the default one for the outer level and turn to the equivalent of innerItemize for inner levels. I don't think I'd like such a hack but this is how you'd go:

\let\oldItemize\itemize
\let\endoldItemize\enditemize
\newcommand{\myItemize}[1][<1->]{\oldItemize[#1]}
\def\endmyItemize{\endoldItemize}
\let\itemize\myItemize
\let\enditemize\endmyItemize