roff is the general name for a set of type-setting programs, known under names like troff, nroff, groff, etc.
The roff type-setting system consists of a formatting language, macro packages, preprocessors, postprocessors for output devices, user front-end programs, and conversion tools.
The most common roff system today is the free software implementation groff (from `GNU roff'). The pre-groff implementations are referred to as `classical' (dating back as long as 1973).
groff is backward-compatible to its classical ancestors, but has many extensions, and is still evolving. As it is available for almost every computer system it is the de-facto roff standard today.
In spite of its age, roff is in wide use today, e.g., the manual pages on UNIX systems (man-pages) are written in roff. The roff output for text devices is still unmatched, and its graphical output has the same quality as the other free type-setting programs and is better than some of the commercial systems.
This document gives only an overview and provides pointers to further documentation.
There are three terms that refer to the language of the roff system. The term troff language is used when the classical aspects of roff are stressed, the term groff language includes the GNU extensions, whereas roff language is the general term.
The main source of documentation for all aspects of the groff language is the groff info file. The manual page groff(7) gives a short description of all predefined language elements.
Documents using roff are normal text files decorated by formatting elements. It is very easy to write high-quality documents by using one of the macro packages. These are like high-level programming languages, while the bare roff language compares to a low-level language like C or assembler.
The roff language is a full programming language providing low-level requests, definition of macros, escape sequences, string variables, number or size registers, and C-like flow controls.
Some clarification on the language elements seems to be wanted. Requests are basic formatting commands defined by programming languages like C, C++, etc., whereas macros are formatting commands that are written in the roff language. A document writer will not note any difference in usage for requests or macros, both are written on a line on their own starting with a dot `.'. But the user may define her own macros if desired.
Formatters are the front-end programs that analyze a groff document and translate it into a form that is suitable for a special device. The traditional roff had two formatters, nroff for text devices and troff for graphical devices.
The classical preprocessors that are still available in groff.
for including mathematical equations.
for constructing graphical elements (this preprocessor doesn't come with groff; it is an extra package).
for including gremlin pictures.
for creating diagrams.
for bibliographic references.
for including other roff files.
for rectangular tables.
Each of these preprocessors defines its own language that is translated into roff code when run through the preprocessor program. So parts written in these languages may be included within a roff document. Such an enhanced document is run through one or more corresponding preprocessors before it is fed into the actual formatter.
Macro packages are collections of macros that are suitable to format a special kind of documents in a convenient way. This greatly eases the usage of roff. The macro definitions of a package are kept in a file called name.tmac (or tmac.name) where name is the internal roff name for this package. All tmac files are stored in a single or few directories at standard positions.
A macro package that is used in a document is specified by the command line option -m for the formatter like troff -m name or groff -m name. General details on the naming of macro packages and their placement is found in groff_tmac(5).
Manual pages (man-pages) take the section number as a file name extension, e.g., the filename for this document is roff.7, i.e., it is kept in section 7 of the man-pages.
A colon separated list of directories in which to search for macro files, see groff_tmac(5).
By default, groff installs all of its data files in subdirectories of /usr/share/groff/1.17.2/font and in /usr/share/groff/1.17.2/tmac (except wrapper files for system-specific macro packages which will be in /usr/lib/groff/site-tmac). These locations might vary for different systems. In the following, the former is referred to as , the latter as .
Initialization file for troff.
Device description file for device name.
Font file for font F of device name.
This document is part of groff, the GNU roff distribution. It was written by Bernd Warken
It is distributed under the terms of the FDL (GNU Free Documentation License) version 1.1 or later. You should have received a copy of the FDL on your system, it is also available on-line under
The main source of information is the groff info(1) file.
The predefined elements of the groff language are also documented in the manual page groff(7).
The man pages for macro packages include groff_tmac(5), __groff_man__(7)?, groff_markup(7)?, __groff_mdoc__(7)?, groff_mdoc.samples(7)?, __groff_me__(7)?, groff_mm(7), __groff_mmroff__(7)?, and groff_ms(7).
For details on the GNU implementation of the roff system see groff_char(7), __groff_font__(7)?, groff_out(7)?, and the file README in the main directory of the groff source distribution. These also give details on how to contact or join the groff developer group.