Reference

mdoc(7)

quick reference guide for the -mdoc macro package

NAME

mdoc – quick reference guide for the -mdoc macro package

SYNOPSIS

groff -mdoc files ...

DESCRIPTION

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 groff_mdoc(7) and 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 -mdoc package from other troff formatting packages.

PAGE STRUCTURE DOMAIN

Title Macros

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

.Dd Month day, year

Document date.

.Dt DOCUMENT_TITLE [section] [volume]

Title, in uppercase.

.Os OPERATING_SYSTEM [version/release]

Operating system (BSD).

Page Layout Macros

Section headers, paragraph breaks, lists and displays.

.Sh

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 VALUE

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.

CONFORMING TO

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.

.Ss

Subsection Headers.

.Pp

Paragraph Break. Vertical space (one line).

.D1

(D-one) Display-one Indent and display one text line.

.Dl

(D-ell) Display-one literal. Indent and display one line of literal text.

.Bd

Begin-display block. Display options:

-ragged

Unjustified (ragged edges).

-filled

Justified.

-literal

Literal text or code.

-file name

Read in named file and display.

-offset 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.

.Ed

End-display (matches .Bd).

.Bl

Begin-list. Create lists or columns. Options:

List-types
-bulletBullet Item List
-itemUnlabeled List
-enumEnumerated List
-tagTag Labeled List
-diagDiagnostic List
-hangHanging Labeled List
-ohangOverhanging Labeled List
-insetInset or Run-on Labeled List
List-parameters
-offset

(All lists.) See ‘.Bd’ begin-display above.

-width

(-tag and -hang lists only.) See ‘.Bd’.

-compact

(All lists.) Suppresses blank lines.

.El

End-list.

.It

List item.

MANUAL AND GENERAL TEXT DOMAIN MACROS

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

.Op Fl s Ar file

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 parsed and callable columns below.

Unless stated, manual domain macros share a common syntax:

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

Note: Opening and closing punctuation characters are recognized as such only 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,

.Ar file1 , file2 , file3 ) .

Produces file1, file2, file3).

Manual Domain Macros

NameParsedCallableDescription
AdYesYesAddress. (This macro may be deprecated.)
AnYesYesAuthor name.
ArYesYesCommand-line argument.
CdNoNoConfiguration declaration (section four only).
CmYesYesCommand-line argument modifier.
DvYesYesDefined variable (source code).
ErYesYesError number (source code).
EvYesYesEnvironment variable.
FaYesYesFunction argument.
FdYesYesFunction declaration.
FnYesYesFunction call (also .Fo and .Fc).
IcYesYesInteractive command.
LiYesYesLiteral text.
NmYesYesCommand name.
OpYesYesOption (also .Oo and .Oc).
OtYesYesOld style function type (Fortran only).
PaYesYesPathname or filename.
StYesYesStandards (-p1003.2, -p1003.1 or -ansiC)
VaYesYesVariable name.
VtYesYesVariable type (Fortran only).
XrYesYesManual Page Cross Reference.

General Text Domain Macros

NameParsedCallableDescription
%AYesNoReference author.
%BYesYesReference book title.
%CNoNoReference place of publishing (city).
%DNoNoReference date.
%JYesYesReference journal title.
%NNoNoReference issue number.
%ONoNoReference optional information.
%PNoNoReference page number(s).
%RNoNoReference report Name.
%TYesYesReference article title.
%VNoNoReference volume.
AcYesYesAngle close quote.
AoYesYesAngle open quote.
ApYesYesApostrophe.
AqYesYesAngle quote.
AtNoNoAT&T UNIX
BcYesYesBracket close quote.
BfNoNoBegin font mode.
BoYesYesBracket open quote.
BqYesYesBracket quote.
BxYesYesBSD.
DbNoNoDebug (default is off)
DcYesYesDouble close quote.
DoYesYesDouble open quote.
DqYesYesDouble quote.
EcYesYesEnclose string close quote.
EfNoNoEnd font mode.
EmYesYesEmphasis (traditional English).
EoYesYesEnclose string open quote.
FxNoNoFreeBSD operating system
NoYesYesNormal text (no-op).
NsYesYesNo space.
PcYesYesParenthesis close quote.
PfYesNoPrefix string.
PoYesYesParenthesis open quote.
PqYesYesParentheses quote.
QcYesYesStraight Double close quote.
QlYesYesQuoted literal.
QoYesYesStraight Double open quote.
QqYesYesStraight Double quote.
ReNoNoReference end.
RsNoNoReference start.
RvNoNoReturn values (sections two and three only).
ScYesYesSingle close quote.
SoYesYesSingle open quote.
SqYesYesSingle quote.
SmNoNoSpace mode (default is \*qon\*q)
SxYesYesSection Cross Reference.
SyYesYesSymbolic (traditional English).
TnYesYesTrade or type name (small Caps).
UxYesYesUNIX
XcYesYesExtend argument list close.
XoYesYesExtend 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.

FILES

doc.tmac

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).

SEE ALSO

groff_mdoc(7), man(7), man-pages(7), mdoc.samples(7)

COLOPHON

This page is part of release 4.16 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.

History