Document Formatting
How to Add Hyperlinks in LaTeX
The hyperref package turns cross-references, citations, and URLs into clickable links in your PDF. It's one of the most popular LaTeX packages and works with all standard document classes.
Load the hyperref Package
Add hyperref to your preamble. It should usually be one of the last packages loaded to avoid conflicts.
\usepackage{hyperref}
% With common options:
\usepackage[
colorlinks=true,
linkcolor=blue,
urlcolor=blue,
citecolor=green
]{hyperref}Output: All cross-references, citations, and URLs in the document become clickable.
URL Links
Use \url{} for plain URLs or \href{}{} for links with custom display text:
% Plain URL (displays the full address)
Visit \url{https://www.bibby.ai} for more.
% Custom link text
Visit \href{https://www.bibby.ai}{Bibby AI} for more.
% URL with special characters (# _ %)
\url{https://example.com/path?key=value&foo=bar}Output: Clickable links appear in the PDF—plain URLs show the address, custom links show your text.
Internal Cross-References
hyperref automatically makes \ref{} and \cite{} clickable. Use \hyperref for manual internal links:
\section{Introduction}
\label{sec:intro}
See Section~\ref{sec:methods} for details.
\section{Methods}
\label{sec:methods}
As mentioned in the \hyperref[sec:intro]{introduction}...Output: Clicking 'Section 2' or 'introduction' jumps to the corresponding section.
Email Links
Use \href with the mailto: prefix to create clickable email addresses:
Contact us at \href{mailto:[email protected]}{[email protected]}.Output: Clicking the email address opens the user's default email client.
Customizing Link Appearance
Control link colors and borders with hyperref options:
\hypersetup{
colorlinks=true, % false = boxed links
linkcolor=black, % internal links
urlcolor=blue, % URL links
citecolor=blue, % citation links
filecolor=magenta, % file links
pdfauthor={Your Name},
pdftitle={Your Title},
bookmarks=true
}
% To hide all link colors (print-friendly):
\hypersetup{hidelinks}Output: Links appear with your chosen colors or as invisible (but still clickable) text.
💡 Tips
- •Load hyperref last (or near-last) in your preamble to avoid conflicts
- •Use hidelinks for print versions so colored/boxed links don't appear
- •\autoref{label} produces 'Section 1' automatically instead of just '1'
- •For long URLs that break badly, add \usepackage{xurl} before hyperref
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing Free