# Rolling bullet points in beamer

Often when I use beamer for slides I use an itemize environment with \pause to show off one bullet point at a time. Also, often all the points I want to show on a single slide does not fit and I need to start a new slide with a couple of more points.

What I would like is instead an itemize-like environment that would give me (when the points do not fit on a single slide) rolling bullet points, something similar to what the following code does:

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{itemize}
\only<-5>{\item one}
\only<2-6>{\item two}
\only<3-7>{\item three}
\only<4-8>{\item four}
\only<5-9>{\item five}
\only<6-10>{\item six}
\only<7-11>{\item seven}
\only<8-12>{\item eight}
\only<9->{\item nine}
\only<10->{\item ten}
\only<11->{\item eleven}
\only<12->{\item twelve}
\end{itemize}
\end{frame}
\end{document}


However I don't want to keep track of how many slides I'm using.

Is there such an environment out there somewhere?

Also, some sort of animated rolling would be excellent, but that might be to ask for to much.

-

## migrated from stackoverflow.comAug 31 '12 at 18:28

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Aug 31 '12 at 18:36
–  Fran Aug 31 '12 at 18:49

## 2 Answers

Here's a version, with a rather weird problem and therefore a limitation. It defines a new counter iii and a new \myitem command. If you use such itemize environments on more than one slide, then the counter has to be reset. Otherwise, if for example you had 10 points on the first slide, it would start at slide 11 on the next slide. So I used etoolbox's \AtBeginEnvironment to reset the iii counter. This however means that you can only use one such itemize list per frame as otherwise you'll scroll through both of them at the same time. I tried to improve this by reseting the iii counter at the begin of each frame. But if I don't have the line \AtBeginEnvironment{itemize}{\setcounter{iii}{0}} I get a large pile of errors ("perhaps a missing item"), so for the moment this is limited to one scrolling itemize per frame. Also, as there's no look ahead mechanism, it won't stop when the last 5 items are displayed, but only when the last one is present.

## Code

\documentclass{beamer}
\usetheme{Darmstadt}
\usepackage{tikz}
\usepackage{etoolbox}

\newcounter{iii}

\AtBeginEnvironment{itemize}{\setcounter{iii}{0}}

\newcommand{\myitem}[2][$\bullet$]
{ \stepcounter{iii}
\pgfmathtruncatemacro{\endslide}{\theiii+4}
\only<\theiii-\endslide>{\item[#1] #2}
}

\begin{document}

\begin{frame}[t]
\begin{itemize}
\myitem{a \theiii}
\myitem{b \theiii}
\myitem{c \theiii}
\myitem{d \theiii}
\myitem{e \theiii}
\myitem{f \theiii}
\myitem{g \theiii}
\myitem{h \theiii}
\myitem{i \theiii}
\myitem{j \theiii}
\myitem{k \theiii}
\myitem{l \theiii}
\myitem{m \theiii}
\myitem{n \theiii}
\myitem{o \theiii}
\myitem{p \theiii}
\myitem{q \theiii}
\myitem{r \theiii}
\myitem{s \theiii}
\myitem{t \theiii}
\myitem{u \theiii}
\myitem{v \theiii}
\myitem{w \theiii}
\myitem{x \theiii}
\myitem{y \theiii}
\myitem{z \theiii}
\end{itemize}
\end{frame}

\end{document}


## Result

-
Thanks. Great, that looks like it should work! I'll try that for the next slides I produce. –  feffemannen Sep 21 '12 at 7:26

This is built into beamer:

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{itemize}[<only@+-+(4)>]
\item one
\item two
\item three
\item four
\item five
\item six
\item seven
\item eight
\item nine
\item ten
\end{itemize}
\end{frame}
\end{document}


The overlay specification +-+(4) means the same thing as (n+1)-(n+5), where n is the current slide count. The only@ action wraps the item in an \only<...>. Putting the specification as an argument to the itemize environment makes it the default for each item.

If you want to specify item text in a \foreach loop you can explicitly call \only before each item:

\documentclass{beamer}
\usepackage{pgffor}
\begin{document}
\begin{frame}
\begin{itemize}
\foreach \x in {a,b,...,z} {%
\only<+-+(4)>{\item \x}
}
\end{itemize}
\end{frame}
\end{document}


See sections 9.6.3 (Action Specifications) and 9.6.4 (Incremental Specifications) of the beamer (v3.22) manual. Also this answer of mine.

-
Thanks for this tip I didn' know, it does not work with a \foreach loop, but Tom's solution does : \begin{frame}[t] \begin{itemize} \foreach \x in {a,...,z} {% \myitem{\x \theiii} } \end{itemize} \end{frame} will work, but \begin{itemize}[<only@+-+(4)>] \foreach \x in {a,...,z} {% \item \x } \end{itemize} will not. –  Tarass Jul 15 '14 at 8:32
@Tarass: see edit. –  Matthew Leingang Jul 15 '14 at 12:31
This should be marked as the "correct" answer! –  Yossi Gil Aug 18 '14 at 16:25