# [pdftex] minor (old) bug?

Heiko Oberdiek oberdiek at uni-freiburg.de
Fri Feb 11 12:43:58 CET 2005

Hello Ross,

On Fri, Feb 11, 2005 at 08:01:46AM +1100, Ross Moore wrote:

> This is fine, for this particular command.
> But there is the general mechanism provided by
>    \pdfstringdefPreHook
> to fix this kind of problem;
> viz.
>
> \def\pdfstringdefPreHook{%
>   \def\textcolor##1##2{##2}%
>   \let\textit\relax
>   \let\rm\relax
>   ...
>   ...  similar re-definitions ...
>   ...
>   def\sin{ sin}%
>   def\cos{ cos}%
>   ...
> }
>
> This allows you to specify exactly what string should appear
> within a bookmark, when the usual expansion of a macro would
> produce a lot of other tokens that are not relevant.

Yes and no. \pdfstringdefPreHook is a hook, its content
should not be overwritten. For example, a package wants to
provide bookmark replacements for its macros, then a
redefinition of \pdfstringdefPreHook in this way will
overwrite the previous settings.

Therefore hyperref offers the macro \pdfstringdefDisableCommands
that appends the stuff to the hook:

\pdfstringdefDisableCommands{%
% \textcolor can have an optional argument!
\def\textcolor##1##{\@secondoftwo}%
% ...
}

> allows for fonts, colours and styled text within bookmarks.
> Is there any effort underway to provide support for this
> within hyperref ?

Yes. I have started the rewriting of the bookmark organization
stuff in order to support more features and other improvements.
I hope to find the time to finish it before EuroTeX.

> It would be neat to have proper math-symbols appearing
> in the bookmarks, especially for section-headings, etc.

A very limited set of glyphs are available in PDFDocEncoding.
Unicode provides a larger range in theory, also some mathematics.
But in praxis I am working under Linux and here the pdf viewers
(AR5/Linux, xpdf 3) are not able to display unicode characters
except for some at the beginning (PDFDocEncoding characters).

Anyway, writing code for converting arbitraty TeX math to
Unicode is not done with some few lines.

Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
--