我正在尝试让以下几个项目出现在一个框架中,但每次只显示一张幻灯片,每张幻灯片后都会消失。这是代码,但它是错误的,我不知道在哪里。
\begin{frame}[t]
\frametitle{Slope of a Tangent Line}
% The following two lines I want to appear on one slide:
\only<1>Consider the function $f(x)$ and the tangent line at the point $(a,f(a))$: \bigskip
\begin{center}\includegraphics[width=3.5in]{fig1}\end{center} \pause
%The following two lines I want to appear on another
\only<2>To find the slope of the tangent to $f(x)$ at this point, we begin by looking at the secant line through the point $(a,f(a))$ and some other point $(x,f(x))$. The graph would be:
\begin{center}\includegraphics[width=3.5in]{fig2}\end{center} \pause
\end{frame}
问题是图像根本没有改变,现在底部有文字。
这是最新的代码:
\begin{frame}[t]
\frametitle{Slope of a Tangent Line}
\only<1->{Consider the function $f(x)$ and the tangent line at the point $(a,f(a))$: \bigskip
\begin{center}\includegraphics[width=3.5in]{fig1}\end{center} }
\only<2>{To find the slope of the tangent to $f(x)$ at this point, we begin by looking at the secant line through the point $(a,f(a))$ and some other point $(x,f(x))$. The graph would be:
\begin{center}\includegraphics[width=3.5in]{fig2}\end{center}}
\only<3>{The point $(x,f(x))$ that we chose was arbitrary. We could have chosen any point that we wanted, so now let's choose a point that is closer to $(a,f(a))$ and look at the secant through those two points.
\begin{center}\includegraphics[width=3.5in]{fig3}\end{center}}
\only<4>{Again, let's move the point $(x,f(x))$ even closer to $(a,f(a))$ and see what the secant looks like. \bigskip
\begin{center}\includegraphics[width=3.5in]{fig4}\end{center}}
\only<5>{Notice that each time we move the second point $(x,f(x))$ closer to $(a,f(a))$, the secant through those two points moves closer to the tangent.
\begin{center}\includegraphics[width=3.5in]{fig5}\end{center}}
\only<6>{Notice that each time we move the second point $(x,f(x))$ closer to $(a,f(a))$, the secant through those two points moves closer to the tangent.
\begin{center}\includegraphics[width=3.5in]{fig6}\end{center}}
\end{frame}
答案1
您只是缺少一些括号。\only<slides>{Text}
需要这些括号才能获取所有内容。在任何其他情况下,它只会使用下一个标记(对于第一个示例“C”)并仅在幻灯片 1 上显示该标记。
此外,您还应该删除您的\pause
宏,因为宏之后它们就毫无用处了\only
。
更新:\only
为了您的目的(尤其是在更新的代码中),只需为(in )添加幻灯片编号即可<>
。请勿使用连字符。
\documentclass[demo]{beamer}
\begin{document}
\begin{frame}[t]
\frametitle{Slope of a Tangent Line}
% The following two lines I want to appear on one slide:
\only<1>{Consider the function $f(x)$ and the tangent line at the point $(a,f(a))$: \bigskip
\begin{center}\includegraphics[width=3.5in]{fig1}\end{center}}
%The following two lines I want to appear on another
\only<2>{To find the slope of the tangent to $f(x)$ at this point, we begin by looking at the secant line through the point $(a,f(a))$ and some other point $(x,f(x))$. The graph would be:
\begin{center}\includegraphics[width=3.5in]{fig2}\end{center}}
\end{frame}
\end{document}
答案2
包含缺失括号并删除不必要的\pause
s 的代码示例:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\begin{frame}[t]
\frametitle{Slope of a Tangent Line}
% The following two lines I want to appear on one slide:
\only<1>{Consider the function $f(x)$ and the tangent line at the point $(a,f(a))$: \bigskip
\begin{center}\includegraphics[height=1.5in]{fig1}\end{center}}
%The following two lines I want to appear on another
\only<2>{To find the slope of the tangent to $f(x)$ at this point, we begin by looking at the secant line through the point $(a,f(a))$ and some other point $(x,f(x))$. The graph would be:
\begin{center}\includegraphics[height=1.5in]{fig2}\end{center}}
\end{frame}
\end{document}
编辑:慢了 5 秒
EDIT2:对于您最新的代码,您应该-
从第一个中删除\only<1->
:
\begin{frame}[t]
\frametitle{Slope of a Tangent Line}
\only<1>{Consider the function $f(x)$ and the tangent line at the point $(a,f(a))$: \bigskip %here I removed the '-' from \only<1->
\begin{center}\includegraphics[width=3.5in]{fig1}\end{center} }
\only<2>{To find the slope of the tangent to $f(x)$ at this point, we begin by looking at the secant line through the point $(a,f(a))$ and some other point $(x,f(x))$. The graph would be:
\begin{center}\includegraphics[width=3.5in]{fig2}\end{center}}
\only<3>{The point $(x,f(x))$ that we chose was arbitrary. We could have chosen any point that we wanted, so now let's choose a point that is closer to $(a,f(a))$ and look at the secant through those two points.
\begin{center}\includegraphics[width=3.5in]{fig3}\end{center}}
\only<4>{Again, let's move the point $(x,f(x))$ even closer to $(a,f(a))$ and see what the secant looks like. \bigskip
\begin{center}\includegraphics[width=3.5in]{fig4}\end{center}}
\only<5>{Notice that each time we move the second point $(x,f(x))$ closer to $(a,f(a))$, the secant through those two points moves closer to the tangent.
\begin{center}\includegraphics[width=3.5in]{fig5}\end{center}}
\only<6>{Notice that each time we move the second point $(x,f(x))$ closer to $(a,f(a))$, the secant through those two points moves closer to the tangent.
\begin{center}\includegraphics[width=3.5in]{fig6}\end{center}}
\end{frame}
顺便说一句:如果您的一个帧不包含任何持久信息,您可能需要考虑添加更多帧。