# Space appearing between equation and itemize (with enumitem) when adding a onslide command in beamer

I am running into this behavior that there is a space that gets added after the equation when i use the enumitem package and that i have a onslide command ending just before the itemize. Any idea how to get rid of the space after the equation and why it appears there? I tried adding %, with and without the enumitem package, adding a nosep option to itemize, but the space is still there.

\documentclass{beamer}
\usepackage{enumitem}
\usepackage{blindtext}

\begin{document}

\begin{frame}
\blindtext
\begin{equation*}
A=A
\end{equation*}
\begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
\end{itemize}
\blindtext

\end{frame}

\begin{frame}
\blindtext
\onslide<2->{
\begin{equation*}
A=A
\end{equation*}
}
\begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
\end{itemize}
\blindtext

\end{frame}

\end{document}


Using \align instead of \equation and putting the \onslide inside the align environment solves the issue. But still very confused by the origin of this behavior.

\documentclass{beamer}
\usepackage{enumitem}
\usepackage{blindtext}
\begin{document}

\begin{frame}
\blindtext
\begin{align*}
\onslide<2->{A=A}
\end{align*}
\begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
\end{itemize}
\blindtext
\end{frame}

\end{document}


Edit: (much closer to your desired result) Improved to work good enought for everything that can be added inside a minipage.

\documentclass{beamer} \usepackage{enumitem} \usepackage{blindtext} \usepackage{tikz}

\newsavebox{\mybox} \newcommand{\myonly}[2]{\alt<#1>{\begin{minipage}[inner sep=0,outer sep=0]{\linewidth}#2\end{minipage}}{\savebox\mybox{\vbox{\begin{minipage}[inner sep=0,outer sep=0]{\linewidth}#2\end{minipage}}}\par\rule{0pt}{\dimexpr\ht\mybox+\dp\mybox-\baselineskip}\par}} \begin{document}

\begin{frame} \blindtext[1] \begin{align*}
A&=A\\
B&=f(x)\\ \end{align*} \begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \end{itemize} \blindtext[1]

\end{frame}

\begin{frame} \blindtext[1] \myonly{2-}{\begin{align*}
A&=A\\
B&=f(x)\\ \end{align*}} \begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \end{itemize} \blindtext[1]

\end{frame}

\end{document}


(old answer) Not perfect but close:

\documentclass{beamer}
\usepackage{enumitem}
\usepackage{blindtext}

\newsavebox{\mybox}
\newcommand{\myonly}[2]{\alt<#1>{#2}{\savebox\mybox{\vbox{#2}}\vspace*{\dimexpr\ht\mybox+\dp\mybox}\par}
}
\begin{document}

\begin{frame}
\blindtext
\begin{equation*}
A=A
\end{equation*}
\begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
\end{itemize}
\blindtext

\end{frame}

\begin{frame}
\blindtext
\myonly{2-}{\begin{equation*}
A=A
\end{equation*}}
\begin{itemize}
\item AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
\end{itemize}
\blindtext

\end{frame}

\end{document}

• Thanks, still a bit wobbly, but getting there.. – Chachni Aug 17 '19 at 18:00
• Welcome ... The edit is much better... – koleygr Aug 17 '19 at 21:06
• Thanks, the wiggling is close to 0 now. But if i put something more complicated instead of the \equation*, like: {\begin{align*} A&=A\\ B&=B \end{align*} then it fails. So i'll stick with my solution of putting the \onlide inside the \begin{align}. Thanks for your efforts! – Chachni Aug 18 '19 at 15:31