This is my first take at XeLaTeX so maybe I’m missing something, but I figure inserting a non-breaking space (U+00A0) results in a too wide space on the PDF. I would expect the width to be the same as a normal (non extended) space, and at the least as the same as the result of the ’~’ TeX command.
Minimal working example :
\documentclass{report}
\begin{document}
\noindent
| | normal space (U+0020)\\
| | non-breaking space (U+00A0)\\
|~| \TeX non-breaking space ($\sim$)\\
| | thin space (U+202F)\\
|\,| \TeX thin space (\textbackslash,)
\end{document}
Anonymous
It depends on the font being used; unless you (or some macro package) defines it in another way, U+00A0 will simply print that character from the current font. Some fonts (rather weirdly, in my opinion) have a different width for U+00A0 than for U+0020.
What might be preferable would be to define U+00A0 as a macro, e.g.:
but of course this may depend on what other packages etc are in use.
Alternatively, try another font. For example, if I add
to your example, the widths of U+0020 and U+00A0 match as you'd expect.
Thanks, that makes sense and works indeed. I’m a bit surprised because that means TeX’s ’~’ doesn’t insert U+00A0 (I guess it just inserts some fixed-width blank space then ? Anyway that’s out of the scope of this ticket.)
Plain TeX's
~is just an active-character macro defined as\def~{\nobreak\ }, so my suggestion was simply to make U+00A0 do the same thing.Last edit: Jonathan Kew 2020-10-12