# Questions regarding the distinction between XeTeX and XeLaTeX and how they relate to TeX and LaTeX? [duplicate]

Briefest possible version of the question (after having seen comments):

Is the only distinction between XeTeX and XeLaTeX that the commands xetex and xelatex are differently compatible with TeX and LaTeX formatted documents?

That is, the XeTeX and XeLaTeX typesetting engines are actually the same, and that both xetex and xelatex are commands that are part of these engines, and those commands differ.

What are the main differences between XeTeX and XeLaTeX? Are they just the analogous differences between TeX and LaTeX, where the former is a typesetting engine along a basic set of macros(plain-tex) and the latter is a more comprehensive set of macros?

Does XeTeX contain LaTeX macros? On the XeTeX webpage, it seems to suggest this, saying

XeTeX is now part of the standard TeX distribution TeX Live and works well with TeX macro packages like LaTeX and ConTeXt.

If so, do they need to be specially invoked when using XeTeX to process your document?

Additionally, if LaTeX is already "included" in some sense in XeTeX, then what is different in XeLaTeX? I.e., are XeTeX and XeLaTeX identical?

Are the maintainers XeTeX the same as the maintainers of XeLaTeX? If so where can one find information about this (note it is not included in either the TUG linked reference on XeTeX nor the XeTeX webpage)?

Are there any packages that are supported by XeTeX that are not supported by XeLaTeX? Are those the same packages that are supported by TeX but not LaTeX?

Are there any packages that are supported by XeLaTeX that are not supported by LaTeX? Are those the same packages that are supported by LaTeX but not TeX?

Is XeTeX structured such that updates to the TeX or LaTeX codebases are automatically incorporated?

Is XeLaTeX structured such that updates to TeX or LaTeX codebases are automatically incorporated?

As anticipated this was flagged with being a duplicate, it includes many other aspects than previous questions had(e.g., asking about the maintainers of XeLaTeX), and I made prefatory remarks about how it is different. If you think this is a duplicate, please read below.

A similar question has actually been asked before, but it was listed as a duplicate with a pointer to a question that does not actually answer the original question regarding the difference between XeTeX and XeLaTeX. I am new to TeX. Should I use LaTeX, XeLaTeX, ...? answers a question about which typesetting engine would be most useful to begin with as a new user. The distinction between XeTeX and XeLaTeX is not written anywhere; in fact, XeTeX and XeLaTeX do not even appear in the same sentence or even in the same paragraph.

An answer that would seem to almost hold exists in a different question (XeTeX and XeLaTeX in TeXworks editor), but it actually seems to not be accurate, as it claims XeTeX cannot be used when writing in the LaTeX format. It may be the options in the TeXworks actually follow this convention, even though the xetex command when run on the command line would itself be capable of processing LaTeX formatted documents.

I have looked for a long time today trying to find an answer to this, which I would then have just written up as a blog post, but I can't find anything definitive.

Before flagging this as a duplicate, please consider the following:

• It is not obvious that XeTeX and XeLaTeX bear a relationship like TeX and LaTeX to one another, even if that is the case. For example, BibTeX and BibLaTeX also share this naming convention, but the difference between them is not the same as the difference between TeX and LaTeX.
• If you look in many questions and answers about XeTeX or XeLaTeX, the two terms are used as if they can be exchanged freely (which surely is not the case with TeX and LaTeX). Indeed, the question author in XeTeX and XeLaTeX in TeXworks editor states this assumption explicitly.
• The webpage for XeTeX says nothing about the relation between XeTeX and XeLaTeX, much of the documentation about XeTeX only obliquely mentions xelatex the command if it mentions XeLaTeX at all, and XeLaTeX does not seem to have a webpage of its own.
• I'm guessing this is searched often enough that having the answer tied to a question that matches people's expected search terms will be useful for many. Even if questions about TeXWorks and "which engine should a new user use" answered this (and as noted above, they don't) they will not be what people search to find this answer.

## marked as duplicate by Mico, David Carlisle, Svend Tveskæg, Martin Schröder, touhamiFeb 29 '16 at 21:58

• I'm sure this is a duplicate I'll find something but the relationship between tex and latex is the same as the relationship between xetex and xelatex, tex, pdftex, xetex, luatex, are all tex-like engines and the same latex sources may be used with them to produce laetx, pdflatex, xelatex and lualatex respectively – David Carlisle Feb 29 '16 at 21:07
• the command xetex will run xetex with the plain tex format which will fail with latex documents in exactly the same way as plain tex with classical tex does, – David Carlisle Feb 29 '16 at 21:13
• Eight questions in one! – musarithmia Feb 29 '16 at 21:17
• @mpacer - This site works best if a posting raises exactly one main question or issue. Your posting raises a whole bunch of (not-all-that-clearly-structures) questions. The three links I provided in my earlier comment should address virtually all of your questions. However, I will agree that there's probably not one single posting out there that answers all of your questions in the exact same order as you've posed them. – Mico Feb 29 '16 at 21:18
• Off-topic: People may mind here that there are answers to your other questions but you did not accept them (No, I am not one of the users who answered one of them) ;-) – user31729 Feb 29 '16 at 21:27

