MAN(7) | Miscellaneous Information Manual | MAN(7) |
In a man document, lines beginning with the control character ‘.' are called “macro lines”. The first word is the macro name. It usually consists of two capital letters. For a list of available macros, see MACRO OVERVIEW. The words following the macro name are arguments to the macro.
Lines not beginning with the control character are called “text lines”. They provide free-form text to be printed; the formatting of the text depends on the respective processing context:
.SH Macro lines change control state. Text lines are interpreted within the current state.
Many aspects of the basic syntax of the man language are based on the roff(7) language; see the LANGUAGE SYNTAX and MACRO SYNTAX sections in the roff(7) manual for details, in particular regarding comments, escape sequences, whitespace, and quoting.
Beyond TH, at least one macro or text line must appear in the document.
The following is a well-formed skeleton man file for a utility “progname”:
.TH PROGNAME 1 2009-10-10 .SH NAME \fBprogname\fR \(en a description goes here .\" .SH LIBRARY .\" For sections 2 & 3 only. .\" Not used in OpenBSD. .SH SYNOPSIS \fBprogname\fR [\fB\-options\fR] arguments... .SH DESCRIPTION The \fBfoo\fR utility processes files... .\" .SH IMPLEMENTATION NOTES .\" Not used in OpenBSD. .\" .SH RETURN VALUES .\" For sections 2, 3, & 9 only. .\" .SH ENVIRONMENT .\" For sections 1, 6, 7, & 8 only. .\" .SH FILES .\" .SH EXIT STATUS .\" For sections 1, 6, & 8 only. .\" .SH EXAMPLES .\" .SH DIAGNOSTICS .\" For sections 1, 4, 6, 7, & 8 only. .\" .SH ERRORS .\" For sections 2, 3, & 9 only. .\" .SH SEE ALSO .\" .BR foo ( 1 ) .\" .SH STANDARDS .\" .SH HISTORY .\" .SH AUTHORS .\" .SH CAVEATS .\" .SH BUGS .\" .SH SECURITY CONSIDERATIONS .\" Not used in OpenBSD.
The sections in a man document are conventionally ordered as they appear above. Sections should be composed as follows:
\fBname\fR \(en description
Standard C Library (libc, -lc)
For the first, utilities (sections 1, 6, and 8), this is generally structured as follows:
\fBname\fR [-\fBab\fR] [-\fBc\fR\fIarg\fR] \fBpath\fR...
For the second, function calls (sections 2, 3, 9):
.B char *name(char *\fIarg\fR);
And for the third, configurations (section 4):
.B name* at cardbus? function?
Manuals not in these sections generally don't need a SYNOPSIS.
.BR bar ( 1 ),
Cross-references should conventionally be ordered first by section, then alphabetically.
IEEE Std 1003.2 (\(lqPOSIX.2\(rq)
If not adhering to any standards, the HISTORY section should be used.
TH | set the title: title section date [source [volume]] |
AT | display AT&T UNIX version in the page footer (<= 1 argument) |
UC | display BSD version in the page footer (<= 1 argument) |
SH | section header (one line) |
SS | subsection header (one line) |
PP, LP, P | start an undecorated paragraph (no arguments) |
RS, RE | reset the left margin: [width] |
IP | indented paragraph: [head [width]] |
TP | tagged paragraph: [width] |
HP | hanged paragraph: [width] |
br | force output line break in text mode (no arguments) |
sp | force vertical space: [height] |
fi, nf | fill mode and no-fill mode (no arguments) |
in | additional indent: [width] |
B | boldface font |
I | italic font |
R | roman (default) font |
SB | small boldface font |
SM | small roman font |
BI | alternate between boldface and italic fonts |
BR | alternate between boldface and roman fonts |
IB | alternate between italic and boldface fonts |
IR | alternate between italic and roman fonts |
RB | alternate between roman and boldface fonts |
RI | alternate between roman and italic fonts |
OP | optional arguments |
Examples:
.BI bold italic bold italic
The output of this example will be emboldened “bold” and italicised “italic”, with spaces stripped between arguments.
See BI for an equivalent example.
The width argument must conform to Scaling Widths. If specified, it's saved for later paragraph left-margins; if unspecified, the saved or default width is used.
See BI for an equivalent example.
The width argument defines the width of the left margin and is defined by Scaling Widths. It's saved for later paragraph left-margins; if unspecified, the saved or default width is used.
The head argument is used as a leading term, flushed to the left margin. This is useful for bulleted paragraphs and so on.
See BI for an equivalent example.
The key is usually a command-line flag and value its argument.
See BI for an equivalent example.
See BI for an equivalent example.
The width argument must conform to Scaling Widths. If not specified, the saved or default width is used.
See also RE.
Conventionally, the document title is given in all caps. The recommended date format is YYYY-MM-DD as specified in the ISO-8601 standard; if the argument does not conform, it is printed verbatim. If the date is empty or not specified, the current date is used. The optional source string specifies the organisation providing the utility. The volume string replaces the default rendered volume, which is dictated by the manual section.
Examples:
.TH CVS 5 1992-02-12 GNU
The width argument must conform to Scaling Widths. If specified, it's saved for later paragraph left-margins; if unspecified, the saved or default width is used.
See also sp.
.in [width]
If width is signed, the new offset is relative. Otherwise, it is absolute. This value is reset upon the next paragraph, section, or sub-section.
Insert height spaces, which must conform to Scaling Widths. If 0, this is equivalent to the br macro. Defaults to 1, if unspecified.
See also br.
.I foo
is equivalent to ‘.I foo'. If next-line macros are invoked consecutively, only the last is used. If a next-line macro is followed by a non-next-line macro, an error is raised, except for br, sp, and na.
The syntax is as follows:
.YO [body...] [body...]
Macro | Arguments | Scope | Notes |
AT | <=1 | current | |
B | n | next-line | |
BI | n | current | |
BR | n | current | |
DT | 0 | current | |
I | n | next-line | |
IB | n | current | |
IR | n | current | |
OP | 0, 1 | current | compat |
R | n | next-line | |
RB | n | current | |
RI | n | current | |
SB | n | next-line | |
SM | n | next-line | |
TH | >1, <6 | current | |
UC | <=1 | current | |
br | 0 | current | compat |
fi | 0 | current | compat |
ft | 1 | current | compat |
in | 1 | current | compat |
na | 0 | current | compat |
nf | 0 | current | compat |
sp | 1 | current | compat |
Macros marked as “compat” are included for compatibility with the significant corpus of existing manuals that mix dialects of roff. These macros should not be used for portable man manuals.
The syntax is as follows:
.YO [head...] [head...] [body...]
The closure of body scope may be to the section, where a macro is closed by SH; sub-section, closed by a section or SS; part, closed by a section, sub-section, or RE; or paragraph, closed by a section, sub-section, part, HP, IP, LP, P, PP, or TP. No closure refers to an explicit block closing macro.
As a rule, block macros may not be nested; thus, calling a block macro while another block macro scope is open, and the open scope is not implicitly closed, is syntactically incorrect.
Macro | Arguments | Head Scope | Body Scope | Notes |
HP | <2 | current | paragraph | |
IP | <3 | current | paragraph | |
LP | 0 | current | paragraph | |
P | 0 | current | paragraph | |
PP | 0 | current | paragraph | |
RE | 0 | current | none | compat |
RS | 1 | current | part | compat |
SH | >0 | next-line | section | |
SS | >0 | next-line | sub-section | |
TP | n | next-line | paragraph |
Macros marked “compat” are as mentioned in Line Macros.
If a block macro is next-line scoped, it may only be followed by in-line macros for decorating text.
\f
' font escape sequences can be used to choose fonts. In text lines, the effect of manual font selection by escape sequences only lasts until the next macro invocation; in macro lines, it only lasts until the end of the macro scope. Note that macros like BR open and close a font scope for each argument.
The OP macro is part of the extended man macro set, and may not be portable to non-GNU troff implementations.
January 3, 2012 | NetBSD 6.1 |