# xunicode expansion problem (was Re: [XeTeX] Hyphenation of "--" with tex-text mapping on)

Bruno Voisin bvoisin at mac.com
Sun Nov 27 14:08:19 CET 2005

```Le 26 nov. 05 à 13:14, Bruno Voisin a écrit :

> Thus the problem must be specific to my document, and a consequence
> of the many redefinitions I made in the preamble, or a bad
> interaction of packages.
>
> I'll look for a reduction to identify what's causing the problem.
> I'm not sure, though, that I'll be able to do that this week-end.
> Here's, otherwise, the document itself, with graphics inclusion
> commented out.

Finally it turns out I had made an extremely silly mistake: I
measured the chapter, section etc. number width, through:

\newlength{\chapnowd}
\settowidth{\chapnowd}{\normalfont\normalsize\bfseries A.9 \textendash
\ }
\newlength{\sectnoid}
\setlength{\sectnoid}{\chapnowd}
\newlength{\sectnowd}
\settowidth{\sectnowd}{\normalfont\normalsize A.9.9 \textendash\ }
[...]
\renewcommand*{\l at section}{\@dottedtocline{1}{\sectnoid}{\sectnowd}}

before setting the font and the tex-text mapping through:

\setromanfont[Mapping=tex-text]{Optima Regular}

Thus, not only the Optima font wasn't selected at the time the width
was measured, but also the translation of -- into a Unicode endash
wasn't selected as well. Which explains the difference between the
outputs when either -- or \textendash was used. Of course
xunicode.sty was in no way the culprit here.

I should have thought more carefully, or used \AtBeginDocument
{\settowidth[...]}, certainly.

I'm sorry for this mistake. I just hope I didn't waste too much of