9

I used hyperref to make bookmarks. After reading hyperref's manual, I got this example and it worked:

\section{Pythagoras:  \texorpdfstring{$ a^2 + b^2 = c^2 $}{ a\texttwosuperior\ + b\texttwosuperior\ =  c\texttwosuperior}}  

Referring to this example, I used the following but it didn't work:

\subsection{Wind load \texorpdfstring{$\mathsf{Z^{STAAD}}$ -- Direction}{Z\textsuperscript{STAAD} -- Direction}}

Is anything wrong with my code or is there any other method to include superscripts in bookmarks, or is it impossible at all?

9

hyperref needs only text to include in the PDF bookmarks. \textsuperscript expands to something that's not simple text — it contains executable TeX commands and as such can't be simply turned into a sequence of letters. You'll have to replace it with a solution that only contains regular symbols.

First approach: use ASCII characters to approximate the needed effect:

\subsection{Wind load \texorpdfstring{$\mathsf{Z^{STAAD}}$ -- Direction}%
  {Z\^STAAD -- Direction}}

Another approach would be to use Unicode superscript symbols at the risk that some PDF viewers won't have the needed font support to display this. But there doesn't seem to be an uppercase superscript letter S, so this is not applicable here.

Finally, a bit of advice if I may: don't use math, abbreviations and other non-readable things in headings unless really needed. For example, instead of

\section{Proof that $\forall n \in \mathbb N (n > 1 \implies n =
  p_1^{\alpha_1}p_2^{\alpha_2}\ldots p_k^{\alpha_k})$}

write

\section{Proof that any natural number greater than 1 can be
  represented as a product of prime numbers}
2
  • 2
    according to hyperref's manual, it supports some math in bookmark, but apparently doesn't support all math. so i take your last advice: try not to use whatever special in bookmark.
    – warem
    Mar 21 '11 at 8:33
  • @warem: That's nice to know about the math support! Mar 21 '11 at 8:37

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.