:man| Alphabetical   Categories   About us 
MDOC (7) | Miscellanea | Unix Manual Pages | :man


mdoc - quick reference guide for the -mdoc macro package


Page Structure Domain
Title Macros
Page Layout Macros
Manual And General Text Domain Macros
Manual Domain Macros
General Text Domain Macros


groff -m doc 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 -\mdoc package from other troff formatting packages.


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 upper case.
".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.
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.
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).
Two tabs.
right Left aligns block 2 inches from right.
xx n Where xx is a number from 4 n to 99 n.
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:
-bullet "Bullet Item List"
-item "Unlabeled List"
-enum "Enumerated List"
-tag "Tag Labeled List"
-diag "Diagnostic List"
-hang "Hanging Labeled List"
-ohang "Overhanging Labeled List"
-inset "Inset or Run-on Labeled List"
-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.


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]

Created by Blin Media, 2008-2013