hyperref

LaTeX hyperref package for hyperlinks, cross-references, bookmarks, and PDF metadata. Use when helping users add clickable links, configure PDF properties, or manage cross-references.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "hyperref" with this command: npx skills add igbuend/grimbard/igbuend-grimbard-hyperref

hyperref — Hyperlinks, Cross-References & PDF Metadata

CTAN: https://ctan.org/pkg/hyperref
Manual: texdoc hyperref

Setup

% LOAD HYPERREF LAST (or near last) — it redefines many commands
\usepackage[
  colorlinks=true,
  linkcolor=blue,
  citecolor=green!50!black,
  urlcolor=blue!70!black,
  pdftitle={My Document Title},
  pdfauthor={Author Name},
]{hyperref}

% If using cleveref, load it AFTER hyperref:
\usepackage{cleveref}

Common Setup Options

OptionDefaultDescription
colorlinksfalseColor link text (vs boxes)
linkcolorredInternal links (refs, TOC)
citecolorgreenCitation links
urlcolormagentaURL links
filecolorcyanFile links
allcolorsSet all link colors at once
hidelinksNo color, no boxes (for print)
bookmarkstrueGenerate PDF bookmarks
bookmarksnumberedfalseInclude section numbers in bookmarks
bookmarksopenfalseExpand bookmarks by default
pdfborder{0 0 1}Link border (set {0 0 0} to remove)
breaklinkstrueAllow links to break across lines
unicodetrue (modern)Unicode in bookmarks

PDF Metadata Options

OptionDescription
pdftitleDocument title
pdfauthorAuthor name(s)
pdfsubjectSubject
pdfkeywordsKeywords (comma-separated)
pdfcreatorCreating application
pdfproducerPDF producer
% Or set after loading:
\hypersetup{
  pdftitle={My Paper},
  pdfauthor={Jane Doe},
  pdfsubject={LaTeX Tutorial},
  pdfkeywords={LaTeX, hyperref, tutorial},
}

Link Commands

% External URL
\href{https://example.com}{Click here}
\href{mailto:user@example.com}{Email me}
\href{file:./report.pdf}{Local file}

% URL (typewriter, breakable)
\url{https://example.com/path?query=value}

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

% Standard cross-references (auto-linked by hyperref)
\ref{fig:plot}        % "3"
\pageref{tab:data}    % "12"
\eqref{eq:main}       % "(1)" — from amsmath

% Auto-named references
\autoref{fig:plot}     % "Figure 3"
\autoref{tab:data}     % "Table 2"
\autoref{sec:intro}    % "section 1"
\autoref{eq:main}      % "equation 1"

% Name reference (prints the title/caption)
\nameref{sec:intro}    % "Introduction"

\autoref Names

CounterDefault name
figureFigure
tableTable
equationequation
sectionsection
chapterchapter
theoremTheorem
pagepage

Customize: \renewcommand{\sectionautorefname}{Section}

cleveref Integration

\usepackage{hyperref}
\usepackage{cleveref}   % MUST be after hyperref

% Automatic type detection + ranges
\cref{fig:a}              % "fig. 1"
\Cref{fig:a}              % "Figure 1" (capitalized)
\cref{fig:a,fig:b,fig:c}  % "figs. 1 to 3"
\cref{eq:1,eq:2}          % "eqs. (1) and (2)"
\crefrange{fig:a}{fig:d}  % "figs. 1 to 4"

% Customize names
\crefname{equation}{eq.}{eqs.}
\Crefname{equation}{Equation}{Equations}
\crefname{figure}{fig.}{figs.}

Bookmarks

% Manual bookmark entry
\pdfbookmark[level]{Text}{anchor}
\pdfbookmark[0]{Title Page}{title}

% Current bookmark (without section command)
\currentpdfbookmark{Appendix A}{appendixA}

% Bookmark with section:
\belowpdfbookmark{Subsection text}{anchor}  % below current level

Link Appearance

% Colored text links (preferred for screen)
\hypersetup{colorlinks=true, allcolors=blue}

% Boxed links (default)
\hypersetup{colorlinks=false, pdfborder={0 0 1}}

% Hidden links (for print)
\hypersetup{hidelinks}

% Custom: colored + no underline
\hypersetup{
  colorlinks=true,
  linkcolor={blue!80!black},
  citecolor={green!60!black},
  urlcolor={red!70!black},
}

Common Patterns

Clickable TOC with Print-Friendly Style

\usepackage[
  colorlinks=true,
  linkcolor=black,      % TOC/internal links in black
  citecolor=blue!50!black,
  urlcolor=blue!70!black,
  bookmarks=true,
  bookmarksnumbered=true,
]{hyperref}

Thesis/Dissertation Setup

\usepackage[
  hidelinks,            % clean for printing
  bookmarks=true,
  bookmarksnumbered=true,
  bookmarksopen=true,
  bookmarksopenlevel=2,
  pdftitle={PhD Thesis},
  pdfauthor={Name},
]{hyperref}
\usepackage{cleveref}

Back-References in Bibliography

\usepackage[backref=page]{hyperref}
% Adds "Cited on page(s) X, Y" to bibliography entries

Common Pitfalls

ProblemCauseFix
Broken cross-referenceshyperref loaded too earlyLoad hyperref last (before cleveref)
\autoref says "section" lowercaseDefault names\renewcommand{\sectionautorefname}{Section}
Bookmark errors with mathMath in section titles\texorpdfstring{$E=mc^2$}{E=mc2}
"Token not allowed"Special chars in PDF stringsUse \texorpdfstring{LaTeX}{LaTeX}
Links in headers/footersFragile commandsUse \protect or \texorpdfstring
cleveref not workingLoaded before hyperrefLoad order: hyperref → cleveref
Link boxes overlap textDefault border styleUse colorlinks=true or hidelinks
\url breaks wrongLong URLshyperref handles this; check breaklinks=true
Conflicts with other packagesPackage redefines same commandsLoad hyperref after most packages

Load Order Guide

% Safe order (most common packages):
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{...}          % other packages
\usepackage[options]{hyperref}  % near last
\usepackage{cleveref}           % very last

Tips

  • Always use colorlinks for screen PDFs; hidelinks for print
  • \texorpdfstring{LaTeX version}{plain text} for anything fancy in section titles
  • \phantomsection before \addcontentsline for correct hyperlinks in unnumbered sections
  • \hypersetup{} can be called multiple times to change settings mid-document
  • Use \nohyperpage in index entries to prevent hyperref page linking

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

codebase-discovery

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

message-authentication-code-pattern

No summary provided by upstream source.

Repository SourceNeeds Review
General

tikz

No summary provided by upstream source.

Repository SourceNeeds Review