Document Classes ⇒ Hyperref links to all other files except pdfs
-
- Posts: 6
- Joined: Wed Jan 09, 2008 1:38 am
Hyperref links to all other files except pdfs
\href{file:///pathtofilefolder/file.pdf}{Caption}
The problem is, when clicking the link in the outputted pdf file, nothing happens. There is a box around the link to indicate it's there, but it never opens when the link is to a pdf document. I've linked to other document types, .psd, .eps, .png, etc and when the link is clicked, the documents open up fine. Any ideas?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: Hyperref links to all other files except pdfs
\href{file:/Users/myname/Desktop/myfile.pdf}{text} and it works fine. You can also try to write "run" instead of "file".
-
- Posts: 6
- Joined: Wed Jan 09, 2008 1:38 am
Re: Hyperref links to all other files except pdfs
I checked my log file and I am using version 6.75r of hyperref. Was yours a newer version? Also, the color of the link around the link when trying to link to a pdf is a darker blue than when linking to other file types, does that indicate anything?
Hyperref links to all other files except pdfs
-
- Posts: 6
- Joined: Wed Jan 09, 2008 1:38 am
Re: Hyperref links to all other files except pdfs
\documentclass[12pt]{report}
\usepackage{hyperref}
\begin{document}
\href{file:/Users/Jeremy/Documents/University%20of%20Cincinnati/Electrodynamics/Notes/Supplements/Solid%20Angle.pdf}{Testing}
\end{document}
Obviously the file path is unique to my computer, but substitution of your own would check the correctness of the input. I should probably stress that replacing the pdf at the end of the file name with a png links fine to a png file with the same name in the same folder. I will attach an example pdf and a log file. Are you using the 2007 MacTeX-2007 package? Because I tried this same type of thing today on a school computer with the same MacTeX-2007 install and got the same results as at home and I was wondering if it is a problem with the package.
- Attachments
-
- Solid Angle.pdf
- (84.49 KiB) Downloaded 369 times
-
- Untitled-2.log
- (5.39 KiB) Downloaded 360 times
Hyperref links to all other files except pdfs
/Users/my%20name/my%20folder/Solid%20Angle.pdf,
write
/Users/my\ name/my\ folder/Solid\ Angle.pdf
This works on my Mac. It should also work in yours, since we are using the same TeX distribution.
Good luck
-
- Posts: 6
- Joined: Wed Jan 09, 2008 1:38 am
Re: Hyperref links to all other files except pdfs
Hyperref links to all other files except pdfs

Let's do a final test. Write a tex file with the following code:
Code: Select all
\documentclass[12pt]{report}
\usepackage{hyperref}
\begin{document}
\href{file:./LaTeX\ Community/Solid\ Angle.pdf}{File keyword}
\href{run:./LaTeX\ Community/Solid\ Angle.pdf}{Run keyword}
\end{document}
- Attachments
-
- LinkTest.pdf
- (6.66 KiB) Downloaded 436 times
-
- Posts: 6
- Joined: Wed Jan 09, 2008 1:38 am
Re: Hyperref links to all other files except pdfs
1. The file: command does not work for pdfs, but does for other all other file types I tried using an absolute file address, not one relative to the document. So something like file:/Users/Jeremy/Documents/University%20of%20Cincinnati/Solid%20Angle.pdf
2. The run: command does not work with absolute addresses like the one given above, just addresses relative to where the document is saved and links do not work in TeXShop pdf viewer, I had to use Preview for working links, which is fine.
3. The run: command did not work for a png. file with the same name as the pdf and which was in the same folder as the pdf file, which is fine because I can open png files using the file: command with an absolute address.
4. The run: command did not work for relative address with spaces, meaning all folder and file names relative to the document must contain no spaces, which is fine because all it meant was I had to change Solid Angle.pdf to Solid-Angle.pdf. Using the file: command I could have spaces by putting a %20, or a \%20 in. A \ with a space after it never worked for any of them.
In the end I find this all very confusing as to why some things work but others don't. I did get what I wanted to work with your help, so thanks a lot for putting time into getting this sorted out.