Monday, April 11, 2011

Removing garbage from the pdf bookmarks

In the process of generating proceedings for the Workshop on Intermediate Representation, I explained previously how to include pdf pages and I mixed this with a technique so that the titles are aligned on the left and the authors on the right (see adjusting paragraphs).
Since I also wanted slightly different colors (red!40!black for the title, and blue!60!black for the authors), all this ended up in the bookmark section of the pdf file:

red!40!black Tirex: A Textual Target-level...Exchangeto 1em. to 0pt

And this for all included files.

I have to yet worked out a clean way to get rid of this garbage, but I found that bookmarks are saved by the hyperref package in the .out file, which contains lines like the following:

\BOOKMARK [0][]{chapter*.3}{red!40!black \040Tirex: A Textual 
Target-Level Intermediate Representation for Compiler Exchangeto 
1em. to 0pt to 1em. blue!50!black \040Artur Pietrek, Florent 
Bouchez and Benoit Dupont De Dinechin}{}

So the obvious trick is to clean this .out file save it and backup it.

\BOOKMARK [0][]{chapter*.3}{Tirex: A Textual Target-Level 
Intermediate Representation for Compiler Exchange -- Artur 
Pietrek, Florent Bouchez and Benoit Dupont De Dinechin}{}

Then, run again pdflatex once. This is important since the first run will erase the .out file and replace it with a file with garble again.

This produces the expected result, with a clean index bookmark in my pdf. However, I would prefer a cleaner way to perform this. This is probably possible in the hyperref package, but the difficulty will likely come from the interaction with pdfpages.