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.

For some reason, I can't get a link to generate when I use the \hyperref package with pdfLaTeX compiler. \hyperref[this is link text]{www.google.com} yields only a plain unformatted "www.google.com" in the finished document.

I'm running manually installed Texlive 2013 on Linux Mint 16 Cinnamon 32-bit. On a 64-bit Lenovo Thinkpad e420 machine.

Below is a shortened example of the doc I'm trying to compile:

\documentclass[letter]{article}
\usepackage{hyperref}

\begin{document}

Here's a hyperref. \hyperref[This is a link to Google]{http://www.google.com}.

\end{document}

Output for the above compiles to "Here's a hyperref. http://www.google.com" (no hyperlink or link text).

share|improve this question
    
Welcome to TeX.SE! –  Mico Jan 28 at 20:42

2 Answers 2

up vote 11 down vote accepted

The syntax of \hyperref with the optional argument is:

\hyperref[<label name>]{<text>}

I assume, you do not have \label{This is a link to Google}. Then the text "http://www.google.com" appears without link to a non-existing label.

I think you want somethink like:

\href{https://www.google.com/}{This is a link to Google.}

Then the text "This is a link to Google." is a link to the URL https://www.google.com/.

share|improve this answer
    
That was dumb of me. I read the documentation too quickly and replaced \href with \hyperref. I was confounded by the fact that hyperref is defined, so I didn't get any errors; else I probably would have figured it out sooner.... argh. The simplest things. Thanks again! :-) –  Kevin Jan 28 at 21:24

From the hyperref documentation (section 4 Additional user macros):

If you need to make references to URLs, or write explicit links, the following low-level user macros are provided:

\href[options]{URL}{text}

The text is made a hyperlink to the URL; this must be a full URL (relative to the base URL, if that is defined). The special characters # and ~ do not need to be escaped in any way.

So you're after \href{http://www.google.com}{This is a link to Google}.

share|improve this answer

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.