# [XeTeX] No-Break Space

BPJ bpj at melroch.se
Tue Mar 1 19:11:24 CET 2011

2011-02-20 18:03, enrico.gregorio at univr.it skrev:
> Alexander wrote:
>
>> I decided to try to replace the sign "~" in my text on the analogue of
>> the Unicode (code 00a0), and the words that are connected in such a
>> space no longer hyphenated. Is this normal? Or a feature not yet
>> implemented?
>
> The problem is that U+00A0 has zero lccode and (Xe)TeX abandons hyphenation
> whenever it finds such a character. So the solution would be to add
>
>    \lccode"A0="A0
>
> to you preamble. However, this is not a good solution, because this "space" will
> not stretch or shrink together with the other interword spaces on the same line.
> The explicit tie is way better. You can achieve the same behavior as ~ with
>
>    \catcode<NBS>=\active
>    \protected\def<NBS>{\nobreakspace{}}
>
>
>    \newunicodechar{<NBS>}{\nobreakspace{}}
>
> Here<NBS>  denotes the character U+00A0, of course and that
> character must be used.

I just realized that the solution to a problem I've had may lurk
here: I've been using interpuncts U+00B7 inside some words, and
XeTeX won't hyphenate those words.  However it's not only that I
want them hyphenated -- I don't want them hyphenated too close
to the interpunct!  Never closer than two ordinary letters and
preferably more if possible.  When there are many of those words
it gets quite annoying to insert soft hyphens by hand.

/bpj
`