# Make hyperref take pdfinfo from \title and \author

I once read about an option for `hyperref` that automatically takes the info provided via the standard `\author` and `\title`, and puts it into the `pdfinfo`. Now I want to implement it in my template and can't find it anywhere in the `hyperref` manual nor anywhere else.

(A similar, but more general question: Is hyperref really the best way to add metadata to a TeX file?)

-

The option is `pdfusetitle`. It is described in the hyperref README file.

-
Ah, that's where I saw it, thanks! For some reason it only seems to work as `\usepackage[pdfusetitle]{hyperref}` and not as `\hypersetup{pdfusetitle}` though. –  doncherry May 2 '11 at 22:11
@doncherry: Yeah, a few options are like that. I suppose they require special arrangements to be made at load time... –  SamB May 3 '11 at 3:58
As of April 2012, this option is not described in the hyperref manual. Any reason for that? –  Olivier Jul 7 '12 at 10:13

You could also use

`````` \makeatletter
\hypersetup{pdftitle={\@title},pdfauthor={\@author}}
\makeatother
``````

(edit: makeat* pointed out by Joseph Wright)

-
This needs `\makeatletter`, of course. –  Joseph Wright May 3 '11 at 11:27
This might be a nice alternative if `pdfusetitle` fails -- the readme says it "tries to derive the values", so a failure for whatever reason apparently can't be excluded. –  doncherry May 3 '11 at 15:18
@Joseph: Would `\makeatletter` be called before (and `\makeatother` after) `\hypersetup{...}` or separately for each argument? Considering that I have up to nine or ten arguments for `\hypersetup` and considering how mighty and thus dangerous `hyperref` is, it might cause conflicts if placed around the entire command? –  doncherry May 3 '11 at 15:23
@doncherry: `\makeatletter` before `\hypersetup` and `\makeatother` after it. –  Joseph Wright May 3 '11 at 15:37