Animations in LaTeX












52














I am a new user of LaTeX and this site. I have seen that many answers in this site have animations. However I am not able to produce any of these animations. For example, I asked How to reduce size of line in tikz L-system? and a got this answer, but when I compile this with pdflatex, I get this pdf which does not have any animation. What am I doing wrong?










share|improve this question




















  • 1




    Basically the PDF is giving you something like individual frames of the animation - one per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output, I assume. beamer can also create animated effects by quickly displaying one image after another e.g. including the first pdf/other image on slide one, the second on slide two and so on. beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. which can gradually change colouring, for example, to simulate movement.
    – cfr
    Jan 4 '14 at 4:40










  • you can find some details in plotting the sequence x_n using tikz or How to convert pstricks animation to GIF file? for example
    – cmhughes
    Jan 4 '14 at 4:44










  • @cfr Ok, So is there no way to directly produce animations in PDFs?
    – Kartik
    Jan 4 '14 at 4:49












  • @Kartrik I am not sure but I think it depends on the capabilities of your pdf viewer. So you can create animations using beamer, for example. You could use tikz or whatever to create the different slides in situ or you could include different frames from external files. But whether that will appear animated will, I think, depend on the viewer you use. (Obviously this is true for gif, too - your browser has to be capable - but I think it is more unusual for pdf viewers to support that kind of animation than for browsers to support animated gifs.)
    – cfr
    Jan 4 '14 at 4:57






  • 2




    You can convert that pdf file in to a gif file using imagemagick. convert -delay 30 -loop 0 -density 200 -alpha remove yourfile.pdf yourfile.gif. I usually have a batch file for this job.
    – user11232
    Jan 4 '14 at 5:53
















52














I am a new user of LaTeX and this site. I have seen that many answers in this site have animations. However I am not able to produce any of these animations. For example, I asked How to reduce size of line in tikz L-system? and a got this answer, but when I compile this with pdflatex, I get this pdf which does not have any animation. What am I doing wrong?










share|improve this question




















  • 1




    Basically the PDF is giving you something like individual frames of the animation - one per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output, I assume. beamer can also create animated effects by quickly displaying one image after another e.g. including the first pdf/other image on slide one, the second on slide two and so on. beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. which can gradually change colouring, for example, to simulate movement.
    – cfr
    Jan 4 '14 at 4:40










  • you can find some details in plotting the sequence x_n using tikz or How to convert pstricks animation to GIF file? for example
    – cmhughes
    Jan 4 '14 at 4:44










  • @cfr Ok, So is there no way to directly produce animations in PDFs?
    – Kartik
    Jan 4 '14 at 4:49












  • @Kartrik I am not sure but I think it depends on the capabilities of your pdf viewer. So you can create animations using beamer, for example. You could use tikz or whatever to create the different slides in situ or you could include different frames from external files. But whether that will appear animated will, I think, depend on the viewer you use. (Obviously this is true for gif, too - your browser has to be capable - but I think it is more unusual for pdf viewers to support that kind of animation than for browsers to support animated gifs.)
    – cfr
    Jan 4 '14 at 4:57






  • 2




    You can convert that pdf file in to a gif file using imagemagick. convert -delay 30 -loop 0 -density 200 -alpha remove yourfile.pdf yourfile.gif. I usually have a batch file for this job.
    – user11232
    Jan 4 '14 at 5:53














52












52








52


34





I am a new user of LaTeX and this site. I have seen that many answers in this site have animations. However I am not able to produce any of these animations. For example, I asked How to reduce size of line in tikz L-system? and a got this answer, but when I compile this with pdflatex, I get this pdf which does not have any animation. What am I doing wrong?










share|improve this question















I am a new user of LaTeX and this site. I have seen that many answers in this site have animations. However I am not able to produce any of these animations. For example, I asked How to reduce size of line in tikz L-system? and a got this answer, but when I compile this with pdflatex, I get this pdf which does not have any animation. What am I doing wrong?







pdf animations






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 12 mins ago









Martin Scharrer

198k45632814




198k45632814










asked Jan 4 '14 at 4:29









Kartik

8311717




8311717








  • 1




    Basically the PDF is giving you something like individual frames of the animation - one per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output, I assume. beamer can also create animated effects by quickly displaying one image after another e.g. including the first pdf/other image on slide one, the second on slide two and so on. beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. which can gradually change colouring, for example, to simulate movement.
    – cfr
    Jan 4 '14 at 4:40










  • you can find some details in plotting the sequence x_n using tikz or How to convert pstricks animation to GIF file? for example
    – cmhughes
    Jan 4 '14 at 4:44










  • @cfr Ok, So is there no way to directly produce animations in PDFs?
    – Kartik
    Jan 4 '14 at 4:49












  • @Kartrik I am not sure but I think it depends on the capabilities of your pdf viewer. So you can create animations using beamer, for example. You could use tikz or whatever to create the different slides in situ or you could include different frames from external files. But whether that will appear animated will, I think, depend on the viewer you use. (Obviously this is true for gif, too - your browser has to be capable - but I think it is more unusual for pdf viewers to support that kind of animation than for browsers to support animated gifs.)
    – cfr
    Jan 4 '14 at 4:57






  • 2




    You can convert that pdf file in to a gif file using imagemagick. convert -delay 30 -loop 0 -density 200 -alpha remove yourfile.pdf yourfile.gif. I usually have a batch file for this job.
    – user11232
    Jan 4 '14 at 5:53














  • 1




    Basically the PDF is giving you something like individual frames of the animation - one per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output, I assume. beamer can also create animated effects by quickly displaying one image after another e.g. including the first pdf/other image on slide one, the second on slide two and so on. beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. which can gradually change colouring, for example, to simulate movement.
    – cfr
    Jan 4 '14 at 4:40










  • you can find some details in plotting the sequence x_n using tikz or How to convert pstricks animation to GIF file? for example
    – cmhughes
    Jan 4 '14 at 4:44










  • @cfr Ok, So is there no way to directly produce animations in PDFs?
    – Kartik
    Jan 4 '14 at 4:49












  • @Kartrik I am not sure but I think it depends on the capabilities of your pdf viewer. So you can create animations using beamer, for example. You could use tikz or whatever to create the different slides in situ or you could include different frames from external files. But whether that will appear animated will, I think, depend on the viewer you use. (Obviously this is true for gif, too - your browser has to be capable - but I think it is more unusual for pdf viewers to support that kind of animation than for browsers to support animated gifs.)
    – cfr
    Jan 4 '14 at 4:57






  • 2




    You can convert that pdf file in to a gif file using imagemagick. convert -delay 30 -loop 0 -density 200 -alpha remove yourfile.pdf yourfile.gif. I usually have a batch file for this job.
    – user11232
    Jan 4 '14 at 5:53








1




1




Basically the PDF is giving you something like individual frames of the animation - one per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output, I assume. beamer can also create animated effects by quickly displaying one image after another e.g. including the first pdf/other image on slide one, the second on slide two and so on. beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. which can gradually change colouring, for example, to simulate movement.
– cfr
Jan 4 '14 at 4:40




Basically the PDF is giving you something like individual frames of the animation - one per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output, I assume. beamer can also create animated effects by quickly displaying one image after another e.g. including the first pdf/other image on slide one, the second on slide two and so on. beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. which can gradually change colouring, for example, to simulate movement.
– cfr
Jan 4 '14 at 4:40












you can find some details in plotting the sequence x_n using tikz or How to convert pstricks animation to GIF file? for example
– cmhughes
Jan 4 '14 at 4:44




you can find some details in plotting the sequence x_n using tikz or How to convert pstricks animation to GIF file? for example
– cmhughes
Jan 4 '14 at 4:44












@cfr Ok, So is there no way to directly produce animations in PDFs?
– Kartik
Jan 4 '14 at 4:49






@cfr Ok, So is there no way to directly produce animations in PDFs?
– Kartik
Jan 4 '14 at 4:49














@Kartrik I am not sure but I think it depends on the capabilities of your pdf viewer. So you can create animations using beamer, for example. You could use tikz or whatever to create the different slides in situ or you could include different frames from external files. But whether that will appear animated will, I think, depend on the viewer you use. (Obviously this is true for gif, too - your browser has to be capable - but I think it is more unusual for pdf viewers to support that kind of animation than for browsers to support animated gifs.)
– cfr
Jan 4 '14 at 4:57




@Kartrik I am not sure but I think it depends on the capabilities of your pdf viewer. So you can create animations using beamer, for example. You could use tikz or whatever to create the different slides in situ or you could include different frames from external files. But whether that will appear animated will, I think, depend on the viewer you use. (Obviously this is true for gif, too - your browser has to be capable - but I think it is more unusual for pdf viewers to support that kind of animation than for browsers to support animated gifs.)
– cfr
Jan 4 '14 at 4:57




