Troff

Troff is a typesetting system that was developed by AT & T for the Unix operating system. It allows professional and high quality typesetting, including typographic features such as different fonts and font styles, spacing, paragraphs, margins, automatic hyphenation at the end of the line, footnotes and table of contents, just to name a few. There are extensions to represent tables, charts and mathematical formulas. Troff is a markup language such as HTML so it is written in plain text with a text editor.

Troff is used in almost all UNIX -like systems to format the online documentation ( man pages ).

Troff and TeX are so far related, as both aim to provide high-quality typesetting. However, the approaches are very different, not only in the syntax, but also in the handling of the program packets and fonts.

History

Troff has its origin in a word processing program called RUNOFF, written by Jerome H. Saltzer for the CTSS operating system at MIT in the mid-1960s. ( Supposedly, the name came from the then- common phrase, I'll run off a document. )

Fotobelichter worked at that time with templates of each character. A light source is illuminated by an appropriate arrangement of lenses and Stencil a movie, letter by letter, line by line. A different font was the same, achieved by replacing the semi-automatic drawing templates, changing the font style, an internal rotation. A template set always consisted of a font with various styles. The exposure could be a number of these stencil sets manage this limitation stems from the need, fonts at the beginning of the document "load" to.

Bob Morris ported RUNOFF on the GE 635- Architecture and called the program roff (an abbreviation of runoff ). It has been rewritten as rf for the PDP -7, and at the same time (1969 ) Douglas McIlroy wrote an extended and simplified version of roff in the programming language BCPL.

The first version of Unix was developed on a PDP -7, which was at Bell Labs. 1971 required the developer of a PDP-11 to continue to work on the operating system. In order to justify the cost of this system, they proposed to develop a document formatting system for the AT & T Patent Division. This first roff formatter was one written by Joe F. Ossanna reimplementation of McIllroys.

Nroff ( Newer, roff '), was developed with respect to the previously restricted commands. It had a much more complicated syntax, but was the basis for all later versions. However, it was only format editions for character-oriented devices such as line printers, daisy wheel printers, computer terminals, etc..

When the Labs a Graphic Systems CAT Photo Typesetter got Ossanna wrote a customized version of nroff in PDP-11 assembly language, which could drive him. This version was troff ( typesetter roff ) called, although many have speculated that it's actually Times roff mean, due to the use of the font family in troff Times Roman as the default font.

The commitment to the PDP -11 and the CAT proved in a row, however, as limiting. Osanna troff ported to C, although there are now dependent on line 7000 of CAT, uncommented code had grown. When the CAT was older and the manufacturer stopped the support, got the need for troff other devices can control, priority. Ossanna, however, died of a heart attack, before this could be realized.

Brian W. Kernighan So came to the task of troff in C programming. This produced from scratch developed version device-independent code that could be easily read by drivers and translated into appropriate printer codes. This new version of troff ( ditroff for device independent, troff ' called ) also had some extensions such as character features.

Troff then became the Documenter 's Workbench and was at Bell Labs (which were in Unix System Laboratories, USL, renamed) to 1994 constantly evolving. Then Soft Quad took over the care. Brian Kernighan developed troff still continue alone. Therefore, there are currently three variants of the Bell Labs troff. The source code of ditroff from the Documenter 's Workbench was on 14 June 2005, together with Sun's Solaris published placed under the open source license CDDL.

Internal structure

Dripping can be understood as a filter. With an editor, a text document is created, which is translated by troff into a different format, following the instructions that are embedded in the document text.

Earlier it was driven by the troff output code directly the Fotobelichter. With the advent of other high-resolution printing methods ( eg laser printers ) was dripped rewritten in such a way that a kind Metakode was generated, so called device-independent troff, short ditroff. More filters programs generated from this intermediate format then the final, device-specific code to control.

Macros

Since the troff commands are partially complex and can occur multiple times within a document, the macro creation was intended from the outset the possibility. Thus, various troff commands are grouped together at the same time changing the left and right feeder to a macro, for example, to decrease the font size. This increases the clarity enormously in the document and allows similar to CSS in HTML or style sheets in the familiar graphical word processors centralized format structure that needs to be changed adjustments at once, thus avoiding changes in many places in the document.

There extensive macro packages have been developed for various documents styles. A typical troff distribution contains, for example, the me macros to format academic papers, man macros to create Unix man pages, and the ms macros for books, technical documentation and reports.

Preprocessors

When troff to DWB further developed, work began on various preprocessor programs, as could not be realized everything just in troff. These programs transform - again as a filter - certain parts of a document within troff input. This filter programs have their own syntax and recognize their code in troff document certain key commands ( exactly on a single line ) and translate the code between them in troff commands (requests).

Nroff produces output for character- oriented devices such as line printers, daisy wheel printers, computer terminals, etc. commands that are not applicable ( such as font changes ) are ignored.

Variants

  • Troff, Bill Joy, was delivered to SunOS 4.x Sun; since SunOS 5.x Sun ditroff supplies
  • The Heirloom Documentation Tools are a version of ditroff with some extensions; the freely available source code is based on the same programs OpenSolaris
  • The Soft Quad DWB, which is based on the USL DWB 2.0 1994
  • The DWB 3.4 Lucent Software Solutions ( USL )
  • Groff, GNU troff and nroff implementation for

Troff today

In the 1990s, the popularity of the troff family subsided, but it is still used quite intensively. Although Troff was replaced by other programs such Interleaf, FrameMaker and LaTeX, it is still the standard format of the UNIX documentation, the so-called man pages.

The possibility Plain text output and this format still is, nowadays probably the most important function of troff: Viewing a man page on a modern Unix system starts in the background a nroff process, which formats the present in troff format man pages, and these a text viewer (eg more or less) goes further.

Credentials

  • Mel Melchner explained in a letter the roff / troff / DWB History and Status
242140
de