TeX is a language used to typeset documents, especially ones containing mathematics. It has both programming and mark-up features. In this study guide we will describe "primitive TeX"--the basic engine for the macro languages plain TeX, LaTeX, ConTeXt, and so on. If you are new to TeX, then this is probably not what you want to read: you may be looking for LaTeX, a macro package for TeX that makes it easier to produce standard documents.
The canonical source for learning the TeX language, both to write documents and to program, is the TeXbook by Donald Knuth. There's also a comprehensive programmer's reference called TeX by topic which the author has generously made available free at his website as well as TeX for the Impatient.
We describe the basic anatomy of TeX: the registers, the parameters, and other resource that affect the processing of a TeX source file.
The concept of a box is fundamental to TeX. Boxes represent the content that make up a typeset page. For example, letters, lines of text, paragraphs, mathematical formula and its composite symbols are all conceptually just boxes that TeX pastes together to build the page, which itself is also a box. Boxes are often composed of smaller boxes.
Each box has a number of properties that TeX uses to paste the boxes together using various algorithms. These are:
As an example, the letter 'a' is placed in a box so that is sits directly on the baseline; while letters such as 'p', 'g', or 'j' extend below the baseline. When TeX is building a line of ordinary text, all the baselines are aligned, and so a line of characters is positioned as one would expect. Font designers determine how to place each glyph within its respective box.
While boxes represent the contents of a page, glue represents the white space that fits in between boxes, and as TeX is building the page this glue can expand or contract to allow the contents to be positioned optimally. This glue is eventually 'set' after which it can no longer adjust--it's just fixed white space.
Many types of predefined glues exist to meet the different needs that can arise with typesetting.
At each point in the processing of a source file, TeX is in one of the following modes:
How TeX interprets the source file depends on the current mode.
TeX has 25 keywords. These words have no backslash before them, and they are not case-sensitive. TeX interprets each of these words as a keyword only in certain contexts.
Here we describe each of the 325 TeX primitive control sequences. Each entry gives a synopsis, description, and examples. The synopsis gives the proper syntactical context of the control sequence. For example,
gives the syntax of one of TeX's integer parameters. In the source file, the <integer> needs to be replaced by an actual integer as described in the 'description' section of the entry \pretolerance. In general anything of the form <...>, where the ellipse is some descriptive word, needs to be replaced by something appropriate; the 'description' section will tell you what is allowable.
Sometimes part of the syntax is optional, this is indicated by placing it in between brackets, as in
\ifmmode <TeX code 1> [\else <TeX code 2>] \fi
which gives the syntax of one of TeX's if-then-else control structures. The brackets here indicate that '\else <TeX code 2>' need not be included in actual use. In either case, the brackets should not be used in actual use.
Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your Digital Marketing and Technology knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.