# What is the best way to animate (with multiframe maybe...) the steps of a long polynomial division like this?

How can I to do this code for animate with multiframe or in a beamer. I would like to animate each steps whith the division. It's possible to use stage=6 together multiframe for include in a beamer?

My code:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix}
\usepackage{polynom}
\usepackage[brazil]{babel}

\begin{document}
\huge
\polylongdiv[style=D,stage=10]{x^{2}+2x+1}{x+1}

\end{document}



Produces this:

Using package animate and its \multiframe command, as requested. The dimensions of the last stage are measured first in order to correctly size the animation widget.

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


A pure beamer approach could look as follows:

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

• It's possible to beamer, using multido ? Maybe... Jun 23 '20 at 1:42
• @RonyDeiksonSantana As in the second code box, perhaps. Jun 24 '20 at 11:02