3

I want to put a "short" URL (without http://) in my document: something like \url{google.com}. But if I do that, the link does not work (it tries to link locally, and does not recognize it as a web address).

I also tried \href{http://google.com}{google.com}, which links correctly, but shows "google.com" in standard font instead of the nice URL monospaced font. I could do \href{http://google.com}{\texttt{google.com}} to get the monospaced font, but other things like URL wrapping don't work.

Is there some way that I can have the link work, and have the URL formatted nicely?

Also, apologies if this has already been asked. It seems like it must have been asked before, but I couldn't find an answer anywhere.

3

1 Answer 1

6

The \nolinkurl command can be used to format a URL without creating a link. This can be combined with \href to get the desired effect:

\href{http://google.com}{\nolinkurl{google.com}}

This duplicate issue shows the specific case when only the "http://" has been omitted (thanks @Werner for finding this).

Not the answer you're looking for? Browse other questions tagged .