Stage 4 · Structure and cross-references 27 / 48 ≈ 19 min read

LaTeX hyperref: Clickable Links and cleveref

A reference that reads "(4.2)" and a reference you can click are two different machines. This lesson takes hyperref apart: what it patches, why the option list is split between load time and \hypersetup, how a label becomes a named PDF destination, which macro supplies the word "Equation", and where cleveref stops being a luxury.

    What hyperref actually changes

    hyperref is not a stylesheet for your references. It is a patch layer: when it loads, it walks through almost everything that already produces a reference or a heading — \ref, \pageref, \cite, \bibitem, \contentsline, \caption, \footnote, every sectioning command — and redefines each one so that it emits two extra objects into the PDF.

    The first object is an annotation: the clickable rectangle drawn over the text on the page. The second is a destination: the named anchor somewhere else in the file that the annotation points to. Every hyperref option belongs to one of those two sides. colorlinks, pdfborder, frenchlinks and hidelinks talk about the annotation. hypertexnames, plainpages, hyperfootnotes and the \theH<counter> macro talk about the destination. People who mix the two groups spend an evening looking for a colour setting that fixes a broken jump.

    The destination name is the piece that travels through the build. Since 2023 the kernel stores five fields per label, so the line hyperref writes into .aux for an equation reads roughly \newlabel{eq:amp}{{4.2}{17}{}{equation.4.2}{}}: printed number, page, title text (for \nameref), destination name, and a reserved slot. \ref reads field one, \pageref field two, hyperref reads field four and turns it into the /Dest entry in the PDF. That is why a reference can be perfectly correct and still not clickable: the number arrived from the .aux while the name did not arrive in the PDF.

    hyperref also grows two extra build products. The .out file beside your PDF is the bookmark tree in progress, and the /Info dictionary of the PDF is filled from your \hypersetup metadata. Both are written by the same hooks that make links work, which is why removing hyperref from a template can break the table of contents, the bookmarks and the document title in one go.

    \underbrace{\oint_{\partial \Omega} \omega = \int_{\Omega} d\omega}_{\text{destination } \mathtt{equation.4.2}}
    \underbrace{\oint_{\partial \Omega} \omega = \int_{\Omega} d\omega}_{\text{destination } \mathtt{equation.4.2}}

    Load order: last, with one deliberate exception

    hyperref's own manual states the rule plainly: load it as the last package. The reason is mechanical rather than political. Because it redefines commands it has already seen, any package loaded afterwards that redefines \ref, \l@section, \Hfootnote or the caption machinery silently installs an unpatched version back, and you get output that is correct but inert: references that print the right number and do nothing when clicked.

    There is exactly one package designed to sit below it: cleveref. cleveref needs hyperref's patched \ref and \autoref to exist before it wraps them, so the canonical tail of a preamble is \usepackage{hyperref} then \usepackage{cleveref}. Everything else — geometry, fontenc, inputenc, babel, amsmath, graphicx, xcolor, caption, booktabs, subcaption, microtype — belongs above it.

    The second half of the story is where the options are written. hyperref decides its driver (pdftex.def, xetex.def, luatex.def, dvips.def) from the engine that is running, and that choice is frozen the moment the package loads. Anything that changes behaviour at write time has to be known then: draft/final, driver=, hyperfigures, hyperfootnotes, hyperindex, pageanchor. Anything that only changes appearance can wait for \hypersetup: the colour keys, colorlinks, the bookmark switches, the metadata. Keeping the two lists apart is what makes a mid-document \hypersetup legal, and a mid-document colour change is genuinely useful — see the screen-versus-print trick below.

    A practical note on colours: pass xcolor (or at least color) before hyperref if you name your link colours, and do not expect \definecolor to help if it comes afterwards. Options are never re-parsed; a colour that did not exist when hyperref read the option list stays undefined and the key silently keeps its default.

    \text{options} \times \text{engine} \Rightarrow \mathtt{driver = pdftex} \quad (\text{decided once})
    \text{options} \times \text{engine} \Rightarrow \mathtt{driver = pdftex} \quad (\text{decided once})
    Preamble load order: hyperref patches the packages above it and cleveref is the only package allowed below it TOP OF THE PREAMBLE WHAT HYPERREF DOES TO EACH LAYER document class + geometry + fontenc + inputenc page and font decisions: hyperref needs them to pick a driver babel, amsmath, graphicx, xcolor colour names must exist before linkcolor is parsed caption, subcaption, booktabs, float anything that touches \caption or \label \usepackage[...]{hyperref} behaviour options here (driver, draft, hyperfootnotes, hyperindex) presentation options in \hypersetup below it \usepackage[capitalise]{cleveref} the one package that must load after: it wraps the patched \ref \begin{document} ... \hypersetup{hidelinks} \ref, \pageref, \cite, \bibitem rewritten to emit a link annotation plus a destination \section, \caption, \contentsline headings gain bookmarks; captions gain a target for \label \footnote, \item, \theH<counter> footnote link pairs, list targets, unique destination names loaded below hyperref instead a package that redefines \ref or \caption afterwards puts the unpatched version back: the number is right, the link is dead. symptom in the log: no warning at all. Rule of thumb: hyperref last, cleveref after it - and never a second \hypersetup key that contradicts the load-time list, because options are parsed once and the later value silently wins.
    hyperref sits at the bottom of the preamble because it patches whatever is already defined; only cleveref is allowed to load below it.

    Colour per link type, and what colorlinks really does

    Six keys colour six kinds of target, and they are independent: linkcolor for internal references from \ref and \autoref, citecolor for \cite, urlcolor for \href and \url, filecolor for file: links, menucolor for PDF menu actions and allcolors as the default for any key you leave alone. The usual house style is one restrained colour for internal jumps, a second for the bibliography, and a third for anything that leaves the document — three colours are already the maximum a reader can learn.

    If you set no colour key at all, hyperref draws a box around the link instead. On screen many viewers paint that box black, and — the part that surprises people — some viewers also print it. \hypersetup{pdfborder={0 0 0}} hides the box without switching to colour; colorlinks=true drops the box and tints the glyphs. Each choice has a cost: a box survives being pasted into another program, coloured text can be read as emphasis and gets inherited by anything that reuses the string.

    hidelinks is the third option and the one to use for a print PDF: it removes both the box and the colour while leaving every destination and every annotation live. Because it is a presentation key you can issue it in the middle of the document, which gives one source two builds — a linked, coloured reading copy and a black-and-white submission copy — with a single switch. Do not use draft for that: draft is a behaviour option, and it removes the links rather than their styling.

    linktoc (older hyperref: linktocpage) decides whether the whole table-of-contents line is clickable or only its page number; the second variant is calmer in a coloured heading. And if a bookmark inherits a bright colour from a coloured heading, that is not a bug — the bookmark text is the same string, so style the heading with \texorpdfstring or turn colour off for the structural levels.

    \documentclass[11pt,a4paper]{article}
    
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath,amssymb}
    \usepackage[a4paper,margin=2.5cm]{geometry}
    \usepackage{xcolor}                 % named colours must exist before hyperref
    \usepackage{caption}                % caption machinery before hyperref, too
    \usepackage[american]{babel}
    
    % ---- behaviour: decided at load time, because hyperref patches what it finds
    \usepackage[
      bookmarks        = true,
      bookmarksdepth   = 2,
      hyperfootnotes   = true,
      breaklinks       = true,
      linktocpage      = true,
    ]{hyperref}
    
    % ---- presentation: a \hypersetup keeps the option list short and readable
    \hypersetup{%
      colorlinks = true,
      linkcolor  = violet,
      citecolor  = teal,
      urlcolor   = blue!70!black,
      filecolor  = orange,
      pdftitle    = {Clickable links and cleveref},
      pdfauthor   = {A. Student},
      pdfsubject  = {LaTeX structure lesson},
      pdfkeywords = {hyperref, cleveref, autoref, bookmarks},
    }
    
    \usepackage[capitalise]{cleveref}   % ALWAYS after hyperref, never before it
    
    \begin{document}
    \tableofcontents
    
    \section{A numbered result}\label{sec:gauss}
    \begin{equation}
      \label{eq:gauss}
      \int_{-\infty}^{\infty} e^{-x^{2}}\,dx = \sqrt{\pi}
    \end{equation}
    Plain \verb|\ref| gives the bare number: \ref{eq:gauss}. With \verb|\eqref|
    you get the parentheses: \eqref{eq:gauss}. With hyperref's \verb|\autoref|
    the noun comes from the counter: \autoref{eq:gauss}. With cleveref it comes
    from the counter too, but it also pluralises and understands lists:
    \cref{sec:gauss,eq:gauss}. A page reference with the right word is
    \cref{eq:gauss} on \cpageref{eq:gauss}.
    
    \section{\texorpdfstring{$\varepsilon$--$\delta$}{epsilon-delta} arguments}
    \label{sec:eps}
    The heading above holds maths, so it needed \verb|\texorpdfstring|; the PDF
    bookmark reads \emph{epsilon-delta arguments} while the typeset heading keeps
    the symbols. See \cref{sec:gauss} again from the other direction:
    \hyperref[sec:gauss]{this wording is ours, the target is theirs}.
    
    \subsection{A figure to point at}
    \begin{figure}[htbp]
      \centering
      \rule{4cm}{2cm}
      \caption{A placeholder.}\label{fig:box}
    \end{figure}
    The label sits \emph{after} the caption because it is \verb|\caption| that
    steps \verb|figure|: \cref{fig:box}.
    
    \begin{thebibliography}{9}
    \bibitem{lamport} Leslie Lamport. \emph{\LaTeX: a Document Preparation System}.
      Addison-Wesley, 1994.
    \end{thebibliography}
    
    Cited as \cite{lamport} --- note the colour, which is a separate key.
    \end{document}

    The noun problem: autoref, cref and nameref

    LaTeX itself never says "Equation". \ref prints a number and nothing else; \eqref (amsmath) adds parentheses around the number, which is typographically correct for maths and useless as prose. Putting the noun in front is a separate job with three candidate tools, and choosing deliberately beats mixing them across one document.

    hyperref's \autoref looks the word up in a control sequence named after the counter — \<counter>autorefname, so \figureautorefname is Figure, \equationautorefname is Equation, \sectionautorefname is Section. For the built-in counters the names already exist. Two consequences follow. A counter you invented has no name, so \autoref{ex:one} prints the bare number until you add \newcommand*{\exerciseautorefname}{Exercise}. And \autoref cannot pluralise: two references read "Figure 1 and Figure 2" where the prose wants "Figures 1 and 2".

    cleveref covers exactly those gaps. \cref prints the number with the noun in lower case, \Cref capitalises it, \crefrange{a}{b} and \crefrangeformat produce "sections 2 to 4", a comma-separated list \cref{sec:a,sec:b,sec:c} collapses into "sections 1, 2 and 3", \cpageref gives the noun plus page, \labelcref deliberately gives bare numbers, and \nameCref prints the title of the target. Names for your own counters are declared with \crefname{exercise}{exercise}{exercises} and \Crefname{exercise}{Exercise}{Exercises} — singular and plural, twice, because the capitalised form is a separate table. The capitalise package option is the polite default for British-style prose: it capitalises only where a sentence would.

    cleveref also reads the two extra label fields the kernel now stores, which is why it must be loaded after hyperref rather than instead of it, and why its \label works inside subequations and on a named theorem: \newtheorem{theorem}{Theorem}[section] plus \begin{theorem}[Cauchy--Schwarz]\label{thm:cs}\end{theorem} lets \nameCref{thm:cs} print "Cauchy–Schwarz". If you only reference figures and equations occasionally, \autoref is cheaper. If your prose is a chain of pointers, cleveref is not decoration.

    \mathtt{Equation}\ (2.1) \quad \mathtt{Figure}\ 3 \quad \mathtt{page}\ 47
    \mathtt{Equation}\ (2.1) \quad \mathtt{Figure}\ 3 \quad \mathtt{page}\ 47

    Why the label has to stand after the counter

    The rule a \label obeys is stricter than "put it nearby". A label has no idea what it names: it records whatever \@currentlabel happens to hold at that instant, and \@currentlabel was written by the most recent \refstepcounter. Stand the label one line early and you do not get an error; you get the previous numbered object's number, in the right format, pointing at the wrong thing.

    Concretely: \caption{...}\label{fig:x} and never the other way round, because \caption is the command that steps figure; inside equation the label may stand anywhere after \begin{equation} because that already stepped equation; after \section{...}, not before it; inside enumerate it works because \item runs \refstepcounter on the list counter the environment chose (which is enumi at the first level, and \usecounter is what ties a list to a counter). The single most common silent corruption in long documents is a label placed above its caption in a figure that was moved by hand.

    hyperref adds the destination-name question on top. The name it writes is built from \theH<counter> — a macro the kernel has provided itself since the 2024 release, so that equation.4.2 is unique without hyperref inventing a parallel numbering. When two labels collide in name, the log says Destination with same id(... ) was already defined and the viewer jumps to the first of the pair. Real causes: the same label name used twice, a counter that genuinely does not advance (two \subsections inside an unnumbered environment, a theorem sharing a counter with a repeated box), or a package that steps a counter without \refstepcounter. The documented surgical fix is to make the name more specific, e.g. \renewcommand{\theHlemma}{\thechapter.\arabic{lemma}}; hypertexnames=false switches hyperref to content-derived names, which removes the warning and makes names unreadable and unstable across runs, so treat it as a last resort.

    \mathtt{??} \xrightarrow{\text{write .aux}} (4.2) \xrightarrow{\text{read .aux}} \text{clickable}
    \mathtt{??} \xrightarrow{\text{write .aux}} (4.2) \xrightarrow{\text{read .aux}} \text{clickable}
    How a LaTeX label becomes a clickable PDF destination across two compile passes SOURCE AUX FILE (written on pass 1) PDF (read by the viewer) equation environment \begin{equation} \label{eq:amp} \nabla\times B = \mu_0 J \end{equation} begin{equation} runs \refstepcounter{equation} \newlabel{eq:amp}{{4.2}{17}{}{equation.4.2}{}} field 1: number 4.2 read by \ref, \eqref field 2: page 17 read by \pageref field 4: destination equation.4.2 built from \theHequation field 3: title text for \nameref /Names /Dests tree /equation.4.2 -> [17 /XYZ null null null] one named anchor per \refstepcounter annotation on page 12 the rectangle over the ink of \ref{eq:amp} /Subtype /Link /Rect [...] /Dest (equation.4.2) styled by colorlinks / pdfborder / hidelinks click: annotation -> name -> destination -> page wrong number: the label stood before the command that steps the counter no jump: two labels produced the same destination name -> duplicate /Dest
    One label, five fields, two passes: the number and the destination name are written on the pass that sees them and read back on the pass that uses them.

    Bookmarks, metadata and headings that contain maths

    The bookmark panel is a second table of contents built from a different file. Every sectioning command issues an \addcontentsline; hyperref collects those lines into the .out file and converts them into the PDF /Outlines tree. bookmarks=false switches the panel off, bookmarksopen=true with bookmarksopenlevel=1 decides what is expanded on opening, and bookmarksdepth caps how many levels exist at all — set it to 1 for a 300-page thesis whose subsubsections would otherwise fill the panel.

    A bookmark string cannot contain maths: it is written to a file and packed into a PDF name object, not typeset. So \chapter{The $\varepsilon$-$\delta$ proof} produces garbage or, with the strictness settings of a modern hyperref, a warning about token not allowed. \texorpdfstring{<typeset>}{<pdf string>} is the escape hatch, and it must be written inside the heading: \chapter{\texorpdfstring{$\varepsilon$--$\delta$}{epsilon-delta} arguments}. The same macro is what you want in any heading that carries a \cite, a \ref or an accent that a PDF reader may not decode. Note that this is a different problem from the one the optional argument solves: \chapter[Short]{Long title} fixes the table of contents, not the bookmark.

    Unnumbered headings need a little more. \section*{Acknowledgements} writes no contents line and no destination, so the usual three-line recipe is \section*{...}, \phantomsection (create an anchor at this point), then \addcontentsline{toc}{section}{Acknowledgements}. The \phantomsection is what makes the resulting contents line clickable; without it you get an entry that jumps nowhere, and it is one of the most quietly annoying bugs in a hand-built thesis.

    Document metadata goes in the same \hypersetup: pdftitle, pdfauthor, pdfsubject, pdfkeywords, pdfcreator, pdftoolbar, pdfdisplaydoctitle=true. Put it in the preamble, not after \maketitle — the /Info dictionary is written when the last page ships out, but a title containing \today or a macro you redefine later is a title you cannot predict. Keep the braces: pdftitle = {A title with a comma, and braces}. Metadata is also the field a journal or a university repository reads first, and an empty pdfauthor is the most common reason an automated deposit check fails.

    \documentclass[twoside]{report}
    
    \usepackage[T1]{fontenc}
    \usepackage{amsmath}
    \usepackage[a4paper,inner=3cm,outer=2.5cm]{geometry}
    \usepackage[hyphens]{url}       % let \url break at each hyphen (loaded early:
                                    % hyperref would otherwise pick its own defaults)
    \usepackage{xcolor}
    
    \usepackage[breaklinks=true]{hyperref}
    \hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue!70!black}
    
    \newcommand{\printmode}{\hypersetup{hidelinks}}  % black text, links still live
    
    \begin{document}
    
    \chapter{Sources and outbound links}\label{ch:sources}
    \printmode                       % the print build swaps colours off, from here on
    
    The manual lives at \url{https://ctan.org/pkg/hyperref}; the source is on
    \href{https://github.com/latex3/hyperref}{GitHub}. A web address you would
    rather not advertise as a link still typesets correctly with
    \nolinkurl{https://ctan.org/pkg/hyperref}.
    
    \section{Jumping with your own words}\label{sec:jump}
    A cross-reference does not have to print the number:
    \hyperref[sec:jump]{this link points back at the section you are reading}.
    Targets outside the document work the same way ---
    \hyperref[ch:sources]{back to the chapter} --- and so does a file next to the
    PDF: \href{file:./data/measurements.csv}{measurements.csv}. A mail address is
    \href{mailto:student@example.org}{student@example.org}.
    
    \section*{Acknowledgements}
    \phantomsection
    \addcontentsline{toc}{section}{Acknowledgements}
    Unnumbered headings get no destination of their own, so \verb|\phantomsection|
    creates one before the table-of-contents line is written.
    
    \end{document}

    Leaving the document: href, url and the long-address problem

    Three commands cover almost all outbound linking. \href{https://example.org}{descriptive text} makes the text a link. \url{https://example.org/a?b=1&c=2} prints the address itself in a typewriter-ish style and treats its argument almost verbatim, so underscores, percent signs and ampersands inside it do not need escaping. \nolinkurl{...} prints the same thing with no link, which is what you want in a printed bibliography. For file paths in running text, \path|/usr/local/texlive| keeps the slashes but does not create a link.

    Two link schemes deserve care. file: links open something next to the PDF; they work in a desktop reader and are ignored by browser viewers, so never make essential navigation depend on one. run: links can launch a program and are blocked by most modern readers with a security prompt. mailto: links open a mail composer. Everything else should be an https: address, and hyperref will happily accept a relative one (\href{../appendix.pdf}{}) which breaks the moment somebody moves the file.

    The failure people actually hit is a long URL that refuses to break. TeX sees an address as one unbreakable box: no spaces, therefore no breakpoints, therefore an Overfull \hbox and ink in the margin. Three fixes, in ascending order of bluntness: \hypersetup{breaklinks=true} lets the annotation span several lines, which is a correctness fix rather than a line-breaking one; loading the url package with its hyphens option before hyperref makes hyphens legal breakpoints; and the xurl package allows a break after any character, which looks worse and prevents nothing. The combination breaklinks=true plus [hyphens]{url} solves most real cases, and putting a \sloppy-ish tolerance on the paragraph is a last resort.

    \underbrace{\mathtt{https://ctan.org/pkg/imakeidx}}_{\text{no breakpoint inside}}
    \underbrace{\mathtt{https://ctan.org/pkg/imakeidx}}_{\text{no breakpoint inside}}
    Inside a caption or any other moving argument, protect the command: \caption[short]{\protect\href{...}{long text}}.

    When hyperref fights back

    Conflicts with other packages are rarely hyperref's fault and almost always about who patched a command last. The four that come up in ordinary documents: beamer, which loads hyperref itself and breaks when you do it again; memoir and the KOMA-Script classes, which ship their own hyperref-aware interfaces (\hypersetup plus class options such as hyperref=... — read the class, do not fight it); subfigure, whose caption hackery predates hyperref, so move to subcaption or subfig and load them above hyperref; and the old float package's H floats combined with captions placed below the figure, which produces hyperreference ... multiplied defined style warnings.

    Footnotes are the other standing conflict. Each footnote generates two destinations (Hfootnote.1 forwards and a Hfootnote.n anchor back), so a \footnote that appears more than once — inside a \chapter whose text is also written to the table of contents — is hyperref's most reported warning, Footnote ... is multiply defined. Fix it by moving the note out of the heading, by giving the heading a short optional form, or by wrapping the maths part in \texorpdfstring; hyperfootnotes=false removes the link pairs and the warning at the price of non-clickable notes.

    Two further settings earn their keep more often than their documentation. pageanchor=true (the default) gives every page a named destination so that \pageref links land exactly; switch it off if you fight duplicate-page warnings in a document with deliberately repeated page numbers, such as roman front matter followed by arabic body. plainpages=false makes page destinations use the printed form rather than the physical page index, which is what you want when two pages both read "iii". And when a link seems to jump one page early, check whether the destination was created by \label inside a float that then floated away — that is a placement problem, not a hyperref problem.

    Finally, the debugging order that resolves most of these in two minutes: read the .log for Destination and reference warnings first, open the .aux and check the fourth field of the failing \newlabel, then compare that string against the names in the PDF viewer's link list. Those three artefacts between them account for every hyperref problem this lesson has mentioned.

    \mathtt{??} \xrightarrow{\text{write .aux}} (4.2) \xrightarrow{\text{read .aux}} \text{clickable}
    \mathtt{??} \xrightarrow{\text{write .aux}} (4.2) \xrightarrow{\text{read .aux}} \text{clickable}
    Keep behaviour options in the \usepackage list and appearance options in one \hypersetup: when the same key is written twice, the later one wins and the earlier one is what the log blames.

    Lesson cheat sheet

    One key line of code from each section — jump to it or copy it straight from here.

    Section Key code
    \underbrace{\oint_{\partial \Omega} \omega = \int_{\Omega} d\omega}_{\text{destination } \mathtt{equation.4.2}}
    \text{options} \times \text{engine} \Rightarrow \mathtt{driver = pdftex} \quad (\text{decided once})
    \documentclass[11pt,a4paper]{article}
    \mathtt{Equation}\ (2.1) \quad \mathtt{Figure}\ 3 \quad \mathtt{page}\ 47
    \mathtt{??} \xrightarrow{\text{write .aux}} (4.2) \xrightarrow{\text{read .aux}} \text{clickable}
    \documentclass[twoside]{report}

    Common mistakes

    • Loading cleveref before hyperref, or a caption package below hyperref. The symptom is references that print correctly and are not clickable, because the command was re-patched after hyperref saw it. Order: everything else, then hyperref, then cleveref.
    • Putting \label{fig:x} before \caption{...}. The label records whatever counter was last stepped, so the figure silently inherits the previous float's number and \cref politely prints the wrong noun.
    • Expecting \autoref{ex:one} to print "Exercise 2.1" for a counter you created with \newcounter. Define \newcommand*{\exerciseautorefname}{Exercise} (hyperref) or \crefname plus \Crefname (cleveref) — \autoref will also never pluralise.
    • Using \hypersetup{draft} or the class option draft "to turn off link colours". draft removes the annotations altogether, so you have traded decoration for a dead document. Use hidelinks.
    • Writing \chapter{The $\varepsilon$-delta proof} and then wondering why the bookmark is empty or the run warns about an undefined control sequence in a PDF string. Wrap it: \texorpdfstring{$\varepsilon$}{epsilon}.
    • Leaving colorlinks=true in a submission to a printer or a journal that wants no colour, or shipping pdfborder={0 0 1} and getting black boxes around every number in the printed copy.
    • Pasting a 60-character URL and accepting the Overfull \hbox. Load [hyphens]{url} before hyperref, set breaklinks=true, and only then consider xurl.

    Questions about this lesson

    Which package do I load last, hyperref or cleveref?
    cleveref last. hyperref must be the last general package because it patches existing commands, and cleveref is the one package explicitly designed to be loaded after it, since it wraps hyperref's patched \ref and \autoref. Any caption, float or language package belongs above both.
    Why are my links correct but not clickable?
    Usually because something redefined the reference command after hyperref patched it, or because the destination name stored in the .aux is not present in the PDF. Compile twice, check the fourth field of the \newlabel line in the .aux, and look for "Destination with same id" warnings in the log.
    How do I stop hyperref drawing boxes around references?
    Either \hypersetup{colorlinks=true} plus a linkcolor, or \hypersetup{hidelinks} if you want plain black text with the links still working. The boxes are PDF annotations, so they can also be hidden with pdfborder={0 0 0} while you keep the coloured text.
    Do I need autoref if I already use cleveref?
    Not in the same document. cleveref's \cref and \Cref do everything \autoref does, pluralise, and handle ranges and lists; \autoref needs a \counterautorefname for every custom counter and cannot say "Figures 1 and 2". Pick one and stay with it, because mixed conventions read as carelessness.
    How do I add the title and author to the PDF information?
    With \hypersetup{pdftitle={...},pdfauthor={...},pdfsubject={...},pdfkeywords={...}} in the preamble, after hyperref is loaded. Keep the braces around each value, and avoid macros inside them: a pdftitle containing \today is fine, one containing a fragile command is not.
    Why does my table of contents entry not jump anywhere?
    Because the heading is unnumbered. \section*{...} writes neither a contents line nor a destination, so the standard recipe is \section*{...}, \phantomsection, then \addcontentsline{toc}{section}{...}. Without the \phantomsection the entry exists but has no anchor to point at.

    Live playground: edit the LaTeX, see it render

    The preview updates as you type — break it on purpose to see how errors look.

    KaTeX error
    Try an example

    Keep reading

    Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.