## tex

tex is an executable file--a runnable program. By default it has the Plain TeX format preloaded, so when you run tex file.tex it is prepared to read macros defined in plain.tex. It produces DVI output.

## pdftex

pdftex is another version of the tex executable that includes certain extensions to the original program (the e-tex extensions, including additional memory registers). By default this produces PDF output directly instead of DVI. It also has the Plain TeX format preloaded.

## latex

The command latex calls the pdftex program (or "engine") but with the LaTeX format preloaded instead of Plain TeX, and set to produce DVI output.

## pdflatex

The command pdflatex calls the pdftex engine but with the LaTeX format preloaded instead of Plain TeX, and set to produce PDF output.

## xetex

xetex is a different executable file from tex and pdftex. It includes extensions to the original program to allow Unicode input and right-to-left typesetting, among other features. By default it has the Plain TeX format preloaded and produces PDF output.

## xelatex

The command xelatex calls the xetex engine but with the LaTeX format preloaded instead of Plain TeX and produces PDF output.

## luatex

luatex is yet another distinct executable file, a partial reimplementation of tex that incorporates the lua scripting language. Like xetex, luatex is built to accept Unicode input. It has the Plain TeX format preloaded and produces PDF output.

## lualatex

The command lualatex calls the luatex engine with the LaTeX format preloaded instead of Plain TeX, and produces PDF output.

## Examples

Plain TeX format

You can successfully compile this Plain Tex file with either tex, pdftex, xetex, or luatex:

Test of Plain \TeX.\bye


Plain TeX format with Unicode input

If you use Unicode characters, you will only be able to print those characters by running xetex or luatex and selecting a font that includes them:

\font\tenrm=ecrm1000 \rm
Test of Unicode with Plain \TeX: Matthäuspassion, esdrújulo.\bye


LaTeX format

To compile a LaTeX document, use latex, pdflatex, xelatex, or lualatex:

\documentclass{article}
\begin{document}
Test of \LaTeX.
\end{document}


LaTeX format with Unicode input

If you use Unicode characters, you can print them in two ways:

1. use pdflatex and set the proper input and font encoding using inputenc and fontenc packages, or
2. use xelatex or lualatex and select a Unicode font using the fontspec package.

For pdflatex:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
Test of Unicode with \LaTeX: Matthäuspassion, esdrújulo.
\end{document}


For xelatex or lualatex:

 \documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\begin{document}
Test of Unicode with \LaTeX: Matthäuspassion, esdrújulo.
\end{document}

