troff

troff

Robbert Haarman

2010-12-11


Introduction

troff is one of the oldest typesetting systems in existance. According to The History of Troff, it was first written in 1973. Since then, it has become a standard component of a complete Unix system.

Modern Unix systems typically include groff, the GNU version of troff, which is typically used to render man pages. However, groff can be used to produce quality typeset output in a variety of format, including DVI and PostScript. While groff cannot compete with Latex on quality, usability, or features, it is relatively light-weight, runs quickly, and comes pre-installed on most Unix systems.

This tutorial serves as a quick introduction to using groff to generate man pages, letters, and articles.


Example

I have created a sample groff document using the ms package. You can download the source here: example.ms (1274 bytes). To process it, use a command like:


groff -Tps -ms example.ms > example.ps

You can also try different output formats; see the manpage for groff to find out which ones are supported.

Valid XHTML 1.1! Valid CSS! Viewable with Any Browser