1

Me again :-(

System: Windows 7, MikTeX 2.9, WinEdt 7, LaTeX->Dvips->ps2pdf pipe

Trying the same animation as a year ago - just for the sake of being specific. This year I am teaching multivariable calculus so my needs will be a bit different, and this time I am aiming a bit higher.

Below you can see one animation I want to embed to a PowerDot presentation

enter image description here

It is 64 frames of GIF. Filesize about 150 kB. As we all know we cannot mix .gif and .eps (sigh), so something has to give. The animation is generated by Mathematica, so I have the options of exportin it (as well as individual frames) at least in .eps, .gif, .swf, .avi, .png formats.

Last year I managed using media9. That package is good for many a thing, but to use it I needed to convert the animation to either .swf or .mp4. And that's were the problems lie. Try as I may I was unable to get the conversion to keep the video quality. Hardly a surprise as neither of those formats is designed with compressing mathematical plots in mind. The avi-file has size 10MB at this quality, but both the swf and mp4 look cruddy in comparison - the curves look like they were first anti-aliased to 160x100 screen resolution and left at that with all the jaggies (your eyes are spared, because we cannot embed an mp4 to a question). The conversion service linked to in the previous question cannot be coerced to do lossless compression. To tell you the truth I don't know if there is anything like lossless mp4?

Are there options other than media9? This is only 64 frames (and I can compromise with a lower number). Or can you recommend a conversion program that produces higher quality mp4s from this kind of frames.

Will using the animate package help? Will that necessitate each frame to come from a separate file or can it handle an animated GIF?

  • 1
    The number of frames is relatively small. The best result in terms of quality and scalability might be obtained with animating a set of vector graphics using the animate package. Can you direct Mathematica to produce vector graphics (in EPS format, as required by Powerdot)? – AlexG Nov 27 '14 at 12:22
  • 1
    This seems to be possible. – AlexG Nov 27 '14 at 12:25
  • Yes. That is possible. I probably need to figure out how to name the files with the frame number tagged to the end, but that should not be too taxing. Will using animate package allow LaTeX to output everything in a single pdf-file? – Jyrki Lahtonen Nov 27 '14 at 12:34
  • 1
    Yes, at the end you will get your presentation PDF with embedded animations for display with AdobeReader. – AlexG Nov 27 '14 at 12:37
  • 1
    I have just seen that, in powerdot, animation controls are rotated by 90 deg. I will be uploading an update very soon. – AlexG Dec 4 '14 at 7:54
3

As suggested by AlexG the package animate works very well here. Posting a summary of the steps as an answer in case somebody later has the same problem. The early steps include Mathematica instructions, which may be off-topic here, but I needed to get it to co-operate with LaTeX, so hopefully that is ok.

  1. Prepare the individual frames as separate eps-files. I had coded a Mathematica function roll[t_] that produced the image of a rolling circle that had revolved a total angle t together with the part of the cycloid drawn up to that point. For the animation to work as intended it is probably a good idea to set the PlotRange -option so that the entire area is shown - your call.
  2. Save the files so that their filenames end with the frame number as instructed in the animate manual. I did it with the following command that produced 65 files named "sykloidi0.eps", sykloidi1.eps", et cetera For[k = 0, k < 65, ++k, Export[StringJoin[{"sykloidi", ToString[k], ".eps"}], roll[k*0.1]]]
  3. In the above step you may need to cut down the size of the created eps-images. The reason is that the animate-package has problems fitting oversized images correctly into the pdf-animation. The solution is to give Export an extra parameter ImageSize->150or another suitable value. Otherwise you may run into difficulties described here.

  4. In your TeX-source add the following line. Pick options to your liking.

    \animategraphics[autoplay,loop,width=320pt,height=100pt,keepaspectratio]{12}{sykloidi}{0}{64}

  • 1
    Thank you for this nice tutorial! However, zero-padding the numbers in the filenames (step 3) is really not necessary. Simple numbers work perfectly too: \animategraphics[...]{12}{sykloidi}{0}{64} . – AlexG Dec 1 '14 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.