LinuxCommandLibrary

roff

Format documents for printing or display

SYNOPSIS

roff [options] [files...]

PARAMETERS

-T device
    Specify the output device to use. Common devices include ps for PostScript, pdf for PDF, ascii for plain text, and utf8 for UTF-8 encoded text. If not specified, a default device may be used based on system configuration.

-m macro_package
    Prepend the specified macro file. Commonly used macro packages include man for man pages and ms for general document formatting.

-e
    Enable environment commands.

-h
    Produce output suitable for viewing on a terminal, typically enabling hyphenation and other terminal-specific optimizations.

-i
    Read standard input after processing all files.

-M path
    Specify a directory to search for macro files.

-w
    Enable warning messages.

files...
    The input files to process. If no files are specified, roff reads from standard input.

DESCRIPTION

roff (run off) is a family of text formatting languages and their corresponding processors.
The most common roff implementation on Linux is GNU troff (groff), which is part of the GNU project. roff is used to format documents for display on a terminal or for printing. It provides a markup language that allows authors to control the appearance of the text, including fonts, margins, spacing, headers, footers, and other formatting elements.
roff is particularly useful for creating man pages, technical documentation, and other types of documents where precise formatting is important. It works by interpreting special formatting commands embedded within the text and generating output in a variety of formats, including PostScript, PDF, and plain text.

CAVEATS

roff and its implementations like groff can have a steep learning curve due to the complexity of the markup language and the various macro packages. Error messages can be cryptic, and debugging roff documents can be challenging.

MACRO PACKAGES

Macro packages provide pre-defined formatting commands that simplify the creation of documents. The man macro package is commonly used for creating man pages, while the ms macro package is used for general document formatting. These packages define macros for headings, paragraphs, lists, tables, and other common document elements.

INVOCATION

While the roff command itself is often used, it is more common to use wrapper commands like groff or man, which automatically handle device selection and macro package loading.

HISTORY

The original roff program was developed in the early 1970s at Bell Labs as a typesetting tool for Unix. nroff was a later version designed for output on line printers, while troff was designed for phototypesetters. GNU troff (groff) is a modern implementation of troff that is part of the GNU project. It supports a wider range of devices and features than the original versions of roff.

SEE ALSO

groff(1), nroff(1), troff(1), man(1)

Copied to clipboard