2




2




You can convert that pdf file in to a gif file using imagemagick. convert -delay 30 -loop 0 -density 200 -alpha remove yourfile.pdf yourfile.gif. I usually have a batch file for this job.
– user11232
Jan 4 '14 at 5:53




You can convert that pdf file in to a gif file using imagemagick. convert -delay 30 -loop 0 -density 200 -alpha remove yourfile.pdf yourfile.gif. I usually have a batch file for this job.
– user11232
Jan 4 '14 at 5:53










6 Answers
6






active

oldest

votes


















29














Since the OP asks for creating an animated PDF using the animate package without the need to have the animation frames in a separate (PDF) file, the tikzpicture environment can be directly put into an animateinline environment:



documentclass{article}
usepackage{animate}
usepackage{tikz}
usetikzlibrary{lindenmayersystems}
pgfdeclarelindenmayersystem{A}{%
symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
rule{A->F[+A][-A]}
}

begin{document}
begin{animateinline}[controls,autoplay,loop]{2}
multiframe{8}{n=1+1}{
begin{tikzpicture}[scale=10,rotate=90]
draw (-.1,-.2) rectangle (.4,0.2);
draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
l-system [l-system={A,axiom=A,order=n,angle=45,step=0.25cm}];
end{tikzpicture}
}
end{animateinline}
end{document}





share|improve this answer



















  • 1




    THIS was what I wanted. All the other answers gave GIFs
    – Kartik
    Jan 9 '14 at 11:22






  • 1




    This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
    – Nasser
    Jan 9 '14 at 22:26










  • @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
    – AlexG
    Jan 10 '14 at 7:38



















28














There are two things here,




  1. to produce a gif file (which we do here normally, in this site for uploading).

  2. to have the animation inside the pdf file.


For first, my take will be imagemagick. Install imagemagick and ensure that convert.exe is in system path. Produce your pdf file (as you have shown in the link in OP). Then issue this command from within the same folder using command prompt.



convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif  


Change the parameters as needed. For details refer to imagemagick's documentation. Ususally, I prefer a batch file for repeated use. Save the contents below in to a file named mygifbatch.bat inside the same folder as your pdf file.



@ECHO ON
cls

REM convert to animated gif

CD /D %~dp0
mkdir gifs
SET Program="convert.exe"
for %%A in (*.pdf) do %Program% -delay 30 -loop 0 -density 200 -alpha remove %%A gifs/%%~nA.gif
Pause


To convert, double click on mygifbatch.bat file and it will convert all pdf files in the current folder in to gif files inside a sub-directory gifs.



Now the second. You can use animate package as in the following code:



documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}

usepackage{filecontents}
%% This is your file to be animated
begin{filecontents*}{lsystems.tex}
documentclass{article}
usepackage{tikz}
usepackage[active,tightpage]{preview}PreviewEnvironment{tikzpicture}
usetikzlibrary{lindenmayersystems}
pgfdeclarelindenmayersystem{A}{
symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
rule{A->F[+A][-A]}
}
begin{document}
foreach n in {1,...,8} {
begin{tikzpicture}[scale=10,rotate=90]
draw (-.1,-.2) rectangle (.4,0.2);
draw
[blue,opacity=0.5,line width=0.1cm,line cap=round]
l-system [l-system={A,axiom=A
,order=n,angle=45,step=0.25cm}];
end{tikzpicture}
}

end{document}
end{filecontents*}
%
immediatewrite18{pdflatex lsystems}

%% convert to GIF animation. Uncomment following line to have a gif animation in the same folder.
%immediatewrite18{convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif}
%%

usepackage{animate}
begin{document}
begin{preview}
%animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
animategraphics[controls,autoplay,loop,scale=1]{2}{lsystems}{}{}
end{preview}
end{document}


Here I used filecontents to write your .tex file and pdflatexed it from within the main document. Hence you will need to use --shell-escape while compiling. If you already have the pdf file, you don't need lines 3--32. The pdf should be viewed using adobe reader. For more details refer to animate documentation (texdoc animate or at to texdoc.net).



There is a nice arara rule written by Chris (cmhughes) which makes production of gif from pdf easy. Install the cool tool arara from Paulo's github repository. It is included in texlive. But you have to install it by yourself if you are a miktex user. Now save the contents of cmhughes code in to a file by name animate.yaml. Put this file in some folder, say C:Users<your name>AppDataRoamingArararules (for windows). Then create a file araraconfig.yaml in your home directory (C:Users<your name> usually) with the following contents:



!config
paths:
- C:Users<your name>AppDataRoamingArararules


You can add many paths like this. Now your good to go. Add the following in your tex file



% arara: pdflatex
% arara: animate: {density: 200, delay: 20}


Sample code (lsystems.tex):



% arara: pdflatex
% arara: animate: {density: 200, delay: 20}
documentclass[tikz]{standalone}
usetikzlibrary{lindenmayersystems}
pgfdeclarelindenmayersystem{A}{
symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
rule{A->F[+A][-A]}
}
begin{document}
foreach n in {1,...,8} {
begin{tikzpicture}[scale=10,rotate=90]
draw (-.1,-.2) rectangle (.4,0.2);
draw
[blue,opacity=0.5,line width=0.1cm,line cap=round]
l-system [l-system={A,axiom=A
,order=n,angle=45,step=0.25cm}];
end{tikzpicture}
}
%
end{document}


Compile lsystems.tex with - arara lsystems.tex. arara can also be integrated with many editors. For details, refer to beautiful arara manual.



enter image description here






share|improve this answer























  • I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
    – kiss my armpit
    Jan 4 '14 at 19:27










  • This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
    – Sean Allred
    Jul 16 '15 at 21:16



















21














You can create .gif animations by the follwing steps:




  1. Create a PDF with multiple pages. Every page is one part of the animation. The easiest way to do this might be the beamer document class

  2. Use pdfcrop and imagemagicks convert to create the animation.


For Linux users



To make step 2 trivial, I use the following Makefile for every projects:



SOURCE = bellman-ford-algorithm
DELAY = 80
DENSITY = 300
WIDTH = 512

make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean

clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav

gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean

animatedGif:
make
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean

transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean

png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png

svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg



  1. Just save it as Makefile (be aware of the fact that Makefiles have tabs, not four spaces! So copy-and-paste might not work)

  2. Replace the first 4 variables according to your needs

  3. Type make animatedGif in the shell of your choice (most might use bash, but zsh with the oh-my-zsh plugin offers tabbed autocompletion for Makefiles :-))


Examples



Eulerian path



See my article "How to visualize Graph algorithms" for more information how this was created:



enter image description here



Cholesky decomposition



Source: LaTeX-examples



enter image description here






share|improve this answer



















  • 1




    This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
    – Léo Léopold Hertz 준영
    Apr 22 '14 at 17:57



















15














Another way to get .gif files, in addition to @Harish answer, is GIMP. This is my usual procedure and it is useful for uploading in websites: you find an example (of an external web page with respect to TeX.SX) in http://cfiandra.github.io/Sa-TikZ/. The example contains an animation for presentations: it is done with TikZ (code below). Indeed, you can create animations in Beamer without the animate package.



For demonstration purposes I will exploit my solution from Draw a closed liquid-droped shaped curve with TikZ: the file is named liquid_shape.tex.



enter image description here



Let's now open the file liquid_shape.pdf with GIMP and import all pages:



enter image description here



Typing CTRL+SHIFT+E it is possible to export the image; change the file extension to .gif:



enter image description here



and export; automatically GIMP recognizes you want to create an animation and it shows you a window like this:



enter image description here



Select Like animation (in italian Come animazione) and possibly customize the delay between overlays (I selected 1200 ms).



Export and you will have liquid_shape.gif.






