# Beamer: including items only some slides using a relative syntax

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.

• 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. Oct 11, 2014 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 ;-) Oct 12, 2014 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. Oct 12, 2014 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. Oct 13, 2014 at 5:23
• I've edited here and removed the dupe, based on the (now deleted) comments on dcmst's answer. Oct 13, 2014 at 16:23

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.

• Perhaps I'll mention this in my blog! Oct 13, 2014 at 16:27
• Thank you, it is exactly what wanted. If one omit only@, one has the \visible behavior. Great ! Oct 13, 2014 at 16:40

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}


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

Second version:

\documentclass{beamer}

\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}


## 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}
}

\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.

• It's not exactly what I want. I don't want a stop for 3 slide on this item, I want 1,2,3,4,5,6,7... smooth but 3 disapears after 5. Oct 11, 2014 at 17:34
• @Tarass, see the edit. Oct 11, 2014 at 17:40
• Thank for all your work, but Joseph Wright gives the general compact syntax that answers the question he expresses better than me. I must accept his answer. Oct 13, 2014 at 16:42
• @Tarass I completely agree :) Oct 13, 2014 at 16:47