Hi,
On 21 Apr 2021, at 23:09, Jano Kula
wrote: On Wed, Apr 21, 2021 at 8:37 PM Hans van der Meer
wrote: Why tilde is displayed?
Wouldn't the simple answer not be: because XML is not TeX?
You are never going back to “TeX mode”: the preprocessor converts XML into *other* XML. And tilde in XML is just that: the ascii tilde glyph.
I still would expect unicode nbsp to be expandable,
I agree with that, but for fine-tuning XML output I would use a trick like this: \startluacode function lxml.preprocessor(data) return string.gsub(data, " ", "<nbsp/>") end \stopluacode \startxmlsetups xml:name ... \xmlsetsetup{\xmldocument}{document|nbsp}{xml:name:*} \stopxmlsetups \startxmlsetups xml:name:nbsp \penalty10000\hskip .3em plus 2em % or something, just a wild example. \stopxmlsetups Using an xml element would also allow your code to ‘look around’ to make sure all is well with its (typesetting) environment. Best wishes, Taco — Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)