[XeTeX] XeLaTeX and SIunitx(in a way OT)

Bruno Le Floch blflatex at gmail.com
Mon May 14 09:08:59 CEST 2012


> In a style file would say TeX barf if it contained utf-8 characters even if
> I have them in a conditional sothat the are not processed by the engine
> just parsed?

I believe that it would be ok if you use the actual bytes ^^c3 and
^^b5 in the file.

The reason is that pdfTeX only makes (most) code points from 0 to 31
invalid (?), and those only appear in the utf-8 encoding of the
Unicode code points 0 to 31, which you are probably not using in your
files (except 9, 10, 13, which are ok for pdfTeX).

On the other hand, if you want to use the ^^ notation, for pdfTeX (set
up with the appropriate inputenc option) you'd need to use the eight
characters ^, ^, c, 3, ^, ^, b, and 5 (that'd give you à and µ in
[Xe/Lua]TeX), whereas for the other two engines you'd need either ^^b5
or ^^^^00b5.  In this last case of the ^^^^ notation, pdfTeX will
choke even if it appears in the unused branch of a conditional.

Now, why would anyone use the ^^ notation? Because it is most robust
against encoding changes since we then only use ASCII characters.
Using utf-8 encoded characters directly is only good if you stick with
utf-8 (which I'd advise).

So I'd say my impression is that the best is to use ^^^^xxxx, but in a
separate file, loaded for the luatex or xetex engine.  Three other
options:

* Keep one file, work in a group, and use \catcode`\^^^=9 for the
pdftex engine before any ^^^^xxxx appears.

* Put the pdfTeX-specific commands first in the file, and
conditionally \ifpdftex \endinput \fi, then anyhing can appear later
in the file.

* Use \char"00b5, which only works if your font is encoded in a
sensible way IIRC.

Hope that helps (and is correct),
Bruno



More information about the XeTeX mailing list