from small one page howto to huge articles all in one place
Last additions:
May 25th. 2007:
April, 26th. 2006:
|
You are here: manpages
MDOC
Section: Environments, Tables, and Troff Macros (7) Index
Return to Main Contents
BSD mandoc
NAME
mdoc
- semantic markup language for formatting manual pages
DESCRIPTION
The
mdoc
language supports authoring of manual pages for the
man(1)
utility by allowing semantic annotations of words, phrases,
page sections and complete manual pages.
Such annotations are used by formatting tools to achieve a uniform
presentation across all manuals written in
,
and to support hyperlinking if supported by the output medium.
This reference document describes the structure of manual pages
and the syntax and usage of the
language.
The reference implementation of a parsing and formatting tool is
mandoc(1);
the
Sx COMPATIBILITY
section describes compatibility with other implementations.
In an
document, lines beginning with the control character
`.'
are called
``macro lines''
The first word is the macro name.
It consists of two or three letters.
Most macro names begin with a capital letter.
For a list of available macros, see
Sx MACRO OVERVIEW .
The words following the macro name are arguments to the macro, optionally
including the names of other, callable macros; see
Sx MACRO SYNTAX
for details.
Lines not beginning with the control character are called
``text lines''
They provide fre-form text to be printed; the formatting of the text
depends on the respective processing context:
.Sh Macro lines change control state.
Text lines are interpreted within the current state.
Many aspects of the basic syntax of the
language are based on the
roff(7)
language; see the
LANGUAGE SYNTAX
and
MACRO SYNTAX
sections in the
roff(7)
manual for details, in particular regarding
comments, escape sequences, whitespace, and quoting.
However, using
roff(7)
requests in
documents is discouraged;
mandoc(1)
supports some of them merely for backward compatibility.
MANUAL STRUCTURE
A wel-formed
document consists of a document prologue followed by one or more
sections.
The prologue, which consists of the
,
and
macros in that order, is required for every document.
The first section (sections are denoted by
)
must be the NAME section, consisting of at least one
followed by
-
Following that, convention dictates specifying at least the
SYNOPSIS
and
DESCRIPTION
sections, although this varies between manual sections.
The following is a wel-formed skeleton
file for a utility
Qq progname :
.Dd $Mdocdate$
.Dt PROGNAME section
.Os
.Sh NAME
.Nm progname
.Nd one line about what it does
.dq .Sh LIBRARY
.dq For sections 2, 3, and 9 only.
.dq Not used in OpenBSD.
.Sh SYNOPSIS
.Nm progname
.Op Fl options
.Ar
.Sh DESCRIPTION
The
.Nm
utility processes files ...
.dq .Sh CONTEXT
.dq For section 9 functions only.
.dq .Sh IMPLEMENTATION NOTES
.dq Not used in OpenBSD.
.dq .Sh RETURN VALUES
.dq For sections 2, 3, and 9 function return values only.
.dq .Sh ENVIRONMENT
.dq For sections 1, 6, 7, and 8 only.
.dq .Sh FILES
.dq .Sh EXIT STATUS
.dq For sections 1, 6, and 8 only.
.dq .Sh EXAMPLES
.dq .Sh DIAGNOSTICS
.dq For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
.dq .Sh ERRORS
.dq For sections 2, 3, 4, and 9 errno settings only.
.dq .Sh SEE ALSO
.dq .Xr foobar 1
.dq .Sh STANDARDS
.dq .Sh HISTORY
.dq .Sh AUTHORS
.dq .Sh CAVEATS
.dq .Sh BUGS
.dq .Sh SECURITY CONSIDERATIONS
.dq Not used in OpenBSD.
The sections in an
document are conventionally ordered as they appear above.
Sections should be composed as follows:
- NAME
-
The name(s) and a one line description of the documented material.
The syntax for this as follows:
.Nm name0 ,
.Nm name1 ,
.Nm name2
.Nd a one line description
Multiple
`
'
names should be separated by commas.
The
macro(s) must precede the
- macro.
See
and
-
- LIBRARY
-
The name of the library containing the documented material, which is
assumed to be a function in a section 2, 3, or 9 manual.
The syntax for this is as follows:
.Lb libarm
See
Lb
- SYNOPSIS
-
Documents the utility invocation syntax, function call syntax, or device
configuration.
For the first, utilities (sections 1, 6, and 8), this is
generally structured as follows:
.Nm bar
.Op Fl v
.Op Fl o Ar file
.Op Ar
.Nm foo
.Op Fl v
.Op Fl o Ar file
.Op Ar
Commands should be ordered alphabetically.
For the second, function calls (sections 2, 3, 9):
.In header.h
.Vt extern const char *global;
.Ft "char *"
.Fn foo "const char *src"
.Ft "char *"
.Fn bar "const char *src"
Ordering of
In ,
Vt ,
Fn ,
and
Fo macros should follow C heade-file conventions.
And for the third, configurations (section 4):
.Cd dqit* at isa? port 0x2edq
.Cd dqit* at isa? port 0x4edq
Manuals not in these sections generally don't need a
SYNOPSIS
Some macros are displayed differently in the
SYNOPSIS
section, particularly
,
Fd ,
Fn ,
Fo ,
In ,
Vt ,
and
Ft
All of these macros are output on their own line.
If two such dissimilar macros are pairwise invoked (except for
Ft before
Fo or
Fn )
they are separated by a vertical space, unless in the case of
Fo ,
Fn ,
and
Ft ,
which are always separated by vertical space.
When text and macros following an
macro starting an input line span multiple output lines,
all output lines but the first will be indented to align
with the text immediately following the
macro, up to the next
,
or
macro or the end of an enclosing block, whichever comes first.
Em DESCRIPTION
This begins with an expansion of the brief, one line description in
NAME
The
.Nm
utility does this, that, and the other.
It usually follows with a breakdown of the options (if documenting a
command), such as:
The options are as follows:
.Bl -tag -width Ds
.It Fl v
Print verbose information.
.El
List the options in alphabetical order,
uppercase before lowercase for each letter and
with no regard to whether an option takes an argument.
Put digits in ascending order before all letter options.
Manuals not documenting a command won't include the above fragment.
Since the
DESCRIPTION
section usually contains most of the text of a manual, longer manuals
often use the
macro to form subsections.
In very long manuals, the
DESCRIPTION
may be split into multiple sections, each started by an
macro followed by a no-standard section name, and each having
several subsections, like in the present
manual.
Em CONTEXT
This section lists the contexts in which functions can be called in section 9.
The contexts are autoconf, process, or interrupt.
Em IMPLEMENTATION NOTES
Implementatio-specific notes should be kept here.
This is useful when implementing standard functions that may have side
effects or notable algorithmic implications.
Em RETURN VALUES
This section documents the
return values of functions in sections 2, 3, and 9.
See
Rv
Em ENVIRONMENT
Lists the environment variables used by the utility,
and explains the syntax and semantics of their values.
The
environ(7)
manual provides examples of typical content and formatting.
See
Em FILES
Documents files used.
It's helpful to document both the file name and a short description of how
the file is used (created, modified, etc.).
See
Em EXIT STATUS
This section documents the
command exit status for section 1, 6, and 8 utilities.
Historically, this information was described in
DIAGNOSTICS
a practise that is now discouraged.
See
Ex
Em EXAMPLES
Example usages.
This often contains snippets of wel-formed, wel-tested invocations.
Make sure that examples work properly!
Em DIAGNOSTICS
Documents error messages.
In section 4 and 9 manuals, these are usually messages printed by the
kernel to the console and to the kernel log.
In section 1, 6, 7, and 8, these are usually messages printed by
userland programs to the standard error output.
Historically, this section was used in place of
EXIT STATUS
for manuals in sections 1, 6, and 8; however, this practise is
discouraged.
See
-diag
ERRORS
Documents
errno(2)
settings in sections 2, 3, 4, and 9.
See
Er
SEE ALSO
References other manuals with related topics.
This section should exist for most manuals.
Cros-references should conventionally be ordered first by section, then
alphabetically (ignoring case).
References to other documentation concerning the topic of the manual page,
for example authoritative books or journal articles, may also be
provided in this section.
See
-
and
.
Em STANDARDS
References any standards implemented or used.
If not adhering to any standards, the
HISTORY
section should be used instead.
See
St
Em HISTORY
A brief history of the subject, including where it was first implemented,
and when it was ported to or reimplemented for the operating system at hand.
Em AUTHORS
Credits to the person or persons who wrote the code and/or documentation.
Authors should generally be noted by both name and email address.
See
An
Em CAVEATS
Common misuses and misunderstandings should be explained
in this section.
Em BUGS
Known bugs, limitations, and wor-arounds should be described
in this section.
Em SECURITY CONSIDERATIONS
Documents any security precautions that operators should consider.
MACRO OVERVIEW
This overview is sorted such that macros of similar purpose are listed
together, to help find the best macro for any given purpose.
Deprecated macros are not included in the overview, but can be found below
in the alphabetical
Sx MACRO REFERENCE .
Document preamble and NAME section macros
- Ta document date: $Mdocdate$ | month day , year
-
-
-
- Ta operating system version: [system [version
]
]
-
- Ta document name (one argument)
-
- - Ta document description (one line)
-
Sections and cross references
Ta section header (one line)
Ic Ss Ta subsection header (one line)
Ic Sx Ta internal cross reference to a section or subsection
Ic Xr Ta cross reference to another manual page: Ar name section
Ic Tg Ta tag the definition of a Ar term Pq <= 1 arguments
Ic Pp Ta start a text paragraph (no arguments)
Displays and lists
-
-
-type
[-offset width
]
[-compact
]
- D1 Ta indented display (one line)
-
-
Ta indented literal display (one line)
-
- `Ta i-line
'
-
literal display: Ql text
-
-type
[-width val
]
[-offset val
]
[-compact
]
- Ta
list item (syntax depends on -type
-
-
- Ta Ta table cell separator in
-
-
-
%*
,
Re
Ta
bibliographic
block
(references)
Spacing control
- Ta prefix, no following horizontal space (one argument)
-
- Ta roman font, no preceding horizontal space (no arguments)
-
- Ap Ta apostrophe without surrounding whitespace (no arguments)
-
-
-
- , Ta keep block: -words
-
Semantic markup for command line utilities
- Ta start a SYNOPSIS block with the name of a utility
-
- -Ta command line options (flags) (>=0 arguments)
-
- Ta command modifier (>0 arguments)
-
- Ta command arguments (>=0 arguments)
-
- [, [, Ta optional syntax elements (enclosure)
]
]
-
- Ta internal or interactive command (>0 arguments)
-
- Ta environmental variable (>0 arguments)
-
- Ta file system path (>=0 arguments)
-
Semantic markup for function libraries
- Lb Ta function library (one argument)
-
- In Ta include file (one argument)
-
- Fd Ta other preprocessor directive (>0 arguments)
-
- Ft Ta function type (>0 arguments)
-
- Fo , Fc Ta function block: funcname
-
- Fn Ta function name: funcname [argument ...
]
-
- Fa Ta function argument (>0 arguments)
-
- Vt Ta variable type (>0 arguments)
-
- Ta variable name (>0 arguments)
-
- Ta defined variable or preprocessor constant (>0 arguments)
-
- Er Ta error constant (>0 arguments)
-
- Ta environmental variable (>0 arguments)
-
Various semantic markup
- An Ta author name (>0 arguments)
-
- Lk Ta hyperlink: uri [display_name
]
-
- Mt Ta Do mailto Dc hyperlink: localpart @ domain
-
- Ta kernel configuration declaration (>0 arguments)
-
- Ta memory address (>0 arguments)
-
- Ta mathematical symbol (>0 arguments)
-
Physical markup
- Ta italic font or underline (emphasis) (>0 arguments)
-
- Ta boldface font (symbolic) (>0 arguments)
-
- Ta return to roman font (normal) (>0 arguments)
-
- Bf , Ef Ta font block: -type | | |
Physical enclosures
- ``, Do , Dc Ta enclose in typographic double quotes: ``text''
''
-
- Qq , Qo , Qc Ta enclose in typewriter double quotes: Qq text
-
- `, So , Sc Ta enclose in single quotes: `text'
'
-
- (, Po , Pc Ta enclose in parentheses: (text)
)
-
- Bq , Bo , Bc Ta enclose in square brackets: Bq text
-
- Brq , Bro , Brc Ta enclose in curly braces: Brq text
-
- Aq , Ao , Ac Ta enclose in angle brackets: Aq text
-
- Eo , Ec Ta generic enclosure
-
Text production
- Ex -std Ta standard command exit values: [utility ...
]
-
- Rv -std Ta standard function return values: [function ...
]
-
- St Ta reference to a standards document (one argument)
-
- AT&T System
Ta AT&T System
-
- BSD Ta BSD
- Bsx Ta Bsx
-
-
- Nx Ta Nx
- Fx Ta Fx
- Ox Ta Ox
- Dx Ta Dx
MACRO REFERENCE
This section is a canonical reference of all macros, arranged
alphabetically.
For the scoping of individual macros, see
Sx MACRO SYNTAX .
- %A first_name ... last_name
-
Author name of an
-
block.
Multiple authors should each be accorded their own
%A
line.
Author names should be ordered with full or abbreviated forename(s)
first, then full surname.
Ic %B Ar title
Book title of an
-
block.
This macro may also be used in a no-bibliographic context when
referring to book titles.
Ic %C Ar location
Publication city or location of an
-
block.
Ic %D Oo Ar month day , Oc Ar year
Publication date of an
-
block.
Provide the full English name of the
month
and all four digits of the
year
Ic %I Ar name
Publisher or issuer name of an
-
block.
Ic %J Ar name
Journal name of an
-
block.
Ic %N Ar number
Issue number (usually for journals) of an
-
block.
Ic %O Ar line
Optional information of an
-
block.
Ic %P Ar number
Book or journal page number of an
-
block.
Conventionally, the argument starts with
`p.'
for a single page or
`pp.'
for a range of pages, for example:
.%P pp. 42(en47
Ic %Q Ar name
Institutional author (school, government, etc.) of an
-
block.
Multiple institutional authors should each be accorded their own
%Q
line.
Ic %R Ar name
Technical report name of an
-
block.
Ic %T Ar title
Article title of an
-
block.
This macro may also be used in a no-bibliographical context when
referring to article titles.
Ic %U Ar protocol Ns :// Ns Ar path
URI of reference document.
Ic %V Ar number
Volume number of an
-
block.
Ic Ac
Close an
Ao block.
Does not have any tail arguments.
Tg Ad
Ic Ad Ar address
Memory address.
Do not use this for postal addresses.
Examples:
.[0,$]
.0x00000000
Tg An
Ic An Fl split | nosplit | Ar first_name ... last_name
Author name.
Can be used both for the authors of the program, function, or driver
documented in the manual, or for the authors of the manual itself.
Requires either the name of an author or one of the following arguments:
- -split
-
Start a new output line before each subsequent invocation of
An
- -nosplit
-
The opposite of
-split
The default is
-nosplit
The effect of selecting either of the
-split
modes ends at the beginning of the
AUTHORS
section.
In the
AUTHORS
section, the default is
-nosplit
for the first author listing and
-split
for all other author listings.
Examples:
.An -nosplit
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
Ic Ao Ar block
Begin a block enclosed by angle brackets.
Does not have any head arguments.
This macro is almost never useful.
See
Aq for more details.
Tg Ap
Ic Ap
Inserts an apostrophe without any surrounding whitespace.
This is generally used as a grammatical device when referring to the verb
form of a function.
Examples:
.Fn execve Ap d
Tg Aq
Ic Aq Ar line
Enclose the rest of the input line in angle brackets.
The only important use case is for email addresses.
See
Mt for an example.
Occasionally, it is used for names of characters and keys, for example:
Press the
.Aq escape
key to ...
For URIs, use
Lk instead, and
In for
``#include''
directives.
Never wrap
file ...
in
Aq
Since
Aq usually renders with no-ASCII characters in no-ASCII output modes,
do not use it where the ASCII characters
`<'
and
`>'
are required as syntax elements.
Instead, use these characters directly in such cases, combining them
with the macros
,
,
or
Eo as needed.
See also
Ao
Tg Ar
Ic Ar Op Ar placeholder ...
Command arguments.
If an argument is not provided, the string
``file ...''
is used as a default.
Examples:
".-o file
".Ar"
".arg1 , arg2 .
The arguments to the
file ...
macro are names and placeholders for command arguments;
for fixed strings to be passed verbatim as arguments, use
-
or
Tg At
Ic At Op Ar version
Formats an
AT&T System
version.
Accepts one optional argument:
- v[-7] | 32v
-
A version of
AT&T System
.
- III
-
AT&T System
III .
- V | V.[-4]
-
A version of
AT&T System
V .
Note that these arguments do not begin with a hyphen.
Examples:
.AT&T System
.AT&T System
III
.AT&T System
V.1
See also
Bsx
BSD ,
Dx ,
Fx ,
Nx ,
and
Ox
Ic Bc
Close a
Bo block.
Does not have any tail arguments.
Tg Bd
Ic Bd Fl Ns Ar type Oo Fl offset Ar width Oc Op Fl compact
Begin a display block.
Display blocks are used to select a different indentation and
justification than the one used by the surrounding text.
They may contain both macro lines and text lines.
By default, a display block is preceded by a vertical space.
The
type
must be one of the following:
- -centered
-
Produce one output line from each input line, and cente-justify each line.
Using this display type is not recommended; many
implementations render it poorly.
- -filled
-
Change the positions of line breaks to fill each line, and lef- and
righ-justify the resulting block.
- -literal
-
Produce one output line from each input line,
and do not justify the block at all.
Preserve white space as it appears in the input.
Always use a constan-width font.
Use this for displaying source code.
- -ragged
-
Change the positions of line breaks to fill each line, and lef-justify
the resulting block.
- -unfilled
-
The same as
-literal
but using the same font as for normal text, which is a variable width font
if supported by the output device.
The
type
must be provided first.
Additional arguments may follow:
- -offset width
-
Indent the display by the
width
which may be one of the following:
- One of the pr-defined strings
-
indent
the width of a standard indentation (six constant width characters);
inden-two
twice
indent
left
which has no effect;
right
which justifies to the right margin; or
center
which aligns around an imagined center axis.
- A macro invocation, which selects a predefined width
-
associated with that macro.
The most popular is the imaginary macro
Ds ,
which resolves to
6n
- A scaling width as described in
-
roff(7).
- An arbitrary string, which indents by the length of this string.
-
When the argument is missing,
-offset
is ignored.
- -compact
-
Do not assert vertical space before the display.
Examples:
.Bd -literal -offset indent -compact
Hello world.
.Ed
See also
D1
and
Tg Bf
Ic Bf Fl emphasis | literal | symbolic | Cm Em | Li | Sy
Change the font mode for a scoped block of text.
The
-emphasis
and
argument are equivalent, as are
-symbolic
and
,
and
-literal
and
Without an argument, this macro does nothing.
The font mode continues until broken by a new font mode in a nested
scope or
Ef is encountered.
See also
,
Ef ,
,
and
Tg Bk
Ic Bk Fl words
For each macro, keep its output together on the same output line,
until the end of the macro or the end of the input line is reached,
whichever comes first.
Line breaks in text lines are unaffected.
The
-words
argument is required; additional arguments are ignored.
The following example will not break within each
[macro line:]
.Bk -words
.Op Fl f Ar flags
.Op Fl o Ar output
.Ek
Be careful in using ove-long lines within a keep block!
Doing so will clobber the right margin.
Tg Bl
Xo
-type
[-width val
]
[-offset val
]
[-compact
]
[col ...
]
Begin a list.
Lists consist of items specified using the
- macro, containing a head or a body or both.
-
The list
type
is mandatory and must be specified first.
The
-width
and
-offset
arguments accept macro names as described for
-offset
scaling widths as described in
roff(7),
or use the length of the given string.
The
-offset
is a global indentation for the whole list, affecting both item heads
and bodies.
For those list types supporting it, the
-width
argument requests an additional indentation of item bodies,
to be added to the
-offset
Unless the
-compact
argument is specified, list entries are separated by vertical space.
A list must specify one of the following list types:
- -bullet
-
No item heads can be specified, but a bullet will be printed at the head
of each item.
Item bodies start on the same output line as the bullet
and are indented according to the
-width
argument.
- -column
-
A columnated list.
The
-width
argument has no effect; instead, the string length of each argument
specifies the width of one column.
If the first line of the body of a
-column
list is not an
- macro line,
-
- contexts spanning one input line each are implied until an
-
- macro line is encountered, at which point items start being interpreted as
-
described in the
- documentation.
-
- -dash
-
Like
-bullet
except that dashes are used in place of bullets.
- -diag
-
Like
-inset
except that item heads are not parsed for macro invocations.
Most often used in the
DIAGNOSTICS
section with error constants in the item heads.
- -enum
-
A numbered list.
No item heads can be specified.
Formatted like
-bullet
except that cardinal numbers are used in place of bullets,
starting at 1.
- -hang
-
Like
-tag
except that the first lines of item bodies are not indented, but follow
the item heads like in
-inset
lists.
- -hyphen
-
Synonym for
-dash
- -inset
-
Item bodies follow items heads on the same line, using normal inte-word
spacing.
Bodies are not indented, and the
-width
argument is ignored.
- -item
-
No item heads can be specified, and none are printed.
Bodies are not indented, and the
-width
argument is ignored.
- -ohang
-
Item bodies start on the line following item heads and are not indented.
The
-width
argument is ignored.
- -tag
-
Item bodies are indented according to the
-width
argument.
When an item head fits inside the indentation, the item body follows
this head on the same output line.
Otherwise, the body starts on the output line following the head.
Lists may be nested within lists and displays.
Nesting of
-column
and
-enum
lists may not be portable.
See also
and
Ic Bo Ar block
Begin a block enclosed by square brackets.
Does not have any head arguments.
Examples:
.Bo 1 ,
.Dv BUFSIZ Bc
See also
Bq
Tg Bq
Ic Bq Ar line
Encloses its arguments in square brackets.
Examples:
.Bq 1 , BUFSIZ
Remarks
this macro is sometimes abused to emulate optional arguments for
commands; the correct macros to use for this purpose are
[,]
[,
and
]
See also
Bo
Ic Brc
Close a
Bro
block.
Does not have any tail arguments.
Ic Bro Ar block
Begin a block enclosed by curly braces.
Does not have any head arguments.
Examples:
.Bro 1 , ... ,
.Va n Brc
See also
Brq
Tg Brq
Ic Brq Ar line
Encloses its arguments in curly braces.
Examples:
.Brq 1 , ... , n
See also
Bro
Tg Bsx
Ic Bsx Op Ar version
Format the
Bs x
version provided as an argument, or a default value if
no argument is provided.
Examples:
.Bsx 1.0
.Bsx
See also
AT&T System
BSD ,
Dx ,
Fx ,
Nx ,
and
Ox
Ic Bt
Supported only for compatibility, do not use this in new manuals.
Prints
``is currently in beta test.''
Tg Bx
Ic Bx Op Ar version Op Ar variant
Format the
BSD version provided as an argument, or a default value if no
argument is provided.
Examples:
.BSD 4.3 Tahoe
.BSD 4.4
.BSD
See also
AT&T System
Bsx
Dx ,
Fx ,
Nx ,
and
Ox
Tg Cd
Ic Cd Ar line
Kernel configuration declaration.
This denotes strings accepted by
config(8).
It is most often used in section 4 manual pages.
Examples:
.device le0 at scode?
Remarks
this macro is commonly abused by using quoted literals to retain
whitespace and align consecutive
declarations.
This practise is discouraged.
Tg Cm
Ic Cm Ar keyword ...
Command modifiers.
Typically used for fixed strings passed as arguments to interactive
commands, to commands in interpreted scripts, or to configuration
file directives, unless
-
is more appropriate.
Examples:
".mt -f device rewind
".ps -o pid , command
".dd if= file1 of= file2
".set -o vi
".lookup file bind
".permit identity [as target
]
Tg D1
Ic D1 Ar line
On-line indented display.
This is formatted by the default rules and is useful for simple indented
statements.
It is followed by a newline.
Examples:
.D1 -abcdefgh
See also
and
Ic Db
This macro is obsolete.
No replacement is needed.
It is ignored by
mandoc(1)
and groff including its arguments.
It was formerly used to toggle a debugging mode.
Ic Dc
Close a
Do block.
Does not have any tail arguments.
Tg Dd
Ic Dd Cm $Mdocdate$ | Ar month day , year
Document date for display in the page footer,
by convention the date of the last change.
This is the mandatory first macro of any
manual.
The
month
is the full English month name, the
day
is an integer number, and the
year
is the full fou-digit year.
Other arguments are not portable; the
mandoc(1)
utility handles them as follows:
- To have the date automatically filled in by the
-
Ox version of
cvs(1),
the special string
``$Mdocdate$''
can be given as an argument.
- The traditional, purely numeric
-
man(7)
format
year - month - day
is accepted, too.
- If a date string cannot be parsed, it is used verbatim.
-
- If no date string is given, the current date is used.
-
Examples:
.$Mdocdate$
.$Mdocdate: July 2 2018$
.July 2, 2018
See also
and
Tg Dl
Ic Dl Ar line
On-line indented display.
This is formatted as literal text and is useful for commands and
invocations.
It is followed by a newline.
Examples:
.
% mandoc mdoc.7 (ba less
See also
`,'
and
D1
Ic Do Ar block
Begin a block enclosed by double quotes.
Does not have any head arguments.
Examples:
.Do
April is the cruellest month
.Dc
(em T.S. Eliot
See also
``''
Tg Dq
Ic Dq Ar line
Encloses its arguments in
``typographic''
doubl-quotes.
Examples:
.Dq April is the cruellest month
(em T.S. Eliot
See also
Qq ,
`,'
and
Do
Tg Dt
Ic Dt Ar TITLE section Op Ar arch
Document title for display in the page header.
This is the mandatory second macro of any
file.
Its arguments are as follows:
- TITLE
-
The document's title (name), defaulting to
``UNTITLED''
if unspecified.
To achieve a uniform appearance of page header lines,
it should by convention be all caps.
- section
-
The manual section.
This may be one of
1
(General Commands)
2
(System Calls)
3
(Library Functions)
3p
(Perl Library)
4
(Device Drivers)
5
(File Formats)
6
(Games)
7
(Miscellaneous Information)
8
(System Manager's Manual)
or
9
(Kernel Developer's Manual)
It should correspond to the manual's filename suffix and defaults to
the empty string if unspecified.
- arch
-
This specifies the machine architecture a manual page applies to,
where relevant, for example
alpha
amd64
i386
or
sparc64
The list of valid architectures varies by operating system.
Examples:
.
.
See also
and
Tg Dv
Ic Dv Ar identifier ...
Defined variables such as preprocessor constants, constant symbols,
enumeration values, and so on.
Examples:
.NULL
.BUFSIZ
.STDOUT_FILENO
See also
Er and
for specia-purpose constants,
for variable symbols, and
Fd for listing preprocessor variable definitions in the
SYNOPSIS
Tg Dx
Ic Dx Op Ar version
Format the
Dx version provided as an argument, or a default
value if no argument is provided.
Examples:
.Dx 2.4.1
.Dx
See also
AT&T System
Bsx
BSD ,
Fx ,
Nx ,
and
Ox
Ic Ec Op Ar closing_delimiter
Close a scope started by
Eo
The
closing_delimiter
argument is used as the enclosure tail, for example, specifying (rq
will emulate
Dc
Ic Ed
End a display context started by
Ic Ef
End a font mode context started by
Bf
Ic Ek
End a keep context started by
Ic El
End a list context started by
See also
Tg Em
word ...
Request an italic font.
If the output device does not provide that, underline.
This is most often used for stress emphasis (not to be confused with
importance, see
)
In the rare cases where none of the semantic markup macros fit,
it can also be used for technical terms and placeholders, except
that for syntax elements,
and
file ...
are preferred, respectively.
Examples:
Selected lines are those
.Em not
matching any of the specified patterns.
Some of the functions use a
.Em hold space
to save the pattern space for subsequent retrieval.
See also
,
`,'
and
En word ...
This macro is obsolete.
Use
Eo or any of the other enclosure macros.
It encloses its argument in the delimiters specified by the last
Es macro.
Tg Eo
Eo [opening_delimiter
]
An arbitrary enclosure.
The
opening_delimiter
argument is used as the enclosure head, for example, specifying (lq
will emulate
Do
Tg Er
Er identifier ...
Error constants for definitions of the
errno
libc global variable.
This is most often used in section 2 and 3 manual pages.
Examples:
.Er EPERM
.Er ENOENT
See also
for general constants.
Es opening_delimiter closing_delimiter
This macro is obsolete.
Use
Eo or any of the other enclosure macros.
It takes two arguments, defining the delimiters to be used by subsequent
En macros.
Tg Ev
identifier ...
Environmental variables such as those specified in
environ(7).
Examples:
.DISPLAY
.PATH
See also
for general constants.
Tg Ex
Ex -std [utility ...
]
Insert a standard sentence regarding command exit values of 0 on success
and >0 on failure.
This is most often used in section 1, 6, and 8 manual pages.
If
utility
is not specified, the document's name set by
is used.
Multiple
utility
arguments are treated as separate utilities.
See also
Rv
Tg Fa
Fa argument ...
Function argument or parameter.
Each argument may be a name and a type (recommended for the
SYNOPSIS
section), a name alone (for function invocations),
or a type alone (for function prototypes).
If both a type and a name are given or if the type consists of multiple
words, all words belonging to the same function argument have to be
given in a single argument to the
Fa macro.
This macro is also used to specify the field name of a structure.
Most often, the
Fa macro is used in the
SYNOPSIS
within
Fo blocks when documenting mult-line function prototypes.
If invoked with multiple arguments, the arguments are separated by a
comma.
Furthermore, if the following macro is another
Fa ,
the last argument will also have a trailing comma.
Examples:
.Fa dqconst char *pdq
.Fa dqint adq dqint bdq dqint cdq
.Fa dqchar *dq size_t
See also
Fo
Fc End a function context started by
Fo
Tg Fd
Fd # directive [argument ...
]
Preprocessor directive, in particular for listing it in the
SYNOPSIS
Historically, it was also used to document include files.
The latter usage has been deprecated in favour of
In
Examples:
.Fd #define sa_handler __sigaction_u.__sa_handler
.Fd #define SIO_MAXNFDS
.Fd #ifdef FS_DEBUG
.Ft void
.Fn dbg_open dqconst char *dq
.Fd #endif
See also
Sx MANUAL STRUCTURE ,
In ,
and
Tg Fl
-[word ...
]
Comman-line flag or option.
Used when listing arguments to comman-line utilities.
For each argument, prints an ASCII hyphe-minus character
`-'
immediately followed by the argument.
If no arguments are provided, a hyphe-minus is printed followed by a space.
If the argument is a macro, a hyphe-minus is prefixed
to the subsequent macro output.
Examples:
".du [-H | L | P
]
".ls [-1AaCcdFfgHhikLlmnopqRrSsTtux
]
".route add -inet destination gateway
".locate.updatedb [--fcodes = dbfile
]
".aucat -o Fl
".kill -signal_number
For GN-sytle long options, escaping the additional hyphe-minus is not
strictly required, but may be safer with future versions of GNU troff; see
mandoc_char7
for details.
See also
Tg Fn
Fn funcname [argument ...
]
A function name.
Function arguments are surrounded in parenthesis and
are delimited by commas.
If no arguments are specified, blank parenthesis are output.
In the
SYNOPSIS
section, this macro starts a new output line,
and a blank line is automatically inserted between function definitions.
Examples:
.Fn dqint funcnamedq dqint arg0dq dqint arg1dq
.Fn funcname dqint arg0dq
.Fn funcname arg0
.Ft functype
.Fn funcname
When referring to a function documented in another manual page, use
instead.
See also
Sx MANUAL STRUCTURE ,
Fo ,
and
Ft
Tg Fo
Fo funcname
Begin a function block.
This is a mult-line version of
Fn
Invocations usually occur in the following context:
. Ft functype
. Fo funcname
. Fa Qq argtype argname
...
. Fc
A
Fo scope is closed by
Fc
See also
Sx MANUAL STRUCTURE ,
Fa ,
Fc ,
and
Ft
number
This macro is obsolete.
No replacement markup is needed.
It was used to show numerical function return values in an italic font.
Tg Ft
Ft functype
A function type.
In the
SYNOPSIS
section, a new output line is started after this macro.
Examples:
.Ft int
.Ft functype
.Fn funcname
See also
Sx MANUAL STRUCTURE ,
Fn ,
and
Fo
Tg Fx
Fx [version
]
Format the
Fx version provided as an argument, or a default value
if no argument is provided.
Examples:
.Fx 7.1
.Fx
See also
AT&T System
Bsx
BSD ,
Dx ,
Nx ,
and
Ox
Hf filename
This macro is not implemented in
mandoc(1).
It was used to include the contents of a (header) file literally.
Tg Ic
keyword ...
Internal or interactive command, or configuration instruction
in a configuration file.
See also
Examples:
.:wq
.hash
.alias
Note that using
`,'
,
or
is preferred for displaying code samples; the
macro is used when referring to an individual command name.
Tg In
In filename
The name of an include file.
This macro is most often used in section 2, 3, and 9 manual pages.
When invoked as the first macro on an input line in the
SYNOPSIS
section, the argument is displayed in angle brackets
and preceded by
Qq #include ,
and a blank line is inserted in front if there is a preceding
function declaration.
In other sections, it only encloses its argument in angle brackets
and causes no line break.
Examples:
.In sys/types.h
See also
Sx MANUAL STRUCTURE .
Tg It
[head
]
A list item.
The syntax of this macro depends on the list type.
Lists
of type
-hang
-ohang
-inset
and
-diag
have the following syntax:
Lists of type
-bullet
-dash
-enum
-hyphen
and
-item
have the following syntax:
with subsequent lines interpreted within the scope of the
until either a closing
or another
The
-tag
list has the following syntax:
Subsequent lines are interpreted as with
-bullet
and family.
The line arguments correspond to the list's lef-hand side; body
arguments correspond to the list's contents.
The
-column
list is the most complicated.
Its syntax is as follows:
The arguments consist of one or more lines of text and macros
representing a complete table line.
Cells within the line are delimited by the special
Ta block macro or by literal tab characters.
Using literal tabs is strongly discouraged because they are very
hard to use correctly and
code using them is very hard to read.
In particular, a blank character is syntactically significant
before and after the literal tab character.
If a word precedes or follows the tab without an intervening blank,
that word is never interpreted as a macro call, but always output
literally.
The tab cell delimiter may only be used within the
line itself; on following lines, only the
Ta macro can be used to delimit cells, and portability requires that
Ta is called by other macros: some parsers do not recognize it when
it appears as the first macro on a line.
Note that quoted strings may span ta-delimited cells on an
line.
For example,
.
dqcol1 , <TAB> col2 ,dq ;
will preserve the whitespace before both commas,
but not the whitespace before the semicolon.
See also
Tg Lb
Lb lib name
Specify a library.
The
name
parameter may be a system library, such as
z
or
pam
in which case a small library description is printed next to the linker
invocation; or a custom library, in which case the library name is
printed in quotes.
This is most commonly used in the
SYNOPSIS
section as described in
Sx MANUAL STRUCTURE .
Examples:
.Lb libz
.Lb libmandoc
Tg Li
word ...
Request a typewriter (literal) font.
Deprecated because on terminal output devices, this is usually
indistinguishable from normal text.
For literal displays, use
`(i-line)
'
(single line)
or
instead.
Tg Lk
Lk uri [display_name
]
Format a hyperlink.
Examples:
.Lk https://bsd.lv dqThe BSD.lv Projectdq
.Lk https://bsd.lv
See also
Mt
Lp Deprecated synonym for
Tg Ms
name
Display a mathematical symbol.
Examples:
.sigma
.aleph
Tg Mt
Mt localpart @ domain
Format a
``mailto:''
hyperlink.
Examples:
.Mt discuss@manpages.bsd.lv
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
Tg Nd
- line
A one line description of the manual's content.
This is the mandatory last macro of the
NAME
section and not appropriate for other sections.
Examples:
. - mdoc language reference
. - format and display UNIX manuals
The
- macro technically accepts child macros and terminates with a subsequent
invocation.
Do not assume this behaviour: some
whatis(1)
database generators are not smart enough to parse more than the line
arguments and will display macros verbatim.
See also
Tg Nm
Ic Nm Op Ar name
The name of the manual page, or - in particular in section 1, 6,
and 8 pages - of an additional command or feature documented in
the manual page.
When first invoked, the
macro expects a single argument, the name of the manual page.
Usually, the first invocation happens in the
NAME
section of the page.
The specified name will be remembered and used whenever the macro is
called again without arguments later in the page.
The
macro uses
Sx Block ful-implicit
semantics when invoked as the first macro on an input line in the
SYNOPSIS
section; otherwise, it uses ordinary
Sx I-line
semantics.
Examples:
.Sh SYNOPSIS
.Nm cat
.Op Fl benstuv
.Op Ar
In the
SYNOPSIS
of section 2, 3 and 9 manual pages, use the
Fn macro rather than
to mark up the name of the manual page.
Tg No
Ic No Ar word ...
Normal text.
Closes the scope of any preceding i-line macro.
When used after physical formatting macros like
or
,
switches back to the standard font face and weight.
Can also be used to embed plain text strings in macro lines
using semantic annotation macros.
Examples:
".italic , bold , and roman
.Sm off
.Cm :C No / Ar pattern No / Ar replacement No /
.Sm on
See also
,
`,'
and
Tg Ns
Ic Ns
Suppress a space between the output of the preceding macro
and the following text or macro.
Following invocation, input is interpreted as normal text
just like after an
macro.
This has no effect when invoked at the start of a macro line.
Examples:
".name = value
".:M pattern
".-o output
See also
and
Tg Nx
Ic Nx Op Ar version
Format the
Nx version provided as an argument, or a default value if
no argument is provided.
Examples:
.Nx 5.01
.Nx
See also
AT&T System
Bsx
BSD ,
Dx ,
Fx ,
and
Ox
Ic Oc
Close mult-line
[context.
Ic Oo Ar block
Mult-line version of
[]
Examples:
.Oo
.Op Fl flag Ns Ar value
.Oc
Tg Op
Ic Op Ar line
Optional part of a command line.
Prints the argument(s) in brackets.
This is most often used in the
SYNOPSIS
section of section 1 and 8 manual pages.
Examples:
.[-a b
]
.[a | b
]
See also
[
Tg Os
Ic Os Op Ar system Op Ar version
Operating system version for display in the page footer.
This is the mandatory third macro of
any
file.
The optional
system
parameter specifies the relevant operating system or environment.
It is suggested to leave it unspecified, in which case
mandoc(1)
uses its
-Ios
argument or, if that isn't specified either,
Fa sysname
and
Fa release
as returned by
uname(3).
Examples:
.
.KTH/CSC/TCS
.BSD 4.3
See also
and
Ic Ot Ar functype
This macro is obsolete.
Use
Ft instead; with
mandoc(1),
both have the same effect.
Historical
packages described it as
``old function type (FORTRAN)''
Tg Ox
Ic Ox Op Ar version
Format the
Ox version provided as an argument, or a default value
if no argument is provided.
Examples:
.Ox 4.5
.Ox
See also
AT&T System
Bsx
BSD ,
Dx ,
Fx ,
and
Nx
Tg Pa
Ic Pa Ar name ...
An absolute or relative file system path, or a file or directory name.
If an argument is not provided, the character
`ti'
is used as a default.
Examples:
./usr/bin/mandoc
./usr/share/man/man7/mdoc.7
See also
Lk
Ic Pc
Close parenthesised context opened by
Po
Tg Pf
Ic Pf Ar prefix macro Op Ar argument ...
Removes the space between its argument and the following macro.
It is equivalent to:
The
prefix
argument is not parsed for macro names or delimiters,
but used verbatim as if it were escaped.
Examples:
".$ variable_name
".. macro_name
".0x hex_digits
See also
and
Ic Po Ar block
Mult-line version of
()
Tg Pp
Ic Pp
Break a paragraph.
This will assert vertical space between prior and subsequent macros
and/or text.
Paragraph breaks are not needed before or after
or
macros or before displays
(
)
or lists
(
)
unless the
-compact
flag is given.
Tg Pq
(line
)
Parenthesised enclosure.
See also
Po
Qc Close quoted context opened by
Qo
Tg Ql
`line
'
I-line literal display.
This can be used for complete command invocations and for mult-word
code examples when an indented display is not desired.
See also
and
-literal
Qo block
Mult-line version of
Qq
Tg Qq
Qq line
Encloses its arguments in
Qq typewriter
doubl-quotes.
Consider using
``''
See also
``,''
`,'
and
Qo
Close an
-
block.
Does not have any tail arguments.
Tg Rs
Ic Rs
Begin a bibliographic
(``reference''
)
block.
Does not have any head arguments.
The block macro may only contain
%A
%B
%C
%D
%I
%J
%N
%O
%P
%Q
%R
%T
%U
and
%V
child macros (at least one must be specified).
Examples:
.Rs
.%A J. E. Hopcroft
.%A J. D. Ullman
.%B Introduction to Automata Theory, Languages, and Computation
.%I Addiso-Wesley
.%C Reading, Massachusetts
.%D 1979
.Re
If an
-
block is used within a SEE ALSO section, a vertical space is asserted
before the rendered output, else the block continues on the current
line.
Tg Rv
Ic Rv Fl std Op Ar function ...
Insert a standard sentence regarding a function call's return value of 0
on success and -1 on error, with the
errno
libc global variable set on error.
If
function
is not specified, the document's name set by
is used.
Multiple
function
arguments are treated as separate functions.
See also
Ex
Ic Sc
Close singl-quoted context opened by
So
Tg Sh
Ic Sh Ar TITLE LINE
Begin a new section.
For a list of conventional manual sections, see
Sx MANUAL STRUCTURE .
These sections should be used unless it's absolutely necessary that
custom sections be used.
Section names should be unique so that they may be keyed by
Sx
Although this macro is parsed, it should not consist of child node or it
may not be linked with
Sx
See also
,
and
Sx
Tg Sm
Ic Sm Op Cm on | off
Switches the spacing mode for output generated from macros.
By default, spacing is
on
When switched
off
no white space is inserted between macro arguments and between the
output generated from adjacent macros, but text lines
still get normal spacing between words and sentences.
When called without an argument, the
macro toggles the spacing mode.
Using this is not recommended because it makes the code harder to read.
Ic So Ar block
Mult-line version of
`'
Tg Sq
Ic Sq Ar line
Encloses its arguments in
`typewriter'
singl-quotes.
See also
``,''
Qq ,
and
So
Tg Ss
Ic Ss Ar Title line
Begin a new subsection.
Unlike with
,
there is no convention for the naming of subsections.
Except
DESCRIPTION
the conventional sections described in
Sx MANUAL STRUCTURE
rarely have subsections.
Su-section names should be unique so that they may be keyed by
Sx
Although this macro is parsed, it should not consist of child node or it
may not be linked with
Sx
See also
,
and
Sx
Tg St
Ic St Fl Ns Ar abbreviation
Replace an abbreviation for a standard with the full form.
The following standards are recognised.
Where multiple lines are given without a blank line in between,
they all refer to the same standard, and using the first form
is recommended.
- C language standards
-
- -ansiC
-
St -ansiC
- -ansi-89
-
St -ansi-89
- -isoC
-
St -isoC
- -iso-90
-
St -iso-90
The original C standard.
- -iso-amd1
-
St -iso-amd1
- -iso-tcor1
-
St -iso-tcor1
- -iso-tcor2
-
St -iso-tcor2
- -iso-99
-
St -iso-99
The second major version of the C language standard.
- -iso-2011
-
St -iso-2011
The third major version of the C language standard.
- POSIX.1 before the Single UNIX Specification
-
- -p1003.-88
-
St -p1003.-88
- -p1003.1
-
St -p1003.1
The original POSIX standard, based on ANSI C.
- -p1003.-90
-
St -p1003.-90
- -iso994--90
-
St -iso994--90
The first update of POSIX.1.
- -p1003.1-93
-
St -p1003.1-93
- -p1003.1b
-
St -p1003.1b
Rea-time extensions.
- -p1003.1-95
-
St -p1003.1-95
POSIX thread interfaces.
- -p1003.1-95
-
St -p1003.1-95
Technical Corrigendum.
- -p1003.-96
-
St -p1003.-96
- -iso994--96
-
St -iso994--96
Includes POSIX.-1990, 1b, 1c, and 1i.
- X/Open Portability Guide version 4 and related standards
-
- -xpg3
-
St -xpg3
An XPG4 precursor, published in 1989.
- -p1003.2
-
St -p1003.2
- -p1003.-92
-
St -p1003.-92
- -iso994--93
-
St -iso994--93
An XCU4 precursor.
- -p1003.2-92
-
St -p1003.2-92
Updates to POSIX.2.
- -xpg4
-
St -xpg4
Based on POSIX.1 and POSIX.2, published in 1992.
- Single UNIX Specification version 1 and related standards
-
- -susv1
-
St -susv1
- -xpg4.2
-
St -xpg4.2
This standard was published in 1994.
It was used as the basis for UNIX 95 certification.
The following three refer to parts of it.
- -xsh4.2
-
St -xsh4.2
- -xcurses4.2
-
St -xcurses4.2
- -p1003.1-2000
-
St -p1003.1-2000
Networking APIs, including sockets.
- -svid4
-
St -svid4 ,
Published in 1995.
- Single UNIX Specification version 2 and related standards
-
- -susv2
-
St -susv2
This Standard was published in 1997
and is also called X/Open Portability Guide version 5.
It was used as the basis for UNIX 98 certification.
The following refer to parts of it.
- -xbd5
-
St -xbd5
- -xsh5
-
St -xsh5
- -xcu5
-
St -xcu5
- -xns5
-
St -xns5
- -xns5.2
-
St -xns5.2
- Single UNIX Specification version 3
-
- -p1003.-2001
-
St -p1003.-2001
- -susv3
-
St -susv3
This standard is based on C99, SUSv2, POSIX.-1996, 1d, and 1j.
It is also called X/Open Portability Guide version 6.
It is used as the basis for UNIX 03 certification.
- -p1003.-2004
-
St -p1003.-2004
The second and last Technical Corrigendum.
- Single UNIX Specification version 4
-
- -p1003.-2008
-
St -p1003.-2008
- -susv4
-
St -susv4
This standard is also called
X/Open Portability Guide version 7.
- Other standards
-
- -ieee754
-
St -ieee754
Floatin-point arithmetic.
- -iso8601
-
St -iso8601
Representation of dates and times, published in 1988.
- -iso880-3
-
St -iso880-3
Ethernet local area networks.
- -ieee127-94
-
St -ieee127-94
Tg Sx
Ic Sx Ar Title line
Reference a section or subsection in the same manual page.
The referenced section or subsection name must be identical to the
enclosed argument, including whitespace.
Examples:
.Sx MANUAL STRUCTURE
See also
and
Tg Sy
Ic Sy Ar word ...
Request a boldface font.
This is most often used to indicate importance or seriousness (not to be
confused with stress emphasis, see
)
When none of the semantic macros fit, it is also adequate for syntax
elements that have to be given or that appear verbatim.
Examples:
.Sy Warning :
If
.Sy s
appears in the owner permissions, se-use-ID mode is set.
This utility replaces the former
.Sy dumpdir
program.
See also
,
,
and
`'
Tg Ta
Ic Ta
Table cell separator in
lists; can only be used below
Tg Tg
Tg [term
]
Announce that the next input line starts a definition of the
term
This macro must appear alone on its own input line.
The argument defaults to the first argument of the first macro
on the next line.
The argument may not contain whitespace characters, not even when it is quoted.
This macro is a
mandoc(1)
extension and is typically ignored by other formatters.
When viewing terminal output with
less(1),
the interactive
:t
command can be used to go to the definition of the
term
as described for the
MANPAGER
variable in
man(1);
when producing HTML output, a fragment identifier
(id attribute
)
is generated, to be used for deep linking to this place of the document.
In most cases, adding a
Tg macro would be redundant because
mandoc(1)
is able to automatically tag most definitions.
This macro is intended for cases where automatic tagging of a
term
is unsatisfactory, for example if a definition is not tagged
automatically (false negative) or if places are tagged that do
not define the
term
(false positives).
When there is at least one
Tg macro for a
term
no other places are automatically marked as definitions of that
term
word ...
Supported only for compatibility, do not use this in new manuals.
Even though the macro name
(``tradename''
)
suggests a semantic function, historic usage is inconsistent, mostly
using it as a presentatio-level macro to request a small caps font.
Ud Supported only for compatibility, do not use this in new manuals.
Prints out
``currently under development.''
UNIX
Supported only for compatibility, do not use this in new manuals.
Prints out
``UNIX
''
Tg Va
[type identifier ...
]
A variable name.
Examples:
.foo
.const char *bar
For function arguments and parameters, use
Fa instead.
For declarations of global variables in the
SYNOPSIS
section, use
Vt
Tg Vt
Vt type [identifier
]
A variable type.
This is also used for indicating global variables in the
SYNOPSIS
section, in which case a variable name is also specified.
Note that it accepts
Sx Block partia-implicit
syntax when invoked as the first macro on an input line in the
SYNOPSIS
section, else it accepts ordinary
Sx I-line
syntax.
In the former case, this macro starts a new output line,
and a blank line is inserted in front if there is a preceding
function definition or include directive.
Examples:
.Vt unsigned char
.Vt extern const char * const sys_signame[] ;
For parameters in function prototypes, use
Fa instead, for function return types
Ft ,
and for variable names outside the
SYNOPSIS
section
,
even when including a type with the name.
See also
Sx MANUAL STRUCTURE .
Close a scope opened by
block
Extend the header of an
macro or the body of a partia-implicit block macro
beyond the end of the input line.
This macro originally existed to work around the -argument limit
of historic
roff(7).
Tg Xr
Arnamesection
Link to another manual
(Qq cros-reference
)
Cross reference the
name
and
section
number of another man page.
Examples:
.mandoc(1)
.mandoc(1);
.mandoc(1)Nssbehaviour
MACRO SYNTAX
The syntax of a macro depends on its classification.
In this section,
`-arg'
refers to macro arguments, which may be followed by zero or more
`parm'
parameters;
`Yo opens the scope of a macro; and if specified,
'
`Yc closes it out.
'
The
Callable
column indicates that the macro may also be called by passing its name
as an argument to another macro.
For example,
`.[-O file
]
'
produces
`[-O file
]
'
To prevent a macro call and render the macro name literally,
escape it by prepending a zer-width space,
`&'
For example,
`[&-O
]
'
produces
`[-O
]
'
If a macro is not callable but its name appears as an argument
to another macro, it is interpreted as opaque text.
For example,
`.-
produces
'
`-
'
The
Parsed
column indicates whether the macro may call other macros by receiving
their names as arguments.
If a macro is not parsed but the name of another macro appears
as an argument, it is interpreted as opaque text.
The
Scope
column, if applicable, describes closure rules.
Block ful-explicit
Mult-line scope closed by an explicit closing macro.
All macros contains bodies; only
Bf and
(optionally)
contain a head.
.Yo lB-arg lBparm...rBrB lBhead...rB
lBbody...rB
.Yc
- Macro Ta Callable Ta Parsed Ta Scope
-
- Bf Ta Ta Ta closed by Ef
- Ta Ta Ta closed by
-
- Ef Ta Ta Ta opened by Bf
- Ta Ta Ta opened by
Block ful-implicit
Mult-line scope closed by en-o-file or implicitly by another macro.
All macros have bodies; some
Po
-bullet
-hyphen
-dash
-enum
-item
Pc don't have heads; only one
Po
in
Pc has multiple heads.
.Yo lB-arg lBparm...rBrB lBhead... lBTa head...rBrB
lBbody...rB
- Macro Ta Callable Ta Parsed Ta Scope
- Ta
Ta Yes Ta closed by - ,
- Ta Ta Ta closed by
Ta Ta Yes Ta closed by ,
,
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
Note that the
macro is a
Sx Block ful-implicit
macro only when invoked as the first macro
in a
SYNOPSIS
section line, else it is
Sx I-line .
Block partia-explicit
Like block ful-explicit, but also with singl-line scope.
Each has at least a body and, in limited circumstances, a head
Po Fo ,
Eo Pc and/or tail
(Ec
)
.Yo lB-arg lBparm...rBrB lBhead...rB
lBbody...rB
.Yc lBtail...rB
.Yo lB-arg lBparm...rBrB lBhead...rB lBbody...rB Yc lBtail...rB
- Macro Ta Callable Ta Parsed Ta Scope
- Ac Ta Yes Ta Yes Ta opened by Ao
- Ao Ta Yes Ta Yes Ta closed by Ac
- Bc Ta Yes Ta Yes Ta closed by Bo
- Bo Ta Yes Ta Yes Ta opened by Bc
- Brc Ta Yes Ta Yes Ta opened by Bro
- Bro Ta Yes Ta Yes Ta closed by Brc
- Dc Ta Yes Ta Yes Ta opened by Do
- Do Ta Yes Ta Yes Ta closed by Dc
- Ec Ta Yes Ta Yes Ta opened by Eo
- Eo Ta Yes Ta Yes Ta closed by Ec
- Fc Ta Yes Ta Yes Ta opened by Fo
- Fo Ta Ta Ta closed by Fc
- Ta Yes Ta Yes Ta closed by [
- [Ta Yes Ta Yes Ta opened by ]
]
- Pc Ta Yes Ta Yes Ta closed by Po
- Po Ta Yes Ta Yes Ta opened by Pc
- Qc Ta Yes Ta Yes Ta opened by [
- Qo Ta Yes Ta Yes Ta closed by ]
Ic Rs Ta No Ta No Ta closed by Ic Re
Ic Sc Ta Yes Ta Yes Ta opened by Ic So
Ic So Ta Yes Ta Yes Ta closed by Ic Sc
Ic Xc Ta Yes Ta Yes Ta opened by Ic Xo
Ic Xo Ta Yes Ta Yes Ta closed by Ic Xc
Block partia-implicit
Like block ful-implicit, but with singl-line scope closed by the
end of the line.
.Yo lB-arg lBval...rBrB lBbody...rB lBres...rB
- Macro Ta Callable Ta Parsed
- Aq Ta Yes Ta Yes
- Bq Ta Yes Ta Yes
- Brq Ta Yes Ta Yes
- D1 Ta Ta Yes
-
Ta Ta Yes
- ``Ta Yes Ta Yes
''
- En Ta Yes Ta Yes
- [Ta Yes Ta Yes
]
- (Ta Yes Ta Yes
)
- `Ta Yes
'
Ta Yes
- Qq Ta Yes Ta Yes
- `Ta Yes Ta Yes
'
- Vt Ta Yes Ta Yes
Note that the
Vt macro is a
Sx Block partia-implicit
only when invoked as the first macro
in a
SYNOPSIS
section line, else it is
Sx I-line .
Special block macro
The
Ta macro can only be used below
in
lists.
It delimits blocks representing table cells;
these blocks have bodies, but no heads.
- Macro Ta Callable Ta Parsed Ta Scope
- Ta Ta Yes Ta Yes Ta closed by Ta ,
I-line
Closed by the end of the line, fixed argument lengths,
and/or subsequent macros.
I-line macros have only text children.
If a number (or inequality) of arguments is
(n)
then the macro accepts an arbitrary number of arguments.
.Yo lB-arg lBval...rBrB lBargs...rB lBres...rB
.Yo lB-arg lBval...rBrB lBargs...rB Yc...
.Yo lB-arg lBval...rBrB arg0 arg1 argN
- Macro Ta Callable Ta Parsed Ta Arguments
- %A Ta Ta Ta >0
- %B Ta Ta Ta >0
- %C Ta Ta Ta >0
- %D Ta Ta Ta >0
- %I Ta Ta Ta >0
- %J Ta Ta Ta >0
- %N Ta Ta Ta >0
- %O Ta Ta Ta >0
- %P Ta Ta Ta >0
- %Q Ta Ta Ta >0
- %R Ta Ta Ta >0
- %T Ta Ta Ta >0
- %U Ta Ta Ta >0
- %V Ta Ta Ta >0
- Ta Yes Ta Yes Ta >0
- An Ta Yes Ta Yes Ta >0
- Ap Ta Yes Ta Yes Ta 0
- Ta Yes Ta Yes Ta n
- AT&T System
Ta Yes Ta Yes Ta 1
- Bsx Ta Yes Ta Yes Ta n
- is currently in beta test.
Ta Ta Ta 0
- BSD Ta Yes Ta Yes Ta n
- Ta Yes Ta Yes Ta >0
- Ta Yes Ta Yes Ta >0
- Db Ta Ta Ta 1
- Ta Ta Ta n
-
- Ta Yes Ta Yes Ta >0
- Dx Ta Yes Ta Yes Ta n
- Ta Yes Ta Yes Ta >0
- Er Ta Yes Ta Yes Ta >0
- Es Ta Yes Ta Yes Ta 2
- Ta Yes Ta Yes Ta >0
- Ex Ta Ta Ta n
- Fa Ta Yes Ta Yes Ta >0
- Fd Ta Ta Ta >0
- -Ta Yes Ta Yes Ta n
- Fn Ta Yes Ta Yes Ta >0
- Ta Yes Ta Yes Ta >0
- Ft Ta Yes Ta Yes Ta >0
- Fx Ta Yes Ta Yes Ta n
- Hf Ta Ta Ta n
- Ta Yes Ta Yes Ta >0
- In Ta Ta Ta 1
- Lb Ta Ta Ta 1
- Ta Yes Ta Yes Ta >0
- Lk Ta Yes Ta Yes Ta >0
- Lp Ta Ta Ta 0
- Ta Yes Ta Yes Ta >0
- Mt Ta Yes Ta Yes Ta >0
- Ta Yes Ta Yes Ta n
- Ta Yes Ta Yes Ta >0
- Ta Yes Ta Yes Ta 0
- Nx Ta Yes Ta Yes Ta n
- Ta Ta Ta n
- Ot Ta Yes Ta Yes Ta >0
- Ox Ta Yes Ta Yes Ta n
- Ta Yes Ta Yes Ta n
- Ta Yes Ta Yes Ta 1
- Rv Ta Ta Ta n
-
- St Ta Ta Yes Ta 1
- Sx Ta Yes Ta Yes Ta >0
- Ta Yes Ta Yes Ta >0
- Tg Ta Ta Ta <2
- Ta Yes Ta Yes Ta >0
- Ud Ta Ta Ta 0
- UNIX
- Ta Yes Ta Yes Ta n
- Vt Ta Yes Ta Yes Ta >0
- TaYesTaYesTa2
Delimiters
When a macro argument consists of one single input character
considered as a delimiter, the argument gets special handling.
This does not apply when delimiters appear in arguments containing
more than one character.
Consequently, to prevent special handling and just handle it
like any other argument, a delimiter can be escaped by prepending
a zer-width space
(`&'
)
In text lines, delimiters never need escaping, but may be used
as normal punctuation.
For many macros, when the leading arguments are opening delimiters,
these delimiters are put before the macro scope,
and when the trailing arguments are closing delimiters,
these delimiters are put after the macro scope.
Spacing is suppressed after opening delimiters
and before closing delimiters.
For example,
renders as:
Opening delimiters are:
- (
- left parenthesis
- [
- left bracket
Closing delimiters are:
- .
- period
- ,
- comma
- :
- colon
- ;
- semicolon
- )
- right parenthesis
- ]
- right bracket
- ?
- question mark
- !
- exclamation mark
Note that even a period preceded by a backslash
(`.'
)
gets this special handling; use
`&.'
to prevent that.
Many i-line macros interrupt their scope when they encounter
delimiters, and resume their scope when more arguments follow that
are not delimiters.
For example,
renders as:
This applies to both opening and closing delimiters,
and also to the middle delimiter, which does not suppress spacing:
- |
- vertical bar
As a special case, the predefined string *(Ba is handled and rendered
in the same way as a plain
`|'
character.
Using this predefined string is not recommended in new manuals.
Appending a zer-width space
(`&'
)
to the end of an input line is also useful to prevent the interpretation
of a trailing period, exclamation or question mark as the end of a
sentence, for example when an abbreviation happens to occur
at the end of a text or macro input line.
Font handling
In
documents, usage of semantic markup is recommended in order to have
proper fonts automatically selected; only when no fitting semantic markup
is available, consider falling back to
Sx Physical markup
macros.
Whenever any
macro switches the
roff(7)
font mode, it will automatically restore the previous font when exiting
its scope.
Manually switching the font using the
roff(7)
`f'
font escape sequences is never required.
COMPATIBILITY
This section provides an incomplete list of compatibility issues
between mandoc and GNU troff
(Qq groff
)
The following problematic behaviour is found in groff:
- does not format its arguments when used in the FILES section under
- certain list types.
- Ta can only be called by other macros, but not at the beginning of a line.
- `f'
(font face)
- and
`F'
(font family face)
Sx Text Decoration
escapes behave irregularly when specified within lin-macro scopes.
- Negative scaling units return to prior lines.
- Instead, mandoc truncates them to zero.
The following features are unimplemented in mandoc:
-
- is unsupported for security reasons.
-
-filled
- does not adjust the right margin, but is an alias for
-ragged
-
-literal
- does not use a literal font, but is an alias for
-unfilled
-
-offset center
- and
-offset right
don't work.
Groff does not implement centered and flus-right rendering either,
but produces large indentations.
SEE ALSO
man(1),
mandoc(1),
eqn(7),
man(7),
mandoc_char7,
roff(7),
tbl(7)
The web page
Lk https://mandoc.bsd.lv/mdoc/ extended documentation for the mdoc language
provides a few tutoria-style pages for beginners, an extensive style
guide for advanced authors, and an alphabetic index helping to choose
the best macros for various kinds of content.
The manual page
Lk https://man.voidlinux.org/groff_mdoc groff_mdoc(7)
contained in the
``groff''
package documents exactly the same language in a somewhat different style.
HISTORY
The
language first appeared as a troff macro package in
BSD 4.4
It was later significantly updated by Werner Lemberg and Ruslan Ermilov
in grof-1.17.
The standalone implementation that is part of the
mandoc(1)
utility written by Kristaps Dzonsons appeared in
Ox 4.6 .
AUTHORS
The
reference was written by
An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
Index
- NAME
-
- DESCRIPTION
-
- MANUAL STRUCTURE
-
- )
-
- ,
-
- macro or the end of an enclosing block, whichever comes first.
-
- macro to form subsections.
-
- macro followed by a non-standard section name, and each having
-
- MACRO OVERVIEW
-
- Document preamble and NAME section macros
-
- Sections and cross references
-
- Ta section header (one line)
-
- Displays and lists
-
- Spacing control
-
- Semantic markup for command line utilities
-
- Semantic markup for function libraries
-
- Various semantic markup
-
- Physical markup
-
- Physical enclosures
-
- Text production
-
- MACRO REFERENCE
-
- invocation.
-
- or
-
- macros or before displays
-
- ,
-
- ,
-
- ,
-
- and
-
-
- MACRO SYNTAX
-
- produces
-
-
- Block full-explicit
-
- Block full-implicit
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- ,
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by ,
,
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- ,
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
-
Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Ta Ta Yes Ta closed by
,
-
-
- ,
-
-
- Block partial-explicit
-
- Block partial-implicit
-
- Special block macro
-
- In-line
-
- Delimiters
-
- Font handling
-
- COMPATIBILITY
-
- SEE ALSO
-
- HISTORY
-
- AUTHORS
-
|
|