# slide dependent subitemize in beamer

I'm not sure if I do it well but I have what follows:

\documentclass[10pt,fleqn,t]{beamer}
\begin{document}
\frame[t]{
\begin{block}{Title}
\begin{itemize}
\item text 1
\only<1>{%
\begin{itemize}%
\item subtext 1
\item subtext 2
\end{itemize}}
\only<2-3>{\item text 2}
\only<3>{\item text 3}
\end{itemize}
\end{block}}
\end{document}


When the items move vertically when moving forward in the presentation: is there a way to fix this? (I've tried \onslide instead but it freezes vertical space which I do not want).

Added: (by Andrew Stacey) To clarify the problem: it is that in the above document, the text 1 (which is shown on all slides) shifts vertically ever-so-slightly-but-noticeably between frames 1 and 2. As it is the first item in the list and there is plenty of space on the slide, this doesn't not seem the right behaviour.

-
Not a solution to your problem, but note that you can write \item<2-3> ..  instead of \only<2-3>{\item .. }. – Martin Scharrer Jul 11 '11 at 22:16
@Martin: Thanks. Don't you think that the mentioned behaviour could be reported as a beamer bug? – pluton Jul 11 '11 at 22:42
It's not clear what the desired output should be. \only has the items move about, and \onslide has the items stay put. What do you want to happen when you move to slide two? – Seamus Jul 12 '11 at 9:54
Ah. So the problem is that the Item 1 moves slightly when moving to slide 2. Is that the issue? – Seamus Jul 12 '11 at 9:55
yes, this is correct. – pluton Jul 12 '11 at 12:35

I conjecture that this is to do with when TeX knows that the paragraph containing the text 1 has been finished. The inner itemize starts a new paragraph and so shouldn't affect the spacing about the previous \item, but it does. Exactly what shape or form this confusion takes, I don't know. One could well envision this as a bug.

However, despite not knowing exactly what is going on, I can suggest a simple fix: ensure that the paragraphs are clearly separated. Viz, put a blank line after the jumping \item.

\documentclass[10pt,fleqn,t]{beamer}
%\url{http://tex.stackexchange.com/q/22809/86}
\begin{document}
\frame[t]{
\begin{block}{Title}
\begin{itemize}
\item text 1

\only<1>{%
\begin{itemize}%
\item subtext 1
\item subtext 2
\end{itemize}}
\only<2-3>{\item text 2}
\only<3>{\item text 3}
\end{itemize}
\end{block}}
\end{document}


For consistency, but for nothing else, you could have a blank line after the sub-itemized list.

Interestingly, I only got this behaviour with itemize and enumerate and not with any other environments that I tried (including description). Moreover, it is nothing to do with the \only since the following code shows the issue:

\documentclass[10pt,fleqn,t]{beamer}
%\url{http://tex.stackexchange.com/q/22809/86}
\begin{document}
\frame[t]{
\begin{block}{Title}
\begin{itemize}
\item text 1
\begin{itemize}%
\item subtext 1
\item subtext 2
\end{itemize}
\end{itemize}
\end{block}}

\frame[t]{
\begin{block}{Title}
\begin{itemize}
\item text 1
\item text 2
\end{itemize}
\end{block}}
\end{document}


and the same blank line fixes it.

-

If you don't like the output using \item<2-3> text 2 then you can try use an empty "space kipper", that is:

\only<1,4->{\item \mbox{}}
\only<2-3>{\item text 2}

-
This adds a blank item on the first slide (and on a new fourth slide). What you presumably want to do is already achieved by using \onslide instead of \only – Seamus Jul 12 '11 at 11:25