I'd like to insert a URL into this document. Is there a "correct" way of doing that? If so, is there a way to turn it into a link inside the final pdf generated with pdfTeX or XeTeX?
Asked
Active
Viewed 1.4e+01k times
89
-
Seems like a duplicate – TH. Sep 29 '10 at 05:49
-
@TH: Close enough to a distinct question that I'm okay with it, even if the answer is similar. The other question is more about internal links; this question is more about typesetting URLs in general. – Will Robertson Sep 29 '10 at 06:00
2 Answers
95
I thought this was a duplicate but I think I was thinking of email addresses. URLs are simple:
\usepackage{hyperref}
...
\url{http://google.com}
Colours can be changed by setting up hyperref as desired:
\hypersetup{
colorlinks, linkcolor=red
}
If you're not using hyperref then load the url package:
\usepackage{url}
...
\url{http://google.com}
but you won't get hyperlinks, of course.
doncherry
- 54,637
Will Robertson
- 73,872
31
Also,
\href{http://google.com}{Google}
so that when you press on the word Google you get connected to Google's site.
Here is what you should put in the preamble:
\usepackage[colorlinks]{hyperref}
\hypersetup{citecolor=DeepPink4}
\hypersetup{linkcolor=DarkRed}
\hypersetup{urlcolor=DarkBlue}
\usepackage{cleveref}
This should be placed as is at the bottom of the list of added packages.
-
6Why not
\usepackage[colorlinks,citecolor=DeepPink4,linkcolor=DarkRed, urlcolor=DarkBlue]{hyperref}? And what isclevereffor here? – TH. Sep 29 '10 at 05:48 -
2maybe also something like
\usepackage[svgnames]{xcolor}(before\hypersetup) to access the named colours – Geoffrey Jones Sep 29 '10 at 10:05