2

I am working under LyX but of course my question is also for LaTeX. I want to do this:

\begin{overprint}
\only<1>{
Test in slide 1
}
\only<2-4>{
Test in slide 2 with items :
\begin{itemize}
\item<3-4> item 1
\item<4> item 2
\end{itemize}
}
\only<5>{
Test in slide 3
}
\end{overprint}

where Test in slide 1 is replaced by Test in slide 2 with its items showing one by one, and so on, Test in slide 3 replacing all of them.

In a complex frame, I need using automatic slide numbering (<+->) instead of static sequence numbers. I have expected the following to work:

\begin{overprint}
\only<+->{
Test in slide 1
}
\only<+--+(2)->{
Test in slide 2 with items :
\begin{itemize}
\item<+--+(1)-> item 1
\item<+-> item 2
\end{itemize}
}
\only<+->{
Test in slide 3
}
\end{overprint}

But it does not compile:

[1

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
! Missing = inserted for \ifnum.
<to be read again> 
                   -
l.152 \end{frame}

I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
                   >
l.152 \end{frame}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
.....

If I do this:

\begin{overprint}
\only<+->{
Test in slide 1
}
\only<+->{
Test in slide 2 with items :
\begin{itemize}
\item<+-> item 1
\item<+-> item 2
\end{itemize}
}
\only<+->{
Test in slide 3
}
\end{overprint}

then it compiles but the behaviour is not the one expected, the slides are added one after the other instead of replacing the previous one, as if I had used \item instead of overprint and \only.

What should I do please?

Here is the full Lyx code as an screenshot since the text one is bearely readable:

enter image description here

In this code, <+-+> is a strange attempt that make it work for slides 1 and 2, but not the 3rd one:

enter image description here

lalebarde
  • 769

1 Answers1

3

You were rather close, I think. You had a few - too much. A very nice set of explanations can be found here.

\documentclass{beamer}
\begin{document}
\begin{frame}[t]
\frametitle{Absolute numbers}
\begin{overprint}
\only<1>{
Test in slide 1
}
\only<2-4>{
Test in slide 2 with items :
\begin{itemize}
\item<3-4> item 1
\item<4> item 2
\end{itemize}
}
\only<5>{
Test in slide 3
}
\end{overprint}
\end{frame}

\begin{frame}[t]
\frametitle{Relative numbers}
\begin{overprint}
\only<+>{
Test in slide 1
}
 \only<+-+(2)>{
Test in slide 2 with items :
\begin{itemize}
\item<+-+(1)> item 1
\item<+> item 2
\end{itemize}
}
\only<+(2)>{
Test in slide 3
}
\end{overprint}
\end{frame}
\end{document}

enter image description here