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 I load hyperref and use the \autocite{...} command within a \section{...}, my .log file reveals the following warning:

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

I wish to cite an entire section, as it will be adapted from another source (i.e., an experimental procedure).

Could someone explain this warning and how to fix it? Searching similar questions didn't lead to a solution, so forgive me if this is a duplicate.

MWE to reproduce the warning:

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{example,
  author    = {Example E. Example},
  title     = {The Complete Example Reference},
  publisher = {The Example Companies, Inc.},
  year      = {2012},
  address   = {New York},
  isbn      = {000-0-00-000000-0},
  pages     = {1--10}
}
\end{filecontents*}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\begin{document}
\section{Example\autocite{example}}
This entire section is to be cited!
\nocite{*}
\printbibliography
\end{document}
share|improve this question
    
I must confess that I can't figure out what you're trying to achieve by placing a citation to a publication (of type book, but that may be coincidental) inside a section header. Are you maybe trying to create a cross-reference to a given section? If so, why not (i) put a command such as \label{sec:ex} immediately after the \section{Example} command and (ii) use the command \autoref{sec:ex} (rather than \autocite{example}) to generate the cross-reference? –  Mico Mar 17 '12 at 0:28
    
@Mico: There's an experimental procedure (for chemistry) in my textbook on pages, for example, 1--10. I'm writing a report that uses this procedure, and as such, I need to cite the entire procedure. So the actual section in my document reads \section{Procedure\autocite{example}}. –  user2473 Mar 17 '12 at 0:35
    
That's really weird: (1) If you're quoting a procedure that you developed and never published, and that's going in your report (as a section or appendix), you should use normal cross referencing, as @mico pointed out; (2) If you are going to write about how you used a given procedure that's in a book and not in your report (it doesn't matter if you're the author or not), you should start a regular section and just write about it --- citing the original text, normally. Anyway, besides that warning, the MWE compiles fine, adding the citation mark and link to the section title. –  henrique Mar 17 '12 at 0:55

1 Answer 1

up vote 9 down vote accepted

The hyperref package produces this kind of warning when it doesn't know what to do with something that will go into one of the PDF entries. In your case, hyperref doesn't know how to put the instruction \autocite into the PDF bookmark. To prevent this situations, you can use \texorpdfstring{text to be typeset}{text for the bookmark}:

\section{\texorpdfstring{Example\autocite{example}}{A Relevant Example}}

Another option, specially useful if you are going to generate a table of contents would be to use the optional argument of \section (after all, it doesn't make much sense to have the citation mark also in the ToC):

\section[A Relevant Example]{Example\autocite{example}}
share|improve this answer

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.