This is an old revision of this page, as edited by 80.202.80.14 (talk) at 18:46, 22 January 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Revision as of 18:46, 22 January 2003 by 80.202.80.14 (talk)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)Troff is a document processing system developed by AT&T for the Unix operating system.
History
Troff can trace its origins back to a formatting program called runoff, written by J. E. Saltzer. It ran on MIT's CTSS operating system in the mid-sixties. The name came from the phrase at the time, I'll run off a document.
Bob Morris ported it to the GE 635 architecture and called the program roff (an abbreviation of runoff). It was rewritten as rf for the PDP-7, and at the same time (1969), Doug McIllroy rewrote an extended and simplified version of roff in the BCPL programming language.
The first version of Unix was developed on a PDP-7 which was sitting around Bell Labs. In 1971 the developers wanted to get a PDP-11 for further work on the operating system. In order to justify the cost for this system, they proposed that they would implement a document formatting system for the AT&T patents division. This first formatting program was a reimplementation of McIllroy's `'roff, written by Joe F. Ossanna.
When they needed a more flexible language, a new version of roff called nroff (Newer 'roff') was written. It had a much more complicated syntax, but provided the basis for all future versions. When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a version of nroff that would drive it. It was dubbed troff, for typesetter 'roff', although many people have speculated that it actually means Times 'roff' because of the use of the Times font family in troff by default. As such, the name troff is pronounced t-roff rather than trough.
With troff came nroff (they were actually almost the same program), which was for producing output for [[line printer]]s and character terminals. It understood everything troff did, and ignored the commands which were not applicable (e.g. font changes).
Since there are several things which cannot be done easily in troff, work on several preprocessors began. These programs would transform certain parts of a document into troff, which made a very natural use of pipes in Unix.
The eqn preprocessor allowed mathematical formulae to be specified in a much simpler and more intuitive manner. tbl is a preprocessor for formatting tables. The refer preprocessor (and the similar program, bib) processes citations in a document according to a bibliographic database.
Unfortunately, Ossanna's troff was written in PDP-11 assembly language and produced output specifically for the CAT phototypesetter. He rewrote it in C, although it was now 7000 lines of uncommented code and still dependent on the CAT. As the CAT became less common, and was no longer supported by the manufacturer, the need to make it support other devices became a priority. However, before this could be done, Ossanna was killed in an auto accident.
So, Brian Kernighan took on the task of rewriting troff. The newly rewritten version produced a device independent code which was very easy for postprocessors to read and translate to the appropriate printer codes. Also, this new version of troff (called ditroff for device independent 'troff') had several extensions, which included drawing functions.
Due to the additional abilities of the new version of troff, several new preprocessors appeared. The pic preprocessor provides a wide range of drawing functions. Likewise the ideal preprocessor did the same, although via a much different paradigm. The grap preprocessor took specifications for graphs, but, unlike other preprocessors, produced pic code.
Use of troff and family was reduced somewhat in the 1990s, but it is still being used quite extensively. Troff has been supplanted by other programs such as Interleaf, Framemaker and LaTeX.
Features
Troff features commands to designate fonts, spacing, paragraphs, margins, footnotes and more. Extensions are available for producing tables, diagrams, and mathematics. Inputs to troff are plain text files that can be created by any text editor.
Variants
Besides nroff, designed to generate formatted plain text instead of typeset output, groff is the GNU replacement for troff and nroff, and is Free software.