# Beamer: Shift overlays by a group, or define slide numbers relatively

How to shift the overlay slide numbers of all content in a group all by the same integer? How to define slide numbers relative to a reference point (that is an integer)?

I often make a group of content with complicated overlays and then realize I need to show some other content in the same frame before showing the existing group. Then I need to manually, say, add 1 to each overlay number. When this happens, the relative sequence of the overlays within the group should stay the same.

How can I set the overlay numbers within a group only relative to the same reference point (i.e., an integer), and then just change this one reference point to shift the number of the slide on which each part in the group appears all by the same number?

In the following example, the two lines of text appear on the second and the first slides:

\documentclass{beamer}

\begin{document}

\begin{frame}
\uncover<2->{Appear second}\\
\uncover<1->{Appear first}
\end{frame}

\end{document}


By changing a single reference point, I would like to change the result to the following (shift the item that appear in the fist slide to the second slide, and shift the item that appear in the second slide to the third slide - everything shifts by the same number, here 1):

\documentclass{beamer}

\begin{document}

\begin{frame}
\uncover<3->{Appear second}\\
\uncover<2->{Appear first}
\end{frame}

\end{document}


• Are you aware of the <+-> and <.-> syntax? Or more generally, <+(num)-> and <.(num)->. However, in a tikzpicture, I'm not sure if this is going to simplify or complicate matters for you. Jul 8, 2019 at 17:28
• @HerrK. I'm familiar with <+-> and know about the rest, but I am not sure how to use them to solve my problem. In particular, I don't think I really understand <.-> even though I have read the part describing it in the documentation multiple times.
– tvk
Jul 9, 2019 at 20:49
• It's difficult to say without an actual example of a tikzpicture, since the order of the drawing commands does not necessarily coincide with the order you want the effect to appear. You should at least include an MWE that's closer to the problem you're dealing with. Jul 9, 2019 at 21:16
• Jul 9, 2019 at 21:18
• @HerrK. In fact I chose to provide a more general MWE since I don't think this is a TikZ-specific question. If there is a solution to the current MWE, I don't see how changing the text in my MWE to a tikzpicture would change things. Note that in my MWE the order of the text is the reverse of the order I want the parts to appear. I will remove the reference to TikZ to avoid confusion.
– tvk
Jul 10, 2019 at 7:26

You can use the <+(num)-> syntax for more flexible control of the overlay specification.

# Code

\documentclass{beamer}

\begin{document}

\begin{frame}
\uncover<+(1)->{Appear second}\\
\uncover<+(-1)->{Appear first}
\end{frame}

\end{document}


# Output

And after uncommenting the first \uncover:

• Thank you. I think this works for simple cases with only two overlays. However with more overlays, it becomes impractical to keep track of the difference in slide number between consecutive (in terms of location on the frame, not slide number) overlays. The problem with this approach is that every time <+(n)-> is used, the value of beamerpauses changes, so the reference point changes. For a method to be particularly useful, it still need to base on a single reference point (slide number).
– tvk
Jul 11, 2019 at 23:54
• @FangJing: That's why I asked you to provide a more elaborate MWE and why I said "I'm not sure this is going to simplify or complicate matters for you". Jul 12, 2019 at 1:29
• Hmm. A more elaborate MWE would be repeating a dozen more similar overlays on a dozen more slides - I was trying to keep the Minimal Working Example really Minimal. A key element that I need is to use the same reference point for all overlays within the group. Thank you all the same.
– tvk
Jul 14, 2019 at 18:02