From other answers on this site and the FAQ of the TeX User Group my understanding is that:

  1. TeX is the original typesetting program, written by Knuth
  2. Omega, eTeX, pdfTeX, XeTeX, LuaTeX are engines. They are variations of the original TeX program, written in different languages, designed to give almost the same output for the same input as the original TeX, but with great variations in the inner workings and slight variations in the interface that make possible for the user to access the inner workings
  3. LaTeX and ConTeXt are macro packages. They are like libraries of TeX macros. While LaTeX works on all the engines, the last version of ConTeXt (Mark IV) works only with LuaTex, because it uses many features exclusive of this engine.

What I do not understand is why both LaTeX and ConTeXt require their own executable. Isn't it possible just to include in the TeX source files where one wishes to use LaTeX just the definitions of the LaTeX macros (maybe with an \include directive)?


2 Answers 2


It certainly is possible to use LaTeX just as a file to be read by TeX, but it's not common. There are at least a couple of reasons. TeX is designed to allow a set of macros ('format') to be read then dumped 'as is' by 'IniTeX'. When you do

tex <file>

you are running TeX the program with Knuth's plain format, rather than a completely un-initiallised 'VirTeX' ('virgin TeX'). LaTeX cannot be loaded once any other format has been, as there is overlap between names in ways that are not always compatible. You can run TeX with and load the LaTeX kernel using IniTeX

tex -ini "\input latex.ltx"

(on my system, at least: the details vary a bit). However, doing this means that TeX has to process all of the LaTeX kernel before doing anything 'useful'. It's therefore easier to load the pre-built format (memory dump):

tex "&latex"

(The & syntax is general: tex "&<format-name>" loads whatever format is requested.)

The binaries you see on a modern TeX system are very much like wrapper around this process, although they run pdfTeX rather than Knuth's TeX. There are some 'details' to this, but the basic idea is the same.

ConTeXt is a little different as unlike LaTeX it does the multiple TeX run stuff itself. As such context is more than a wrapper: it's a complex script. You can run ConTeXt as a format, in the same way as you can for LaTeX, but this is even less useful than it is in the LaTeX case.

  • 3
    The binaries are just symlinks on Unix (they are wrappers on Windows because of the spotty support for symlinks). By default the format corresponding to the executable name is loaded, but there is -fmt switch to override it. The &fmt syntax is there to be used inside documents (but because of the way TeX reads input you can pass it in the command line as well). May 29, 2013 at 17:12
  • 2
    @KhaledHosny The & syntax in files is a web2c extension of TeX: it does not work in Knuth's TeX (tex <file> in for example TeX Live). However, tex "&<name>" does work from the command line. So I'd say the & syntax has moved from the command line to the document, not the other way. Also note that in a document this line has to be a comment (%&<format>), while on the command line it's not, so it's not quite the same as passing a 'standard' first line.
    – Joseph Wright
    May 30, 2013 at 6:13

Let me elaborate a bit on Joseph's comment about ConTeXt wrapper scripts. There are many aspects of typesetting that are not handled by TeX, the program. These include extracting bibliographic information from bib files, sorting glossaries, indexes, etc.

In LaTeX, there is a separate execute for each of these tasks: bibtex, makeidx, and their variations. In ConTeXt, all this is handled by the context script—that script also handles compiling the document appropriate number of times to get the references correct. So, you can think of the context script as being equivalent to rubber or latexmk scripts for LaTeX that handle running bibtex, makeidx, etc, and take care of multiple runs.

  • 1
    Thank you for your answer! If I could, I would have selected both of your answers as the best, because you both made me things much clearer. So I upvoted your answer
    – Ralph
    May 30, 2013 at 13:30

You must log in to answer this question.

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