这个问题和我的一个问题基本相同较早的一个,除了唯一的区别是我使用“仅”来更改同一位置的文本(即,这个问题)。换句话说,我在进行过程中会破坏我之前的文本,并且不会在之前的文本下面添加新的文本。
由于第一个“only”的文本比第二个“only”短,因此图像将移动位置。我希望图像保持在其位置。
可能不太明显,但第二张图像比第一张更高。
代码在这里,有人能找到解决方案吗?
\documentclass{beamer}
\usepackage{graphicx}
\title[Title]{Presentation}
\author{Sandro Botticelli}
\institute{Italy}
\date{1484}
\begin{document}
\begin{frame}
\begin{figure}
\includegraphics[scale = 0.8]{Venus}
\caption{Nascita di Venere}
\end{figure}
\only<1>{In the centre the newly-born goddess Venus stands nude in a giant scallop shell. Its size is purely imaginary, and is also found in classical depictions of the subject. }
\only<2>{Alternative identifications for the two secondary female figures involve those also found in the Primavera; the nymph held by Zephyr may be Chloris, a flower nymph he married in some versions of her story, and the figure on land may be Flora. Flora is generally the Roman equivalent of the Greek Chloris; in the Primavera Chloris is transformed into the figure of Flora next to her, following Ovid's Fasti, but it is hard to see that such a transformation is envisaged here.}
\end{frame}
\end{document}
答案1
正如@marmot 在他的评论中所建议的那样,\begin{frame}[t]
我会这样做。我认为你无论如何都应该使用环境overprint
。当你的图片不在顶部时也可以工作。
来自 beameruserguide:
这种方法(使用)的问题
\only
在于,它可能会导致线条高度出现轻微但令人讨厌的差异,这可能会导致整个框架在幻灯片之间“摆动”。如果替换文本有几行长,这个问题会变得更加严重。为了解决这个问题,你可以使用两个环境:overlayarea 和 overprint。第一个更灵活,但不太人性化。
\begin{overlayarea}{⟨area width⟩}{⟨area height⟩} ⟨environment contents⟩ \end{overlayarea}
环境中的所有内容都将放置在指定大小的矩形区域中。无论其实际内容如何,该区域在帧的所有幻灯片上都将具有相同的大小。
例子:
\begin{overlayarea}{\textwidth}{3cm} \only<1>{Some text for the first slide.\\Possibly several lines long.} \only<2>{Replacement on the second slide.} \end{overlayarea} \begin{overprint}[⟨area width⟩] ⟨environment contents⟩ \end{overprint}
区域宽度默认为文本宽度。
这是您的 MWEoverprint
\documentclass{beamer}
\title[Title]{Presentation}
\author{Sandro Botticelli}
\institute{Italy}
\date{1484}
\begin{document}
\begin{frame}
\begin{figure}
\includegraphics[scale = 0.8]{Venus}
\caption{Nascita di Venere}
\end{figure}
\begin{overprint}
\onslide<1>{In the centre the newly-born goddess Venus stands nude in a giant scallop shell. Its size is purely imaginary, and is also found in classical depictions of the subject. }
\onslide<2>{Alternative identifications for the two secondary female figures involve those also found in the Primavera; the nymph held by Zephyr may be Chloris, a flower nymph he married in some versions of her story, and the figure on land may be Flora. Flora is generally the Roman equivalent of the Greek Chloris; in the Primavera Chloris is transformed into the figure of Flora next to her, following Ovid's Fasti, but it is hard to see that such a transformation is envisaged here.}
\end{overprint}
\end{frame}
\end{document}