# [XeTeX] &nbsp; in XeTeX

Zdenek Wagner zdenek.wagner at gmail.com
Sun Nov 13 21:55:05 CET 2011

2011/11/13 Philip TAYLOR <P.Taylor at rhul.ac.uk>:
>
>
> Tobias Schoel wrote:
>>
>> Now, that the practicability is cleared, let's come back to the
>> philosophical part:
>
> Actually, I think this is the practical/pragmatic part,
> but let's carry on none the less ...
>>
>> Should &nbsp=u00a0 be active and treated as ~ by default? Just like
>> u202f and u2009 should be active and treated as \, and \,\hspace{0pt}?
>
> Well : a macro-based solution is certainly the best place
> to start (and to experiment) but the particular expansions
> that you have chosen are not entirely generic : \hspace,
> for example, is unknown in Plain TeX, and is therefore
> better replaced with \hskip.  Whether \hskip would then
> work happily with LaTeX, I have no idea, but it is by
> no means unreasonable to think that there might be format-
> specific definitions for each of these characters.
>>
In LaTeX \hskip does exactly the same as in plain but the question is
when this replacement should occur. It may seem that a TECkit map can
be used but this is applied after all macros have been expanded and
the horizontal list is beaing created. If you replace U+00a0 with
\hskip <skip> at that time, \hskip will be printed in the current
font. In order to insert \hskip as a token the replacement has to
occur in TeX mouth. The size of the skip, its stretchability and
shrinkability is taken from the fondimen registers of the curent font
but the TeX mouth does not know what font will be current when the
replaced U+00a0 will be processed by the TeX stomach. The mouth cannot
simply replace it with ~ becose it does not know what will be its
meaning when it is processed in the stomach.

Before typing a document one should think what will be the purpose of
it. If the only purpose is to have it typeset by (La)TeX, I would just
use well known macros and control symbols (~, \$, &, %, ^, _). If the
text should be stored in a generic database, I cannot use ~ because I
do not know whether it will be processed by TeX. I cannot use
because I do not know whether it will be processed by HTML aware
tools. I cannot even use   because the tool used for processing
the exported data may not understand entities at all. In such a case I
must use U+00a0 and make sure that the tool used for processing the
data knows how to handle it, or I should plug in a preprocessor. And I
must prepare a suitable input method how the users will enter U+00a0.
I have it on my keyboard but I am not sure whether such a key is a
common feature. If a user has to enter it using a weird combination,
he or she will not do it. Remember that a user may work remotely via
ssh or telnet with no graphics. (Even then my keyboard contains
U+00a0.)

>> Where would such a default take place:
>> - XeTeX engine
>> - XeLaTeX format
>> - some package (xunicode, fontspec, some new package)
>> - my own package/preamble template
>
> None of these ?  In a stand-alone file that can be \input
> by Plain XeTeX users, by XeLaTeX users, and by XeLaTeX
> package authors.
>
> In a future XeTeX variant (if such a thing comes to exist),
> the functionality could be built into the engine.
>
> My EUR 0,02 (while we still have one).
> ** Phil.
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>  http://tug.org/mailman/listinfo/xetex
>

--
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz