> ## Documentation Index
> Fetch the complete documentation index at: https://resources.latex-cloud-studio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LaTeX Hyperlinks with hyperref: URLs, References, PDF Links

> Learn how to create hyperlinks in LaTeX with hyperref. Add clickable URLs, internal references, table-of-contents links, and PDF metadata.

If you want clickable links in a LaTeX PDF, load the `hyperref` package. It handles external URLs, internal cross-references, bookmarks, PDF metadata, and table-of-contents links.

<Info>
  **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.
</Info>

## Minimal Setup

<Tabs>
  <Tab title="Code">
    ```latex hyperref-setup.tex theme={null}
    \usepackage[colorlinks=true,linkcolor=blue,citecolor=teal,urlcolor=magenta]{hyperref}
    \hypersetup{
      pdftitle={Project Title},
      pdfauthor={Your Name},
      pdfsubject={Technical Report}
    }
    ```
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-title">Project Title</p>
        <p className="latex-preview-meta">Author: Your Name</p>

        <hr className="latex-preview-rule" />

        <p className="latex-preview-paragraph">
          This PDF now includes colored internal links, teal citation links, and magenta URL links.
        </p>

        <ul className="latex-preview-list">
          <li><a className="latex-preview-link" href="#methods-preview">Methods</a></li>
          <li><a className="latex-preview-link" href="#results-preview">Results</a></li>
          <li><span style={{ color: "#0f766e" }}>\[12]</span> linked citation</li>
        </ul>
      </div>
    </div>
  </Tab>
</Tabs>

Load `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.

<Tabs>
  <Tab title="Code">
    ```latex external-links.tex theme={null}
    \url{https://www.latex-cloud-studio.com}
    \href{https://www.overleaf.com/learn}{Overleaf Learn}
    \href{mailto:team@example.com}{Email the team}
    ```
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-paragraph">
          <a className="latex-preview-link" href="https://www.latex-cloud-studio.com">[https://www.latex-cloud-studio.com](https://www.latex-cloud-studio.com)</a>
        </p>

        <p className="latex-preview-paragraph">
          <a className="latex-preview-link" href="https://www.overleaf.com/learn">Overleaf Learn</a>
        </p>

        <p className="latex-preview-paragraph">
          <a className="latex-preview-link" href="mailto:team@example.com">Email the team</a>
        </p>
      </div>
    </div>
  </Tab>
</Tabs>

## Internal Hyperlinks and Clickable References

Internal links usually come from labels and references:

<Tabs>
  <Tab title="Code">
    ```latex internal-links.tex theme={null}
    \section{Methods}\label{sec:methods}
    \section{Results}\label{sec:results}

    See Section~\ref{sec:methods}.
    Use \autoref{sec:results} for automatic label text.
    ```
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-section-title" id="methods-preview">1 Methods</p>
        <p className="latex-preview-paragraph">Methods content starts here.</p>
        <p className="latex-preview-section-title" id="results-preview">2 Results</p>

        <p className="latex-preview-paragraph">
          See Section <a className="latex-preview-link" href="#methods-preview">1</a>. Use <a className="latex-preview-link" href="#results-preview">Section 2</a> for automatic link text.
        </p>
      </div>
    </div>
  </Tab>
</Tabs>

If `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:

<Tabs>
  <Tab title="Code">
    ```latex phantomsection.tex theme={null}
    \section*{Appendix Resources}
    \phantomsection
    \addcontentsline{toc}{section}{Appendix Resources}
    \label{sec:appendix-resources}
    ```
  </Tab>

  <Tab title="Rendered output">
    <div className="latex-preview-shell">
      <div className="latex-preview-paper latex-preview-paper--narrow">
        <p className="latex-preview-toc">Contents</p>

        <p className="latex-preview-paragraph">
          <a className="latex-preview-link" href="#appendix-preview">Appendix Resources</a>
        </p>

        <hr className="latex-preview-rule" />

        <p className="latex-preview-section-title" id="appendix-preview">Appendix Resources</p>

        <p className="latex-preview-paragraph">
          The table-of-contents entry jumps to the unnumbered appendix heading instead of the previous paragraph.
        </p>
      </div>
    </div>
  </Tab>
</Tabs>

This ensures the PDF link points to the right place.

## Common `hyperref` Problems

* Links are not clickable: make sure `hyperref` is loaded.
* Colors look wrong: set `colorlinks=true` and choose explicit `linkcolor`, `citecolor`, and `urlcolor`.
* Link jumps to the wrong spot: use `\phantomsection` before the label for unnumbered headings.
* Package conflicts: load `hyperref` late in the preamble unless another package says otherwise.

## Related Pages

* [Cross-referencing](/learn/latex/cross-referencing)
* [Table of contents](/learn/latex/document-structure/table-of-contents)
* [Bibliography and citations](/learn/latex/bibliography-citations)
