For Programmers: Free Programming Magazines  


Home > Archive > Tex > October 2006 > Bug in url.sty ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bug in url.sty ?
Bevan Weir

2006-10-30, 7:43 pm

Hi,

I have a problem with urls in my document.

If a url contains a hypen, the automatic linking and appending of
http:// does not work

in example 1 below the linked url in the pdf is "
file:///C|/Documents%20and%20Settings/Landcare/WeirB/Desktop/www.latex-project.org
" i.e. the root directory of the tex file.

Both other examples work fine. Note that it works fine if I include
http:// , but I would prefer not to do this in my case.

It is clear if you run pdftex on the sample

------ Simple Example ------

\documentclass[12pt]{article}
\usepackage{url}
\usepackage[hyperindex=true,colorlinks=t
rue,citecolor=blue]{hyperref}

\begin{document}

test url 1: \url{www.latex-project.org}

test url 2: \url{http://www.latex-project.org}

test url 3: \url{www.miktex.org}

\end{document}


------ Simple Example ------


Thanks,

Dr Bevan Weir
http://www.rhizobia.co.nz

Heiko Oberdiek

2006-10-30, 7:43 pm

"Bevan Weir" <bevan.weir@gmail.com> wrote:

> If a url contains a hypen, the automatic linking and appending of
> http:// does not work
>
> in example 1 below the linked url in the pdf is "
> file:///C|/Documents%20and%20Settings/Landcare/WeirB/Desktop/www.latex-project.org
> " i.e. the root directory of the tex file.
>
> Both other examples work fine. Note that it works fine if I include
> http:// , but I would prefer not to do this in my case.


> \usepackage{url}
> \usepackage[hyperindex=true,colorlinks=t
rue,citecolor=blue]{hyperref}


> test url 1: \url{www.latex-project.org}
> test url 2: \url{http://www.latex-project.org}
> test url 3: \url{www.miktex.org}


The scheme part of the absolute URIs is missing in case 1 and 3,
see PDF specification and RFC 2396. (The scheme could be inherited
from the base URI, but a base URI isn't set.)

Thus you force the PDF reader to guess the scheme part, relying on a
heuristics.

Better:
\href{http://www.latex-project.org}{\nolinkurl{www.latex-project.org}}

Yours sincerely
Heiko <oberdiek@uni-freiburg.de>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com