Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Seems like a duplicate –  TH. Sep 29 '10 at 5: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 6:00
add comment

2 Answers 2

up vote 34 down vote accepted

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.

share|improve this answer
    
Wow, that was fast. I can't even accept the answer yet! –  Billy ONeal Sep 29 '10 at 4:52
    
Luck of the draw :) –  Will Robertson Sep 29 '10 at 4:59
add comment

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.

share|improve this answer
4  
Why not \usepackage[colorlinks,citecolor=DeepPink4,linkcolor=DarkRed, urlcolor=DarkBlue]{hyperref}? And what is cleveref for here? –  TH. Sep 29 '10 at 5:48
    
maybe also something like \usepackage[svgnames]{xcolor} (before \hypersetup) to access the named colours –  Geoffrey Jones Sep 29 '10 at 10:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.