# Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding)

\usepackage[bookmarks,bookmarksnumbered]{hyperref}
\hypersetup{colorlinks = true,linkcolor = blue,anchorcolor =red,citecolor = blue,filecolor = red,urlcolor = red}


I get the following hyperref warning in my logfile:

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing \<def>-command' on input line 174.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing \cnotenum' on input line 174.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing \<def>-command' on input line 174.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing \@corref' on input line 174.


But in line 174, it's just an equation:

$$\label{eq_DefP} \mathbf{P} = <\boldsymbol{p}> = <\boldsymbol{\sigma}>$$


If I comment this line, it will appear in next equation. Before this line, there are also equations but no warning appears. Can anyone help me solve this warning?

Here I put a small example:

\documentclass[final,3p,times,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage[bookmarks,bookmarksnumbered]{hyperref}
\hypersetup{colorlinks = true,linkcolor = blue,anchorcolor =red,citecolor = blue,filecolor = red,urlcolor = red}

\journal{Elesvier}

\begin{document}

\begin{frontmatter}

\title{Title}

\author[GRs]{author\corref{cor}}

\cortext[cor]{Corresponding author.}

\end{frontmatter}

$$\label{eq_DefP} \mathbf{P} = <\boldsymbol{\sigma}>$$

\end{document}


I think it's the problem of \author[GRs]{author\corref{cor}} because when I delete the \corref{cor} it will be normal. But I need this so how can I do?

• Make a small but complete example. Aug 19, 2019 at 12:17
• I put an example in the question, thanks for your comments Aug 19, 2019 at 13:23
• The author information will automatically be added to the PDF author meta data, but it does not know what to do with \corref and that macro is not in a form that hyperref can handle it. The affiliation data does not seem to be passed on to the pdf meta data, so you can probably use \texorpdfstring{\corref{cor}}{} to get rid of the \corref warning. It makes hyperref ignore the content in a PDF context Aug 19, 2019 at 13:34
• How about try using \author[GRs]{author}\corref{cor}, i.e. putting the \corref outside the braces. It works for me with the latest template. Oct 3, 2019 at 9:31
• @SyrtisMajor I thought that this was the solution, but it somehow only works if the first person is also the corresponding author. Sep 26, 2021 at 21:52

The problem is not the equation - that's only the place where the problem is reported. At the end of the first page hyperref stores the title and the author in the pdf info and then complains about the \corref in the author name.

The best is to insert it manually with pdfauthor:

\documentclass[final,3p,times,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage[bookmarks,bookmarksnumbered]{hyperref}
\hypersetup{colorlinks = true,linkcolor = blue,anchorcolor =red,citecolor = blue,filecolor = red,urlcolor = red,
pdfauthor=author}

\journal{Elesvier}

\begin{document}

\begin{frontmatter}

\title{Title}

\author[GRs]{author\corref{cor}}

\cortext[cor]{Corresponding author.}

\end{frontmatter}

$$\label{eq_DefP} \mathbf{P} = <\boldsymbol{\sigma}>$$

\end{document}

• Thanks, it works. Aug 19, 2019 at 13:45
• are you sure? Note what happens to the pdf meta data if you add \author[test]{Test Testesen} (without you addition to hypersetup) Aug 19, 2019 at 13:46
• @daleif what do you mean? The quotes and the semicolon? I did find this rather odd, that 's why I suggested pdfauthor instead of \texorpdfstring or \pdfstringdefDisableCommands. Aug 19, 2019 at 13:54
• Just that it seems it can handle multiple authors (not sure of this is hyperref or elsarticle) and that the OP might forget to update the pdfauthor information if a coauthor is added later on. That's why I suggested \texorpdfstring Aug 19, 2019 at 13:57

A similar fix to Ulrike's is reported in this answer, with an effect similar to \texorpdfstring:

\pdfstringdefDisableCommands{%
\def\corref#1{<#1>}%
}


daleif's solution works like a charm for me:

\author[add1]{Author1\texorpdfstring{\corref{cor1}}{}}
\ead{Author1@ist.edu}     % e-mail of the author

\cortext[cor1]{Corresponding author}