|HP-UX Reference > N
HP-UX 11i Version 3: February 2007
nroff — format text
nroff is a text formatting program that interprets source text contained in file and prepares it for printing on typewriter-like devices and line printers. If file name is - or not specified, standard input is used as source text.
If the file contains plain text with no formatter requests, nroff uses default line lengths and page dimensions to produce readable output, outputting a blank line for each blank line encountered in the input, and filling and adjusting text to both margins. nroff ignores any lines in the source text that begin with a period (.) but are not valid nroff formatter requests.
Source File Preparation
Document source file preparation is usually easier when text is coded using macro packages such as mm(1) which provide a high-level interface for headings, page footers, lists, and other features, rather than coding the file with inherently low-level nroff requests.
nroff recognizes the following command-line options, which can appear in any order but must appear before the file argument:
LC_CTYPE determines the interpretation of text as single and/or multi-byte characters.
LANG is used to determine the search path for the -m option. LANG also determines the language in which messages are displayed.
If LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, nroff behaves as if all internationalization variables are set to "C". See environ(5).
The following command prints the first five pages of the document whose nroff source file is filename:
nroff -o-5 filename
Note that there should not be a space between the o and the - or the - and the 5.
To print only pages 1, 3, and 4 type:
nroff -o1,3,4 filename
When nroff is used with the -olist option inside a pipeline, it may cause a harmless "broken pipe" diagnostic if the last page of the document is not specified in list.