TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the hyperref and the bookmark package. Hence the table of content (toc) of the document gets also displayed in the side bar of the PDF reader, when viewing the generated document.

My problem is now that I have mathematical expressions in the headlines of some sections, which then are of course not properly displayed in the toc at the side bar of the PDF viewer. For instance the entry

header example

in the documents table of content gets displayed as

header example 2

in the side bar of the PDF viewer. I know that it is not possible to have the correct mathematical expression written there, but I would for instance like to have X_VIII instead of XVIII.

Another problem i have is that in some headers I added a \vspace{8pt}, and sadly the 8pt is then displayed in the side bar of the PDF viewer:

header example 3

Therefore my question: Is there a way to manually specify the text to appear in the side bar of the PDF to each section/subsection, etc.?

share|improve this question
up vote 4 down vote accepted

Apart from that \vspace should not be used in section titles (they also go into the table of contents and the headers), it can be disabled using \pdfstringdefDisableCommands in the bookmarks.

The mathematical expression is more difficult. Switching to Unicode for the bookmarks helps, because PDFDocEncoding is quite limited. But there are no subscripts for capital letters V and I, only lowercase letters and I could not found an uppercase \mathcal{X}, only


That looks at least close. A different representation for the bookmarks can be provided by \texorpdfstring inside the bookmarks:

\usepackage{amstext}% or amsmath

% disable \vspace in bookmarks



\section{Second section}
\subsection{First subsection}
\subsection{Second subsection}
\subsection{The state space
    X\textunderscore VIII%



If \vinferior or \iinferior are not used, then also an older hyperref will do. Option psdextra in the newer hyperref allows the abbreviation \vinferior and \iinferior instead of \textvinferior and \textiinferior.

share|improve this answer
Thanks for your great help! The disabeling of the \vspace in the bookmarks worked just fine, thx. I however do not seem to have the state of the art version of the hypereff package, since it does not know the psdextra option. So I didn't bring this to work yet and first have to find out how to upgrade the package. I will reply again if I have managed this. Or can you maybe tell me how I do that? (I am on a Mac and have MacTex 2011 and Texive-2011 installed.) – Britzel Sep 17 '12 at 15:07
The second version replacement string X\textunderscore VIII also works for older hyperref versions. – Heiko Oberdiek Sep 17 '12 at 15:14
Without the \texorpdfstring command it is displayed the right way in the viewer, but also displayed with an underscore in the toc itself, which shouldn't be. With the \texorpdfstring command I get an error. The used codeline is \addcontentsline{toc}{subsection}{\numberline{2.3}{\sf \hspace{-34.5pt}The state space \texorpdfstring{$\mathcal X$\textunderscore VIII}}}. Probably I am doing something wrong here. – Britzel Sep 17 '12 at 17:15
\texorpdfstring has two arguments, see the example in the answer. It is also explained in the manual of hyperref. – Heiko Oberdiek Sep 17 '12 at 17:42
Sorry, I was cross eyed! It works fine now :). Thanks a lot! – Britzel Sep 17 '12 at 21:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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