We are still actively working on the spam issue, the wiki may be restored to an earlier date and account creation may be disabled.


From InstallGentoo Wiki
Jump to: navigation, search

troff is a typesetting language that can be used for creating all sorts of documents, such as letters and even your homework, if you happen to be an underage b8r. troff differs from monolithic word processors by being a barebones language with decent macros provided for common tasks that describes what you want your document to look like. It differs from TeX and LaTeX in that troff tends to be more terse with commands such as .LP and .SH. Perhaps the most widespread use of troff is the use of the mdoc and man macros, used to write manual pages for Unix-like operating systems such as GNU/Linux and the BSDs.

Distributions of troff

You should probably consider these two versions of troff:

Plan 9 troff

Plan 9 troff is descended from J. Ossanna's original troff for Unix on the PDP-11/70 at Bell Labs. It is also included in plan9port.

Plan 9 troff relies more on pipes than groff. Here's how a document using the ms macro package gets turned into a PDF on 9front:

% troff -ms doc.ms | dpost -f | ps2pdf > doc.pdf

Alternatively, it can be done with lp(1) like so:

% troff -ms doc.ms | lp -lstdout | ps2pdf > doc.pdf

On Unix-like systems using plan9port, dpost is missing, but tr2post does mostly the same thing. No ps2pdf is provided with plan9port, so the Ghostscript ps2pdf script will suffice:

$ 9 troff -ms doc.ms | 9 tr2post | ps2pdf - > doc.pdf

Ghostscript is (at least on OpenBSD) a dependency of plan9port.


Groff is the GNU Project's version of troff, originally written by James Clark in C++, and that might tell you quite a lot about the design of groff.