I would like a command such as this:


but I want the subsequent link to open the file in gedit or the default text editor in linux. Bonus points if it also works in windows.

  • 5
    I think that whatever happens with the hyperlink when clicked depends on your pdf viewer. Sep 7 '10 at 16:53
  • if you can run a windows calculator with the following command: \href{run:./calc.exe}{CALCULATOR} why can't you open a file in gedit?
    – denilw
    Sep 7 '10 at 17:11
  • 1
    Well the PDF viewer has to be configured to allow it of course ;-) But if the calculator example works, have you tried the obvious substitution? \href{run:/usr/bin/gedit ../src/wkfl/vlyUpstrOvrlp.sh}{vlyUpstrOvrlp}? What goes wrong with it?
    – David Z
    Sep 7 '10 at 21:23
  • I haven't tried the calculator but I found it on the internet here: latex-community.org/forum/viewtopic.php?f=5&t=2746 If I use a absolute path such as: \href{run:/usr/bin/gedit ~/Desktop/hg18.chrom.sizes}{hg18.chrom.sizes} then I get the error "No application found for opening file of mimetype application/octet-stream". If I use a relative path such as \href{run:/usr/bin/gedit ../src/wkfl/vlyUpstrOvrlp.sh}{vlyUpstrOvrlp} then i believe it is opening the new file "gedit ../src/wkfl/vlyUpstrOvrlp.sh" located in /usr/bin/ with gedit
    – denilw
    Sep 7 '10 at 22:11
  • 1
    Try adding the line 'application/octet-stream; gedit %s' to your .mailcap file. It may be that your PDF viewer wisely refuses to run applications not said to be safe in your mailcap file, as a safety precaution. Do say what you are using to view the PDF. Sep 8 '10 at 9:35

Make a small script "rungedit" containing

#!/bin/bash --
gedit /path/to/vlyUpstrOvrlp.sh

and use


in your document. This works for me in Acrobat Reader on Linux.

  • 1
    In my Linux (Fedora 19) and Acrobat Reader (9.4.1) this actually opens (to edit) the file rungedit, instead of /path/to/vlyUpstrOvrlp.sh
    – alfC
    Jul 21 '13 at 10:17
  • I found that it is more robust to give the script and extension (e.g. an invented extension name, like .mygedit or simply .sh and associate that extension with execution of bash. Associations can be specified by generating a application .desktop file and then choosing a default action for the extension. ask.fedoraproject.org/en/question/9735/… (at least in Linux).
    – alfC
    Nov 22 '14 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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