Chapter 5. Hints and Tricks

Table of Contents

5.1 PDF

This chapter lists some hints and tricks which might be useful in creating online presentations.

5.1. PDF

5.1.1. Start other programs from within a PDF presentation

Herman Bruyninckx submitted the following macros to start up movies or other programs from within a PDF presentation made with LaTeX:

The key is to write a little shell-script and launch it from within pdflatex. In the shell-script you should simply call a standard unix tool for viewing video files, e.g.:

mpeg_play -controls off -dither color -position +128+96 video.mpg

Name this script for example and make it executable. Defining the following two new commands in pdflatex,

\newcommand{\pdflaunch}[1] {\pdfpageattr{/AA << /O << /S /Launch /F (#1) >>>>}}
      \pdfannotlink attr{/Border [0 0 0]} user{/Subtype /Link /A << %
        /S /Launch /F (#1) >>}%
      \pdfliteral{0 1 0 0 k}%  
      {#2}\pdfliteral{0 0 0 1 k}\pdfendlink%

you have either the possibility to launch this script instantly with a new slide:


or after pressing a special link defined by:

\pdflaunchlink{}{Start video}

Don't forget to kill the video application when it is not needed anymore. For this purpose again define a little script e.g.:

killall mpeg_play

and call it as mentioned above.

Uwe Brauer submitted the following hint how to call shell scripts form within PDF using a recent version of hyperref:


The magic is the string run: which is followed by the name of the script.