[XeTeX] expandable version of \char

David Carlisle d.p.carlisle at gmail.com
Sun May 4 19:11:08 CEST 2014


Would it be possible (ever:-) to add a \Uchar primitive like that in luatex?

So like \char but is expandable and returns a character token rather than a
typesetting primitive.

This would be useful in lots of situations, in particular for lowercase
constructs and encoding mapping. In classic TeX it's feasible to do these
things with explicit lists cf \alph and \Alph in LaTeX are expandable as
they don't use \uppercase or \lowercase but each have an explicit list of
"all" the letters, but there are rather a lot of Unicode letters, so that
isn't feasible in extended texs:-).  Similar issues come up while trying to
handle different encodings.

An enhanced version that also allowed you to control the catcode of the
generated character would be nice, especially if luatex added it at the
same time, but a basic \Uchar to match that in luatex would already be very
useful and make it much easier to write portable code across the two
engines (or in fact to support expandable character mapping constructs in
xetex at all).

You can almost fake \UChar"221E   with \scantokens{^^^^221e} but that
requires \everyeof to be set with a trick \noexpand to hide the end of
file, and requires ^ to have catcode 7, and you can't set those in an
expandable way, apart from the fact that scanning a fake internal file
seems a heavyweight solution to generate a single character token.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20140504/c9c1b672/attachment.html>


More information about the XeTeX mailing list