[XeTeX] hyperref bookmark problem

Jonathan Kew jonathan at jfkew.plus.com
Mon Oct 27 12:07:40 CET 2008


On 27 Oct 2008, at 10:38 AM, Dohyun Kim wrote:

> Hi,
>
> Compiling the following code with xelatex renders incorrect character
> in bookmark pane:
> the ligature character of `--' is broken.

In this situation, xelatex is behaving correctly. Your data does not  
contain an en-dash, it contains two hyphens, and that's what goes into  
the PDF bookmark. The fact that those two hyphens are printed via TeX  
as a dash (using a ligature in "classical" TeX fonts, simulated by the  
tex-text mapping in this case) does not have any effect on what goes  
into the bookmark, which is simply the actual character data.

>
> On the other hand, if I load hyperref package with [unicode] option,
> `--' character becomes well displayed in bookmark; but now Korean
> characters are broken.

I don't know much about hyperref but I assume this option tries to  
replace certain "special" TeX characters with Unicode equivalents, and  
it recognizes the -- ligature. But I'm not surprised it fails to  
handle the Korean correctly, as it was not designed for a fully  
Unicode-based engine.

>
>
> Please inspect the problem.
>
> ----------
> \documentclass{article}
> \usepackage{fontspec}
> \setmainfont[Mapping=tex-text]{UnBatang} % UnBatang is a Korean
> truetype font shipped with many linux distributions.
> \usepackage{hyperref}
> \begin{document}
> \section{1997년--2001년}
> \end{document}
> ----------

How about using an actual en-dash in your source?

> \section{1997년–2001년}


I would expect this to pass through to the PDF bookmark correctly. Or  
if you load the xunicode package, it might work to use \textendash  
instead.

Alternatively, just accept that PDF viewers don't generally implement  
the TeX convention of displaying -- as a dash, so it's a case of "what  
you see is what's really there"!

JK



More information about the XeTeX mailing list