hyperref package. It handles external URLs, internal cross-references, bookmarks, PDF metadata, and table-of-contents links.
Quick answer: add
\usepackage{hyperref} near the end of your preamble, then use \url{...} for plain links, \href{url}{text} for custom link text, and \label with \ref or \autoref for internal links.Minimal Setup
- Code
- Rendered output
hyperref-setup.tex
hyperref after most other packages so it can patch references correctly.
External Links
Use\url when you want to print the URL itself, and use \href when you want custom anchor text.
- Code
- Rendered output
external-links.tex
Internal Hyperlinks and Clickable References
Internal links usually come from labels and references:- Code
- Rendered output
internal-links.tex
hyperref is loaded, these references become clickable in the final PDF.
Hyperlinks in the Table of Contents and Unnumbered Headings
For unnumbered sections, add a manual anchor before writing the label:- Code
- Rendered output
phantomsection.tex
Common hyperref Problems
- Links are not clickable: make sure
hyperrefis loaded. - Colors look wrong: set
colorlinks=trueand choose explicitlinkcolor,citecolor, andurlcolor. - Link jumps to the wrong spot: use
\phantomsectionbefore the label for unnumbered headings. - Package conflicts: load
hyperreflate in the preamble unless another package says otherwise.
