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 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$

to generate the output file:

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


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 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 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$

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`;


the above text has covered tex, pdftex, luatex and xetex; they are all tex engines; now we see from a different perspective: the backbone of tex is a set of primitives, slightly on top of which is the plain tex format, and both are difficult to use; tex would be easier to use with higher-level commands; this is exactly what latex does; latex is a macro package offering higher-level commands to users; 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
The quadratic formula is $-b \pm \sqrt{b^2 - 4ac} \over 2a$

to generate its output:

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

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

tex l.tex       # error;


pdflatex is pdftex with latex;


lualatex is luatex with latex;


xelatex is xetex with latex;


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 is a cross-platform tex distribution, supporting linux, windows and macos; tex-live is the default choice for most linux users;


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


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