[texhax] \href

Justin C. Walker justin at mac.com
Mon Jan 21 22:25:23 CET 2008


On Jan 21, 2008, at 10:10 , Matthew Leingang wrote:
> On Jan 21, 2008, at 12:16 PM, Justin C. Walker wrote:
>> On Jan 21, 2008, at 07:20 , Matthew Leingang wrote:
>>> Something like this *should* be possible.
>>>
>>> \href{file:///Users/matthew/Documents/}{my documents}
>>
>> This works for me with the 'hyperref' package:
>>
>> \documentclass[11pt]{letter}
>> \usepackage[colorlinks=true]{hyperref}
>>
>> \begin{document}
>>
>> You can just check \href{http://www.hoo.hah}{here}
>>
>> \end{document}
>>
>
> The OP specifically wanted to link to a local file/directory...Can
> you get hyperref to do that?

Thanks for smacking me upside the head :-}  I should pay closer  
attention...

Short answer: yes

Longer answer: yes and no

Start of the much longer answer:

I'm a bit perplexed by what I see, and I don't currently have a good  
"real" answer.  It works for me, as in

===================
\documentclass[11pt]{letter}
\usepackage[colorlinks=true]{hyperref}

\begin{document}

You can just check \href{http://localhost:8000}{here}.

Failing that, check \href{file:LRFG.pdf}{here}.

\end{document}
===================

as long as the generated pdf and the file in the 'file://' URL are in  
the same directory.  If they are not, it does not seem to work.  I  
tried many variants of the 'file://' URL, to no avail.  Only "file:// 
name" would work, where 'name' contains no "separators" ("/" on Unixy  
systems; "\" on those other systems).  In fact, I've checked 'name'  
in the form "foo.pdf", which worked, and "foo.txt", which did not[1].

One caveat: This works with Adobe Reader on a Mac.  If I use TeXShop,  
a Mac editor/viewer for TeX, this does not seem to work in any of the  
ways I have so far tried.  I have no idea what happens with other  
readers and OS's.

One more thing: at least with Reader on the Mac, when you click on  
the 'file://foo.pdf" link in the PDF, the linked PDF file opens in  
the same window.  You can get back to the original file with the  
"Previous View" button, or View->Previous View (not "Previous Page").

Sorry for the misleading first response and the somewhat involved  
follow-on.

Justin

[1] 'worked' -> Reader opened the linked file.  'did not' -> No  
response; the Mac app 'TextEdit' should have launched (if I  
understand how this is supposed to work).

--
Justin C. Walker, Curmudgeon-At-Large, Director
Institute for the Enhancement of the Director's Income
--------
The path of least resistance:
it's not just for electricity any more.
--------





More information about the texhax mailing list