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

17.2k views Asked by At

Hey I am getting the following error

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

I've tried the following

\subsection{University of North Carolina \\ at Chapel Hill}

\subsection{{University of North Carolina} {\\} {at Chapel Hill}}
1

There are 1 answers

0
samcarter_is_at_topanswers.xyz On
  • this is a warning and not an error message

  • manually putting formatting instructions in macros like \subsection is bad style. If you want your subsections to appear in a certain way, you should redefine their appearance instead.

  • using \\ for line breaks is also bad. You shouldn't use it outside of tabular and similar environments.

  • if you really must use it, provide an alternative string which hyperref can use to create the pdf bookmarks


\documentclass{book}

\usepackage{hyperref}


\begin{document}


\subsection{\texorpdfstring{University of North Carolina \\ at Chapel Hill}{University of North Carolina at Chapel Hill}}


\end{document}