Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When compiling a beamer presentation and using the following \author command

\author{Name \\ \texttt{my.email@domain.com}}

I get the following hyperref warning in my logfile

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\\' on input line 15.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\new@ifnextchar' on input line 15.

I understand that this has to do with hyperref setting the PDF metadata, where the linebreak does’t make much sense and should be removed.

Trying to set

\hypersetup{pdfauthor={Name}}

does’t change the situation, seems like hyperref is still looking at the author command.

How do I get the desired display of author name with email and still keep hyperref happy?

share|improve this question
    
Other packages may be causing this issue if you switch to use texorpdfstring as Ulrich answered. The culprit for me was the breqn package. –  Oleg Vaskevich Mar 18 at 3:19
add comment

2 Answers 2

up vote 41 down vote accepted

There's the aptly, if verbosely, named macro \texorpdfstring, which takes two arguments and uses the first for (La)TeX and the second for pdf, so something like

\author{A.U. Thor\texorpdfstring{\\ foo@bar.baz}{}} 

should work.

(Yes, I've avoided the issue that I don't know off the top of my head if \url is allowed to go inside another argument...)

share|improve this answer
    
Thanks, Ulrich, this works. –  Nickolay Kolev Feb 8 '11 at 8:18
1  
Sorry, my previous post is wrong. I deleted it. \url is OK, and I think it should be used. Or \protect\url, if any error occurs. –  Leo Liu Feb 8 '11 at 8:32
    
Yes, there shouldn't be trouble, at least not until you have %xx-escaped characters, stuff like that. –  Ulrich Schwarz Feb 8 '11 at 10:46
add comment

One can also add

\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{naturalnames}{hyperref}

before \documentclass{beamer} to remove many messages generated due to national (non-English) section titles, like

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\PD1\cyrn' on input line 33.

P.S. Usually one may get up to few thousands of those even for a simple presentation, and parsing of them takes few extra seconds for many IDEs even on a modern box.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.