LaTeX Guide

LaTeX Hyperlinks

Load hyperref. Use \href for labeled links and \url for raw URLs. Cross-references become clickable automatically.

The basics

% Load hyperref LAST in your preamble
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]{hyperref}

% Labeled link (preferred for body text)
See the \href{https://www.typetex.app}{TypeTeX website}.

% Raw URL (preferred for citations and reference lists)
Available at \url{https://www.typetex.app}.

% Email
Contact \href{mailto:hello@example.com}{hello@example.com}.

% Internal link (works automatically once hyperref is loaded)
See Section~\ref{sec:intro} on page~\pageref{sec:intro}.

% Internal link with custom text
\hyperref[sec:intro]{the introduction}

% Insert section title as link
\nameref{sec:intro}

Recommended hyperref configuration

\usepackage[
  colorlinks=true,        % use colored text instead of boxes
  linkcolor=blue,         % internal links (sections, equations)
  urlcolor=blue,          % external URLs
  citecolor=blue,         % bibliography citations
  pdftitle={Your Paper Title},
  pdfauthor={Your Name},
  pdfsubject={Subject},
  pdfkeywords={keyword1, keyword2}
]{hyperref}

The pdf* options populate the PDF metadata that shows up in viewers and search engines.

Important: load hyperref LAST

hyperref redefines many LaTeX commands (citations, references, footnotes) to make them clickable. If another package overrides these commands later, hyperref's redefinitions get clobbered. Always load hyperref as the last package in your preamble. The exception is cleveref which must come after hyperref — cleveref explicitly hooks into hyperref's commands.

Common mistakes

  • Loading hyperref too early. Other packages override its hooks. Always load last.
  • Using \href in a moving argument. Section titles, captions, etc. require \texorpdfstring for the PDF bookmark version.
  • Box around links. Set colorlinks=true in hyperref options — default is ugly colored boxes.
  • Special characters in URLs. Escape # as \#, % as \% inside \url arguments.
In Typst, links are first-class
#link("https://www.typetex.app")[TypeTeX]
#link("mailto:hello@example.com")
#link(<intro>)[the introduction]    // internal link

// Style globally
#show link: set text(fill: blue)

No package to load, no hyperref ordering rules. Try TypeTeX free.

Try TypeTeX free

Frequently Asked Questions

How do I make a clickable link in LaTeX?

Load the hyperref package: \usepackage{hyperref}. Then use \href{https://example.com}{link text} for a labeled link, or \url{https://example.com} for a raw URL displayed verbatim. Both are clickable in the resulting PDF.

What's the difference between \href and \url?

\href{url}{text} displays text and links to url — like HTML's <a href>. \url{url} displays the URL itself in monospace font and links to it. Use \href when you want 'click here' style; use \url when you want to show the actual URL.

How do I load and configure hyperref?

\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]{hyperref}. Load it LAST in your preamble (after all other packages) — hyperref redefines many commands and works best when nothing comes after it.

How do I change link colors in LaTeX?

Pass color options to hyperref: \usepackage[colorlinks=true,linkcolor=red,urlcolor=blue,citecolor=green]{hyperref}. linkcolor is for internal cross-references, urlcolor for external URLs, citecolor for citations. Use named colors or define your own with \definecolor.

How do I make internal cross-references clickable?

Just load hyperref. Once loaded, \ref, \eqref, \pageref, and \cite all become clickable links to their targets in the PDF. No extra syntax needed — hyperref hooks into the standard reference commands.

How do I link to a specific section by name?

After your section, add \label{sec:intro}. Then use \hyperref[sec:intro]{the introduction} to create a link with custom text. Or use \nameref{sec:intro} to insert the section title as a clickable link.

Why does my URL with underscores or special characters break?

\href and \url are usually robust, but a literal % or # inside a URL can break them. Use the url package's \url+...+ syntax or escape special characters with \%, \#. For URLs in macros (like inside \cite), define a separate \newcommand.

How do I link to a footnote or email?

Email: \href{mailto:name@example.com}{name@example.com}. The mailto: prefix opens the user's email client. Phone: \href{tel:+1234567890}{Call us}. Footnote: combine \footnotemark with \hypertarget — most authors just use plain footnotes since hyperref makes them clickable automatically.

How do I break a long URL across lines?

URLs in regular text won't break automatically — they push past the right margin. \url{} and \href{} break URLs at common points (slashes, dots) automatically. For really long URLs that still don't break well, load the breakurl package or use \sloppy locally.

More LaTeX guides