12

I'm compiling my LaTeX using pdflatex and would like to have some pdfinfo integrated into the resulting file. Alas, this doesn't seem to be working, though I am using the same code which has worked in the past.

The header of my source is below:

\documentclass[twocolumn]{article}
\usepackage{tikz}
\usepackage[numbers]{natbib}
\newcommand{\final}{1}
\usepackage[colorlinks,linkcolor=black,anchorcolor=black,citecolor=black]{hyperref}
\usepackage{fancyhdr}
\usepackage{abstract}

\title{Zombie Paranoia in the Bronx: A Study in Psychosocial Perceptions \\ Draft}

\author{{\bfseries John Smith$^a$} \\
{\footnotesize $^a$Ecology, Evolution, \& Behavior, University of Queens, USA \emph{smith@uoq.edu}}\\
}
\date{}

\pdfinfo
{ /Title (Zombie Paranoia in the Bronx: A Study in Psychosocial Perceptions)
  /Author (John Smith)
%  /CreationDate (D:YYYYMMDDhhmmss) % this is the format used by pdf for date/time
%  /Subject (...)
%  /Keywords ()
}

Any thoughts?

David Carlisle
  • 757,742
Richard
  • 5,723

3 Answers3

22

This is caused by the hyperref package. It's not needed in your example, so you could just delete it. However, if your whole document does need hyperref, you can use \hypersetup to include the information.

\documentclass[twocolumn]{article}
\usepackage[colorlinks,linkcolor=black,anchorcolor=black,citecolor=black]{hyperref}
\title{Zombie Paranoia in the Bronx: A Study in Psychosocial Perceptions \\ Draft}
\author{{\bfseries John Smith$^a$} \\
{\footnotesize $^a$Ecology, Evolution, \& Behavior, University of Queens, USA \emph{smith@uoq.edu}}\\
}
\date{}
\hypersetup{pdfinfo={
Title={Zombie Paranoia in the Bronx: A Study in Psychosocial Perceptions},
Author={John Smith}
}}
\begin{document}
abc
\end{document}

Have a look at section 3.7 of the hyperref package manual for more information.

David Carlisle
  • 757,742
Ian Thompson
  • 43,767
  • Your answer's just what I need, Ian, though I wish it had the full range of options shown in amorua's answer. Of course, there are a great many options and your link brings me to them. Thank you :-) – Richard Mar 15 '12 at 05:51
  • Ran pdflatex with these contents, but OSX Preview 5.0.3 still shows just the document name as the sidebars top level TOC item. Isn't this exactly what pdfinfo Title should change? – Jukka Dahlbom Apr 03 '13 at 14:04
  • Note that pdfinfo={ is more powerful, because you can create custom metadata entries, such as Copyright or Source, while the variant of using pdfauthor= etc. has limited entries (see all possible entries in @amorua's answer) – loved.by.Jesus Oct 16 '20 at 17:47
  • Can we somehow detect if hyperref is loaded and have a solution which works for both cases without commenting/uncommenting depending on if we decide to load hyperref? – bliako Aug 30 '23 at 11:04
  • @bilako --- \ifdefined\hypersetup WHATEVER \else WHATEVER ELSE \fi – Ian Thompson Sep 01 '23 at 09:34
15

Indeed \pdfinfo does not work in combination with hyperref

Try the following

\hypersetup{pdfauthor={Author},%
            pdftitle={Your Title},%
            pdfsubject={Whatever},%
            pdfkeywords={one, two},%
            pdfproducer={LaTeX},%
            pdfcreator={pdfLaTeX}
}
amorua
  • 1,928
5

If I try typesetting your input and preview it with Skim, the Author and Title info are as you want, but not with Adobe Reader. If instead I write

\hypersetup{
  pdfinfo={
   Title={Zombie Paranoia in the Bronx: A Study in Psychosocial Perceptions},
   Author={John Smith},
  }
}

then also Adobe Reader shows the desired data.

egreg
  • 1,121,712