[XeTeX] hyphenating words with hyphen

Jonathan Kew jfkthame at googlemail.com
Tue Oct 6 13:47:57 CEST 2009


On 6 Oct 2009, at 00:11, Vadim Radionov wrote:

> Dear all,
>
> I'm missing this important detail in the manuals: what is the natural
> way to get words with hyphen hyphenated in other places than that
> hyphen?
>
> I tried
>
> \XeTeXinterchartokenstate 1
>
> \XeTeXcharclass `\- 150
> \XeTeXinterchartoks 150 0 = {\nobreak\hskip0pt}
> \XeTeXinterchartoks 0 150 = {\hskip0pt}
>
> and it works almost well -- except for, surprisingly, allowing a break
> *before* the hyphen.

That's not surprising: before the hyphen (class transition from 0- 
 >150), you have an \hskip. After it (150->0), you have \nobreak 
\hskip, so you won't get a break there -- though you might get one  
anyway because of the discretionary node that's automatically inserted  
after the hyphen.

I think you want

> \XeTeXinterchartoks 0 150 = {\nobreak\hskip0pt}

to ensure that the \hskip before the hyphen is never taken as a  
possible breakpoint.

(BTW, it would be better to use \newXeTeXintercharclass rather than  
picking an arbitrary number...)

JK



More information about the XeTeX mailing list