Main Page

encyclopedia.codeboy.net

 

Troff

Troff is a document processing system developed by AT&T for the Unix operating system.

Table of contents
1 History
2 Features
3 Variants
4 External links

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 McIlroy 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\naround Bell Labs. In 1971 the developers wanted to get a PDP-11 for\nfurther work on the operating system. In order to justify the cost for\nthis system, they proposed that they would implement a document\nformatting system for the AT&T patents division. This first formatting\nprogram was a reimplementation of McIllroy's roff, written by\nJoe F. Ossanna. When they needed a more flexible language, a new version of roff\ncalled nroff (Newer 'roff') was written. It had a much more\ncomplicated syntax, but provided the basis for all future versions.\nWhen they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a\nversion of nroff that would drive it. It was dubbed troff, for\ntypesetter 'roff', although many people have speculated that it\nactually means Times 'roff' because of the use of the Times font\nfamily in troff by default. As such, the name troff is pronounced\nt-roff rather than trough. With troff came nroff (they were actually almost the same program), which was for producing output for line printers and character terminalss. It understood everything troff\ndid, and ignored the commands which were not applicable (e.g. font\nchanges). Since there are several things which cannot be done easily in\ntroff, work on several preprocessors began. These programs would\ntransform certain parts of a document into troff, which made a very\nnatural use of "pipes" in Unix -- sending the output of one program as the input to another (see pipes and filters). The eqn preprocessor allowed mathematical formulae to be specified\nin a much simpler and more intuitive manner. tbl is a preprocessor\nfor formatting tables. The refer preprocessor (and the similar\nprogram, bib) processes citations in a document according to a\nbibliographic database. Unfortunately, Ossanna's troff was written in PDP-11 \nassembly language and produced output specifically for the CAT phototypesetter.\nHe rewrote it in C, although it was now 7000 lines of uncommented code\nand still dependent on the CAT. As the CAT became less common, and was\nno longer supported by the manufacturer, the need to make it support\nother devices became a priority. However, before this could be done,\nOssanna was killed in an auto accident. So, Brian Kernighan took on the task of rewriting troff. The\nnewly rewritten version produced a device independent code which was\nvery easy for postprocessors to read and translate to the appropriate\nprinter codes. Also, this new version of troff (called ditroff for\ndevice independent 'troff') had several extensions, which included\ndrawing functions. The troff collection of tools was eventually called Documenter's WorkBench (DWB), and was under continuous development in Bell Labs (renamed Unix System Laboratories, USL) through 1994. At that time, SoftQuad took over the maintenance, although Brian Kernighan continued to improve troff on his own. There is thus currently three variants of the original Bell Labs troff:
  • An ancient variation from Bill Joy, still shipped by Sun.\n*The SoftQuad DWB, based on USL DWB 2.0 from 1994\n*The DWB 3.4 from Lucent Software Solutions (USL)
Use of troff and family was reduced somewhat in the 1990s, but it is still being used quite extensively. While Troff has been supplanted by other programs such as Interleaf, FrameMaker and LaTeX, it is still the default format of the UNIX documentation

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. As troff developed, 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\npreprocessors, produced pic code.

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.

References

\n
Mel Melchner letter explaining roff/troff/DWB history and status

External links

Category:Typesetting software\nCategory:Free software

"Some editors are failed writers, but so are most writers." - T. S. Eliot (1888-1965)