troff
This article is missing information about short list of books typeset with troff.(January 2021) |
Cross-platform | |
---|---|
Type | Command |
License | Plan 9: MIT License |
Website | troff |
troff (.
While nroff was intended to produce output on terminals and line printers, troff was intended to produce output on typesetting systems, specifically the Graphic Systems CAT that had been introduced in 1972. Both used the same underlying markup language and a single source file could normally be used by nroff or troff without change.
troff features commands to designate fonts, spacing, paragraphs, margins, footnotes and more. Unlike many other text formatters, troff can position characters arbitrarily on a page, even overlapping them, and has a fully programmable input language. Separate preprocessors are used for more convenient production of tables, diagrams, and mathematics. Inputs to troff are plain text files that can be created by any text editor.
Extensive
History
troff's origins can be traced to a
in the mid-1960s. (The name allegedly came from the phrase I'll run off a document.)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 Bell Labs patents department.[1] 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, which provided the basis for all future versions. When they got a Graphic Systems CAT phototypesetter, Ossanna modified nroff to support multiple fonts and proportional spacing. Dubbed troff, for typesetter roff, its sophisticated output amazed the typesetter manufacturer and confused peer reviewers, who thought that manuscripts using troff had been published before.[2][3] As such, the name troff is pronounced /ˈtiːrɒf/ rather than */ˈtrɒf/.
With troff came nroff (they were actually almost the same program), which was for producing output for line printers and character terminals. It understood everything troff did, and ignored the commands which were not applicable, e.g., font changes.
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. Ossanna died before this task was completed, so Brian Kernighan took on the task of rewriting troff. The newly rewritten version produced a device-independent code which was very easy for post-processors to read and translate to the appropriate printer codes. Also, this new version of troff (often called ditroff for device independent troff) had several extensions, which included drawing functions.[4] The program's documentation defines the output format of ditroff, which is used by many modern troff clones like GNU groff.
In 1983, troff was one of several UNIX tools available for Charles River Data Systems'
The troff collection of tools (including
- the SoftQuad DWB, based on USL DWB 2.0 from 1994;
- the DWB 3.4 from Lucent Software Solutions (formerly USL);
- troff, Plan 9 edition.
While troff has been supplanted by other programs such as
The software was reimplemented as
Macros
Troff includes macros that are run before starting to process the document. These macros include setting up page headers and footers, defining new commands, and influencing how the output will be formatted. The
The standard macro sets, with leading m are:
- man for creating
- mdoc for semantically-annotated
- me for creating research papers[12]
- mm for creating memorandums[13]
- ms for creating books, reports, and technical documentation[14]
A more comprehensive list of macros available is usually listed in a tmac(5)
Preprocessors
As troff evolved, since there are several things which cannot be done easily in troff, several
- eqn preprocessor allows mathematical formulae to be specified in simple and intuitive manner.[15]
- tblis a preprocessor for formatting tables.
- bibliographicdatabase.
Three preprocessors provide troff with drawing capabilities by defining a domain-specific language for describing the picture.
- procedural programming language providing various drawing functions like circle and box.[16]
- ideal allows the drawing of pictures simultaneous equations based on vectors and transformations described by its input.[17]
- grn describes the pictures through graphical elements drawn at absolute coordinates, based on the gremlin file format defined by an early graphics workstation.[18]
Yet more preprocessors allow the drawing of more complex pictures by generating output for pic.
- grap draws histograms.[19]
- chem draws chemical structure diagrams.[20]
- dformat draws data structures.[21]
See also
- Desktop publishing
- DocBook
- groff GNU troff/nroff replacement
- nroff
- SGML
- TeX
- Scribe (markup language)
References
- ISBN 9781695978553.
- ^ J. F. Ossanna. Nroff/Troff User's Manual. CSTR #54, Bell Labs, 1976. Revised by B. W. Kernighan, 1992.
- McIlroy, M. D. (1987). A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986(PDF) (Technical report). CSTR. Bell Labs. 139.
- ^ B. W. Kernighan. A Typesetter-Independent TROFF. CSTR #97, Bell Labs, 1981, revised March 1982.
- ^ The Insider's Guide To The Universe (PDF). Charles River Data Systems, Inc. 1983. p. 13.
- ^ See the man page of the ditroff -> postscript converter on OpenSolaris: illumos and OpenSolaris User Commands Reference Manual from latest Sun based OpenSolaris –
- ^ "Writing and Formmating UNIX Manual Pages with -man macros". home.fnal.gov. Retrieved 7 May 2019.
- ^ Linux Miscellanea Manual –
- ^ FreeBSD Miscellaneous Information Manual –
- ^ "Index - Mandoc extended documentation". Mandoc. Retrieved 7 May 2019.
- ^ a b Linux File Formats Manual –
- ^ Linux Miscellanea Manual –
- ^ Linux Miscellanea Manual –
- ^ Linux Miscellanea Manual –
- ^ B. W. Kernighan and Lorinda L. Cherry. A System for Typesetting Mathematics. CSTR #17, Bell Labs, May 1974.
- ^ B. W. Kernighan. PIC — A Graphics Language for Typesetting (Revised User Manual). CSTR #116, Bell Labs, December 1984.
- ^ C. J. Van Wyk. IDEAL User's Manual. CSTR #103, Bell Labs, December 1981.
- ^ grn — groff preprocessor for gremlin files [1].
- ^ J. L. Bentley and B. W. Kernighan. GRAP — A Language for Typesetting Graphs (Tutorial and User Manual). CSTR #114, Bell Labs, August 1984.
- ^ J. L. Bentley, L. W. Jelinski, and B. W. Kernighan. CHEM — A Program for Typesetting Chemical Structure Diagrams. CSTR #122, Computers and Chemistry, Bell Labs, April 1986.
- ^ J. L. Bentley. DFORMAT — A Program for Typesetting Data Formats. CSTR #142, Bell Labs, April 1988.
External links
- The Text Processor for Typesetters
- The history of troff
- Free troff implementation
- OpenSolaris-derived port of troff and related programs
- User manual for the Plan 9 edition of troff (In PostScript format)
- A History of UNIX before Berkeley section 3 describes the history of roff, nroff, troff, ditroff, tbl, eqn, and more.
- The original source code of nroff, troff and the preprocessors from AT&T Bell Labs in form of the Documenter's Workbench (DWB) Release 3.3 (ported to current UNIX systems from http://www2.research.att.com/sw/download)