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 would like a command such as this:

\href{../src/wkfl/vlyUpstrOvrlp.sh}{vlyUpstrOvrlp}

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.

share|improve this question
5  
I think that whatever happens with the hyperlink when clicked depends on your pdf viewer. –  Juan A. Navarro 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. –  Charles Stewart Sep 8 '10 at 9:35

1 Answer 1

up vote 4 down vote accepted

Make a small script "rungedit" containing

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

and use

\href{run:rungedit}{vlyUpstrOvrlp}

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

share|improve this answer
    
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 yesterday

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.