11

I am looking for the syntax for making an item appear on say the next three slides. I'm imagining something like

\item<+-??>

The \item should appear here and disappears 3 slides later, in the same way it would if I used \only (i.e. the item shouldn't leave any space once it vanishes).

I'm illustrating this using \item, but I'm looking for a general syntax.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Tarass
  • 16,912
  • Just write \item<+-.(3)> my item. The topic is intensely covered by the great answer of Joseph to Relative overlay specifications in beamer, which appears to be a duplicate of this question. Please take a look at it, if you agree we could close this question. – Daniel Oct 11 '14 at 19:49
  • I agree. Sorry, I red this answer before, because of lak of english or of attention, I didn't understand that it was THE answer ;-) – Tarass Oct 12 '14 at 13:21
  • @Tarass Based on the comments on the answer here, it seems you want a solution which doesn't just 'hide' but completely 'ignores' one or more \item lines using a relative spec. That's related to the link suggested by Daniel but not a dupe. Could you clarify the question? If I'm right, there is a solution related to my answer in the link, but it's a not quite the same. – Joseph Wright Oct 12 '14 at 20:52
  • It was a mwe what I exactly wanted is the syntax to deal with an overlay between current position and 3 slides later. Then I cas use it with \only, \visible, \invisible ... it depends. I just looked for the syntax, (Daniel gave it to me and the link to your answer) for me it is a duplicate question as suggested and I marked so. Sorry for my poor english. But it is not a duplicate, and because of an english suptility I can express, please fill free to clarify my question. Thank you for your concern and for your answer. Btw I use it in tikzpicture not with items. – Tarass Oct 13 '14 at 05:23
  • I've edited here and removed the dupe, based on the (now deleted) comments on dcmst's answer. – Joseph Wright Oct 13 '14 at 16:23

2 Answers2

17

In Relative overlay specification in beamer? I covered how to use relative specifications, but there I stuck to the visible/invisible switch. What you want is the 'extended' syntax which also allows things like altering on some slides or (here) applying \only-like effects:

\documentclass{beamer}

\begin{document}
   \begin{frame}
   \begin{itemize}
      \item<+-> item 1
      \item<+-> item 2
      \item<only@+-.(3)> item 3
      \item<+-> item 4
      \item<+-> item 5
      \item<+-> item 6
   \end{itemize}

   \end{frame}
\end{document}

The key here is that only@ prefix to the 'standard' relative specification, which switches it from doing the normal 'visible/invisible' action to the 'only' action. The part after the @ is exactly the same idea as described in my other answer.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
9

I think you need to create your own macro, something like:

\documentclass{beamer}

\newcommand{\mytimeditem}[1]{\only<+>{\item #1}\only<+>{\item #1}\only<+>{\item #1}}
\begin{document}
   \begin{frame}
   \begin{itemize}
      \item<+-> item 1
      \item<+-> item 2
      \mytimeditem{item 3}
      \item<+-> item 4
      \item<+-> item 5
      \item<+-> item 6
   \end{itemize}

   \end{frame}
\end{document}

enter image description here

If you want to leave a blank line where "item 3" was, replace the last \only into \mytimeditem with \onslide

Second version:

\documentclass{beamer}

\newcommand{\mytimeditem}[1]{\only<+>{\item #1}\only<+>{\item #1}\only<+>{\item #1}\addtocounter{beamerpauses}{-2}}
\begin{document}
   \begin{frame}
   \begin{itemize}
      \item<+-> item 1
      \item<+-> item 2
      \mytimeditem{item 3}
      \item<+-> item 4
      \item<+-> item 5
      \item<+-> item 6
   \end{itemize}

   \end{frame}
\end{document}

enter image description here

A more generic version

With expl3 (code from @Joseph Wright answer) and calc

\documentclass{beamer}
\usepackage{expl3}
\usepackage{calc}

\ExplSyntaxOn
\cs_new_eq:NN \Repeat \prg_replicate:nn
\ExplSyntaxOff

\newcommand{\timeditem}[2]{
 \Repeat{#1}{
   \only<+>{\item #2}
 }\addtocounter{beamerpauses}{-#1+1}
}

\begin{document}
   \begin{frame}
   \begin{itemize}
      \item<+-> item 1
      \item<+-> item 2
      \timeditem{4}{item 3}
      \item<+-> item 4
      \item<+-> item 5
      \item<+-> item 6
      \item<+-> item 7
   \end{itemize}
   \end{frame}
\end{document}

Now the relative number of repetitions can be specified on the fly and the number of pauses is automatically adjusted.

enter image description here

d-cmst
  • 23,095