share|improve this answer































    13














    I am not certain how useful this is at this point. However, here is a slightly elaborated version of my comment together with an example of an animation created with beamer. Unlike the other examples, this one is extremely simple.



    Basically the PDF linked to in the question consists of individual frames which could be used to make up an animation, with one frame per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output. A couple of ways of producing those have been mentioned in the other answers.



    beamer can also create animated effects by quickly displaying one image after another. One way to do that is to include different frames on different slides and to tell beamer to animate them. includegraphics is overlay-specification aware, for example. Essentially, you include the first frame on the first slide, the second on the second slide and so on.



    beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. These can create animated effects just using the TeX code. For example, you can gradually change colouring to simulate movement. The following example fades from one text to another. I used a version of this in a presentation to convey the idea that the second text was explaining the first. I've just altered the texts here to something TeX-related. When you click on the first slide, the text fades out and is replaced by the text on the final slide which fades in. As I say, this is nothing like the sophisticated animations other people post - it is just about as simple as an animation could be, I suppose. But it can be quite effective for all that. I wanted the focus to be on the content of the text, after all - a really impressive animation would just serve to distract from the point being made. (Obviously this doesn't really apply with the dummy text I've used here but think about trying to convey the meaning of a key concept or the nature of a discipline.)



    This works for me in acroread but not Okular. So it should display fine in Adobe Reader but I'm not sure about Foxit Reader or Evince.



    documentclass{beamer}
    usepackage{fixltx2e}
    usepackage{texnames}

    % lliwiau arbennig
    setbeamertemplate{background canvas}[default]
    setbeamercolor{background canvas}{bg=black}
    setbeamercolor{normal text}{fg=blue!40!white,bg=black}
    setbeamercolor{alerted test}{fg=blue!40!white,bg=black}
    setbeamercolor{quote}{fg=blue!40!white,bg=black}

    %title{}
    title{Animation with Beamer}
    subtitle{An Extremely Simple Example}
    date{}
    subject{} % PDF cat. only

    begin{document}

    begin{Form}

    setbeamertemplate{background}{}

    newcountaopaqueness
    newcountqopaqueness
    begin{frame}[plain]
    animate<2-19>
    animatevalue<1-10>{aopaqueness}{100}{0}
    animatevalue<11-20>{qopaqueness}{0}{100}
    begin{center}
    begin{overprint}[.65paperwidth]
    onslide<1-10>
    begin{colormixin}{theaopaqueness!averagebackgroundcolor}
    mbox{ }vspace*{fill}\
    begin{center}
    hugebfseries
    pdfLaTeX\[.5em]
    with beamer and friends
    end{center}
    vspace*{fill}mbox{ }\
    end{colormixin}
    onslide<11-20>
    begin{colormixin}{theqopaqueness!averagebackgroundcolor}
    begin{quote}
    usefont{T1}{pzc}{m}{n}huge
    Beautiful typographydots\[.5em]
    for paper and screen.\[.5em]
    end{quote}
    {hspace*{fill}small emph{Presenting without Tears}, A. Typesetter}
    end{colormixin}
    end{overprint}
    end{center}
    end{frame}

    end{Form}

    end{document}


    EDIT: Thanks to a helpful comment, I have captured the animation as displayed in acroread. Although this is a gif, the animation itself is in the PDF. The gif is just recording the screen shot. Although the recording seems to lose this, the animation is actually triggered by clicking on the first slide. However, for some reason the recording loses the picture of the pointer shown in acroread when actually interacting with the PDF, so you'll just have to imagine that bit. Also, in the PDF, the animation only plays once as you would expect for something intended to convey the relationship between two pieces of text.



    Simple animation for transition created in beamer and displayed in acroread



    EDIT: Worked fine in preview but I only see the last, still frame now I've posted it. No idea why...






    share|improve this answer























    • may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
      – texenthusiast
      Jan 4 '14 at 19:29












    • @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
      – cfr
      Jan 4 '14 at 23:30










    • Wait - why does it suddenly work now? Very confused!
      – cfr
      Jan 4 '14 at 23:38



















    2














    Wow.
    Complicated answers indeed.



    How about using pause at each step to "animate" your work.
    Simple,
    elegant,
    easy
    :D



    Reference: https://www.sharelatex.com/blog/2013/08/20/beamer-series-pt4.html






    share|improve this answer























    • Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
      – Torbjørn T.
      May 16 '16 at 16:32










    • This seems marginally related to the question.
      – Werner
      May 16 '16 at 16:33











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f152358%2fanimations-in-latex%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    6 Answers
    6






    active

    oldest

    votes








    6 Answers
    6






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    29














    Since the OP asks for creating an animated PDF using the animate package without the need to have the animation frames in a separate (PDF) file, the tikzpicture environment can be directly put into an animateinline environment:



    documentclass{article}
    usepackage{animate}
    usepackage{tikz}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{%
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }

    begin{document}
    begin{animateinline}[controls,autoplay,loop]{2}
    multiframe{8}{n=1+1}{
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    end{animateinline}
    end{document}





    share|improve this answer



















    • 1




      THIS was what I wanted. All the other answers gave GIFs
      – Kartik
      Jan 9 '14 at 11:22






    • 1




      This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
      – Nasser
      Jan 9 '14 at 22:26










    • @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
      – AlexG
      Jan 10 '14 at 7:38
















    29














    Since the OP asks for creating an animated PDF using the animate package without the need to have the animation frames in a separate (PDF) file, the tikzpicture environment can be directly put into an animateinline environment:



    documentclass{article}
    usepackage{animate}
    usepackage{tikz}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{%
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }

    begin{document}
    begin{animateinline}[controls,autoplay,loop]{2}
    multiframe{8}{n=1+1}{
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    end{animateinline}
    end{document}





    share|improve this answer



















    • 1




      THIS was what I wanted. All the other answers gave GIFs
      – Kartik
      Jan 9 '14 at 11:22






    • 1




      This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
      – Nasser
      Jan 9 '14 at 22:26










    • @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
      – AlexG
      Jan 10 '14 at 7:38














    29












    29








    29






    Since the OP asks for creating an animated PDF using the animate package without the need to have the animation frames in a separate (PDF) file, the tikzpicture environment can be directly put into an animateinline environment:



    documentclass{article}
    usepackage{animate}
    usepackage{tikz}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{%
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }

    begin{document}
    begin{animateinline}[controls,autoplay,loop]{2}
    multiframe{8}{n=1+1}{
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    end{animateinline}
    end{document}





    share|improve this answer














    Since the OP asks for creating an animated PDF using the animate package without the need to have the animation frames in a separate (PDF) file, the tikzpicture environment can be directly put into an animateinline environment:



    documentclass{article}
    usepackage{animate}
    usepackage{tikz}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{%
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }

    begin{document}
    begin{animateinline}[controls,autoplay,loop]{2}
    multiframe{8}{n=1+1}{
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    end{animateinline}
    end{document}






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 10 '14 at 7:32

























    answered Jan 9 '14 at 10:33









    AlexG

    32.1k478143




    32.1k478143








    • 1




      THIS was what I wanted. All the other answers gave GIFs
      – Kartik
      Jan 9 '14 at 11:22






    • 1




      This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
      – Nasser
      Jan 9 '14 at 22:26










    • @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
      – AlexG
      Jan 10 '14 at 7:38














    • 1




      THIS was what I wanted. All the other answers gave GIFs
      – Kartik
      Jan 9 '14 at 11:22






    • 1




      This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
      – Nasser
      Jan 9 '14 at 22:26










    • @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
      – AlexG
      Jan 10 '14 at 7:38








    1




    1




    THIS was what I wanted. All the other answers gave GIFs
    – Kartik
    Jan 9 '14 at 11:22




    THIS was what I wanted. All the other answers gave GIFs
    – Kartik
    Jan 9 '14 at 11:22




    1




    1




    This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
    – Nasser
    Jan 9 '14 at 22:26




    This is nice. I found it works also if one replaces documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} with just documentclass{article} to allow more pages in the document. And one can then make animations on different pages and not just one page as the case is with standalone style.
    – Nasser
    Jan 9 '14 at 22:26












    @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
    – AlexG
    Jan 10 '14 at 7:38




    @Nasser: Yep, animate is fully doc-class ignorant. Don't know why people keep putting it in relation to the preview and standalone packages/classes.
    – AlexG
    Jan 10 '14 at 7:38











    28














    There are two things here,




    1. to produce a gif file (which we do here normally, in this site for uploading).

    2. to have the animation inside the pdf file.


    For first, my take will be imagemagick. Install imagemagick and ensure that convert.exe is in system path. Produce your pdf file (as you have shown in the link in OP). Then issue this command from within the same folder using command prompt.



    convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif  


    Change the parameters as needed. For details refer to imagemagick's documentation. Ususally, I prefer a batch file for repeated use. Save the contents below in to a file named mygifbatch.bat inside the same folder as your pdf file.



    @ECHO ON
    cls

    REM convert to animated gif

    CD /D %~dp0
    mkdir gifs
    SET Program="convert.exe"
    for %%A in (*.pdf) do %Program% -delay 30 -loop 0 -density 200 -alpha remove %%A gifs/%%~nA.gif
    Pause


    To convert, double click on mygifbatch.bat file and it will convert all pdf files in the current folder in to gif files inside a sub-directory gifs.



    Now the second. You can use animate package as in the following code:



    documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}

    usepackage{filecontents}
    %% This is your file to be animated
    begin{filecontents*}{lsystems.tex}
    documentclass{article}
    usepackage{tikz}
    usepackage[active,tightpage]{preview}PreviewEnvironment{tikzpicture}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }

    end{document}
    end{filecontents*}
    %
    immediatewrite18{pdflatex lsystems}

    %% convert to GIF animation. Uncomment following line to have a gif animation in the same folder.
    %immediatewrite18{convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif}
    %%

    usepackage{animate}
    begin{document}
    begin{preview}
    %animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
    animategraphics[controls,autoplay,loop,scale=1]{2}{lsystems}{}{}
    end{preview}
    end{document}


    Here I used filecontents to write your .tex file and pdflatexed it from within the main document. Hence you will need to use --shell-escape while compiling. If you already have the pdf file, you don't need lines 3--32. The pdf should be viewed using adobe reader. For more details refer to animate documentation (texdoc animate or at to texdoc.net).



    There is a nice arara rule written by Chris (cmhughes) which makes production of gif from pdf easy. Install the cool tool arara from Paulo's github repository. It is included in texlive. But you have to install it by yourself if you are a miktex user. Now save the contents of cmhughes code in to a file by name animate.yaml. Put this file in some folder, say C:Users<your name>AppDataRoamingArararules (for windows). Then create a file araraconfig.yaml in your home directory (C:Users<your name> usually) with the following contents:



    !config
    paths:
    - C:Users<your name>AppDataRoamingArararules


    You can add many paths like this. Now your good to go. Add the following in your tex file



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}


    Sample code (lsystems.tex):



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}
    documentclass[tikz]{standalone}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    %
    end{document}


    Compile lsystems.tex with - arara lsystems.tex. arara can also be integrated with many editors. For details, refer to beautiful arara manual.



    enter image description here






    share|improve this answer























    • I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
      – kiss my armpit
      Jan 4 '14 at 19:27










    • This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
      – Sean Allred
      Jul 16 '15 at 21:16
















    28














    There are two things here,




    1. to produce a gif file (which we do here normally, in this site for uploading).

    2. to have the animation inside the pdf file.


    For first, my take will be imagemagick. Install imagemagick and ensure that convert.exe is in system path. Produce your pdf file (as you have shown in the link in OP). Then issue this command from within the same folder using command prompt.



    convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif  


    Change the parameters as needed. For details refer to imagemagick's documentation. Ususally, I prefer a batch file for repeated use. Save the contents below in to a file named mygifbatch.bat inside the same folder as your pdf file.



    @ECHO ON
    cls

    REM convert to animated gif

    CD /D %~dp0
    mkdir gifs
    SET Program="convert.exe"
    for %%A in (*.pdf) do %Program% -delay 30 -loop 0 -density 200 -alpha remove %%A gifs/%%~nA.gif
    Pause


    To convert, double click on mygifbatch.bat file and it will convert all pdf files in the current folder in to gif files inside a sub-directory gifs.



    Now the second. You can use animate package as in the following code:



    documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}

    usepackage{filecontents}
    %% This is your file to be animated
    begin{filecontents*}{lsystems.tex}
    documentclass{article}
    usepackage{tikz}
    usepackage[active,tightpage]{preview}PreviewEnvironment{tikzpicture}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }

    end{document}
    end{filecontents*}
    %
    immediatewrite18{pdflatex lsystems}

    %% convert to GIF animation. Uncomment following line to have a gif animation in the same folder.
    %immediatewrite18{convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif}
    %%

    usepackage{animate}
    begin{document}
    begin{preview}
    %animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
    animategraphics[controls,autoplay,loop,scale=1]{2}{lsystems}{}{}
    end{preview}
    end{document}


    Here I used filecontents to write your .tex file and pdflatexed it from within the main document. Hence you will need to use --shell-escape while compiling. If you already have the pdf file, you don't need lines 3--32. The pdf should be viewed using adobe reader. For more details refer to animate documentation (texdoc animate or at to texdoc.net).



    There is a nice arara rule written by Chris (cmhughes) which makes production of gif from pdf easy. Install the cool tool arara from Paulo's github repository. It is included in texlive. But you have to install it by yourself if you are a miktex user. Now save the contents of cmhughes code in to a file by name animate.yaml. Put this file in some folder, say C:Users<your name>AppDataRoamingArararules (for windows). Then create a file araraconfig.yaml in your home directory (C:Users<your name> usually) with the following contents:



    !config
    paths:
    - C:Users<your name>AppDataRoamingArararules


    You can add many paths like this. Now your good to go. Add the following in your tex file



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}


    Sample code (lsystems.tex):



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}
    documentclass[tikz]{standalone}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    %
    end{document}


    Compile lsystems.tex with - arara lsystems.tex. arara can also be integrated with many editors. For details, refer to beautiful arara manual.



    enter image description here






    share|improve this answer























    • I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
      – kiss my armpit
      Jan 4 '14 at 19:27










    • This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
      – Sean Allred
      Jul 16 '15 at 21:16














    28












    28








    28






    There are two things here,




    1. to produce a gif file (which we do here normally, in this site for uploading).

    2. to have the animation inside the pdf file.


    For first, my take will be imagemagick. Install imagemagick and ensure that convert.exe is in system path. Produce your pdf file (as you have shown in the link in OP). Then issue this command from within the same folder using command prompt.



    convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif  


    Change the parameters as needed. For details refer to imagemagick's documentation. Ususally, I prefer a batch file for repeated use. Save the contents below in to a file named mygifbatch.bat inside the same folder as your pdf file.



    @ECHO ON
    cls

    REM convert to animated gif

    CD /D %~dp0
    mkdir gifs
    SET Program="convert.exe"
    for %%A in (*.pdf) do %Program% -delay 30 -loop 0 -density 200 -alpha remove %%A gifs/%%~nA.gif
    Pause


    To convert, double click on mygifbatch.bat file and it will convert all pdf files in the current folder in to gif files inside a sub-directory gifs.



    Now the second. You can use animate package as in the following code:



    documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}

    usepackage{filecontents}
    %% This is your file to be animated
    begin{filecontents*}{lsystems.tex}
    documentclass{article}
    usepackage{tikz}
    usepackage[active,tightpage]{preview}PreviewEnvironment{tikzpicture}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }

    end{document}
    end{filecontents*}
    %
    immediatewrite18{pdflatex lsystems}

    %% convert to GIF animation. Uncomment following line to have a gif animation in the same folder.
    %immediatewrite18{convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif}
    %%

    usepackage{animate}
    begin{document}
    begin{preview}
    %animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
    animategraphics[controls,autoplay,loop,scale=1]{2}{lsystems}{}{}
    end{preview}
    end{document}


    Here I used filecontents to write your .tex file and pdflatexed it from within the main document. Hence you will need to use --shell-escape while compiling. If you already have the pdf file, you don't need lines 3--32. The pdf should be viewed using adobe reader. For more details refer to animate documentation (texdoc animate or at to texdoc.net).



    There is a nice arara rule written by Chris (cmhughes) which makes production of gif from pdf easy. Install the cool tool arara from Paulo's github repository. It is included in texlive. But you have to install it by yourself if you are a miktex user. Now save the contents of cmhughes code in to a file by name animate.yaml. Put this file in some folder, say C:Users<your name>AppDataRoamingArararules (for windows). Then create a file araraconfig.yaml in your home directory (C:Users<your name> usually) with the following contents:



    !config
    paths:
    - C:Users<your name>AppDataRoamingArararules


    You can add many paths like this. Now your good to go. Add the following in your tex file



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}


    Sample code (lsystems.tex):



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}
    documentclass[tikz]{standalone}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    %
    end{document}


    Compile lsystems.tex with - arara lsystems.tex. arara can also be integrated with many editors. For details, refer to beautiful arara manual.



    enter image description here






    share|improve this answer














    There are two things here,




    1. to produce a gif file (which we do here normally, in this site for uploading).

    2. to have the animation inside the pdf file.


    For first, my take will be imagemagick. Install imagemagick and ensure that convert.exe is in system path. Produce your pdf file (as you have shown in the link in OP). Then issue this command from within the same folder using command prompt.



    convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif  


    Change the parameters as needed. For details refer to imagemagick's documentation. Ususally, I prefer a batch file for repeated use. Save the contents below in to a file named mygifbatch.bat inside the same folder as your pdf file.



    @ECHO ON
    cls

    REM convert to animated gif

    CD /D %~dp0
    mkdir gifs
    SET Program="convert.exe"
    for %%A in (*.pdf) do %Program% -delay 30 -loop 0 -density 200 -alpha remove %%A gifs/%%~nA.gif
    Pause


    To convert, double click on mygifbatch.bat file and it will convert all pdf files in the current folder in to gif files inside a sub-directory gifs.



    Now the second. You can use animate package as in the following code:



    documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}

    usepackage{filecontents}
    %% This is your file to be animated
    begin{filecontents*}{lsystems.tex}
    documentclass{article}
    usepackage{tikz}
    usepackage[active,tightpage]{preview}PreviewEnvironment{tikzpicture}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }

    end{document}
    end{filecontents*}
    %
    immediatewrite18{pdflatex lsystems}

    %% convert to GIF animation. Uncomment following line to have a gif animation in the same folder.
    %immediatewrite18{convert -delay 10 -loop 0 -density 400 -alpha remove lsystems.pdf lsystems.gif}
    %%

    usepackage{animate}
    begin{document}
    begin{preview}
    %animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
    animategraphics[controls,autoplay,loop,scale=1]{2}{lsystems}{}{}
    end{preview}
    end{document}


    Here I used filecontents to write your .tex file and pdflatexed it from within the main document. Hence you will need to use --shell-escape while compiling. If you already have the pdf file, you don't need lines 3--32. The pdf should be viewed using adobe reader. For more details refer to animate documentation (texdoc animate or at to texdoc.net).



    There is a nice arara rule written by Chris (cmhughes) which makes production of gif from pdf easy. Install the cool tool arara from Paulo's github repository. It is included in texlive. But you have to install it by yourself if you are a miktex user. Now save the contents of cmhughes code in to a file by name animate.yaml. Put this file in some folder, say C:Users<your name>AppDataRoamingArararules (for windows). Then create a file araraconfig.yaml in your home directory (C:Users<your name> usually) with the following contents:



    !config
    paths:
    - C:Users<your name>AppDataRoamingArararules


    You can add many paths like this. Now your good to go. Add the following in your tex file



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}


    Sample code (lsystems.tex):



    % arara: pdflatex
    % arara: animate: {density: 200, delay: 20}
    documentclass[tikz]{standalone}
    usetikzlibrary{lindenmayersystems}
    pgfdeclarelindenmayersystem{A}{
    symbol{F}{pgflsystemstep=0.6pgflsystemsteppgflsystemdrawforward}
    rule{A->F[+A][-A]}
    }
    begin{document}
    foreach n in {1,...,8} {
    begin{tikzpicture}[scale=10,rotate=90]
    draw (-.1,-.2) rectangle (.4,0.2);
    draw
    [blue,opacity=0.5,line width=0.1cm,line cap=round]
    l-system [l-system={A,axiom=A
    ,order=n,angle=45,step=0.25cm}];
    end{tikzpicture}
    }
    %
    end{document}


    Compile lsystems.tex with - arara lsystems.tex. arara can also be integrated with many editors. For details, refer to beautiful arara manual.



    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '17 at 12:35









    Community

    1




    1










    answered Jan 4 '14 at 7:11







    user11232



















    • I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
      – kiss my armpit
      Jan 4 '14 at 19:27










    • This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
      – Sean Allred
      Jul 16 '15 at 21:16


















    • I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
      – kiss my armpit
      Jan 4 '14 at 19:27










    • This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
      – Sean Allred
      Jul 16 '15 at 21:16
















    I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
    – kiss my armpit
    Jan 4 '14 at 19:27




    I am very familiar with this idea. :-) But I think preview environment is no longer needed to sandwich animategraphics because by default standalone does the job for us. Try to remove the preview environment and you will see a miracle. :-)
    – kiss my armpit
    Jan 4 '14 at 19:27












    This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
    – Sean Allred
    Jul 16 '15 at 21:16




    This should be updated at some point -- arara is now included in MiKTeX (I'm almost positive, but CTAN would tell) and animate.yaml is now included in the standard rules (fantastic news to me!)
    – Sean Allred
    Jul 16 '15 at 21:16











    21














    You can create .gif animations by the follwing steps:




    1. Create a PDF with multiple pages. Every page is one part of the animation. The easiest way to do this might be the beamer document class

    2. Use pdfcrop and imagemagicks convert to create the animation.


    For Linux users



    To make step 2 trivial, I use the following Makefile for every projects:



    SOURCE = bellman-ford-algorithm
    DELAY = 80
    DENSITY = 300
    WIDTH = 512

    make:
    pdflatex $(SOURCE).tex -output-format=pdf
    make clean

    clean:
    rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav

    gif:
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    animatedGif:
    make
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    transparentGif:
    convert $(SOURCE).pdf -transparent white result.gif
    make clean

    png:
    make
    make svg
    inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png

    svg:
    make
    #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
    pdf2svg $(SOURCE).pdf $(SOURCE).svg
    # Necessary, as pdf2svg does not always create valid svgs:
    inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
    rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
    inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
    rm $(SOURCE)2.svg



    1. Just save it as Makefile (be aware of the fact that Makefiles have tabs, not four spaces! So copy-and-paste might not work)

    2. Replace the first 4 variables according to your needs

    3. Type make animatedGif in the shell of your choice (most might use bash, but zsh with the oh-my-zsh plugin offers tabbed autocompletion for Makefiles :-))


    Examples



    Eulerian path



    See my article "How to visualize Graph algorithms" for more information how this was created:



    enter image description here



    Cholesky decomposition



    Source: LaTeX-examples



    enter image description here






    share|improve this answer



















    • 1




      This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
      – Léo Léopold Hertz 준영
      Apr 22 '14 at 17:57
















    21














    You can create .gif animations by the follwing steps:




    1. Create a PDF with multiple pages. Every page is one part of the animation. The easiest way to do this might be the beamer document class

    2. Use pdfcrop and imagemagicks convert to create the animation.


    For Linux users



    To make step 2 trivial, I use the following Makefile for every projects:



    SOURCE = bellman-ford-algorithm
    DELAY = 80
    DENSITY = 300
    WIDTH = 512

    make:
    pdflatex $(SOURCE).tex -output-format=pdf
    make clean

    clean:
    rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav

    gif:
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    animatedGif:
    make
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    transparentGif:
    convert $(SOURCE).pdf -transparent white result.gif
    make clean

    png:
    make
    make svg
    inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png

    svg:
    make
    #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
    pdf2svg $(SOURCE).pdf $(SOURCE).svg
    # Necessary, as pdf2svg does not always create valid svgs:
    inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
    rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
    inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
    rm $(SOURCE)2.svg



    1. Just save it as Makefile (be aware of the fact that Makefiles have tabs, not four spaces! So copy-and-paste might not work)

    2. Replace the first 4 variables according to your needs

    3. Type make animatedGif in the shell of your choice (most might use bash, but zsh with the oh-my-zsh plugin offers tabbed autocompletion for Makefiles :-))


    Examples



    Eulerian path



    See my article "How to visualize Graph algorithms" for more information how this was created:



    enter image description here



    Cholesky decomposition



    Source: LaTeX-examples



    enter image description here






    share|improve this answer



















    • 1




      This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
      – Léo Léopold Hertz 준영
      Apr 22 '14 at 17:57














    21












    21








    21






    You can create .gif animations by the follwing steps:




    1. Create a PDF with multiple pages. Every page is one part of the animation. The easiest way to do this might be the beamer document class

    2. Use pdfcrop and imagemagicks convert to create the animation.


    For Linux users



    To make step 2 trivial, I use the following Makefile for every projects:



    SOURCE = bellman-ford-algorithm
    DELAY = 80
    DENSITY = 300
    WIDTH = 512

    make:
    pdflatex $(SOURCE).tex -output-format=pdf
    make clean

    clean:
    rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav

    gif:
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    animatedGif:
    make
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    transparentGif:
    convert $(SOURCE).pdf -transparent white result.gif
    make clean

    png:
    make
    make svg
    inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png

    svg:
    make
    #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
    pdf2svg $(SOURCE).pdf $(SOURCE).svg
    # Necessary, as pdf2svg does not always create valid svgs:
    inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
    rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
    inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
    rm $(SOURCE)2.svg



    1. Just save it as Makefile (be aware of the fact that Makefiles have tabs, not four spaces! So copy-and-paste might not work)

    2. Replace the first 4 variables according to your needs

    3. Type make animatedGif in the shell of your choice (most might use bash, but zsh with the oh-my-zsh plugin offers tabbed autocompletion for Makefiles :-))


    Examples



    Eulerian path



    See my article "How to visualize Graph algorithms" for more information how this was created:



    enter image description here



    Cholesky decomposition



    Source: LaTeX-examples



    enter image description here






    share|improve this answer














    You can create .gif animations by the follwing steps:




    1. Create a PDF with multiple pages. Every page is one part of the animation. The easiest way to do this might be the beamer document class

    2. Use pdfcrop and imagemagicks convert to create the animation.


    For Linux users



    To make step 2 trivial, I use the following Makefile for every projects:



    SOURCE = bellman-ford-algorithm
    DELAY = 80
    DENSITY = 300
    WIDTH = 512

    make:
    pdflatex $(SOURCE).tex -output-format=pdf
    make clean

    clean:
    rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav

    gif:
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    animatedGif:
    make
    pdfcrop $(SOURCE).pdf
    convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
    make clean

    transparentGif:
    convert $(SOURCE).pdf -transparent white result.gif
    make clean

    png:
    make
    make svg
    inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png

    svg:
    make
    #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
    pdf2svg $(SOURCE).pdf $(SOURCE).svg
    # Necessary, as pdf2svg does not always create valid svgs:
    inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
    rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
    inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
    rm $(SOURCE)2.svg



    1. Just save it as Makefile (be aware of the fact that Makefiles have tabs, not four spaces! So copy-and-paste might not work)

    2. Replace the first 4 variables according to your needs

    3. Type make animatedGif in the shell of your choice (most might use bash, but zsh with the oh-my-zsh plugin offers tabbed autocompletion for Makefiles :-))


    Examples



    Eulerian path



    See my article "How to visualize Graph algorithms" for more information how this was created:



    enter image description here



    Cholesky decomposition



    Source: LaTeX-examples



    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 9 '14 at 22:10

























    answered Jan 8 '14 at 21:43









    Martin Thoma

    8,487657159




    8,487657159








    • 1




      This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
      – Léo Léopold Hertz 준영
      Apr 22 '14 at 17:57














    • 1




      This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
      – Léo Léopold Hertz 준영
      Apr 22 '14 at 17:57








    1




    1




    This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
    – Léo Léopold Hertz 준영
    Apr 22 '14 at 17:57




    This is a great answer! I am trying to write it for OSX here apple.stackexchange.com/questions/128400/…
    – Léo Léopold Hertz 준영
    Apr 22 '14 at 17:57











    15














    Another way to get .gif files, in addition to @Harish answer, is GIMP. This is my usual procedure and it is useful for uploading in websites: you find an example (of an external web page with respect to TeX.SX) in http://cfiandra.github.io/Sa-TikZ/. The example contains an animation for presentations: it is done with TikZ (code below). Indeed, you can create animations in Beamer without the animate package.



    For demonstration purposes I will exploit my solution from Draw a closed liquid-droped shaped curve with TikZ: the file is named liquid_shape.tex.



    enter image description here



    Let's now open the file liquid_shape.pdf with GIMP and import all pages:



    enter image description here



    Typing CTRL+SHIFT+E it is possible to export the image; change the file extension to .gif:



    enter image description here



    and export; automatically GIMP recognizes you want to create an animation and it shows you a window like this:



    enter image description here



    Select Like animation (in italian Come animazione) and possibly customize the delay between overlays (I selected 1200 ms).



    Export and you will have liquid_shape.gif.






    share|improve this answer




























      15














      Another way to get .gif files, in addition to @Harish answer, is GIMP. This is my usual procedure and it is useful for uploading in websites: you find an example (of an external web page with respect to TeX.SX) in http://cfiandra.github.io/Sa-TikZ/. The example contains an animation for presentations: it is done with TikZ (code below). Indeed, you can create animations in Beamer without the animate package.



      For demonstration purposes I will exploit my solution from Draw a closed liquid-droped shaped curve with TikZ: the file is named liquid_shape.tex.



      enter image description here



      Let's now open the file liquid_shape.pdf with GIMP and import all pages:



      enter image description here



      Typing CTRL+SHIFT+E it is possible to export the image; change the file extension to .gif:



      enter image description here



      and export; automatically GIMP recognizes you want to create an animation and it shows you a window like this:



      enter image description here



      Select Like animation (in italian Come animazione) and possibly customize the delay between overlays (I selected 1200 ms).



      Export and you will have liquid_shape.gif.






      share|improve this answer


























        15












        15








        15






        Another way to get .gif files, in addition to @Harish answer, is GIMP. This is my usual procedure and it is useful for uploading in websites: you find an example (of an external web page with respect to TeX.SX) in http://cfiandra.github.io/Sa-TikZ/. The example contains an animation for presentations: it is done with TikZ (code below). Indeed, you can create animations in Beamer without the animate package.



        For demonstration purposes I will exploit my solution from Draw a closed liquid-droped shaped curve with TikZ: the file is named liquid_shape.tex.



        enter image description here



        Let's now open the file liquid_shape.pdf with GIMP and import all pages:



        enter image description here



        Typing CTRL+SHIFT+E it is possible to export the image; change the file extension to .gif:



        enter image description here



        and export; automatically GIMP recognizes you want to create an animation and it shows you a window like this:



        enter image description here



        Select Like animation (in italian Come animazione) and possibly customize the delay between overlays (I selected 1200 ms).



        Export and you will have liquid_shape.gif.






        share|improve this answer














        Another way to get .gif files, in addition to @Harish answer, is GIMP. This is my usual procedure and it is useful for uploading in websites: you find an example (of an external web page with respect to TeX.SX) in http://cfiandra.github.io/Sa-TikZ/. The example contains an animation for presentations: it is done with TikZ (code below). Indeed, you can create animations in Beamer without the animate package.



        For demonstration purposes I will exploit my solution from Draw a closed liquid-droped shaped curve with TikZ: the file is named liquid_shape.tex.



        enter image description here



        Let's now open the file liquid_shape.pdf with GIMP and import all pages:



        enter image description here



        Typing CTRL+SHIFT+E it is possible to export the image; change the file extension to .gif:



        enter image description here



        and export; automatically GIMP recognizes you want to create an animation and it shows you a window like this:



        enter image description here



        Select Like animation (in italian Come animazione) and possibly customize the delay between overlays (I selected 1200 ms).



        Export and you will have liquid_shape.gif.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:35









        Community

        1




        1










        answered Jan 4 '14 at 10:33









        Claudio Fiandrino

        52.1k11152306




        52.1k11152306























            13














            I am not certain how useful this is at this point. However, here is a slightly elaborated version of my comment together with an example of an animation created with beamer. Unlike the other examples, this one is extremely simple.



            Basically the PDF linked to in the question consists of individual frames which could be used to make up an animation, with one frame per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output. A couple of ways of producing those have been mentioned in the other answers.



            beamer can also create animated effects by quickly displaying one image after another. One way to do that is to include different frames on different slides and to tell beamer to animate them. includegraphics is overlay-specification aware, for example. Essentially, you include the first frame on the first slide, the second on the second slide and so on.



            beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. These can create animated effects just using the TeX code. For example, you can gradually change colouring to simulate movement. The following example fades from one text to another. I used a version of this in a presentation to convey the idea that the second text was explaining the first. I've just altered the texts here to something TeX-related. When you click on the first slide, the text fades out and is replaced by the text on the final slide which fades in. As I say, this is nothing like the sophisticated animations other people post - it is just about as simple as an animation could be, I suppose. But it can be quite effective for all that. I wanted the focus to be on the content of the text, after all - a really impressive animation would just serve to distract from the point being made. (Obviously this doesn't really apply with the dummy text I've used here but think about trying to convey the meaning of a key concept or the nature of a discipline.)



            This works for me in acroread but not Okular. So it should display fine in Adobe Reader but I'm not sure about Foxit Reader or Evince.



            documentclass{beamer}
            usepackage{fixltx2e}
            usepackage{texnames}

            % lliwiau arbennig
            setbeamertemplate{background canvas}[default]
            setbeamercolor{background canvas}{bg=black}
            setbeamercolor{normal text}{fg=blue!40!white,bg=black}
            setbeamercolor{alerted test}{fg=blue!40!white,bg=black}
            setbeamercolor{quote}{fg=blue!40!white,bg=black}

            %title{}
            title{Animation with Beamer}
            subtitle{An Extremely Simple Example}
            date{}
            subject{} % PDF cat. only

            begin{document}

            begin{Form}

            setbeamertemplate{background}{}

            newcountaopaqueness
            newcountqopaqueness
            begin{frame}[plain]
            animate<2-19>
            animatevalue<1-10>{aopaqueness}{100}{0}
            animatevalue<11-20>{qopaqueness}{0}{100}
            begin{center}
            begin{overprint}[.65paperwidth]
            onslide<1-10>
            begin{colormixin}{theaopaqueness!averagebackgroundcolor}
            mbox{ }vspace*{fill}\
            begin{center}
            hugebfseries
            pdfLaTeX\[.5em]
            with beamer and friends
            end{center}
            vspace*{fill}mbox{ }\
            end{colormixin}
            onslide<11-20>
            begin{colormixin}{theqopaqueness!averagebackgroundcolor}
            begin{quote}
            usefont{T1}{pzc}{m}{n}huge
            Beautiful typographydots\[.5em]
            for paper and screen.\[.5em]
            end{quote}
            {hspace*{fill}small emph{Presenting without Tears}, A. Typesetter}
            end{colormixin}
            end{overprint}
            end{center}
            end{frame}

            end{Form}

            end{document}


            EDIT: Thanks to a helpful comment, I have captured the animation as displayed in acroread. Although this is a gif, the animation itself is in the PDF. The gif is just recording the screen shot. Although the recording seems to lose this, the animation is actually triggered by clicking on the first slide. However, for some reason the recording loses the picture of the pointer shown in acroread when actually interacting with the PDF, so you'll just have to imagine that bit. Also, in the PDF, the animation only plays once as you would expect for something intended to convey the relationship between two pieces of text.



            Simple animation for transition created in beamer and displayed in acroread



            EDIT: Worked fine in preview but I only see the last, still frame now I've posted it. No idea why...






            share|improve this answer























            • may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
              – texenthusiast
              Jan 4 '14 at 19:29












            • @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
              – cfr
              Jan 4 '14 at 23:30










            • Wait - why does it suddenly work now? Very confused!
              – cfr
              Jan 4 '14 at 23:38
















            13














            I am not certain how useful this is at this point. However, here is a slightly elaborated version of my comment together with an example of an animation created with beamer. Unlike the other examples, this one is extremely simple.



            Basically the PDF linked to in the question consists of individual frames which could be used to make up an animation, with one frame per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output. A couple of ways of producing those have been mentioned in the other answers.



            beamer can also create animated effects by quickly displaying one image after another. One way to do that is to include different frames on different slides and to tell beamer to animate them. includegraphics is overlay-specification aware, for example. Essentially, you include the first frame on the first slide, the second on the second slide and so on.



            beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. These can create animated effects just using the TeX code. For example, you can gradually change colouring to simulate movement. The following example fades from one text to another. I used a version of this in a presentation to convey the idea that the second text was explaining the first. I've just altered the texts here to something TeX-related. When you click on the first slide, the text fades out and is replaced by the text on the final slide which fades in. As I say, this is nothing like the sophisticated animations other people post - it is just about as simple as an animation could be, I suppose. But it can be quite effective for all that. I wanted the focus to be on the content of the text, after all - a really impressive animation would just serve to distract from the point being made. (Obviously this doesn't really apply with the dummy text I've used here but think about trying to convey the meaning of a key concept or the nature of a discipline.)



            This works for me in acroread but not Okular. So it should display fine in Adobe Reader but I'm not sure about Foxit Reader or Evince.



            documentclass{beamer}
            usepackage{fixltx2e}
            usepackage{texnames}

            % lliwiau arbennig
            setbeamertemplate{background canvas}[default]
            setbeamercolor{background canvas}{bg=black}
            setbeamercolor{normal text}{fg=blue!40!white,bg=black}
            setbeamercolor{alerted test}{fg=blue!40!white,bg=black}
            setbeamercolor{quote}{fg=blue!40!white,bg=black}

            %title{}
            title{Animation with Beamer}
            subtitle{An Extremely Simple Example}
            date{}
            subject{} % PDF cat. only

            begin{document}

            begin{Form}

            setbeamertemplate{background}{}

            newcountaopaqueness
            newcountqopaqueness
            begin{frame}[plain]
            animate<2-19>
            animatevalue<1-10>{aopaqueness}{100}{0}
            animatevalue<11-20>{qopaqueness}{0}{100}
            begin{center}
            begin{overprint}[.65paperwidth]
            onslide<1-10>
            begin{colormixin}{theaopaqueness!averagebackgroundcolor}
            mbox{ }vspace*{fill}\
            begin{center}
            hugebfseries
            pdfLaTeX\[.5em]
            with beamer and friends
            end{center}
            vspace*{fill}mbox{ }\
            end{colormixin}
            onslide<11-20>
            begin{colormixin}{theqopaqueness!averagebackgroundcolor}
            begin{quote}
            usefont{T1}{pzc}{m}{n}huge
            Beautiful typographydots\[.5em]
            for paper and screen.\[.5em]
            end{quote}
            {hspace*{fill}small emph{Presenting without Tears}, A. Typesetter}
            end{colormixin}
            end{overprint}
            end{center}
            end{frame}

            end{Form}

            end{document}


            EDIT: Thanks to a helpful comment, I have captured the animation as displayed in acroread. Although this is a gif, the animation itself is in the PDF. The gif is just recording the screen shot. Although the recording seems to lose this, the animation is actually triggered by clicking on the first slide. However, for some reason the recording loses the picture of the pointer shown in acroread when actually interacting with the PDF, so you'll just have to imagine that bit. Also, in the PDF, the animation only plays once as you would expect for something intended to convey the relationship between two pieces of text.



            Simple animation for transition created in beamer and displayed in acroread



            EDIT: Worked fine in preview but I only see the last, still frame now I've posted it. No idea why...






            share|improve this answer























            • may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
              – texenthusiast
              Jan 4 '14 at 19:29












            • @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
              – cfr
              Jan 4 '14 at 23:30










            • Wait - why does it suddenly work now? Very confused!
              – cfr
              Jan 4 '14 at 23:38














            13












            13








            13






            I am not certain how useful this is at this point. However, here is a slightly elaborated version of my comment together with an example of an animation created with beamer. Unlike the other examples, this one is extremely simple.



            Basically the PDF linked to in the question consists of individual frames which could be used to make up an animation, with one frame per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output. A couple of ways of producing those have been mentioned in the other answers.



            beamer can also create animated effects by quickly displaying one image after another. One way to do that is to include different frames on different slides and to tell beamer to animate them. includegraphics is overlay-specification aware, for example. Essentially, you include the first frame on the first slide, the second on the second slide and so on.



            beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. These can create animated effects just using the TeX code. For example, you can gradually change colouring to simulate movement. The following example fades from one text to another. I used a version of this in a presentation to convey the idea that the second text was explaining the first. I've just altered the texts here to something TeX-related. When you click on the first slide, the text fades out and is replaced by the text on the final slide which fades in. As I say, this is nothing like the sophisticated animations other people post - it is just about as simple as an animation could be, I suppose. But it can be quite effective for all that. I wanted the focus to be on the content of the text, after all - a really impressive animation would just serve to distract from the point being made. (Obviously this doesn't really apply with the dummy text I've used here but think about trying to convey the meaning of a key concept or the nature of a discipline.)



            This works for me in acroread but not Okular. So it should display fine in Adobe Reader but I'm not sure about Foxit Reader or Evince.



            documentclass{beamer}
            usepackage{fixltx2e}
            usepackage{texnames}

            % lliwiau arbennig
            setbeamertemplate{background canvas}[default]
            setbeamercolor{background canvas}{bg=black}
            setbeamercolor{normal text}{fg=blue!40!white,bg=black}
            setbeamercolor{alerted test}{fg=blue!40!white,bg=black}
            setbeamercolor{quote}{fg=blue!40!white,bg=black}

            %title{}
            title{Animation with Beamer}
            subtitle{An Extremely Simple Example}
            date{}
            subject{} % PDF cat. only

            begin{document}

            begin{Form}

            setbeamertemplate{background}{}

            newcountaopaqueness
            newcountqopaqueness
            begin{frame}[plain]
            animate<2-19>
            animatevalue<1-10>{aopaqueness}{100}{0}
            animatevalue<11-20>{qopaqueness}{0}{100}
            begin{center}
            begin{overprint}[.65paperwidth]
            onslide<1-10>
            begin{colormixin}{theaopaqueness!averagebackgroundcolor}
            mbox{ }vspace*{fill}\
            begin{center}
            hugebfseries
            pdfLaTeX\[.5em]
            with beamer and friends
            end{center}
            vspace*{fill}mbox{ }\
            end{colormixin}
            onslide<11-20>
            begin{colormixin}{theqopaqueness!averagebackgroundcolor}
            begin{quote}
            usefont{T1}{pzc}{m}{n}huge
            Beautiful typographydots\[.5em]
            for paper and screen.\[.5em]
            end{quote}
            {hspace*{fill}small emph{Presenting without Tears}, A. Typesetter}
            end{colormixin}
            end{overprint}
            end{center}
            end{frame}

            end{Form}

            end{document}


            EDIT: Thanks to a helpful comment, I have captured the animation as displayed in acroread. Although this is a gif, the animation itself is in the PDF. The gif is just recording the screen shot. Although the recording seems to lose this, the animation is actually triggered by clicking on the first slide. However, for some reason the recording loses the picture of the pointer shown in acroread when actually interacting with the PDF, so you'll just have to imagine that bit. Also, in the PDF, the animation only plays once as you would expect for something intended to convey the relationship between two pieces of text.



            Simple animation for transition created in beamer and displayed in acroread



            EDIT: Worked fine in preview but I only see the last, still frame now I've posted it. No idea why...






            share|improve this answer














            I am not certain how useful this is at this point. However, here is a slightly elaborated version of my comment together with an example of an animation created with beamer. Unlike the other examples, this one is extremely simple.



            Basically the PDF linked to in the question consists of individual frames which could be used to make up an animation, with one frame per page. To actually make them animate you need something which supports that. The animations people post tend to be .gifs created from the pdf output. A couple of ways of producing those have been mentioned in the other answers.



            beamer can also create animated effects by quickly displaying one image after another. One way to do that is to include different frames on different slides and to tell beamer to animate them. includegraphics is overlay-specification aware, for example. Essentially, you include the first frame on the first slide, the second on the second slide and so on.



            beamer also has some other tricks up its sleeve in conjunction with packages such as tikz etc. These can create animated effects just using the TeX code. For example, you can gradually change colouring to simulate movement. The following example fades from one text to another. I used a version of this in a presentation to convey the idea that the second text was explaining the first. I've just altered the texts here to something TeX-related. When you click on the first slide, the text fades out and is replaced by the text on the final slide which fades in. As I say, this is nothing like the sophisticated animations other people post - it is just about as simple as an animation could be, I suppose. But it can be quite effective for all that. I wanted the focus to be on the content of the text, after all - a really impressive animation would just serve to distract from the point being made. (Obviously this doesn't really apply with the dummy text I've used here but think about trying to convey the meaning of a key concept or the nature of a discipline.)



            This works for me in acroread but not Okular. So it should display fine in Adobe Reader but I'm not sure about Foxit Reader or Evince.



            documentclass{beamer}
            usepackage{fixltx2e}
            usepackage{texnames}

            % lliwiau arbennig
            setbeamertemplate{background canvas}[default]
            setbeamercolor{background canvas}{bg=black}
            setbeamercolor{normal text}{fg=blue!40!white,bg=black}
            setbeamercolor{alerted test}{fg=blue!40!white,bg=black}
            setbeamercolor{quote}{fg=blue!40!white,bg=black}

            %title{}
            title{Animation with Beamer}
            subtitle{An Extremely Simple Example}
            date{}
            subject{} % PDF cat. only

            begin{document}

            begin{Form}

            setbeamertemplate{background}{}

            newcountaopaqueness
            newcountqopaqueness
            begin{frame}[plain]
            animate<2-19>
            animatevalue<1-10>{aopaqueness}{100}{0}
            animatevalue<11-20>{qopaqueness}{0}{100}
            begin{center}
            begin{overprint}[.65paperwidth]
            onslide<1-10>
            begin{colormixin}{theaopaqueness!averagebackgroundcolor}
            mbox{ }vspace*{fill}\
            begin{center}
            hugebfseries
            pdfLaTeX\[.5em]
            with beamer and friends
            end{center}
            vspace*{fill}mbox{ }\
            end{colormixin}
            onslide<11-20>
            begin{colormixin}{theqopaqueness!averagebackgroundcolor}
            begin{quote}
            usefont{T1}{pzc}{m}{n}huge
            Beautiful typographydots\[.5em]
            for paper and screen.\[.5em]
            end{quote}
            {hspace*{fill}small emph{Presenting without Tears}, A. Typesetter}
            end{colormixin}
            end{overprint}
            end{center}
            end{frame}

            end{Form}

            end{document}


            EDIT: Thanks to a helpful comment, I have captured the animation as displayed in acroread. Although this is a gif, the animation itself is in the PDF. The gif is just recording the screen shot. Although the recording seems to lose this, the animation is actually triggered by clicking on the first slide. However, for some reason the recording loses the picture of the pointer shown in acroread when actually interacting with the PDF, so you'll just have to imagine that bit. Also, in the PDF, the animation only plays once as you would expect for something intended to convey the relationship between two pieces of text.



            Simple animation for transition created in beamer and displayed in acroread



            EDIT: Worked fine in preview but I only see the last, still frame now I've posted it. No idea why...







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 4 '14 at 23:28

























            answered Jan 4 '14 at 19:10









            cfr

            156k7185380




            156k7185380












            • may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
              – texenthusiast
              Jan 4 '14 at 19:29












            • @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
              – cfr
              Jan 4 '14 at 23:30










            • Wait - why does it suddenly work now? Very confused!
              – cfr
              Jan 4 '14 at 23:38


















            • may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
              – texenthusiast
              Jan 4 '14 at 19:29












            • @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
              – cfr
              Jan 4 '14 at 23:30










            • Wait - why does it suddenly work now? Very confused!
              – cfr
              Jan 4 '14 at 23:38
















            may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
            – texenthusiast
            Jan 4 '14 at 19:29






            may be this meta thread helps to get the feel meta.tex.stackexchange.com/questions/2868/…
            – texenthusiast
            Jan 4 '14 at 19:29














            @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
            – cfr
            Jan 4 '14 at 23:30




            @texenthusiast Thanks. This worked perfectly when I edited it and previewed the result. Now I've posted it, though, it only shows the final frame and I've no idea why.
            – cfr
            Jan 4 '14 at 23:30












            Wait - why does it suddenly work now? Very confused!
            – cfr
            Jan 4 '14 at 23:38




            Wait - why does it suddenly work now? Very confused!
            – cfr
            Jan 4 '14 at 23:38











            2














            Wow.
            Complicated answers indeed.



            How about using pause at each step to "animate" your work.
            Simple,
            elegant,
            easy
            :D



            Reference: https://www.sharelatex.com/blog/2013/08/20/beamer-series-pt4.html






            share|improve this answer























            • Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
              – Torbjørn T.
              May 16 '16 at 16:32










            • This seems marginally related to the question.
              – Werner
              May 16 '16 at 16:33
















            2














            Wow.
            Complicated answers indeed.



            How about using pause at each step to "animate" your work.
            Simple,
            elegant,
            easy
            :D



            Reference: https://www.sharelatex.com/blog/2013/08/20/beamer-series-pt4.html






            share|improve this answer























            • Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
              – Torbjørn T.
              May 16 '16 at 16:32










            • This seems marginally related to the question.
              – Werner
              May 16 '16 at 16:33














            2












            2








            2






            Wow.
            Complicated answers indeed.



            How about using pause at each step to "animate" your work.
            Simple,
            elegant,
            easy
            :D



            Reference: https://www.sharelatex.com/blog/2013/08/20/beamer-series-pt4.html






            share|improve this answer














            Wow.
            Complicated answers indeed.



            How about using pause at each step to "animate" your work.
            Simple,
            elegant,
            easy
            :D



            Reference: https://www.sharelatex.com/blog/2013/08/20/beamer-series-pt4.html







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 16 '16 at 16:33









            Torbjørn T.

            154k13245435




            154k13245435










            answered May 16 '16 at 16:03









            Mr Nice Guy

            211




            211












            • Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
              – Torbjørn T.
              May 16 '16 at 16:32










            • This seems marginally related to the question.
              – Werner
              May 16 '16 at 16:33


















            • Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
              – Torbjørn T.
              May 16 '16 at 16:32










            • This seems marginally related to the question.
              – Werner
              May 16 '16 at 16:33
















            Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
            – Torbjørn T.
            May 16 '16 at 16:32




            Welcome to the site! pause is not very convenient though if you have a lot of frames, and not suitable if the whole picture has to be redrawn each time.
            – Torbjørn T.
            May 16 '16 at 16:32












            This seems marginally related to the question.
            – Werner
            May 16 '16 at 16:33




            This seems marginally related to the question.
            – Werner
            May 16 '16 at 16:33


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f152358%2fanimations-in-latex%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Lallio

            Futebolista

            Jornalista