manpages.info - online man pages   

Linux man pages : roff (7)
ROFF(7)								       ROFF(7)

NAME

roff - concepts and history of roff typesetting

DESCRIPTION

roff is the general name for a set of type-setting programs, known under names like troff, nroff, ditroff, groff, etc. A roff type-set- ting system consists of an extensible text formatting language and a set of programs for printing and converting to other text formats. Traditionally, it is the main text processing system of Unix; every Unix-like operating system still distributes a roff system as a core package. The most common roff system today is the free software implementation GNU roff, groff(1). The pre-groff implementations are referred to as classical (dating back as long as 1973). groff implements the look- and-feel and functionality of its classical ancestors, but has many extensions. As groff is the only roff system that is available for every (or almost every) computer system it is the de-facto roff stan- dard today. In some ancient Unix systems, there was a binary called roff that implemented the even more ancient runoff of the Multics operating sys- tem, cf. section HISTORY. The functionality of this program was very restricted even in comparison to ancient troff; it is not supported any longer. Consequently, in this document, the term roff always refers to the general meaning of roff system, not to the ancient roff binary. In spite of its age, roff is in wide use today, for example, the manual pages on UNIX systems (man pages), many software books, system documen- tation, standards, and corporate documents are written in roff. The roff output for text devices is still unmatched, and its graphical out- put has the same quality as other free type-setting programs and is better than some of the commercial systems. The most popular application of roff is the concept of manual pages or shortly man pages; this is the standard documentation system on many operating systems. This document describes the historical facts around the development of the roff system; some usage aspects common to all roff versions, details on the roff pipeline, which is usually hidden behind front-ends like groff(1); an general overview of the formatting language; some tips for editing roff files; and many pointers to further readings.

HISTORY

The roff text processing system has a very long history, dating back to the 1960s. The roff system itself is intimately connected to the Unix operating system, but its roots go back to the earlier operating sys- tems CTSS and Multics. The Predecessor runoff The evolution of roff is intimately related to the history of the oper- ating systems. Its predecessor runoff was written by Jerry Saltzer on the CTSS operating system (Compatible Time Sharing System) as early as 1961. When CTTS was further developed into the operating system Mul- tics <http://www.multicians.org>, the famous predecessor of Unix from 1963, runoff became the main format for documentation and text process- ing. Both operating systems could only be run on very expensive com- puters at that time, so they were mostly used in research and for offi- cial and military tasks. The possibilities of the runoff language were quite limited as compared to modern roff. Only text output was possible in the 1960s. This could be implemented by a set of requests of length 2, many of which are still identically used in roff. The language was modelled accord- ing to the habits of typesetting in the pre-computer age, where lines starting with a dot were used in manuscripts to denote formatting requests to the person who would perform the typesetting manually later on. The runoff program was written in the PL/1 language first, later on in BCPL, the grandmother of the C programming language. In the Multics operating system, the help system was handled by runoff, similar to roff's task to manage the Unix manual pages. There are still documents written in the runoff language; for examples see Saltzer's home page, cf. section SEE ALSO. The Classical nroff/troff System In the 1970s, the Multics off-spring Unix became more and more popular because it could be run on affordable machines and was easily available for universities at that time. At MIT (the Massachusetts Institute of Technology), there was a need to drive the Wang Graphic Systems CAT typesetter, a graphical output device from a PDP-11 computer running Unix. As runoff was too limited for this task it was further developed into a more powerful text formatting system by Josef F. Osanna, a main developer of the Multics operating system and programmer of several runoff ports. The name runoff was shortened to roff. The greatly enlarged language of Osanna's concept included already all elements of a full roff sys- tem. All modern roff systems try to implement compatibility to this system. So Joe Osanna can be called the father of all roff systems. This first roff system had three formatter programs. troff (typesetter roff) generated a graphical output for the CAT type- setter as its only device. nroff produced text output suitable for terminals and line printers. roff was the reimplementation of the former runoff program with its limited features; this program was abandoned in later versions. Today, the name roff is used to refer to a troff/nroff sytem as a whole. Osanna first version was written in the PDP-11 assembly language and released in 1973. Brian Kernighan joined the roff development by rewriting it in the C programming language. The C version was released in 1975. The syntax of the formatting language of the nroff/troff programs was documented in the famous Troff User's Manual [CSTR #54], first pub- lished in 1976, with further revisions up to 1992 by Brian Kernighan. This document is the specification of the classical troff. All later roff systems tried to establish compatibility with this specification. After Osanna had died in 1977 by a heart-attack at the age of about 50, Kernighan went on with developing troff. The next milestone was to equip troff with a general interface to support more devices, the intermediate output format and the postprocessor system. This com- pleted the structure of a roff system as it is still in use today; see section USING ROFF. In 1979, these novelties were described in the paper [CSTR #97]. This new troff version is the basis for all existing newer troff systems, including groff. On some systems, this device independent troff got a binary of its own, called ditroff(7). All mod- ern troff programs already provide the full ditroff capabilities auto- matically. Commercialization A major degradation occurred when the easily available Unix 7 operating system was commercialized. A whole bunch of divergent operating sys- tems emerged, fighting each other with incompatibilities in their extensions. Luckily, the incompatibilities did not fight the original troff. All of the different commercial roff systems made heavy use of Osanna/Kernighan's open source code and documentation, but sold them as "their" system