MDOC
Section: Environments, Tables, and Troff Macros (7)
Index
Return to Main Contents
BSD mandoc
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.
Valid headers, in the order of presentation:
- 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.
- -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.
- 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.
Li .Ed
End-display (matches .Bd).
Li .Bl
Begin-list.
Create lists or columns.
Options:
- List-types
-
- -bullet Ta Bullet Item List
-
- -item Ta Unlabeled List
-
- -enum Ta Enumerated List
-
- -tag Ta Tag Labeled List
-
- -diag Ta Diagnostic List
-
- -hang Ta Hanging Labeled List
-
- -ohang Ta Overhanging Labeled List
-
- -inset Ta Inset or Run-on Labeled List
-
- List-parameters
-
- -offset
-
(All lists.) See
`.
'
begin-display
above.
- -width
-
( -tag
and
-hang
lists 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:
- .[-s file
]
-
Produces
[-s file
]
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.)
-
- An Ta Yes Ta Yes Ta Author name.
-
- Ta Yes Ta Yes Ta Command-line argument.
-
- Ta Ta Ta Configuration declaration (section four only).
-
- Ta Yes Ta Yes Ta Command-line argument modifier.
-
- Ta Yes Ta Yes Ta Defined variable (source code).
-
- Er Ta Yes Ta Yes Ta Error number (source code).
-
- Ta Yes Ta Yes Ta Environment variable.
-
- Fa Ta Yes Ta Yes Ta Function argument.
-
- Fd Ta Yes Ta Yes Ta Function declaration.
-
- Fn Ta Yes Ta Yes Ta Function call (also .Fo and .Fc).
-
- Ta Yes Ta Yes Ta Interactive command.
-
- Ta Yes Ta Yes Ta Literal text.
-
- Ta Yes Ta Yes Ta Command name.
-
- [Ta Yes Ta Yes Ta Option (also .[and .Oc).
]
-
- Ot Ta Yes Ta Yes Ta Old style function type (Fortran only).
-
- Ta Yes Ta Yes Ta Pathname or filename.
-
- St Ta Yes Ta Yes Ta Standards (-p1003.2, -p1003.1 or -ansiC)
-
- Ta Yes Ta Yes Ta Variable name.
-
- Vt Ta Yes Ta Yes Ta Variable type (Fortran only).
-
- TaYesTaYesTaManualPageCrossReference.
-
General Text Domain Macros
- Name Parsed Callable Description
-
- %A Ta Yes Ta Ta Reference author.
-
- %B Ta Yes Ta Yes Ta Reference book title.
-
- %C Ta Ta Ta Reference place of publishing (city).
-
- %D Ta Ta Ta Reference date.
-
- %J Ta Yes Ta Yes Ta Reference journal title.
-
- %N Ta Ta Ta Reference issue number.
-
- %O Ta Ta Ta Reference optional information.
-
- %P Ta Ta Ta Reference page number(s).
-
- %R Ta Ta Ta Reference report Name.
-
- %T Ta Yes Ta Yes Ta Reference article title.
-
- %V Ta Ta Ta Reference volume.
-
- Ac Ta Yes Ta Yes Ta Angle close quote.
-
- Ao Ta Yes Ta Yes Ta Angle open quote.
-
- Ap Ta Yes Ta Yes Ta Apostrophe.
-
- Aq Ta Yes Ta Yes Ta Angle quote.
-
- AT&T System
Ta Ta Ta AT&T UNIX
-
- Bc Ta Yes Ta Yes Ta Bracket close quote.
-
- Bf Ta Ta Ta Begin font mode.
-
- Bo Ta Yes Ta Yes Ta Bracket open quote.
-
- Bq Ta Yes Ta Yes Ta Bracket quote.
-
- BSD Ta Yes Ta Yes Ta BSD
-
- Db Ta Ta Ta Debug (default is off)
-
- Dc Ta Yes Ta Yes Ta Double close quote.
-
- Do Ta Yes Ta Yes Ta Double open quote.
-
- ``Ta Yes Ta Yes Ta Double quote.
''
-
- Ec Ta Yes Ta Yes Ta Enclose string close quote.
-
- Ef Ta Ta Ta End font mode.
-
- Ta Yes Ta Yes Ta Emphasis (traditional English).
-
- Eo Ta Yes Ta Yes Ta Enclose string open quote.
-
- Fx Ta Ta Ta FreeBSD operating system
-
- Ta Yes Ta Yes Ta Normal text (no-op).
-
- Ta Yes Ta Yes Ta space.
-
- Pc Ta Yes Ta Yes Ta Parenthesis close quote.
-
- Ta Yes Ta Ta Prefix string.
-
- Po Ta Yes Ta Yes Ta Parenthesis open quote.
-
- (Ta Yes Ta Yes Ta Parentheses quote.
)
-
- Qc Ta Yes Ta Yes Ta Straight Double close quote.
-
- `Ta Yes
'
-
Ta Yes Ta Quoted literal.
- Qo Ta Yes Ta Yes Ta Straight Double open quote.
-
- Qq Ta Yes Ta Yes Ta Straight Double quote.
-
Li Rs Ta No Ta No Ta "Reference start."
Li Rv Ta No Ta No Ta "Return values (sections two and three only)."
Li Sc Ta Yes Ta Yes Ta "Single close quote."
Li So Ta Yes Ta Yes Ta "Single open quote."
Li Sq Ta Yes Ta Yes Ta "Single quote."
Li Sm Ta No Ta No Ta "Space mode (default is \*qon\*q)"
Li Sx Ta Yes Ta Yes Ta "Section Cross Reference."
Li Sy Ta Yes Ta Yes Ta "Symbolic (traditional English)."
Li Tn Ta Yes Ta Yes Ta "Trade or type name (small Caps)."
Li Ux Ta Yes Ta Yes Ta Ux
Li Xc Ta Yes Ta Yes Ta "Extend argument list close."
Li Xo Ta Yes Ta Yes Ta "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
( `.
'
`.
'
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.13 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/.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- PAGE STRUCTURE DOMAIN
-
- Title Macros
-
- Page Layout Macros
-
- Section Headers.
-
- MANUAL AND GENERAL TEXT DOMAIN MACROS
-
- Manual Domain Macros
-
- General Text Domain Macros
-
- FILES
-
- SEE ALSO
-
- COLOPHON
-