[OS X TeX] linking to and opening a .tex file using hyperref?

Gary L. Gray euler at psu.edu
Wed Jun 13 16:30:55 EDT 2018

This is sort of Mac related in that I do not understand why it works on my Mac. :-) And I apologize in advance for a rather long message.

From within a presentation, I would like to be able to link to and open a .tex file. Some searching in the hyperref manual alludes to the fact that this can be done, but I sure can’t find the scheme for doing so. So I tried the following

\href{file:///Users/gray/Documents/Teaching/LaTeX\ Course/Lectures/2018\ -\ Fall/Lecture\ 03/simple_document/simple_doc.tex}{Simple \LaTeX\ Document}

which shows the title as a link, but clicking on it does nothing and when one hovers, it shows nothing.

The next thing I did was to head over to TeX StackExchange (that place intimidates me a more than a little) where I found this


The answer from Sony suggests using “run:” before the path to the file. So I tried this

\href{run:/Users/gray/Documents/Teaching/LaTeX\ Course/Lectures/2018\ -\ Fall/Lecture\ 03/simple_document/simple_doc.tex}{Simple \LaTeX\ Document}

which also did not work. In this case it linked to:


so you can see that some extraneous stuff was inserted.

Finally, rather than use an absolute path, I used a relative one as

\href{run:simple_document/simple_doc.tex}{Simple \LaTeX\ Document 2}

and amazingly, this worked. In this case, the link is to


and so the .tex file opens in the default app for such files. By the way, this also works:

\href{run:./simple_document/simple_doc.tex}{Simple \LaTeX\ Document}

So, can anyone explain what this run thing is doing? Searching the web, it appears to be a Windows thing, but works perfectly on my machine. More importantly, what should I be doing to open a .tex file as I am doing here?

Any insights would be greatly appreciated.


More information about the MacOSX-TeX mailing list