DOKK / manpages / debian 11 / manpages-pt / mdoc.7.pt
MDOC(7) Miscellaneous Information Manual MDOC(7)

mdocquick reference guide for the -mdoc macro package

groff -mdoc files ...

The -mdoc package is a set of content-based and domain-based macros used to format the BSD man pages. The macro names and their meanings are listed below for quick reference; for a detailed explanation on using the package, see the tutorial sampler mdoc.samples(7).

Note that this is not the usual macro package for Linux documentation, although it is used for documentation of several widely-used programs; see man(7).

The macros are described in two groups, the first includes the structural and physical page layout macros. The second contains the manual and general text domain macros which differentiate the -oc package from other troff formatting packages.

To create a valid manual page, these three macros, in this order, are required:

Month day, year
Document date.
DOCUMENT_TITLE [section] [volume]
Title, in upper case.
OPERATING_SYSTEM [version/release]
Operating system (BSD).

Section headers, paragraph breaks, lists and displays.

Section Headers. Valid headers, in the order of presentation:
NAME
Name section, should include the ‘.Nm’ or ‘.Fn’ and the ‘.Nd’ macros.
SYNOPSIS
Usage.
DESCRIPTION
General description, should include options and parameters.
RETURN VALUES
Sections two and three function calls.
ENVIRONMENT
Describe environment variables.
FILES
Files associated with the subject.
EXAMPLES
Examples and suggestions.
DIAGNOSTICS
Normally used for section four device interface diagnostics.
ERRORS
Sections two and three error and signal handling.
SEE ALSO
Cross references and citations.
STANDARDS
Conformance to standards if applicable.
HISTORY
If a standard is not applicable, the history of the subject should be given.
BUGS
Gotchas and caveats.
other
Customized headers may be added at the authors discretion.
Subsection Headers.
Paragraph Break. Vertical space (one line).
(D-one) Display-one Indent and display one text line.
(D-ell) Display-one literal. Indent and display one line of literal text.
Begin-display block. Display options:
Unjustified (ragged edges).
Justified.
Literal text or code.
name
Read in named file and display.
string
Offset display. Acceptable string values:
left
Align block on left (default).
center
Approximate center margin.
indent
Six constant width spaces (a tab).
indent-two
Two tabs.
right
Left aligns block 2 inches from right.
xxn
Where xx is a number from 4n to 99n.
Aa
Where Aa is a callable macro name.
string
The width of string is used.
End-display (matches .Bd).
Begin-list. Create lists or columns. Options:
List-types
Bullet Item List
Unlabeled List
Enumerated List
Tag Labeled List
Diagnostic List
Hanging Labeled List
Overhanging Labeled List
Inset or Run-on Labeled List
List-parameters
(All lists.) See ‘.Bd’ begin-display above.
(-tag and -hang lists only.) See ‘.Bd’.
(All lists.) Suppresses blank lines.
End-list.
List item.

The manual and general text domain macros are special in that most of them are parsed for callable macros for example:

Produces [-s file]

In this example, the option enclosure macro ‘.Op’ is parsed, and calls the callable content macro ‘Fl’ which operates on the argument ‘s’ and then calls the callable content macro ‘Ar’ which operates on the argument ‘file’. Some macros may be callable, but are not parsed and vice versa. These macros are indicated in the and columns below.

Unless stated, manual domain macros share a common syntax:

.Va argument [ . , ; : ( ) [ ] argument ... ]

: Opening and closing punctuation characters are only recognized as such if they are presented one at a time. The string ‘),’ is not recognized as punctuation and will be output with a leading white space and in what ever font the calling macro uses. The argument list ‘] ) ,’ is recognized as three sequential closing punctuation characters and a leading white space is not output between the characters and the previous argument (if any). The special meaning of a punctuation character may be escaped with the string ‘\&’. For example the following string,

Produces file1, file2, file3).

Parsed Callable Description
Yes Yes Author name.
Yes Yes Command line argument.
No No Configuration declaration (section four only).
Yes Yes Command line argument modifier.
Yes Yes Defined variable (source code).
Yes Yes Error number (source code).
Yes Yes Environment variable.
Yes Yes Function argument.
Yes Yes Function declaration.
Yes Yes Function call (also .Fo and .Fc).
Yes Yes Interactive command.
Yes Yes Literal text.
Yes Yes Command name.
Yes Yes Option (also .Oo and .Oc).
Yes Yes Old style function type (Fortran only).
Yes Yes Pathname or file name.
Yes Yes Standards (-p1003.2, -p1003.1 or -ansiC)
Yes Yes Variable name.
Yes Yes Variable type (Fortran only).
Yes Yes Manual Page Cross Reference.

Parsed Callable Description
Yes No Reference author.
Yes Yes Reference book title.
No No Reference place of publishing (city).
No No Reference date.
Yes Yes Reference journal title.
No No Reference issue number.
No No Reference optional information.
No No Reference page number(s).
No No Reference report Name.
Yes Yes Reference article title.
No No Reference volume.
Yes Yes Angle close quote.
Yes Yes Angle open quote.
Yes Yes Apostrophe.
Yes Yes Angle quote.
No No AT&T UNIX
Yes Yes Bracket close quote.
No No Begin font mode.
Yes Yes Bracket open quote.
Yes Yes Bracket quote.
Yes Yes BSD.
No No Debug (default is \*qoff\*q)
Yes Yes Double close quote.
Yes Yes Double open quote.
Yes Yes Double quote.
Yes Yes Enclose string close quote.
No No End font mode.
Yes Yes Emphasis (traditional English).
Yes Yes Enclose string open quote.
No No FreeBSD operating system
Yes Yes Normal text (no-op).
Yes Yes No space.
Yes Yes Parenthesis close quote.
Yes No Prefix string.
Yes Yes Parenthesis open quote.
Yes Yes Parentheses quote.
Yes Yes Straight Double close quote.
Yes Yes Quoted literal.
Yes Yes Straight Double open quote.
Yes Yes Straight Double quote.
No No Reference end.
No No Reference start.
No No Return values (sections two and three only).
Yes Yes Single close quote.
Yes Yes Single open quote.
Yes Yes Single quote.
No No Space mode (default is \*qon\*q)
Yes Yes Section Cross Reference.
Yes Yes Symbolic (traditional English).
Yes Yes Trade or type name (small Caps).
Yes Yes UNIX
Yes Yes Extend argument list close.
Yes Yes Extend argument list open.

Macro names ending in ‘q’ quote remaining items on the argument list. Macro names ending in ‘o’ begin a quote which may span more than one line of input and are close quoted with the matching macro name ending in ‘c’. Enclosure macros may be nested and are limited to eight arguments.

Note: the extended argument list macros (‘.Xo’, ‘.Xc’) and the function enclosure macros (‘.Fo’, ‘.Fc’) are irregular. The extended list macros are used when the number of macro arguments would exceed the troff limitation of nine arguments.

The macros UR (starting a URI/URL hypertext reference), UE (ending one), and UN (identifying a target for a reference) are also available. See man(7) for more information on these macros.

For site specific configuration of the macro package, see the file /usr/src/share/tmac/README.

tmac.doc
Manual and general text domain macros.
tmac.doc-common
Common structural macros and definitions.
tmac.doc-nroff
Site dependent nroff style file.
tmac.doc-ditroff
Site dependent troff style file.
tmac.doc-syms
Special defines (such as the standards macro).

mdoc.samples(7), man(7)

July 11, 1999 Linux