2

I am trying to create a link to a folder such as

C:\Program Files (x86)\7-Zip

I have tried to use href, but as I understand that automatically appends a .pdf to the end.

I tried the solution in hyperref: How to open a directory view with href{...}?

but no success there either. The documentation http://www.tug.org/applications/hyperref/manual.html seems to imply that \url{} can be used for paths. But this just generated a text version of the url.

What is the correct method for linking to a folder? Am I misusing a method or am I not using the correct approach?

Thanks in advance

  • 1
    Welcome to TeX - LaTeX! Please post the code you have tried. Loading hyperref and using \url should work, but will display the path name in the file too. What end result do you want? – Andrew Swann Jun 6 '18 at 8:59
  • If you give a pathname to MS internet explorer, it will display the directory, but this is not standard behavior. The first thing it should do is look for home.html or index.html. Firefox defaults to using the search engine. – John Kormylo Jun 7 '18 at 15:08
2

On MacOS, the MWE below produces:

enter image description here

and upon clicking on the link it invokes Finder and opens to the ../images directory.

Notes:

  • Only relative links work. Absolute directory paths do not seem to work.

Code:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
    \href{run:../images}{My Images Folder}
\end{document}
0

This is not a solution, but it does show some of my experiments.

\documentclass{article}
\usepackage[obeyspaces]{url}
\usepackage{hyperref}

\begin{document}
\url{C:/Program Files (x86)/7-Zip}% replace \ with /

\href{../slides/demo}{pdf}% relative pathname

\href{../slides}{directory}% does nothing

\href{../slides/}{directory}% does nothing
\end{document}

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.