Last modified by Farooq Sheikh on 2019/07/17 07:55

What is a TEX File?

TeX is a language that comprises of programming as well as mark-up features, used to typeset documents. Donald Knuth from Stanford University, is the creator of this resourceful typesetting system. Across the world, TeX is the ultimate choice of authors and publishers to produce high quality technical documents. TeX performs an outstanding job of formatting complex mathematical expressions. In conjunction with a high-quality phototypesetter, TeX competes the results generated by the best traditional typesetting systems. Therefore regarded as the classiest digital typographical systems.

TeX input files are based on ASCII-code, thereby allowing manuscript sharing among writers, publishing managers and critics. A wide variety of computing environments, almost every modern platform and lot of older platforms support TeX. Moreover, TeX is a free software, available to a wide range of consumers. Many UNIX installations use both UNIX troff and TeX as their formatting system for different purposes. Other typesetting tasks are performed tremendously in the form of LaTeX, ConTeXt, and other macro packages.

Brief History

TeX was designed and written by Donald Knuth in 1978. Guy Steele from Massachusetts Institute of Technology revised input/output of TeX to make it run under the Incompatible operating system like Timesharing System (ITS). The first version of TeX was developed under Stanford's WAITS operating system in the programming language (SAIL) and tested to run on a PDP-10. Knuth introduced the idea of literate programming for advance versions. Literate programming is a way of generating compilable source code and typeset (in TeX) for cross-linked documentation using the original file. The language used to develop these advanced versions of TeX is called WEB, a mixture of DEC PDP-10 Pascal programs to ensure portability.

A revised new version of TeX published in 1982 and was called TeX82. The major change is the replacement of the original hyphenation algorithm with the newly written algorithm by Frank Liang. To ensure portability across different platforms, Instead of using floating-point, TeX82 uses fixed-point arithmetic along with a real, turing-complete programming language. In 1989, a new versions of TeX and Metafont was released. So the version 3.0 of TeX facilitates 8-bit inputs, allowing 256 different characters in the text. After version 3, updates are denoted by adding an extra digit at the end of the decimal e.g. current version of TeX is indicated as 3.14159265. This version was last updated 12-1-2014.

TeX Input

An Input file to TEX can be prepared with a text editor using ordinary text. Unlike a typical Word processor, this input file disallows any invisible control characters. One file can be embedded into another file, containing macro definitions and auxiliary definitions that enhances TeX’s capabilities. If a TeX installation comes with any macro files, the local information about TeX demonstrates about using macro files. The standard form of TeX, integrates a combination of macros and other definitions known as plain TEX. On the basis of precise knowledge of the sizes of all characters and symbols, it calculates the optimum organization of letters per line and lines per page.  At the time of document processing, a .dvi file is produced, where “dvi” stands for “device independent”. Device driver programs are required for printing or previewing the document with a dvi extension. Nowadays, dvi generation is bypassed by a commonly used pdf- TeX. No prior knowledge of fonts is available within TeX installation, so external font files, which are part of local TeX environment are used to obtain information for document.

Typesetting System

About 300 primitives (commands) can be understand by the base TeX system. Primitives are low-level commands, therefore a common user rarely used them directly and most functionality is performed by format files. These format file are preloaded memory images of TeX which are followed by the loading of large macro collections. The original default format of the language i.e plain TeX adds about 600 commands. A backslash grouped with curly braces denotes the starting of TeX commands. Since TeX is a macro and token based language, almost all of TeX's syntactic characteristic can be changed at run time, including user-defined ones except unexpandable tokens which are then executed. Expansion itself is practically trouble free. Some commands need to come after an arguments that help to explain the function of a command. For instance, the \vskip command directs TEX to skip down/up the page followed by an argument determining how much space to skip. 


LaTeX is the most frequently used format which is originally developed by Leslie Lamport. LaTeX integrates different document styles for files, letters, books and slides and offers referencing and automatic numbering for different sections and mathematical expressions. AMS-TeX is another popular format, developed by the American Mathematical Society. AMS-TeX offers a lot more user-friendly commands, which can be redefined by journals to fit with their local style. LaTeX can take the benefits of AMS-TeX by using the AMS "packages" which is then termed as AMS-LaTeX. ConTeXt is another format written by Hans Hagen used mainly for desktop publishing.

The TeX software offers several features that were unavailable, or of lower quality, in other typesetting systems at the time of its creation. Some of the innovative features of this language are based on interesting algorithms derived from the theses of Knuth's students. While other typesetting programs are now incorporating useful features of TeX into their programs.


Created by Farooq Sheikh on 2019/07/10 12:50