the tex family is a big one, which has quite a few members: tex, pdftex, luatex, xetex, latex, pdflatex, lualatex, xelatex, context, tex-live, mactex, miktex, etc.; this list looks daunting to tex newbs like me; so i wrote this article explaining what they are;

## tex

tex is the core of the entire tex family, from which all other programs are derived; tex is a typesetting system which inputs a .tex file and outputs a .dvi file; the latter can be viewed and printed by appropriate devices;

an example input file:

% t.tex
The quadratic formula is $-b \pm \sqrt{b^2 - 4ac} \over 2a$
\bye


to generate the output file:

tex t.tex       # outputs t.dvi;
dvips t.dvi     # outputs t.ps;
ps2pdf t.ps     # outputs t.pdf;


## pdftex

pdftex takes the same input as tex, but generates a .pdf file instead of a .dvi file; so we can run:

pdftex t.tex    # outputs t.pdf;


## luatex

luatex is an extension of tex with a lua scripting engine embedded; it makes the tex internals accessible from lua; tbh i dont have much experience with it, but we can run it like this:

luatex t.tex    # outputs t.pdf;


here is an example that helps explain how luatex works:

% a.tex
\directlua{tex.print("hello luatex\noexpand\\bye")}


to generate the output file:

luatex a.tex    # outputs a.pdf;


luatex works like this: when tex sees \directlua, it expands its argument and feeds the expanded argument into lua; lua then processes the expanded argument; in this case, it prints a string to a special tex stream, using tex.print; this tex stream is then passed back to tex, which expands the stream and runs it; the whole process happens as if lua substitutes the \directlua argument with its processed result, possibly with some other actions that may change the tex internals (not shown in this example);

in this case, what lua sees is:

tex.print("hello luatex\\bye")


and what passed back to tex is:

hello luatex\bye


we can use \directlua at various places in a tex file to access tex internals; and lua can do much more than printing a string;

## xetex

xetex improves tex by adding support for:

• unicode characters;

• system fonts;

this makes xetex a great choice for non-latin users; for example:

% x.tex
\font\jp="Sazanami Mincho" at 16pt
The {\jp 二次方程式の解の公式} is $-b \pm \sqrt{b^2 - 4ac} \over 2a$
\bye


the same input file doesnt work with tex, pdftex or luatex:

tex x.tex       # error;
pdftex x.tex    # error;
luatex x.tex    # error;


but it works with xetex:

xetex x.tex     # outputs x.pdf;


## latex

the above text has covered tex, pdftex, luatex and xetex; they are all tex engines; now we view from another perspective: the plain tex language is difficult to use; it would be easier to use with a set of tex macros; this is exactly what latex does; latex is pretty much a “framework” of the tex language, offering users higher-level commands to use; most tex files we see these days are actually latex files;

we cannot run a plain tex file through latex:

latex t.tex     # error;


a minimal latex file looks like this:

% l.tex
\documentclass{article}
\begin{document}
The quadratic formula is $-b \pm \sqrt{b^2 - 4ac} \over 2a$
\end{document}


to generate its output:

latex l.tex     # outputs l.dvi;
dvips l.dvi     # outputs l.ps;
ps2pdf l.ps     # outputs l.pdf;


note that we cannot run a latex file through tex, either:

tex l.tex       # error;


## pdflatex

pdflatex is pdftex with latex;

## lualatex

lualatex is luatex with latex;

## xelatex

xelatex is xetex with latex;

## context

context may be compared with latex, but with a different goal in mind: provide users easy access to advanced typographical control; sadly i dont have knowledge about context, so i cant speak more of it here;

## tex-live

tex-live is a cross-platform tex distribution, supporting linux, windows and macos; tex-live is the default choice for most linux users;

## mactex

mactex is a redistribution of tex-live with macos-specific features; obviously it is for macos users;

## miktex

miktex is a tex distribution popular on windows; it also has support for linux and macos, but is usually used by windows users;