Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to have a flash file (.swf) in my beamer document on a Linux machine, using pdfLaTeX and Evince.

Is there a way to make a link to that file which runs an external player or even better, is it possible to embed it into my presentation?

For the first option I tried

\href{run:/usr/bin/gnash /tmp/test.swf}{test}

which gives me the error

Failed to open "/usr/bin/gnash /tmp/test.swf"
Error stating file '/usr/bin/gnash /tmp/test.swf': No such file or directory.

(however \href{run:/usr/bin/gnash}{test} starts just gnash).

For the second I know the flashmovie package. However I want use Evince as PDF viewer and not Adobe Reader.

Edit:

Finally I just used \href{run:/tmp/test.swf}. I think if you open this by Evince the correct application to open the .swf file is chosen by gnome-open. If you use okular I guess it is kde-open. To avoid possible configuration problems with those openers and to have more control, I think it would be much better to have a way to specify the application which should open my file (in my case gnash) as I tried in my question above. So if there are any ideas ...

share|improve this question
    
have a look at this link. It's a similar question that I have asked. Hope it helps. –  Bill Mar 17 '12 at 21:18
    
@Bill Thanks, but I don't see, how this solves my problem –  student Mar 18 '12 at 10:00
    
no problem, thought it might help. –  Bill Mar 18 '12 at 21:35
2  
@student Please convert your comment either into an answer or into additional information in the question (as you feel is appropriate). –  Joseph Wright Mar 26 '12 at 7:31
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
Can you give an example of how to use the \write thing in this case? –  student Jun 24 '13 at 18:06
    
@student Easiest would actually be to use the filecontents package. –  Loop Space Jun 24 '13 at 19:10
add comment

You can try to use the movie15 package, it supports .swf and you should be able to play the animation inside Adobe Reader or impressive. You can install it via apt-get, as it needs a plethora of dependencies.

share|improve this answer
    
the movie15 package is obsolete, consider using package midia9 –  Pig Cry Apr 19 '12 at 11:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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