答案1
根据要求使用包animate
及其\multiframe
命令。首先测量最后阶段的尺寸,以便正确调整动画小部件的大小。
\documentclass[border=2mm]{standalone}
\usepackage{polynom}
\usepackage{animate}
\newlength\boxwidth
\newlength\boxheight
\begin{document}
\huge%
\settowidth\boxwidth{\polylongdiv[style=D,stage=10]{x^{2}+2x+1}{x+1}}%
\settototalheight\boxheight{\polylongdiv[style=D,stage=10]{x^{2}+2x+1}{x+1}}%
\begin{animateinline}[step,controls]{1}
\multiframe{7}{i=1+1}{ % seven steps seem to be enough
\parbox[t][\boxheight]{\boxwidth}{\polylongdiv[style=D,stage=\i]{x^{2}+2x+1}{x+1}}
}
\end{animateinline}
\end{document}
一个纯粹的beamer
方法可能如下所示:
\documentclass{beamer}
\usepackage{polynom}
\usepackage{pgffor,calc}
\newlength\boxwidth
\newlength\boxheight
\begin{document}
\begin{frame}{Polynomial division}\huge
\settowidth\boxwidth{\polylongdiv[style=D,stage=10]{x^{2}+2x+1}{x+1}}%
\settototalheight\boxheight{\polylongdiv[style=D,stage=10]{x^{2}+2x+1}{x+1}}%
\foreach \i in {1,...,7} {%
\only<\i>{\parbox[t][\boxheight]{\boxwidth}{\polylongdiv[style=D,stage=\i]{x^{2}+2x+1}{x+1}}}%
}
\end{frame}
\end{document}