Troff
Encyclopedia
troff is a document processing system developed by AT&T
AT&T
AT&T Inc. is an American multinational telecommunications corporation headquartered in Whitacre Tower, Dallas, Texas, United States. It is the largest provider of mobile telephony and fixed telephony in the United States, and is also a provider of broadband and subscription television services...

 for the Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 operating system.

History

troff can trace its origins back to a text formatting program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

 called RUNOFF
RUNOFF
RUNOFF was the first computer text formatting program to see significant use. It was written in 1964 for the CTSS operating system by Jerome H. Saltzer in MAD assembler....

, written by Jerome H. Saltzer
Jerome H. Saltzer
Jerome H. Saltzer is a computer scientist who has made many notable contributions.-Career:He received an Sc. D in Electrical Engineering from MIT in 1966...

 for MIT
Massachusetts Institute of Technology
The Massachusetts Institute of Technology is a private research university located in Cambridge, Massachusetts. MIT has five schools and one college, containing a total of 32 academic departments, with a strong emphasis on scientific and technological education and research.Founded in 1861 in...

's CTSS operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 in the mid-1960s. (The name allegedly came from the phrase at the time, I'll run off a document.)

Bob Morris
Robert Morris (cryptographer)
Robert Morris , was an American cryptographer and computer scientist. -Family and Education:Morris was born in Boston, Massachusetts. His parents were Walter W. Morris, a salesman, and Helen Kelly Morris...

 ported it to the GE 635 architecture and called the program roff
Roff
roff was the first Unix text-formatting computer program, the most important application run on the first machine specifically purchased to run UNIX, and a predecessor of the nroff and troff document processing systems....

 (an abbreviation of runoff). It was rewritten as rf for the PDP-7
PDP-7
The DEC PDP-7 is a minicomputer produced by Digital Equipment Corporation. Introduced in 1965, it was the first to use their Flip-Chip technology. With a cost of only $72,000 USD, it was cheap but powerful by the standards of the time. The PDP-7 was the third of Digital's 18-bit machines, with...

, and at the same time (1969), Doug McIlroy rewrote an extended and simplified version of roff in the BCPL
BCPL
BCPL is a procedural, imperative, and structured computer programming language designed by Martin Richards of the University of Cambridge in 1966.- Design :...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

.

The first version of Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 was developed on a PDP-7
PDP-7
The DEC PDP-7 is a minicomputer produced by Digital Equipment Corporation. Introduced in 1965, it was the first to use their Flip-Chip technology. With a cost of only $72,000 USD, it was cheap but powerful by the standards of the time. The PDP-7 was the third of Digital's 18-bit machines, with...

 which was sitting around Bell Labs
Bell Labs
Bell Laboratories is the research and development subsidiary of the French-owned Alcatel-Lucent and previously of the American Telephone & Telegraph Company , half-owned through its Western Electric manufacturing subsidiary.Bell Laboratories operates its...

. In 1971 the developers wanted to get a PDP-11
PDP-11
The PDP-11 was a series of 16-bit minicomputers sold by Digital Equipment Corporation from 1970 into the 1990s, one of a succession of products in the PDP series. The PDP-11 replaced the PDP-8 in many real-time applications, although both product lines lived in parallel for more than 10 years...

 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
Joe Ossanna
Joseph F. Ossanna was a Member of the Technical Staff of the Bell Telephone Laboratories in Murray Hill, New Jersey...

.

