XeTeX introduced new primitives such as \Umathcode
(up to version 0.9998 called \XeTeXmathcode
, renamed for compatibility with LuaTeX) that's the Unicode analog of \mathcode
.
What does \mathcode
in traditional TeX? A declaration such as
\mathcode`+="202B
tells TeX that a +
in math mode should be treated as a binary operation symbol (leftmost byte "2
), taken from font family "0
and slot "2B
in the corresponding font. In the same vein, one can say something like
\Umathcode`∑="1 "1 "2211
or even
\Umathcode`∑="1 "1 `∑
The primitive \Umathcode
has the syntax
\Umathcode<Unicode point> = <math type> <family> <slot>
After the (optional) =
, three numbers should be given, because packing the information into a single number as done by TeX is not possible. Actually the information is still packed into a single number (in this case it's decimal 18883089, hexadecimal "1202211
), but the translation from packed number to explicit type-family-slot is not straightforward.
This will be probably accompanied by a similar declaration
\Umathchardef\sum="1 "1 "2211
so that typing $∑$
or $\sum$
will give the same result.
The unicode-math
package loads a huge list of symbols and performs assignments similar to the one for ∑
. The number corresponding to ∑
will be different, because it depends on many aspects which can't be covered in a short answer.
Actually unicode-math
does much more than this, because it sets things up so that commands such as \mathbf
or \mathrm
give the desired result.
There are other primitives corresponding to the traditional ones, namely \Umathchar
, for using a directly specified character, or \Udelimiter
for setting delimiters with normal and large variant, \Umathaccent
and finally \Uradical
for defining root symbols. See texdoc xetex
that will open “The XeTeX reference guide” by Will Robertson and Khaled Hosny.
Best Answer
XeTeX allows easy access to system fonts, but none of the standard formats (here the LaTeX format) load these. Indeed, it's not possible to save system fonts into a format: they have to be loaded when used. As such, when you run
xelatex
you get almost the same preloaded code as you do withlatex
orpdflatex
(there are a few changes to deal with assigning codes to an extended set of characters). The standard TeX fonts don't have coverage of all of Unicode, so the characters you want to print are simply not available.It's not absolutely necessary to use
fontspec
to use system fonts with XeLaTeX: you can load the font directly using the\font
primitive, which is extended by XeTeX. However, usingfontspec
makes life a lot easier. With the standard settings,fontspec
will load the Latin Modern font, which includes a lot wider glyph coverage than LaTeX 'out of the box'. It's important to note that you will see only see the glyphs that the font includes: a classic issue is that most western fonts don't cover Chinese, etc., so you need an appropriate font here.