# Why does XeTeX differ from pdfTeX?

I understand that XeTeX was written to handle UTF-8 input better than pdfTeX. However, it seems to process documents in a slightly different way. That is, documents that don't use special fonts or need UTF-8 encoding still compile differently from the two engines.

This site contains many questions along the lines of "How do I get XeTeX to do xyz ?", where xyz is something that works fine with pdfTeX. I understand that XeTeX and pdfTeX do handle internals differently; my question is "Do they have to?" Is it possible to have XeTeX handle fonts/input differently, but once this is accomplished, it handles everything else exactly the same way as pdfTeX? Or is the issues of input encoding and fonts so fundamental that things necessarily have to be different, and workarounds must constantly be made to match outputs from the different engines?

-
if you want a unicode aware tex that is closer to pdftex you should probably look at luatex. luatex extends the pdftex base but xetex extends the classic (dvi) tex base and then uses a dvi driver to generate pdf. –  David Carlisle Feb 8 '13 at 14:38
Can you give a minimal example of a document that compiles differently? –  egreg Feb 8 '13 at 15:04
In terms of "plain text," no (although I seem to recall reading somewhere that the line-breaking algorithm between the two is slightly different.) Graphics seem to be handled differently. The `crop` command of `\includegraphics` in `graphicx` package doesn't seem to work; the `spy` library of `tikz` doesn't work. These are two that I've run into recently and part of what spawned the question. –  GregH Feb 8 '13 at 15:20
@GregH The crop issue is solved, and an updated `xetex.def` should be emerging soon to solve it :-) –  Joseph Wright Feb 8 '13 at 15:32
The answer is simple, your first sentence is wrong, XeTeX was not written to do anything better than PDFTeX; XeTeX is a desendant of TeXGX which was first released in 1996 and was never based on PDFTeX. –  Khaled Hosny Feb 8 '13 at 17:52
show 4 more comments