Set PDF metadata in LaTeX (title, author, keywords)

Load hyperref and set the fields with \hypersetup: pdftitle, pdfauthor, pdfsubject and pdfkeywords. A PDF viewer shows them in the document properties.

Preamble

The snippets on this page need these lines before \begin{document}:

\usepackage{hyperref}

Title, author, subject and keywords

Put each value in braces, so a comma inside it is not read as the end of the option. Umlauts and other UTF-8 characters can be written directly.

This goes into the preamble.

\hypersetup{
  pdftitle={Measuring Wind Speed with Ultrasound},
  pdfauthor={Anna Schmidt, Jörg Müller},
  pdfsubject={Master's thesis},
  pdfkeywords={ultrasound, wind speed, sensor}
}

Open in the editor

Take title and author from the document

The package option pdfusetitle copies \title and \author into the PDF fields, so you write them only once.

Complete document:

\documentclass{article}
\usepackage[pdfusetitle]{hyperref}
\title{Measuring Wind Speed with Ultrasound}
\author{Anna Schmidt}
\begin{document}
\maketitle
Text of the document.
\end{document}
Result
The compiled example

Open in the editor

Language and the view on opening

pdflang stores the language of the text, which screen readers use. pdfdisplaydoctitle=true shows the title in the title bar of the viewer in place of the file name, pdfpagemode=UseOutlines opens the bookmark panel, and pdfstartview=FitH fits the page width to the window.

This goes into the preamble.

\hypersetup{
  pdflang={en-GB},
  pdfdisplaydoctitle=true,
  pdfpagemode=UseOutlines,
  pdfstartview=FitH
}

Open in the editor

Bookmarks from the headings

hyperref turns the headings into PDF bookmarks. bookmarksnumbered=true adds the section numbers and bookmarksopen=true unfolds all levels. A bookmark is plain text; for a heading with a formula, \texorpdfstring{formula}{text} supplies the text for the bookmark.

Complete document:

\documentclass{article}
\usepackage{hyperref}
\hypersetup{bookmarksnumbered=true, bookmarksopen=true}
\begin{document}
\section{The \texorpdfstring{$\alpha$}{alpha} particle}
Text of the section.
\end{document}
Result
The compiled example

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages