This is actually to do with the PDF renderer, not TeX. I don't have gnash
installed, nor any flash files to hand, but I tested with the following file:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{run:firefox http://www.math.ntnu.no/}{launch}
\href{http://www.math.ntnu.no/}{launch}
\end{document}
With evince
then the second link opened my department homepage, as expected, but the first produced the error:
Error stating file `/path/to/directory/where/I/launched/evince/firefox http:/www.math.ntnu.no': No such file or directory
So clearly evince
is trying to launch a program in its current directory called firefox http://www.math.ntnu.no/
(well, modulo disappearing slashes).
However, when I try this with xpdf
, my usual PDF reader, then when I click on the link it says:
About to execute the command: firefox http://www.math.ntnu.no/ &
and asks me if I really want to do this. If I click "OK" then I get what I expect. This experiment suggests that there is some latitude in what the viewer gets to do.
Looking at the resulting PDF file, I see the following:
4 0 obj
<</Border[0 0 1]/Subtype/Link/C[0 .7 .7]/A<</F(firefox http://www.math.ntnu.no/)/S/Launch>>/Type/Annot/Rect[147.716 656.239 178.213 665.15]/H/I>>
endobj
5 0 obj
<</Border[0 0 1]/Subtype/Link/C[0 1 1]/A<</URI(http://www.math.ntnu.no/)/Type/Action/S/URI>>/Type/Annot/Rect[179.541 656.239 210.038 665.15]/H/I>>
endobj
(Note that the slashes are as they should be). So a run:
directive gets converted to a Launch
action, and an http:
directive to a URI
action.
Looking at the PDF specs (or at least, Adobe's free copy thereof) I learnt more than I wanted to about the internals of PDFs, including launch actions. These are detailed in Section 12.6.4.5 (p422, internal numbering, p430, external). What is interesting is that some parts of this have the tag "not yet defined". Whilst I don't think that these are relevant here (as they refer to OS-specific features and these aren't used), I think that this implies that the specification here might be subject to revision as unusual use-cases appear. (Seeing this just after reading about Windows behaviour with spaces in program names is an interesting juxtaposition.)
So my inference (and it is nothing more) is that exactly what a PDF viewer does when it encounters a "Launch" action is pretty much up to that viewer. Unfortunately, this includes whether to regard the string as a single command name or to break it up. Actually, I suspect that the question is whether to pass it to the relevant open
command (or maybe the shell) as a quoted string or not.
To avoid this, I recommend writing a small script that calls the flash viewer on your program. Something like:
!# /bin/sh
/usr/bin/gnash test.swf
and then call that from within your file.
With a bit of \write
trickery, you could even get tex
to create that file itself.
In addition to Karl's students answers (Can we use media9 to show a video on a PDF but the video is not embedded to the PDF?) and this other question: gif image in beamer presentation
I can suggest what I did for my thesis presentation:
In the preamble of the beamer:
%Graphics and Videos
\usepackage{graphicx} %The mode "LaTeX => PDF" allows the following formats: .jpg .png .pdf .mps
\graphicspath{{./PresentationPictures/}} %Where the figures folder is located
\usepackage{media9}
\addmediapath{./Movies/}
And then I included my file like this:
\begin{frame}
\frametitle{Forward Kinematics}
\begin{center}
\includemedia[
activate=onclick,
width=0.75\textwidth
]{\includegraphics{FK3.png}}{FK3.swf}
\end{center}
\end{frame}
As you can see, I used the .swf
file extension. I too had a .avi file and in order to convert it to .swf I used AnyVideoConverter.
I hope this helps
Best Answer
A lot of what can be done with flash can also be done with SVG + JavaScript.
A great example of that is JessyInk which allows to make dynamic presentations in Inkscape.
Now since PDF also supports vector graphics and a subset of JavaScript, maybe the best way would be to integrate a solution like JessyInk inside LaTeX, or using JavaScript + Tikz to achieve it.