6

I have very often met the Package hyperref Warning: Token not allowed in a PDF string. Being fed up about it and curious to know what it meant, I was about to ask the n-th duplicate of that questions. Fortunately I bumped into this question just in time and solved the problem. Another question was naturally opened in the process: what are these pdf bookmarks, what is their use, and how do I make them appear in the pdf? And since I had a \cdot in a section title, is it possible to have a high dot in a bookmark, as \texttwosuperior seems to make it possible for a 2?

2
  • A pdf bookmark is basically the same thing in a .pdf file as a piece of paper (or whatever) positioned between pages of a real book: It lets you easily find some portions of content (say a figure,table,chapter, section etc.) from the bookmark view in your reader. You can add basically anywhere a bookmark with a comment like \pdfbookmark ...
    – user31729
    Apr 22, 2014 at 14:39
  • @MickG If you use either \usepackage[utf8]{inputenc} OR xelatex, you can just place the unicode char for \cdot in the text, which is U+00B7 or as a copy-paste template · Apr 22, 2014 at 15:21

1 Answer 1

5

Examples, how to generate the dots (middle and above):

\documentclass{article}

\usepackage[
  pdfencoding=auto, % or option "unicode"
  psdextra, % additional math macros are supported in bookmarks
]{hyperref}[2012/08/13]% psdextra is a quite new feature
\usepackage{bookmark}% recommended

\begin{document}
\section{middle dot: $\cdot$}
\section{U+00B7: \texorpdfstring{$\cdot$}{\unichar{"00B7}}}
\section{dot above: \texorpdfstring{\.{}}{\textdotaccent}}
\section{U+02D9: \texorpdfstring{\.{}}{\unichar{"02D9}}}
\end{document}

Result

The first \section generates warnings because of $ characters:

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

Either they can be ignored or they can be avoided by:

  • \section{middle dot: \ensuremath{\cdot}}

  • \section{middle dot: \texorpdfstring{$\cdot$}{\cdot}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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