How to include animated GIF in LaTeX / PDF

http://www.geogebra.org/forum/viewtopic.php?f=20&t=25986

GeoGebra allows exporting animated  GIF images but does not export the Protocols of Construction, the ide of this post is how to include  GIF and animated Construction Protocols in LaTeX.
Animated GIF
For include animated  GIFs Need ImageMagick program and one  GIF animated, for this example we use the picture hypo_hypotrochoid_001.gif
Image 
from  viewtopic.php?f=2&t=25044&p=88364&hilit=animated+gif#p88364
Now follow steps
1. Create a directory called test and copy hypo_hypotrochoid_001.gif
2.The following is convert the image into separate files, we have two cases
a) For Latex users (latex>dvisps>ps2pdf) open a command prompt, move to the test directory and enter the following line
Code:
convert hypo_hypotrochoid_001.gif -coalesce animate_%d.eps
then create the directory imgeps and copy ALL pictures in this.
b) For pdfLatex users (xelatex,lualatex) open a command prompt, move to the test directory and enter the following line
Code:
convert hypo_hypotrochoid_001.gif -coalesce animate_%d.pdf
then create the directory imgpdf and copy ALL pictures in this.
With this we have completed the process of conversion of images, we can now create your TEX file
3.We create a tex file and add the following lines into the preamble
Code:
\usepackage{graphicx}
\usepackage{animate}

4. And the body of the document add the line 
a)For LaTeX
Code:
\animategraphics[height=2.8in,autoplay,controls]{12}{imgeps/animate_}{0}{120}

v)For pdfLaTeX
Code:
\animategraphics[height=2.8in,autoplay,controls]{12}{imgpdf/animate_}{0}{120}

Compiled and finish, we have a PDF with an animated image.

Construction
To animated construction step we use the environment animateinline, this environment allows separate figure for steps, this will use the \newframe, the idea goes like this, we create our figure with GeoGebra and export, depending on the situation we have to add different lines.
1. Pstricks
Code:
\begin{animateinline}[
begin={\begin{pspicture*}(...,...)(...,...)},
end={\end{pspicture*}},
controls,autoplay,timeline=time1.txt]{1}
\psset{...}
\code
\newframe
\code
\newframe
...
\end{animateinline}

2. PGF/TiKZ
Code:
\begin{animateinline}[
begin={
\begin{tikzpicture}[...]
\clip(...,...)  rectangle (...,...);
},
end={\end{tikzpicture}},
controls,timeline=time2.txt]{1}
\code
\newframe
\code
\newframe
...
\end{animateinline}

Now we must create the "timeline", this is a file containing the order and time of the transparencies, the amount of overhead this ity in the amount of \newframe which is used, this file has the following form
Code:
::0x0
::1x0
::2x0
::3x0
::4x0
::5x0
To fully understand how it works you should read the documentation of animate ( texdoc animate for TeXLive) 
Compressed file attached two examples pstanimate.pdf and tikzanimate.pdf
Hope this helps for users of GeoGebra and LaTeX
Saludos
Pablo


Attachments:
File comment: Example using tikz and pstricks
 ggbanimate.rar [38.77 KiB] 
Downloaded 479 times 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值