# How to avoid a jumpy slide while using \only?

The following slide is jumpy'' at 2 and 4. I would like to get the equations between <2> and <4> to appear sequentially replacing one another. This is way I use \only instead that \onslide. However, I get a jumpy slide. How can I fix this?

PS: I saw this thread beamer: \only with columns makes things move down and I tried both \onslide and \visible, but I couldn't make it work

\documentclass[10pt,english,xcolor={usenames,dvipsnames}]{beamer}
\begin{document}

\begin{frame}[label=id1]
\frametitle{A non-identification result}
\begin{itemize}
\item<1-> 1
\begin{itemize}
\item<2->   The equation is
\only<2>{\begin{equation*}
x = y
\end{equation*}}
\only<3>{\begin{equation*}x = z
\end{equation*}}
\onslide<4->{\begin{equation*}x=\textcolor{red}{z}
\end{equation*}}
\item<4-> yet \\
\onslide<5->...  $x = u$
\end{itemize}
\item<6-> There is a jump at 2
\item<7-> and at 4
\end{itemize}
\end{frame}
\end{document}


All you need to do is to at t to the options of the frame.

\documentclass[10pt,english,xcolor={usenames,dvipsnames}]{beamer}
\begin{document}

\begin{frame}[label=id1,t]
\frametitle{A non-identification result}
\begin{itemize}
\item<1-> 1
\begin{itemize}
\item<2->   The equation is
\only<2>{\begin{equation*}
x = y
\end{equation*}}
\only<3>{\begin{equation*}x = z
\end{equation*}}
\onslide<4->{\begin{equation*}x=\textcolor{red}{z}
\end{equation*}}
\item<4-> yet \\
\onslide<5->...  $x = u$
\end{itemize}
\item<6-> There is a jump at 2
\item<7-> and at 4
\end{itemize}
\end{frame}
\end{document}


• Better than my hacks!! but I will leave my answer for similar problems that possibly could not be solved so easy (don't really know if they exist after your answer... but I will read about that option) (+1) – koleygr Oct 18 '18 at 2:37
• @koleygr Thanks! I learned this trick from samcarter. Another thing that works (which I was using before the trick from samcarter) is to use overlayarea. Maybe you could consider trying this out in your answer. – marmot Oct 18 '18 at 2:39
• You may add it in your answer since I am just looking around here in the breaks of an urgent job... I will check it tomorrow (and upvote for real this time :P ) – koleygr Oct 18 '18 at 2:43
• Oh! this does it! very nice hack! Sorry I saw this only now! – Andrew Oct 18 '18 at 3:46
• @Andrew feel free to accept this answer – koleygr Oct 18 '18 at 11:33

Some (2) tricks as ideas to use in such cases:

\documentclass[10pt,english,xcolor={usenames,dvipsnames}]{beamer}
\begin{document}

\begin{frame}[label=id1]
\frametitle{A non-identification result}
\begin{itemize}
\item<1-> 1
\begin{itemize}
\item<2->   The equation is
\onslide<2->{\begin{equation*}
\alt<2>{x=y}{x=\textcolor{red}{z}}
\end{equation*}}
\only<1-3>{\invisible<1-3>{\item .\\}}
\only<4->{\item<4->yet \\}
\onslide<5->...  $x = u$
\end{itemize}
\item<6-> There is not a jump at 2
\item<7-> neither at 4
\end{itemize}
\end{frame}
\end{document}

• Thank you for your answer. However in this way x = z does not replace x = y. It visualize both one after the other. I would like to see x = y first, then x = z and then x = \textcolor{red}{z}. – Andrew Oct 18 '18 at 2:23
• Sorry @Andrew, lost some things during the game of changes... Fixed somehow but didn't check if it is like your desired... I am sure if you get the idea and it isn't like you wish yet... you can easily fix it in your needs... It is just an example right now that does the trick of your request – koleygr Oct 18 '18 at 2:32
• Thank you. All I needed to add is that, to obtain the list 1, 2, 3, you need to nest an alt inside another: \alt<3>{3}{\alt<1>{1}{2}} – Andrew Oct 18 '18 at 3:44

Changing a bit the code you could do this:

\documentclass[10pt,english,xcolor={usenames,dvipsnames}]{beamer}
\begin{document}

\begin{frame}[label=id1]
\frametitle{A non-identification result}
\begin{itemize}
\item<1-> 1
\begin{itemize}
\item<2->   The equation is
\begin{equation*}
x = \only<2>{y}\only<3>{z}\only<4->{\textcolor{red}{z}}
\end{equation*}
\item<4-> yet \\
\onslide<5->...  $x = u$
\end{itemize}
\item<6-> There is a jump at 2
\item<7-> and at 4
\end{itemize}
\end{frame}
\end{document}


For prevent the little horizontal shift between 2 and 3:

\documentclass[10pt,english,xcolor={usenames,dvipsnames}]{beamer}
\usepackage{tikz}
\newcommand{\tn}[1]{\tikz[baseline]{
\useasboundingbox (-1ex,-0.5ex) rectangle (1ex,1.5ex);
\node[inner sep=0pt,outer sep=0pt,text depth=0.5ex,text height=1.5ex,anchor=base]{$#1$};}}
\begin{document}

\begin{frame}[label=id1]
\frametitle{A non-identification result}
\begin{itemize}
\item<1-> 1
\begin{itemize}
\item<2->   The equation is
\begin{equation*}
x = \tn{\only<2>{y}\only<3>{z}\only<4->{\textcolor{red}{z}}}
\end{equation*}
\item<4-> yet \\
\onslide<5->...  $x = u$
\end{itemize}
\item<6-> There is a jump at 2
\item<7-> and at 4
\end{itemize}
\end{frame}
\end{document}