# Renumber in \only<x> beamer

I have a frame with some text popping and transfoming as slides are flowing using only :

\begin{frame}
A is
\only<1>{Y}
\only<2>{Z}
\end{frame}


Assume that I want to add first an X in my text, popping before Y, I cannot do

\only<0>{X}


Is there a way to renumber properly in \only?

• You want the relative specification. I've covered some of it in tex.stackexchange.com/questions/154521/…, but perhaps that answer is too complicated here: if it doesn't help, I'll write some basics up. – Joseph Wright Oct 23 '18 at 8:28
• Try with \only<+>{...} instead of hard coded numbers – user36296 Oct 23 '18 at 8:30

In simple terms, what you want is a relative specification. The beamer class supports them using the + syntax. Thus for example your example could be made into

\begin{frame}
A is
\only<+>{Y}
\only<+>{Z}
\end{frame}


and then into

\begin{frame}
A is
\only<+>{X}
\only<+>{Y}
\only<+>{Z}
\end{frame}


Each time + is found, it is replaced by an incremented slide number: the first use is therefore slide 1. There is a lot of subtlety to this process, which I've covered in Relative overlay specification in beamer?.