Lots of useful information for human beings, especially in academia. But, what is actually underlying the TeX engine? How does it really work? Does it parse everything and just put the stuff together? Or any special spec info?! Or even any good resources for further reading? How is it possible to write some modules and how to develop something more for the community?


1 Answer 1


TeX is an interpreter and macro processor (the canonical implementation of which written in WEB, a dialect of pascal) it takes in text files consisting of text and macros, and font files (and a few other possible things) and expands the macros and evaluates some expressions defined in the TeX syntax and produces a file description of a sequence of typeset pages (usually in dvi or pdf format).

Asking "how TeX works" is like asking "how does C work" or "How does Fortran work". It is answerable on several levels depending firstly whether you mean how does one write macros in TeX, or how does the TeX system evaluate the macros. (Compare to asking how one programs in C or how one writes a C complier). The TeXBook and TeX-The-Program fully document the TeX language and the TeX program itself. These books are not available for free (although their source text is) but there is lots of information, not least on this site, about all aspects of TeX programming.

There are other questions on site detailing differences between XeTeX, TeX etc but in brief classic TeX was written in 1970's-80s and at its heart it is based around 8-bit encodings. It can be made to process Unicode files but under the covers the details are less than ideal. XeTeX is an extended system based on the original TeX source but using Unicode encodings and system fonts as far as possible. LuaTeX is a separate extension of TeX again with a unicode base but is more radical in that it also incorporates the separate Lua programming language as an alternative to the traditional TeX macro language.

LaTeX is by far the most popular way of using TeX it is a set of macros but also a mechanism for anyone to contribute additional extension sets of macros known as packages.

last one:-) none of those are defined terms they are just English descriptions, but the "engine" is the underlying interpreter. The original TeX, pdfTeX (a variant that takes the same input but produces pdf rather than dvi) eTeX (a variant of TeX), and the newer engines XeTeX and LuaTeX. LaTeX is written in TeX macros so may be used over any of the engines (hence latex pdflatex xelatex lualatex which are all more or less the same TeX source processed with TeX, pdfTeX, XeTeX and LuaTeX respectively). A distribution like "MikTeX" or "TeXLive" is a complete packaged installation of all the files you need, an update mechanism, matching previewers and editors and stuff. TeX the program is a single executable file, the TeXLive TeX distribution is a dvd full of tens (hundreds?) of thousands of files.

  • That was great David. But could you please describe more about what is something like xelatex or other things like packages and modules and so on...
    – SMG
    Oct 16, 2012 at 21:17
  • and once more, if you please explain shortly what is the difference between macro packages, alternative engines, and distributions ?
    – SMG
    Oct 16, 2012 at 21:47
  • 1
    I feel great now ;) Have fun using it everybody!
    – SMG
    Oct 17, 2012 at 4:33
  • 2
    @SMG: Wikipedia exists, and there is a TeX FAQ. And this site has a search field at the top right of the page. Oct 17, 2012 at 9:46
  • “TeX: The program” is available for free. It comes with TeXlive and can be viewed using texdoc tex. Nov 22, 2017 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .