[texhax] animated gif files in Latex/Beamer
Steve Schwartz
s.schwartz at imperial.ac.uk
Thu May 11 02:11:44 CEST 2006
On Thu, 2006-05-11 at 00:35 +0200, Martin Schröder wrote:
> On 2006-05-10 16:25:34 -0400, b|c|r wrote:
> > Well, I'd sorta like to know the answer.
>
> pdfanim
>
You can also show animated gifs in the same way that you would show
mpegs, using a run href. Here's how its done (from my previous postings
to this list and notes I keep in a safe place):
\usepackage{hyperref} [actually, I think beamer will load this]
...
\href{run:<showscript>}{ LINK }
where LINK is something to click on (could be a graphic or text) and
<showscript> is the path and name of a script to execute, e.g., for
mpegs and such I use a file showscript.sh, say, which has a single line:
mplayer -geometry 30%:100% -nofs -xy 2 -loop 0 file.mpg
or whatever is necessary to play the movie at the size and position I
want. Clicking on LINK will launch mplayer and play your movie. For
animated gifs I use gifview, which is part of gifsicle
(www.lcdf.org/~eddietwo/gifsicle/)
There are two things slightly inelegant about this approach. Firstly,
the movie/animation runs in a separate window on top of your
presentation, rather than within it (and if you have other things
running on your desktop, those windows might get popped forward).
Secondly, because it uses scripts and paths, it makes your presentation
not so portable, especially across operating systems.
Finally (and this took some time before Achim Beetz sent me the
solution), to get acroread or xpdf or whatever to launch your script
without popping up an error box claiming it doesn't know how to handle
showscript, you need to teach your mailcap and mime-type handling how to
cope. E.g.:
In ~/.mailcap:
application/x-sh; /bin/sh %s
In ~/.mime.types:
application/x-sh sh
(note that these will allow any href link to a shell script to run
without prompting, such as a malicious one in an html page somewhere, so
represents a security risk. I've thought about, but not tried, inventing
a special msh mimetype and application/x-msh, etc., so that only evil
shells named <evilname>.msh would launch this way. I suspect until lots
of hackers start using beamer - or reading this list - we might be
pretty safe. Alternatively, edit/swap .mailcap files.)
A final alternative is to teach mailcap about video files, and "run" the
video file directly:
In ~/.mailcap:
video/*; mplayer [options] %s
Now .mime.type will need to know the video endings
Then
\href{run:mymovie.mpeg}
will launch mplayer (though there isn't a way I've found to pass
positioning, scaling, looping, ... options via this mechanism).
Finally, one day \usepackage{movie15} will run on my linux box and I'll
try that.
Steve
--
+-------------------------------------------------------------------+
Professor Steven J Schwartz Phone: +44-(0)20-7594-7660
Space and Atmospheric Physics Fax: +44-(0)20-7594-7772
The Blackett Laboratory E-mail: s.schwartz at imperial.ac.uk
Imperial College London Office: Huxley 6M70
London SW7 2BW, U.K. Web: http://www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+
More information about the texhax
mailing list