troff, nroff, dpost – text formatting and typesetting


troff [ option ... ] [ file ... ]

dpost [ -f ] [ file ... ]

nroff [ option ... ] [ file ... ]


Troff formats text in the named files for printing on a typesetter, emitting a textual intermediate format called ‘typesetter-independent troff output’, understood by programs such as proof(1) and lp(1), but also by a troff post-processor named dpost, which emits corresponding Postscript. Under -f, dpost also emits Postscript font definitions as needed. Nroff does the same as troff, but produces output suitable for typewriter-like devices, usually without further post-processing, but see col(1).

If no file argument is present, the standard input is read. An argument consisting of a single minus (-) is taken to be a file name corresponding to the standard input. The options are:

unhandled troff command .nr


Print pages in the comma-separated list of numbers and ranges. A range N-M means N through M; initial -M means up to M; final N- means from N to the end.  


Number first generated page N.  


Process the macro file /sys/lib/tmac/ before the input files.  


Set register a (one character name) to N.  


Read standard input after the input files are exhausted.  


Invoke the simultaneous input-output mode of the rd request.  


Produce output suitable for typewriter-like devices.  

Typesetter devices (not -N) only


Send a printable textual approximation of the results to the standard output.  


Prepare output for typesetter dest:

unhandled troff command .ns


(The default.) PostScript printers with preprocessing to handle Unicode characters encoded in UTF  


Regular PostScript printers  


Mergenthaler Linotron 202  


Take font information from directory dir.  

Typewriter (-N) output only


Halt prior to every N pages (default N=1) to allow paper loading or changing.  


Prepare output for specified terminal. Known names include utf for the normal Plan 9 UTF encoding of the Unicode Standard character set (default), 37 for the Teletype model 37, lp (‘line-printer’) for any terminal without half-line capability, 450 for the \s-1DASI\s+1-450 (Diablo Hyterm), and think (HP ThinkJet).  


Produce equally-spaced words in adjusted lines, using full terminal resolution.  


Use output tabs during horizontal spacing to speed output and reduce output character count. Tab settings are assumed to be every 8 nominal character widths.  



temporary file  


standard macro files  


terminal driving tables for nroff  


font width tables for troff  




lp(1), proof(1), page(1), eqn(1), tbl(1), pic(1), grap(1), doctype(1), ms(6), image(6), deroff(1), col(1)
J. F. Ossanna and B. W. Kernighan, “Troff User’s Manual”
B. W. Kernighan, “A Typesetter-Independent TROFF”, CSTR #97
B. W. Kernighan, “A TROFF Tutorial”, Unix Research System Programmer’s Manual, Tenth Edition, Volume 2.