roff.man revision 69626
-*- nroff -*-
roff.7 This file is part of groff, the GNU roff type-setting system. Copyright (C) 2000 Free Software Foundation, Inc. written by Bernd Warken <bwarken@mayn.de> Last update: 17 May 2000 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being this .ig-section and AUTHOR, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the Free Documentation License is included as a file called FDL in the main directory of the groff source package. .. . --------------------------------------------------------------------
Setup
--------------------------------------------------------------------
. . mso tmac.tty-char . ftr CR R . ftr CI I . ftr CB B .\} . text lines in macro definitions or bracketed sections \{...\}
. if 1 \\$*\& .. . . ds @tmp@ \f(CB\\$1 . shift 1 . text \\*[@tmp@]\\$* . rm @tmp@ .. . . ds @tmp@ `\f(CB\\$1' . shift . text \\*[@tmp@]\\$* . rm @tmp@ .. . . ds @tmp@ \f(CB\e\\$1 . shift . text \\*[@tmp@]\\$* . rm @tmp@ .. . . ds @tmp@ \f(CI\\$1 . shift 1 . text \\*[@tmp@]\\$* . rm @tmp@ .. . . ds @tmp@ \\$1 \f(CR\\$2 . shift 2 . text \\*[@tmp@]\\$* . rm @tmp@ .. . --------------------------------------------------------------------
Title
--------------------------------------------------------------------
ROFF @MAN7EXT@ "@MDATE@" "Groff Version @VERSION@"
NAME
roff - a survey of the roff typesetting system --------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------
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. This document is not maintained and might be out of date. For the real documentation refer to the groff info file that contains the detailed, actual and concise reference information. --------------------------------------------------------------------

"FORMATTING LANGUAGE"
--------------------------------------------------------------------
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 (@MAN7EXT@) 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. In the 1980s, it was even possible to write the common utilities for system administration by only using troff. There were contests on writing the most unreadable program fake by exclusively using troff. Because of security impacts, these dangerous features were removed in groff . ./

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 .'char . . But the user may define her own macros if desired.

Escape sequences are in-line elements starting with a backslash .'char \e . They are used to implement various features, including the insertion of non-ASCII characters with .esc ( , the content of strings with .esc * and register variables with .esc n , font changes with .esc f , in-line comments with .esc \(dq , the escaping of special control characters like .esc \e , and many other features. --------------------------------------------------------------------

FORMATTERS
--------------------------------------------------------------------
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.

These programs still exist in the groff implementation, but usually they are accessed through a program called groff . This combined and extended the old functionality into a single program. It has many command-line options, most of them herited from troff . To ease the option jungle, the user-friendly utility grog (from `groff guess') was created. It tries to guess from the document which arguments should be used and displays a suitable command line. Though not being perfect, it is a good starting point. --------------------------------------------------------------------

PREPROCESSORS
--------------------------------------------------------------------
The classical preprocessors that are still available in groff.

0

eqn for including mathematical equations.

grap for constructing graphical elements (this preprocessor doesn't come with groff; it is an extra package).

grn for including gremlin pictures.

pic for creating diagrams.

refer for bibliographic references.

soelim for including other roff files.

tbl 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.

The preprocessor programs extract and transform the document parts determined for them. They can be called either in a UNIX pipeline with their program name or automatically with a groff option.

preprocessor@groff option
eqn@-e
grap@-G
grn@-g
pic@-p
refer@-R
tbl@-r
soelim@-s

. --------------------------------------------------------------------

"MACRO PACKAGES"
--------------------------------------------------------------------
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 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 .option -m for the formatter like .option "troff -m" .argname name or .option "groff -m" .argname name . General details on the naming of macro packages and their placement is found in tmac (@MAN5EXT@).

Famous classical macro packages are man , mandoc , and mdoc for manual pages and me , ms , and mm for books, articles, and letters. Besides these collections, groff provides an increasing number of new macro packages for various applications, for example integration of or conversion into other file formats. --------------------------------------------------------------------

"FILE NAME EXTENSIONS"
--------------------------------------------------------------------
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 .prefixednumber section 7 of the man-pages.

The classical macro packages take the package name as an extension, e.g. file. me for a document using the me macro package, file. mm for mm , file. ms for ms , file. pic for pic files, etc.

But there is no general naming scheme for roff documents, though file. roff or file. rof seems to be a good choice.

File name extensions can be very handy in conjunction with the less (1) pager. It provides the possibility to feed all input into a command-line pipe that is specified in the shell environment variable LESSOPEN This process is not well documented, so here an example LESSOPEN='|lesspipe %s' where lesspipe is either a system supplied command or a shell script of your own. .. --------------------------------------------------------------------

EDITING
--------------------------------------------------------------------
Most text editors provide support for editing documents using roff. Especially useful is the nroff-mode in all flavors of the Emacs editor. --------------------------------------------------------------------
ENVIRONMENT
--------------------------------------------------------------------

GROFF_TMAC_PATH A colon separated list of directories in which to search for macro files, see tmac (@MAN5EXT@).

GROFF_TYPESETTER Default device.

GROFF_FONT_PATH A colon separated list of directories in which to search for the dev name directory. troff will search in directories given in the .option -F option before these, and in standard directories ( .:/usr/local/share/groff/font:/usr/lib/font ) after these. --------------------------------------------------------------------

FILES
--------------------------------------------------------------------
By default, groff installs all of its library files in a directory tree under /usr/local/share/groff . This location might vary for different systems. In the following, this directory is referred to as <groff_dir> .

<groff_dir> /tmac/troffrc Initialization file for troff.

<groff_dir> /tmac/tmac. name Macro files.

<groff_dir> /font/dev name /DESC Device description file for device name .

<groff_dir> /font/dev name / F Font file for font F of device name . --------------------------------------------------------------------

BUGS
--------------------------------------------------------------------
The groff documentation is in evolution at the moment. It is possible that small inconsistencies between different documents exist temporarily. --------------------------------------------------------------------
AUTHOR
--------------------------------------------------------------------
This document is part of groff, the GNU roff distribution. It was written by Bernd Warken <bwarken@mayn.de>.

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

--------------------------------------------------------------------
"SEE ALSO"
--------------------------------------------------------------------
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 (@MAN7EXT@).

Formatters and their wrappers: groff (@MAN1EXT@), grog (@MAN1EXT@), nroff (@MAN1EXT@), and troff (@MAN1EXT@).

Postprocessors for the output devices: grodvi (@MAN1EXT@), grohtml (@MAN1EXT@), grolbp (@MAN1EXT@), grolj4 (@MAN1EXT@), grops (@MAN1EXT@), and grotty (@MAN1EXT@).

Standard preprocessors: eqn (@MAN1EXT@), grn (@MAN1EXT@), grap (1), pic (@MAN1EXT@), refer (@MAN1EXT@), soelim (@MAN1EXT@), and tbl (@MAN1EXT@).

The man pages for macro packages include groff_tmac (@MAN5EXT@), groff_man (@MAN7EXT@), groff_markup (@MAN7EXT@), groff_mdoc (@MAN7EXT@), groff_mdoc.samples (@MAN7EXT@), groff_me (@MAN7EXT@), groff_mm (@MAN7EXT@), groff_mmroff (@MAN7EXT@), groff_ms (@MAN7EXT@), and groff_msafer (@MAN7EXT@).

The following utilities are available: addftinfo (@MAN1EXT@), afmtodif (@MAN1EXT@), hpftodit (@MAN1EXT@), indxbib (@MAN1EXT@), lookbib (@MAN1EXT@), pfbtops (@MAN1EXT@), tfmtodit (@MAN1EXT@), and gxditview (@MAN1EXT@).

For details on the GNU implementation of the roff system see groff_char (@MAN7EXT@), groff_font (@MAN7EXT@), groff_out (@MAN7EXT@), 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.

Many classical .troff documents are still available on-line. Especially informative are the original Bell Labs proceedings for the old, free UNIX 7 found at http://cm.bell-labs.com/cm/cs/cstr.html and the collection of the late Richard S. Stevens at http://www.kohala.com/start/troff/ .