A TROFF Tutorial

Brian W. Kernighan
Typesetting Text formatting NROFF


      troff is a text-formatting program for driving the Graphic Systems phototypesetter on the UNIXand GCOS operating systems. This device is capable of producing high quality text; this paper is an example of troff output.

      The phototypesetter itself normally runs with four fonts, containing roman, italic and bold letters (as on this page), a full greek alphabet, and a substantial number of special characters and mathematical symbols. Characters can be printed in a range of sizes, and placed anywhere on the page.

      troff allows the user full control over fonts, sizes, and character positions, as well as the usual features of a formatter _ right-margin justification, automatic hyphenation, page titling and numbering, and so on. It also provides macros, arithmetic variables and operations, and conditional testing, for complicated formatting tasks.

      This document is an introduction to the most basic use of troff. It presents just enough information to enable the user to do simple formatting tasks like making viewgraphs, and to make incremental changes to existing packages of troff commands. In most respects, the UNIX formatter nroff is identical to troff, so this document also serves as a tutorial on nroff.

Table of Contents