mdoc (7) Linux Manual Page
Linux
Name
mdoc – quick reference guide for the -mdoc macro package
Synopsis
groff –m doc 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_mdoc7 and the tutorial sampler mdoc.samples7.
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:
.Month day, year- Document date.
.- Title, in uppercase.
.OPERATING_SYSTEM [version/release]- Operating system (
BSD)
Page Layout Macros
Section headers, paragraph breaks, lists and displays.
.
Section Headers.
- NAME
- Name section, should include the `.
groff‘ or `.Fn and ‘ the `. – 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.
Li .Ss Subsection Headers. Li .Pp Paragraph Break. Vertical space (one line). Li .D1 (D-one) Display-one Indent and display one text line. Li .Dl (D-ell) Display-one literal. Indent and display one line of literal text. Li .Bd Begin-display block. Display options:
-ragged- Unjustified (ragged edges).
-filled- Justified.
-literal- Literal text or code.
-filename- Read in named file and display.
-offsetstring- 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.
- xx
n - Where xx is a number from
4 nto99 n - Aa Where
- Aa is a callable macro name.
- string
- The width of string is used.
Li .Ed End-display (matches .Bd). Li .Bl Begin-list. Create lists or columns. Options:
- List-types
-
-bullet TaBullet Item List-item TaUnlabeled List-enum TaEnumerated List-tag TaTag Labeled List-diag TaDiagnostic List-hang TaHanging Labeled List-ohang TaOverhanging Labeled List-inset TaInset or Run-on Labeled List
List-parameters-
-offset- (All lists.) See `. ‘ begin-display above.
-width- ( –
tagand –hanglists only.) See `. ‘ -compact- (All lists.) Suppresses blank lines.
Li .El End-list. Li .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:
.[-sfile ]- Produces [-
sfile ]
In this example, the option enclosure macro `.[is] ‘ parsed, and calls the callable content macro `- ‘ which operates on the argument `s’ and then calls the callable content macro `file … ‘ 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:
.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,
.file1 , file2 , file3 ) .- Produces file1 , file2 , file3 )
Manual Domain Macros
- Name
Parsed Callable Description - Ta Yes Ta Yes Ta Address. (This macro may be deprecated.)
AnTa Yes Ta Yes Ta Author name.- Ta Yes Ta Yes Ta Command-line argument.
TaTaTaConfiguration declaration (section four only).TaYes Ta Yes Ta Command-line argument modifier.TaYes Ta Yes Ta Defined variable (source code).ErTa Yes Ta Yes Ta Error number (source code).TaYes Ta Yes Ta Environment variable.FaTa Yes Ta Yes Ta Function argument.FdTa Yes Ta Yes Ta Function declaration.FnTa Yes Ta Yes Ta Function call (also .Fo and .Fc).TaYes Ta Yes Ta Interactive command.TaYes Ta Yes Ta Literal text.TaYes Ta Yes Ta Command name.- [Ta Yes Ta Yes Ta Option (also .[and .Oc). ]
OtTa Yes Ta Yes Ta Old style function type (Fortran only).TaYes Ta Yes Ta Pathname or filename.StTa Yes Ta Yes Ta Standards (-p1003.2, -p1003.1 or -ansiC)- Ta Yes Ta Yes Ta Variable name.
VtTa Yes Ta Yes Ta Variable type (Fortran only).TaYesTaYesTaManualPageCrossReference.
General Text Domain Macros
- Name
Parsed Callable Description %A TaYes TaTaReference author.%B TaYes Ta Yes Ta Reference book title.%C TaTaTaReference place of publishing (city).%D TaTaTaReference date.%J TaYes Ta Yes Ta Reference journal title.%N TaTaTaReference issue number.%O TaTaTaReference optional information.%P TaTaTaReference page number(s).%R TaTaTaReference report Name.%T TaYes Ta Yes Ta Reference article title.%V TaTaTaReference volume.AcTa Yes Ta Yes Ta Angle close quote.AoTa Yes Ta Yes Ta Angle open quote.ApTa Yes Ta Yes Ta Apostrophe.AqTa Yes Ta Yes Ta Angle quote.AT&T System TaTaTaAT&T UNIXBcTa Yes Ta Yes Ta Bracket close quote.BfTaTaTaBegin font mode.BoTa Yes Ta Yes Ta Bracket open quote.BqTa Yes Ta Yes Ta Bracket quote.BSD TaYes Ta Yes Ta BSDDbTaTaTaDebug (default is "off")DcTa Yes Ta Yes Ta Double close quote.DoTa Yes Ta Yes Ta Double open quote.“TaYes Ta Yes Ta Double quote. ”EcTa Yes Ta Yes Ta Enclose string close quote.EfTaTaTaEnd font mode.- Ta Yes Ta Yes Ta Emphasis (traditional English).
EoTa Yes Ta Yes Ta Enclose string open quote.FxTaTaTaFreeBSD operating systemTaYes Ta Yes Ta Normal text (no-op).TaYes Ta Yes Taspace.PcTa Yes Ta Yes Ta Parenthesis close quote.TaYes TaTaPrefix string.PoTa Yes Ta Yes Ta Parenthesis open quote.(TaYes Ta Yes Ta Parentheses quote. )QcTa Yes Ta Yes Ta Straight Double close quote.`TaYes ‘- Ta Yes Ta Quoted literal.
QoTa Yes Ta Yes Ta Straight Double open quote.QqTa Yes Ta Yes Ta Straight Double quote.
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 ( `. ‘ `. ‘ 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_mdoc7, man(7), man-pages7, mdoc.samples7
Colophon
This page is part of release 4.15 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/.
