I started a document like this to avoid having to write the title and author twice:
\title{The Document's Title}
\author{My Name}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=blue,
urlcolor=black,
pdftitle={\@title},
pdfauthor={\@author},
bookmarks=true
}
I read about using \@title to insert the document's title. However, it doesn't work. Instead, my PDF's title (the text in the window bar of the PDF viewer) is now "title".
If you want a complete document which exhibits the problem for testing, you can use this:
\documentclass{report}
\usepackage{hyperref}
\title{The Document's Title}
\author{My Name}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=blue,
urlcolor=black,
pdftitle={\@title},
pdfauthor={\@author},
bookmarks=true
}
\begin{document}
Some text.
\end{document}
\@titleis the\@command followed bytitlein a document unless you use\makeatletterwhich makes@a letter – David Carlisle Oct 30 '16 at 16:57\makeatletterand\makeatother, as suggested in http://tex.stackexchange.com/a/17254/4012. But it’s easier to use the optionpdfusetitle. Essentially, this question seems to be a duplicate of http://tex.stackexchange.com/q/17218/4012, so I’d propose closing it as that? Edit: Why doesn’t tex.sx show me new comments until I submitted mine ... ? – doncherry Oct 30 '16 at 17:04