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

Bruno Voisin bvoisin at mac.com
Thu Nov 24 16:35:02 CET 2005

Le 24 nov. 05 à 14:29, Bruno Voisin a écrit :

> A late follow-up to this thread: I've just realized that, in LaTeX  
> 2e, the recommended way of entering en- and em-dashes is through  
> the commands \textendash and \textemdash. That solves the above  
> problem (like the \Dash macro you used with plain TeX, I guess).

Using \textendash further, I've just realized a problem can occur in  
combination with the xunicode package.

With the LaTeX report class, in order to get, in the table of  
contents, adjustable space for chapter numbers etc. depending on the  
font, size, series etc. used in this table, I've defined, for  
example, a typical chapter number width:

\settowidth{\chapnowd}{\normalfont\normalsize\bfseries A.9 -- }

(the chapter numbers will appear in the form "A.1 -- " in normal  
size, normal face and bold series, with A, B, C etc. the part numbers  
and 1, 2, 3 etc. the chapter numbers), and then redefined the command  
\l at chapter (producing the chapter entry in the toc) so as to use this  
width for the chapter numbers, which amounts to replacing, in  
\l at chapter, the default:




So far so good.

If now I use \textendash instead of --, namely:

\settowidth{\chapnowd}{\normalfont\normalsize\bfseries A.9 \textendash 
\ }

things still work OK. But if I add the xunicode package on top of  
this, then it seems \textendash is not taken into account when  
\chapnowd is measured (in \settowidth), and the chapter numbers in  
the toc are superposed partly on the chapter titles.

I imagine this is caused by the way \textendash is expanded by  
\settowidth, causing the redefinition of \textendash by xunicode.sty  
to fail. How can this be avoided?

Then the subsidairy question is: why do I always have to confronted  
with bugs or features, as soon as I'm starting to use software  
seriously ;-(

For example earlier today I had problems getting correct bookmarks in  
a hyperref document where I had defined subsubsections to be  
unnumbered but to appear in the toc and bookmarks using:


This turned out to be linked with cryptic error messages such as:

Package hyperref Warning: The anchor of a bookmark and its parent's  
must not
(hyperref)                be the same. Added a new anchor on input  
line 748.

Eventually, after many unsuccessful attempts, I ended up searching  
comp.text.tex in Google groups to find a post from December 2000  
mentioning the hyperref command \phantomsection which fixed the  
problem but seems to be mentioned nowhere except inside the source  
code hyperref.sty itself.

Bruno Voisin

More information about the XeTeX mailing list