Hyperref – Warning: Token Not Allowed in a PDF String (Unicode) Removing `\faLink’ on Input Line 1

hyperref

Above warning is killing me as I am not able to resolve it and it is occurring multiple times as I am using the same code through out my document. I have tried all the solution pitched in on stack-overflow but not able to resolve it.

So, ultimately I want to show a link icon in front of one of my section heading and for that I have written the following 2 lines of code:

\usepackage[pro]{fontawesome5}

\section{2020\_conf\_chau\_multiply \href{https://drive.google.com/}{\faLink}}

However wherever I am putting the above section it is giving me the above mentioned error.

Best Answer

The PDF bookmark has trouble with the special character (link symbol: \faLink). Based on

use the following as a starting point. The key is the \texorpdfstring{LaTeX Version}{PDF Bookmark Version} command. I will not comment on the topic of the usefulness of your section title :).

\documentclass{article}
\usepackage[pro]{fontawesome5}
\usepackage{hyperref}

\begin{document}

\tableofcontents

% \texorpdfstring{LaTeX Version}{PDF Bookmark Version}
\section{%
    \texorpdfstring{%
                2020\_conf\_chau\_multiply \href{https://drive.google.com/}{\faLink}%
                }{%
                Bookmark Version%
            }%
        }

\end{document}

enter image description here


Otherwise, you get the following warning:

enter image description here

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