我正在尝试将代码块替换为动画。但我无法将其放入或verbatim
中。\onslide
\visible
我尝试使用savebox
,问题是第二个代码块排版在第一个代码块下方。我希望代码块显示在相同位置。
我的代码:
\documentclass{beamer}
\usepackage{fancyvrb}
\begin{document}
\begin{frame}[fragile]{Object}
\begin{center}
\onslide<2>{
\begin{Verbatim}[frame=single, fontsize=\fontsize{7pt}{8pt}\selectfont]
class int(object)
| int(x[, base]) -> integer
|
| Convert a string or number to an integer, if possible. A floating point
| argument will be truncated towards zero (this does not include a string
| representation of a floating point number!) When converting a string, use
| the optional base. It is an error to supply a base when converting a
| non-string. If base is zero, the proper base is guessed based on the
| string content. If the argument is outside the integer range a
| long object will be returned instead.
\end{Verbatim}
}
\onslide<3>{
\begin{Verbatim}[frame=single, fontsize=\fontsize{7pt}{8pt}\selectfont]
class int(object)
| int(x[, base]) -> integer
|
\end{Verbatim}
}
\end{center}
\end{frame}
\end{document}
答案1
它与 一起起作用,\only<>
而不是onslide<>
。