[XeTeX] hyperref bookmark problem

Dohyun Kim nomosnomos at gmail.com
Mon Oct 27 18:36:04 CET 2008

2008/10/28 Peter Dyballa <Peter_Dyballa at web.de>:
> Am 27.10.2008 um 16:51 schrieb Dohyun Kim:
>> See also the ChangeLog of hyperref package:
>> 2008-09-29  6.78l  Heiko Oberdiek
>>     * 6.78l
>>     * Bookmarks: `--' and `---' are automatically replaced by
>> \textendash
>>       and \textemdash in bookmark strings.
> This does not seem to be true – or XeTeX stops this conversion. You
> should contact Heiko Oberdiek!

I do not think it's a problem caused by hyperref.
If you want to create a pdf file, you should honour pdf specification,
which hyperref conforms to.

Anyway, here's a quick and temporary workaround written in perl:
use strict;
use warnings;

my $infile = $ARGV[0] or die "usage: $0 <jobname.out>\n";

my (@PD1,$pd1file);
$pd1file = `kpsewhich pd1enc.def`;
chomp $pd1file;

open my $fh,$pd1file or die;
while(<$fh>) {
and $PD1[$1] = $2;
close $fh;

my $tmpfile = $infile.".tmp";

open $fh,$infile or die;
open my $tmp,">",$tmpfile or die;
binmode $fh,":utf8" ;
binmode $tmp,":utf8" ;
select $tmp;
while(<$fh>) {
        s/\\(\d\d\d)/chr hex $PD1[$1]/ge;
close $fh;
close $tmp;

rename $tmpfile, $infile or die;

Between first and second running of xelatex, issue command as follows:

shell prompt$  perl tempscript.pl test.out

Dohyun Kim

More information about the XeTeX mailing list