# Plain TeX and XeTeX

Will all plain TeX code also work with XeTeX?

• You may need to tighten this up a bit. As discussed in tex.stackexchange.com/questions/222286, there are some 'pathological' cases that will be different, plus any driver code may need adjustment. If you mean 'in general is plain XeTeX like plain (e-)TeX' then 'yes'. Sep 9 '15 at 11:37

The question is not really well formed as plain tex is a macro format and xetex is an extended TeX engine, but I assume you mean to compare plain Tex with the tex (or pdftex) engine, with plain tex using xetex.

Most things will work, but some things will not, such as

``````\ifx\Umathchar\undefined
hello
\else
\ERROR
\fi

\bye
``````

which typesets `hello` with pdftex and just makes an error with xetex,

or this (latin-1, ISO 8859-1) encoded document

``````\font\x=ecrm1000\x

café

\bye
``````

which typesets `café` with pdftex but with xetex typesets `caf` and warns in the log:

``````Invalid UTF-8 byte or sequence at line 4 replaced by U+FFFD.
Missing character: There is no � in font ecrm1000!
``````
• The fact that `café` prints the right character is rather a coincidence than a feature; try `straße`. Sep 9 '15 at 12:30
• @egreg well it's not a complete coincidence that some of the Cork encoding matches latin-1, although I chose my example carefully. But the question was not "will all things work in plain pdftex" it was "will things that work in pdftex work in xetex" I could have chosen an LY1/ansinew encode font which by design is closer to the input encoding if you prefer. Sep 9 '15 at 12:33