在使用 \only 时如何避免跳跃滑动?

在使用 \only 时如何避免跳跃滑动?

下面的幻灯片在 2 和 4 处“跳跃”。我想让 <2> 和 <4> 之间的方程依次出现,相互替换。这就是我使用 \only 而不是 \onslide 的方法。但是,我得到的幻灯片跳跃了。我该如何解决这个问题?

PS:我看到了这个帖子beamer: \只有柱子才能使物体向下移动我尝试了 \onslide 和 \visible,但无法正常工作

\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}

答案1

您需要做的就是查看t框架的选项。

\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}

在此处输入图片描述

答案2

在这种情况下可以使用一些(2)个技巧:

\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}

答案3

稍微改变一下代码就可以做到这一点:

\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}

为了防止 2 和 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}

相关内容