# XeTeX and XeLaTeX in TeXworks editor

In TeXworks editor in the Typeset dropdown menu among others I can select XeTeX or XeLaTex typesetting formats.

If I understand correctly XeLaTex and XeTex is exactly the same thing, so why does TeXworks list them as separate options?

-

They are not the same. That is, they use the same engine, the XeTeX engine, but they are for different formats. The XeTeX option is for use when writing plain TeX, while the XeLaTeX option is for LaTeX.

The document `lualatex-doc` describes the difference between an engine and a format. I quote:

To answer this question, we need to mention a few details about the TEX world that you may usually ignore: the difference between an engine and a format. An engine is an actual computer program, while a format is a set of macros executed by an engine, usually preloaded when the engine is invoked with a particular name.

Actually, a format is more or less like a document class or a package, except it is associated with a particular command name. Imagine there is a command latex-article that would do the same as latex, except you wouldn’t need to say `\documentclass{article}` at the beginning of your file. Similarly, in current distributions, the command pdflatex is the same as the command pdftex except that you don’t need to put the instructions to load LaTeX at the beginning of your source file. This is convenient, and slightly more efficient too.

Formats are great because they implement powerful commands using the basic tools an engine provides. However the power of the format is sometimes limited by the engine’s tools set, so people started developing more powerful engines so that other people can implement even more powerful formats (or packages). The most famous engines now (except the original TEX) are pdfTeX, XeTeX and LuaTeX.

-
@egreg Didn't see your comment before I posted my answer. –  Torbjørn T. Nov 16 '11 at 15:59
And I've deleted it now that a good answer has been provided. –  egreg Nov 16 '11 at 16:02
Now it is more clear to me. So I can't run xetex if my source document contains latex commands, I need to run xelatex instead, correct? –  Maxim Nov 16 '11 at 16:13
@Maxim That is correct, for a LaTeX document, with `documentclass` and a `document` environment, you have to run `xelatex`. The same goes for pdfTeX vs. pdfLaTeX and LuaTeX vs. LuaLaTeX. –  Torbjørn T. Nov 16 '11 at 16:23