• there's also "etex" which contains the extensions to registers. (it seems to be included in tex live.) pdftex adds the pdf output. – barbara beeton Feb 29 '16 at 22:11
• This is much better than my attempt at answering. The only thing that I think would make it better is a further clarification about the meanings of the terms when discussing XeTeX and XeLaTeX, where they are often interchanged without anyone mentioning the distinctions between format files and typesetting engines. This interchanging probably doesn't happen with the commands xetex and xelatex because that kind of ambiguity isn't possible on the command line. – mpacer Feb 29 '16 at 22:14
• @mpacer There is really only one program, xetex. The program checks the command with which it was called (in the C programming language, this would be argv[0]), and if it is xetex it uses Plain, and if it is xelatex it uses LaTeX. There is no "XeLaTeX" format, just LaTeX format. – musarithmia Feb 29 '16 at 22:21
• @AndrewCashner Is that why xetex --ini latex.ltx is sufficient to generate the non-existing "XeLaTeX" format file xelatex.ini? – mpacer Feb 29 '16 at 22:23
• You can also compile accented characters without XeTeX, TeX is capable of it if you use the same encoding for font and file. In your example you used the font ecrm1000, it would be able to compile if you save the file with Latin 1 encoding. – Brian Mayer Mar 1 '16 at 4:51

I don't know if this is a complete answer, but based on the comments on this question so far, some parts of the answer are starting to form.

Because the question asks about XeTeX and XeLaTeX specifically, I will address it specifically, but as suggested by the chosen answer and pointed out in the comments, there is nothing special about the relationship between XeTeX and XeLaTeX. However, because of this specificity it is possible to go into greater detail though it will not generalize without modification to the other cases(at least in terms of the exact characters typed in commands).

There are two sets of things being conflated here: XeTeX is a typesetting engine, XeLaTeX is a format file for compiling LaTeX formatted documents with the XeTeX engine, the xetex command line command is the binary that actually does the compiling, and xelatex is a convenience wrapper function for including the appropriate format files to the xetex command.

If you speak of XeTeX and XeLaTeX as both being typesetting engines, then there is no difference between the two (or you are mistaken in describing XeLaTeX as a typesetting engine).

However, the xetex and xelatex commands are not the same. In fact, xelatex is a convenience wrapper for the xetex command with particular arguments.

xetex will not be able to compile a document using the instruction codes specified by the LaTeX format file, it expects a plain-tex formatted document just as the tex binary does.
xelatex is a wrapper that is essentially the same as xetex "&xelatex" which is able to process LaTeX formatted documents, which involves invoking xelatex.ini as part of the preamble.

This answer helped a good deal for clarifying this: https://tex.stackexchange.com/a/126634/67313

You may be able to generate the necessary format file by using xetex --ini latex.ltx, see How to build xelatex from xetex source, though it seems that additional code may need to be added to build something actually equivalent to the xelatex.ini format file.

Thank you also to everyone in the comments for helping clarify points in which I was "off" in my understanding and description.

• This answer shows that you haven't understood what xetex and xelatex are, according to me. – User Feb 29 '16 at 21:48
• You're making this much more complicated than it is. TeX is to LaTeX what pdfTeX is to pdfLaTeX, XeTeX is to XeLaTeX, and LuaTeX is to LuaLaTeX. An "engine" is a binary and understands a set of primitive instructions to perform the actual typesetting. A "format" is a group of macros (not a "binary") meant to make the primitives usable by humans. TeX, pdfTeX, XeTeX, and LuaTeX use the "Plain (e)TeX" format with the respective engines, whereas LaTeX, pdfLaTeX, XeLaTeX, and LuaLaTeX use the "LaTeX2e" format with the respective engines. (LaTeX2e superseded LaTeX2.09 in the mid-1990s.) – Mico Feb 29 '16 at 21:50
• @Mico -- actually "tex" remains without the addition of e-tex; it is the original "knuth tex". at leasf on the system i'm working on, the command "etex" brings up the extended version, based on pdftex. – barbara beeton Feb 29 '16 at 21:56
• With a Unix-based TeX distribution (sorry, I have no idea how things are done under MS Windows), the file called xelatex is a symbolic link to another file called xetex. That's why I would not call xelatex a "binary". The first thing xetex (the binary) does is to examine how it was called: If it was called as xetex, the Plain-TeX format is loaded; if it was called as xelatex, the LaTeX2e format is loaded. – Mico Feb 29 '16 at 22:45
• This answer doesn't add anything and seems to imply that there is something special about the relationship between xetex and xelatex that is not shared between tex and latex or pdftex and pdflatex, which is simply not the case. – David Carlisle Feb 29 '16 at 23:10