When they needed a more flexible language, a new version of roff called nroff
Nroff
nroff is a Unix text-formatting program; it produces output suitable for simple fixed-width printers and terminal windows...

 (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
CAT (phototypesetter)
The GSI C/A/T is a phototypesetter developed by Graphic Systems in 1972. This phototypesetter, along with troff software for UNIX, revolutionized the typesetting and document printing industry...

, Ossanna wrote a version of nroff that would drive it. It was dubbed troff, for typesetter 'roff. As such, the name troff is pronounced ˈtiː.rɒf rather than }.

With troff came nroff (they were actually almost the same program), which was for producing output for line printer
Line printer
The line printer is a form of high speed impact printer in which one line of type is printed at a time. They are mostly associated with the early days of computing, but the technology is still in use...

s and character terminal
Computer terminal
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system...

s. It understood everything troff did, and ignored the commands which were not applicable (e.g. font
Typeface
In typography, a typeface is the artistic representation or interpretation of characters; it is the way the type looks. Each type is designed and there are thousands of different typefaces in existence, with new ones being developed constantly....

 changes).

Unfortunately, Ossanna's troff was written in PDP-11
PDP-11
The PDP-11 was a series of 16-bit minicomputers sold by Digital Equipment Corporation from 1970 into the 1990s, one of a succession of products in the PDP series. The PDP-11 replaced the PDP-8 in many real-time applications, although both product lines lived in parallel for more than 10 years...

 assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

 and produced output specifically for the CAT phototypesetter. He rewrote it in C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

, 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 died.

So, Brian Kernighan
Brian Kernighan
Brian Wilson Kernighan is a Canadian computer scientist who worked at Bell Labs alongside Unix creators Ken Thompson and Dennis Ritchie and contributed to the development of Unix. He is also coauthor of the AWK and AMPL programming languages. The 'K' of K&R C and the 'K' in AWK both stand for...

 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. The program's documentation defines the output format of ditroff, which is used by many modern troff clones like GNU groff.

The troff collection of tools was eventually called Documenter's WorkBench (DWB), and was under continuous development in Bell Labs
and later at the spin-off Unix System Laboratories
Unix System Laboratories
Unix System Laboratories was originally organized as part of Bell Labs in 1989. USL joined with the UNIX Software Operation, also a Bell Laboratories division, in 1990. It assumed responsibility for Unix development and licensing activities...

 (USL)
through 1994. At that time, SoftQuad took over the maintenance, although Brian Kernighan continued to improve troff on his own. There are thus currently four variants of the original Bell Labs troff:
  • An ancient variation from Bill Joy
    Bill Joy
    William Nelson Joy , commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy and Andy Bechtolsheim, and served as chief scientist at the company until 2003...

    , still shipped by Sun Microsystems
    Sun Microsystems
    Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

    .
  • The SoftQuad DWB, based on USL DWB 2.0 from 1994
  • The DWB 3.4 from Lucent Software Solutions (USL)
  • Troff, Plan 9
    Plan 9 from Bell Labs
    Plan 9 from Bell Labs is a distributed operating system. It was developed primarily for research purposes as the successor to Unix by the Computing Sciences Research Center at Bell Labs between the mid-1980s and 2002...

     edition


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
Interleaf
Founded in 1981, Interleaf was a company that created software products for the technical publishing creation and distribution process. Its initial product was the first commercial document processor that integrated text and graphics editing, producing WYSIWYG output at near-typeset quality...

, FrameMaker
FrameMaker
Adobe FrameMaker is a document processor for the production and manipulation of large structured documents. It is produced by Adobe Systems. Although FrameMaker has evolved slowly in recent years, it maintains a strong following among professional technical writers.- Overview :FrameMaker has more...

 and LaTeX
LaTeX
LaTeX is a document markup language and document preparation system for the TeX typesetting program. Within the typesetting system, its name is styled as . The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to...

, it is still the default format of the UNIX documentation.

The software was reimplemented as groff
Groff (software)
Groff is the GNU replacement for the troff and nroff text formatters. It is an original implementation written primarily in C++ by James Clark and is modeled after ditroff, including many extensions. The first version, 0.3.1, was released June 1990. The first stable version, 1.04, was announced in...

 for the GNU system beginning in 1990. In addition, due to the open sourcing
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 of Ancient UNIX Systems
Ancient UNIX Systems
Ancient UNIX is a term coined by Santa Cruz Operation, to describe early releases of the Unix code base released prior to Unix System III, particularly the Research Unix releases prior to and including Version 7 .After the publication of the Lions' book, work was undertaken to release the earlier...

, as well as modern successors such as OpenSolaris
OpenSolaris
OpenSolaris was an open source computer operating system based on Solaris created by Sun Microsystems. It was also the name of the project initiated by Sun to build a developer and user community around the software...

 and Plan 9 from Bell Labs
Plan 9 from Bell Labs
Plan 9 from Bell Labs is a distributed operating system. It was developed primarily for research purposes as the successor to Unix by the Computing Sciences Research Center at Bell Labs between the mid-1980s and 2002...

, several versions of AT&T troff are available under various open source licenses.

Features

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 macro packages have been created for various document styles. A typical distribution of troff includes the me macros for formatting research papers, man macros for creating Unix man pages, and the ms and mm macros for letters, books, technical memoranda, and reports.

Preprocessors

As troff evolved, since there are several things which cannot be done easily in troff, several preprocessor
Preprocessor
In computer science, a preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers...

s were developed. These programs transform certain parts of a document into troff input, fitting naturally into the use of "pipelines" in Unix — sending the output of one program as the input to another (see pipes and filters).
  • eqn
    Eqn
    Part of the troff suite of Unix document layout tools, eqn is a preprocessor that formats equations for printing. A similar program, neqn, accepted the same input as eqn, but produced output tuned to look better in nroff...

     preprocessor allows mathematical formulae to be specified in simple and intuitive manner.
  • tbl
    Tbl
    Part of the troff suite of Unix document layout tools, tbl is a preprocessor that formats tables.Like the main troff program, tbl uses command lines interspersed with data to be printed...

     is a preprocessor for formatting tables.
  • refer
    Refer (software)
    refer is a program for managing bibliographic references,and citing them in troff documents.It is implemented as a troff preprocessor.refer was written by Mike E...

     (and the similar program bib) processes citations in a document according to a bibliographic database.
  • vgrind formats program listings.


Three preprocessors provide troff with drawing capabilities by defining a domain-specific language for describing the picture.
  • pic is a procedural programming language providing various drawing functions like circle and box.
  • ideal allows the drawing of pictures declaratively
    Declarative programming
    In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than...

    , deriving the picture by solving a system of simultaneous equations
    Simultaneous equations
    In mathematics, simultaneous equations are a set of equations containing multiple variables. This set is often referred to as a system of equations. A solution to a system of equations is a particular specification of the values of all variables that simultaneously satisfies all of the equations...

     based on vectors and transformations described by its input.
  • grn describes the pictures through graphical elements drawn at absolute coordinates, based on the gremlin file format defined by an early graphics workstation.


Yet more preprocessors allow the drawing of more complex pictures by generating output for pic.
  • grap draws charts
    Chart
    A chart is a graphical representation of data, in which "the data is represented by symbols, such as bars in a bar chart, lines in a line chart, or slices in a pie chart"...

    , like scatter plots and histograms.
  • chem draws chemical structure diagrams
    Structural formula
    The structural formula of a chemical compound is a graphical representation of the molecular structure, showing how the atoms are arranged. The chemical bonding within the molecule is also shown, either explicitly or implicitly...

    .
  • dformat draws record-based
    Row (database)
    In the context of a relational database, a row—also called a record or tuple—represents a single, implicitly structured data item in a table. In simple terms, a database table can be thought of as consisting of rows and columns or fields...

     data structures.

Reimplementations

  • groff
    Groff (software)
    Groff is the GNU replacement for the troff and nroff text formatters. It is an original implementation written primarily in C++ by James Clark and is modeled after ditroff, including many extensions. The first version, 0.3.1, was released June 1990. The first stable version, 1.04, was announced in...

     is GNU Project
    GNU Project
    The GNU Project is a free software, mass collaboration project, announced on September 27, 1983, by Richard Stallman at MIT. It initiated GNU operating system development in January, 1984...

    's free
    Free software
    Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

     replacement for troff and nroff.
  • unroff is an extensible replacement of troff written in Scheme
  • Heirloom troff is based on troff from OpenSolaris
    OpenSolaris
    OpenSolaris was an open source computer operating system based on Solaris created by Sun Microsystems. It was also the name of the project initiated by Sun to build a developer and user community around the software...

    . It includes: support for OpenType
    OpenType
    OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior...

     fonts, improved support for Type 1 fonts, support for Unicode
    Unicode
    Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

    , a new paragraph formatting algorithm, and a groff
    Groff (software)
    Groff is the GNU replacement for the troff and nroff text formatters. It is an original implementation written primarily in C++ by James Clark and is modeled after ditroff, including many extensions. The first version, 0.3.1, was released June 1990. The first stable version, 1.04, was announced in...

     compatibility mode.
  • mandoc
    Mandoc
    mandoc is an ISC licensed utility for formatting man pages, specifically those written in the mdoc macro language...

     is a specialised compiler/formatter only for the man and mdoc
    MDOC
    MDOC can refer to:* Maine Department of Corrections* Michigan Department of Corrections* Mississippi Department of Corrections* Missouri Department of Corrections...

     macro
    Troff macro
    The troff typesetting system includes sets of commands called macros that are run before starting to process the document. These macros include setting up page headers and footers, defining new commands, and generally influencing how the output will be formatted.The command-line argument for...

     packages.

See also

  • Desktop publishing
    Desktop publishing
    Desktop publishing is the creation of documents using page layout software on a personal computer.The term has been used for publishing at all levels, from small-circulation documents such as local newsletters to books, magazines and newspapers...

  • DocBook
    DocBook
    DocBook is a semantic markup language for technical documentation. It was originally intended for writing technical documents related to computer hardware and software but it can be used for any other sort of documentation....

  • groff
    Groff (software)
    Groff is the GNU replacement for the troff and nroff text formatters. It is an original implementation written primarily in C++ by James Clark and is modeled after ditroff, including many extensions. The first version, 0.3.1, was released June 1990. The first stable version, 1.04, was announced in...

     GNU troff/nroff replacement

  • nroff
    Nroff
    nroff is a Unix text-formatting program; it produces output suitable for simple fixed-width printers and terminal windows...

  • SGML
  • TeX
    TeX
    TeX is a typesetting system designed and mostly written by Donald Knuth and released in 1978. Within the typesetting system, its name is formatted as ....



External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK