*Brian W. Kernighan and Lorinda L. Cherry
*

## ABSTRACT

` ` ` ` ` `This paper describes the design and implementation
of a system for typesetting mathematics.` `
The language has been designed to be easy to learn
and to use
by people
(for example, secretaries and mathematical typists)
who know neither mathematics nor typesetting.` `
Experience indicates that the language can
be learned in an hour or so,
for it has few rules and fewer exceptions.` `
For typical expressions,
the size and font changes, positioning, line drawing,
and the like necessary to print according to mathematical conventions
are all done automatically.` `
For example,
the input

sum from i=0 to infinity x sub i = pi over 2

produces

` ` ` ` ` `The syntax of the language is specified by a small
context-free grammar;
a compiler-compiler is used to make a compiler
that translates this language into typesetting commands.` `
Output may be produced on either a phototypesetter
or on a terminal with forward and reverse half-line motions.` `
The system interfaces directly with text formatting programs,
so mixtures of text and mathematics may be handled simply.` `

` ` ` ` ` `This paper is a revision of a paper originally published in
CACM, March, 1975.` `

## Table of Contents

- 1.
Introduction
- 2.
Photocomposition
- 3.
Language Design
- 4.
The Language
- 5.
Language Theory
- 6.
Experience
- 7.
Conclusions
- 8.
Introduction
- 9.
Displayed Equations
- 10.
Input spaces
- 11.
Output spaces
- 12.
Symbols, Special Names, Greek
- 13.
Spaces, Again
- 14.
Subscripts and Superscripts
- 15.
Braces for Grouping
- 16.
Fractions
- 17.
Square Roots
- 18.
Summation, Integral, Etc.
- 19.
Size and Font Changes
- 20.
Diacritical Marks
- 21.
Quoted Text
- 22.
Lining Up Equations
- 23.
Big Brackets, Etc.
- 24.
Piles
- 25.
Matrices
- 26.
Shorthand for In-line Equations
- 27.
Definitions
- 28.
Local Motions
- 29.
A Large Example
- 30.
Keywords, Precedences, Etc.
- 31.
Troubleshooting
- 32.
Use on UNIX
- 33.
Acknowledgments
- Footnotes