Hyperlinks in LaTeX
The hyperref package adds clickable links and URLs to your PDF output.
Quick answer
latex
\usepackage{hyperref} % in preamble
\href{https://example.com}{Link text}
\url{https://example.com}Basic link commands
latex
% Clickable link with custom text:
\href{https://example.com}{Visit example.com}
% Display the URL itself as a clickable link:
\url{https://example.com}
% Email link:
\href{mailto:hello@example.com}{hello@example.com}Package setup & options
Always load hyperref last in your preamble — it redefines many commands and conflicts with packages loaded after it.
latex
% Load last, with common options:
\usepackage[
colorlinks=true,
linkcolor=blue,
urlcolor=blue,
citecolor=blue,
pdftitle={My Thesis},
pdfauthor={Your Name}
]{hyperref}Colored vs. boxed links
latex
% Colored links (clean, PDF-only):
\usepackage[colorlinks=true, urlcolor=blue]{hyperref}
% Boxed links (visible when printed):
\usepackage[colorlinks=false]{hyperref}
% No visible styling (for print submissions):
\usepackage[hidelinks]{hyperref}Internal links
Link to sections, figures, or equations within the same document using labels and \autoref.
latex
\section{Introduction}\label{sec:intro}
% Later in the document:
As discussed in \autoref{sec:intro}, ...
% Produces: "As discussed in Section 1, ..."
% Manual link with custom anchor text:
See \hyperref[sec:intro]{the introduction}.Long URLs
Long URLs can overflow the line. The url package (loaded automatically by hyperref) handles line-breaking.
latex
% Allow URL line breaks (hyperref loads url automatically):
\Urlmuskip=0mu plus 2mu
% Or use breakurl package for additional control:
\usepackage{breakurl}