# Beamer: Reuse incremental overlay number from list item?

I'm using an item list with the overlay specification <+(1)->. For one of the items, I want a text after the item list to be uncovered simultaneously with the item. How can I achieve that?

\begin{frame}

\begin{itemize}[<+(1)->]
\item First item
\item ...
\item An item somewhere in the middle of the list
\item ...
\item Last item
\end{itemize}

Some text to be synchronized with the item in the middle of the list

\end{frame}


Note: Although the text I want to be uncovered simultaneously with the list item is currently located after the list, I may decide to move it to before the list.

Not sure if this covers all (or even most) beamer possibilities, but it works here (please always use complete documents for examples, not just fragments, it simplifies testing).

Mark the special item with \zz with some label, then use \yy with the label which should work like \only<4-> in this case. It takes two latex runs, to cope with the forward reference needed for the text before the list.

\documentclass{beamer}

\begin{document}
\makeatletter
\def\zz#1{%
\expandafter\ifx\csname foo@#1\endcsname\relax
\expandafter\xdef\csname foo@#1\endcsname{\the\c@beamerpauses}%
\immediate\write\@auxout{\def\string\foo@#1{\the\c@beamerpauses}}%
\fi}
\def\yy#1{%
\expandafter\ifx\csname foo@#1\endcsname\relax
\typeout{layer of [#1] unknown}%
\let\@foo\@gobble
\else
\edef\@foo{\noexpand\only<\csname foo@#1\endcsname->}%
\fi
\@foo}

\makeatother
\begin{frame}

\yy{this}{Some text to be synchronized with the item in the middle of the list}

%\tracingall
\begin{itemize}[<+(1)->]
\item First item
\item ...
\item An item somewhere in the middle of the list\zz{this}
\item ...
\item Last item
\end{itemize}

\yy{this}{Some text to be synchronized with the item in the middle of the list}

\end{frame}

\end{document}


If you want to display your text from slide 4 onward, you need to use <4-> as overlay specification with one of the following commands:

• \uncover<4->{text}: when text is not displayed, it still occupies some space.
• \only<4->{text} : when text is not displayed, it doesn't occupy any space.
• action<4->{text} : works also in math mode.
\documentclass{beamer}
\begin{document}

\begin{frame}
\begin{itemize}[<+(1)->]
\item First item
\item ...
\item An item somewhere in the middle of the list
\item ...
\item Last item
\end{itemize}
\action<4->{Some text to be synchronized with the item in the middle of the list}
\end{frame}

\end{document}


The counter beamerpauses keeps track of the slide number. If you don't want to manually find the slide number, you can access it using the command \thebeamerpauses. Then you can save it somewhere to use it later in the overlay specification:

\documentclass{beamer}
\begin{document}

\newcounter{slidenumber}
\begin{frame}
\begin{itemize}[<+(1)->]
\item First item
\item ...
\item An item somewhere in the middle of the list \setcounter{slidenumber}{\thebeamerpauses}
\item ...
\item Last item
\end{itemize}
\action<\theslidenumber->{Some text to be synchronized with the item in the middle of the list}
\end{frame}

\end{document}


I'm not sure if saving the value in a counter is the right move though.

• The reason I wrote "somewhere in the middle of the list" is because I don't really know where in the list that is; I may add more items before and after that item, and then the synchronization will break if you use <4->. Aug 21 '13 at 23:11
• That what I was wondering actually... I would be interested to know a easy way to do it, it's quite annoying to have to keep track of the slide number. Aug 21 '13 at 23:18
• You need to save the value of the counter \thebeamerpauses`, I think it should be easy. Aug 21 '13 at 23:25
• Hm, good idea, remjg! Aug 22 '13 at 7:05