2

This question already has an answer here:

I'm trying to separate (with a vertical spacing) the word "Me" from "Prof: My professor", basically putting the latter on a new line. This works fine, but I've got a warning:

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

Should I care? How can I remove the warning, mantaining the vertical spacing?

% titlepage settings
\title[My title]{My long title}
\author[Me]{Me \vskip25pt \footnotesize Prof: My professor}
\institute{University of Foo\\My title}
\date{18 luglio 2013}

marked as duplicate by Maarten Dhondt, Henri Menke, barbara beeton, Jesse, user36296 Aug 11 '16 at 15:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Me\texorpdfstring{\vspace{25pt}\footnotesize}{} Prof: My prof might do – egreg Jul 12 '13 at 10:18
  • @egreg works fine, please answer the question, I'll accept it. Btw why should i use \texorpdfstring? – user34295 Jul 12 '13 at 10:21
7

Some tokens are not allowed in bookmarks: a \vspace command doesn't make sense in them, for instance, since bookmarks are one line only.

For coping with this problem hyperref provides \texorpdfstring that takes two arguments: the first one is for what you want TeX to typeset, the second one a substitute for the bookmark.

So

\author{Me\texorpdfstring{\\[25pt]\footnotesize}{}Prof: My professor}

should do what you want.

Another use case would be if a title contains a math formula, say

\section{A proof that $\pi$ is rational}

which would confuse the bookmarks; in that case you can type

\section{A proof that \texorpdfstring{$\pi$}{pi} is rational}

so you give a cheap substitute for the bookmark.

  • π is available in bookmarks with hyperref option unicode or pdfencoding=auto: \usepackage[pdfencoding=auto]{hyperref}...\texorpdfstring{$\pi$}{\textpi} – Heiko Oberdiek Jul 12 '13 at 10:44
  • @HeikoOberdiek Thanks. With beamer one probably has to use \hypersetup{pdfencoding=auto} or say hyperref={pdfencoding=auto} in the \documentclass options. – egreg Jul 12 '13 at 10:53

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