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:

\newlength{\chapnowd}
\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:

\setlength{\@tempdima}{2.2em}

by:

\setlength{\@tempdima}{\chapnowd}

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:

\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{3}

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  
<http://groups.google.com/group/comp.text.tex/browse_thread/thread/ 
5f5632c9cdd5f2a2/9689fc0b4365dc53?q=Package+hyperref+Warning%3A+The 
+anchor+of+a+bookmark+and+its 
+parent's&rnum=1&auth=DQAAAGQAAABbYvlv0bjyVsORMqk5DWQJPUIgz6rUiAmaexfov1 
qCaq9n7yLl9gZeBVehQSfpYehFUFk-aOmzdEWN_-mDS6- 
wfaKXa60w1HS0XHL6N4IgKpAKs7V9LRYHRcgBzAk_Wqr7HhMw1x3GqWcim_Jgs9Yh>,  
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