Link to external application in LaTeX Beamer

13,846

Solution 1

I usually use the movie command of the multimedia package to open any video, audio, image file in an external viewer. But no, it will not open programs.

\frame{    
\movie[externalviewer]{Audio Title}{audio.wav}
\movie[externalviewer]{Video Title}{video.mp4}
\movie[externalviewer]{Image Title}{image.jpg}
\movie[externalviewer]{PDF Title}{doc.pdf}
\movie[externalviewer]{Gedit}{/usr/bin/gedit} % does not work
}

Solution 2

It is possible! The following works well with my Acrobat, involves a bit PDF hacking. Just tested it on my Mac, you have to adjust it according your platform. Simply define the following macro

\newcommand{\LaunchBinary}[2]{%
  % #1: layer name,
  % #2: link text
  \leavevmode%
  \pdfstartlink user {
    /Subtype /Link
    /Border [0 0 0]%
    /A <<
      /F <<
         /DOS (xxx)
         /Unix (xxx)
         /Mac (#1)
      >>
      /S /Launch
    >>
  }#2%
  \pdfendlink%
}

Fix the "xxx" to maybe #1 as well or rewrite it to suit your need. Then, to add a link somewhere in the PDF called "Start" which launches "demos/1/Wave1D.app", just

\LaunchBinary{demos/1/Wave1D.app}{Start}

This works well even for beamer class. With this, I can directly launch demo apps from a fullscreen presentation. Awesome!

Note again, though, this apparently only works with Adobe Acrobat (Reader). MacOS "Preview" does not work.

Share:
13,846
Mathias Soeken
Author by

Mathias Soeken

Researcher and software developer Working at Microsoft Quantum

Updated on June 04, 2022

Comments

  • Mathias Soeken
    Mathias Soeken almost 2 years

    Is there a way to link to an external application (so that it starts) when clicking on a link in a PDF file, e.g. in a beamer class LaTeX file?