1GROFF_MDOC(7)        BSD Miscellaneous Information Manual        GROFF_MDOC(7)
2

NAME

4     groff_mdoc — reference for groff's mdoc implementation
5

SYNOPSIS

7     groff -mdoc file ...
8

DESCRIPTION

10     A complete reference for writing UNIX manual pages with the -mdoc macro
11     package; a content-based and domain-based formatting package for GNU
12     troff(1).  Its predecessor, the -man(7) package, addressed page layout
13     leaving the manipulation of fonts and other typesetting details to the
14     individual author.  In -mdoc, page layout macros make up the page
15     structure domain which consists of macros for titles, section headers,
16     displays and lists – essentially items which affect the physical position
17     of text on a formatted page.  In addition to the page structure domain,
18     there are two more domains, the manual domain and the general text
19     domain.  The general text domain is defined as macros which perform tasks
20     such as quoting or emphasizing pieces of text.  The manual domain is
21     defined as macros that are a subset of the day to day informal language
22     used to describe commands, routines and related UNIX files.  Macros in
23     the manual domain handle command names, command line arguments and
24     options, function names, function parameters, pathnames, variables, cross
25     references to other manual pages, and so on.  These domain items have
26     value for both the author and the future user of the manual page.  Hope‐
27     fully, the consistency gained across the manual set will provide easier
28     translation to future documentation tools.
29
30     Throughout the UNIX manual pages, a manual entry is simply referred to as
31     a man page, regardless of actual length and without sexist intention.
32

GETTING STARTED

34     The material presented in the remainder of this document is outlined as
35     follows:
36
37           1.   TROFF IDIOSYNCRASIES
38                Macro Usage
39                Passing Space Characters in an Argument
40                Trailing Blank Space Characters
41                Escaping Special Characters
42                Other Possible Pitfalls
43
44           2.   A MANUAL PAGE TEMPLATE
45
46           3.   CONVENTIONS
47
48           4.   TITLE MACROS
49
50           5.   INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
51                What's in a Name...
52                General Syntax
53
54           6.   MANUAL DOMAIN
55                Addresses
56                Author Name
57                Arguments
58                Configuration Declarations (Section Four Only)
59                Command Modifiers
60                Defined Variables
61                Errno's
62                Environment Variables
63                Flags
64                Function Declarations
65                Function Types
66                Functions (Library Routines)
67                Function Arguments
68                Return Values
69                Exit Status
70                Interactive Commands
71                Library Names
72                Literals
73                Names
74                Options
75                Pathnames
76                Standards
77                Variable Types
78                Variables
79                Manual Page Cross References
80
81           7.   GENERAL TEXT DOMAIN
82                AT&T Macro
83                BSD Macro
84                NetBSD Macro
85                FreeBSD Macro
86                DragonFly Macro
87                OpenBSD Macro
88                BSD/OS Macro
89                UNIX Macro
90                Emphasis Macro
91                Font Mode
92                Enclosure and Quoting Macros
93                No-Op or Normal Text Macro
94                No-Space Macro
95                Section Cross References
96                Symbolics
97                Mathematical Symbols
98                References and Citations
99                Trade Names (or Acronyms and Type Names)
100                Extended Arguments
101
102           8.   PAGE STRUCTURE DOMAIN
103                Section Headers
104                Subsection Headers
105                Paragraphs and Line Spacing
106                Keeps
107                Examples and Displays
108                Lists and Columns
109
110           9.   MISCELLANEOUS MACROS
111
112           10.  PREDEFINED STRINGS
113
114           11.  DIAGNOSTICS
115
116           12.  FORMATTING WITH GROFF, TROFF, AND NROFF
117
118           13.  FILES
119
120           14.  SEE ALSO
121
122           15.  BUGS
123

TROFF IDIOSYNCRASIES

125     The -mdoc package attempts to simplify the process of writing a man page.
126     Theoretically, one should not have to learn the tricky details of GNU
127     troff(1) to use -mdoc; however, there are a few limitations which are
128     unavoidable and best gotten out of the way.  And, too, be forewarned,
129     this package is not fast.
130
131   Macro Usage
132     As in GNU troff(1), a macro is called by placing a ‘.’ (dot character) at
133     the beginning of a line followed by the two-character (or three-charac‐
134     ter) name for the macro.  There can be space or tab characters between
135     the dot and the macro name.  Arguments may follow the macro separated by
136     spaces (but no tabs).  It is the dot character at the beginning of the
137     line which causes GNU troff(1) to interpret the next two (or more) char‐
138     acters as a macro name.  A single starting dot followed by nothing is
139     ignored.  To place a ‘.’ (dot character) at the beginning of an input
140     line in some context other than a macro invocation, precede the ‘.’ (dot)
141     with the ‘\&’ escape sequence which translates literally to a zero-width
142     space, and is never displayed in the output.
143
144     In general, GNU troff(1) macros accept an unlimited number of arguments
145     (contrary to other versions of troff which can't handle more than nine
146     arguments).  In limited cases, arguments may be continued or extended on
147     the next line (See Extended Arguments below).  Almost all macros handle
148     quoted arguments (see Passing Space Characters in an Argument below).
149
150     Most of the -mdoc general text domain and manual domain macros are spe‐
151     cial in that their argument lists are parsed for callable macro names.
152     This means an argument on the argument list which matches a general text
153     or manual domain macro name (and which is defined to be callable) will be
154     executed or called when it is processed.  In this case the argument,
155     although the name of a macro, is not preceded by a ‘.’ (dot).  This makes
156     it possible to nest macros; for example the option macro, ‘.Op’, may call
157     the flag and argument macros, ‘Fl’ and ‘Ar’, to specify an optional flag
158     with an argument:
159
160           [-s bytes]  is produced by ‘.Op Fl s Ar bytes’
161
162     To prevent a string from being interpreted as a macro name, precede the
163     string with the escape sequence ‘\&’:
164
165           [Fl s Ar bytes]  is produced by ‘.Op \&Fl s \&Ar bytes’
166
167     Here the strings ‘Fl’ and ‘Ar’ are not interpreted as macros.  Macros
168     whose argument lists are parsed for callable arguments are referred to as
169     parsed and macros which may be called from an argument list are referred
170     to as callable throughout this document.  This is a technical faux pas as
171     almost all of the macros in -mdoc are parsed, but as it was cumbersome to
172     constantly refer to macros as being callable and being able to call other
173     macros, the term parsed has been used.
174
175     In the following, we call an -mdoc macro which starts a line (with a
176     leading dot) a command if this distinction is necessary.
177
178   Passing Space Characters in an Argument
179     Sometimes it is desirable to give as an argument a string containing one
180     or more blank space characters, say, to specify arguments to commands
181     which expect particular arrangement of items in the argument list.  Addi‐
182     tionally, it makes -mdoc working faster.  For example, the function com‐
183     mand ‘.Fn’ expects the first argument to be the name of a function and
184     any remaining arguments to be function parameters.  As ANSI C stipulates
185     the declaration of function parameters in the parenthesized parameter
186     list, each parameter is guaranteed to be at minimum a two word string.
187     For example, int foo.
188
189     There are two possible ways to pass an argument which contains an embed‐
190     ded space.  One way of passing a string containing blank spaces is to use
191     the hard or unpaddable space character ‘\ ’, that is, a blank space pre‐
192     ceded by the escape character ‘\’.  This method may be used with any
193     macro but has the side effect of interfering with the adjustment of text
194     over the length of a line.  Troff sees the hard space as if it were any
195     other printable character and cannot split the string into blank or new‐
196     line separated pieces as one would expect.  This method is useful for
197     strings which are not expected to overlap a line boundary.  An alterna‐
198     tive is to use ‘\~’, a paddable (i.e. stretchable), unbreakable space
199     (this is a GNU troff(1) extension).  The second method is to enclose the
200     string with double quotes.
201
202     For example:
203
204           fetch(char *str)  is created by ‘.Fn fetch char\ *str’
205
206           fetch(char *str)  can also be created by ‘.Fn fetch "char *str"’
207
208     If the ‘\’ before the space in the first example or double quotes in the
209     second example were omitted, ‘.Fn’ would see three arguments, and the
210     result would be:
211
212           fetch(char, *str)
213
214   Trailing Blank Space Characters
215     Troff can be confused by blank space characters at the end of a line.  It
216     is a wise preventive measure to globally remove all blank spaces from
217     ⟨blank-space⟩⟨end-of-line⟩ character sequences.  Should the need arise to
218     use a blank character at the end of a line, it may be forced with an
219     unpaddable space and the ‘\&’ escape character.  For example,
220     ‘string\ \&’.
221
222   Escaping Special Characters
223     Special characters like the newline character ‘\n’ are handled by replac‐
224     ing the ‘\’ with ‘\e’ (e.g. ‘\en’) to preserve the backslash.
225
226   Other Possible Pitfalls
227     A warning is emitted when an empty input line is found outside of dis‐
228     plays (see below).  Use ‘.sp’ instead.  (Well, it is even better to use
229     -mdoc macros to avoid the usage of low-level commands.)
230
231     Leading spaces will cause a break and are output directly.  Avoid this
232     behaviour if possible.  Similarly, do not use more than one space charac‐
233     ter between words in an ordinary text line; contrary to other text for‐
234     matters, they are not replaced with a single space.
235
236     You can't pass ‘"’ directly as an argument.  Use ‘\*[q]’ (or ‘\*q’)
237     instead.
238
239     By default, troff(1) inserts two space characters after a punctuation
240     mark closing a sentence; characters like ‘)’ or ‘'’ are treated transpar‐
241     ently, not influencing the sentence-ending behaviour.  To change this,
242     insert ‘\&’ before or after the dot:
243
244           The
245           .Ql .
246           character.
247           .Pp
248           The
249           .Ql \&.
250           character.
251           .Pp
252           .No test .
253           test
254           .Pp
255           .No test.
256           test
257
258     gives
259
260           The ‘’.  character
261
262           The ‘.’ character.
263
264           test.  test
265
266           test. test
267
268     As can be seen in the first and third line, -mdoc handles punctuation
269     characters specially in macro arguments.  This will be explained in sec‐
270     tion General Syntax below.  In the same way, you have to protect trailing
271     full stops of abbreviations with a trailing zero-width space: ‘e.g.\&’.
272
273     A comment in the source file of a man page can be either started with
274     ‘.\"’ on a single line, ‘\"’ after some input, or ‘\#’ anywhere (the lat‐
275     ter is a GNU troff(1) extension); the rest of such a line is ignored.
276

A MANUAL PAGE TEMPLATE

278     The body of a man page is easily constructed from a basic template:
279
280           .\" The following commands are required for all man pages.
281           .Dd Month day, year
282           .Dt DOCUMENT_TITLE [section number] [architecture/volume]
283           .Os [OPERATING_SYSTEM] [version/release]
284           .Sh NAME
285           .Nm name
286           .Nd one line description of name
287           .\" This next command is for sections 2 and 3 only.
288           .\" .Sh LIBRARY
289           .Sh SYNOPSIS
290           .Sh DESCRIPTION
291           .\" The following commands should be uncommented and
292           .\" used where appropriate.
293           .\" .Sh IMPLEMENTATION NOTES
294           .\" This next command is for sections 2, 3, and 9 only
295           .\"     (function return values).
296           .\" .Sh RETURN VALUES
297           .\" This next command is for sections 1, 6, 7, and 8 only.
298           .\" .Sh ENVIRONMENT
299           .\" .Sh FILES
300           .\" This next command is for sections 1, 6, and 8 only
301           .\"     (command return values to the shell).
302           .\" .Sh EXIT STATUS
303           .\" .Sh EXAMPLES
304           .\" This next command is for sections 1, 4, 6, 7, 8, and 9 only
305           .\"     (fprintf/stderr type diagnostics).
306           .\" .Sh DIAGNOSTICS
307           .\" .Sh COMPATIBILITY
308           .\" This next command is for sections 2, 3, 4, and 9 only
309           .\"     (settings of the errno variable).
310           .\" .Sh ERRORS
311           .\" .Sh SEE ALSO
312           .\" .Sh STANDARDS
313           .\" .Sh HISTORY
314           .\" .Sh AUTHORS
315           .\" .Sh CAVEATS
316           .\" .Sh BUGS
317
318     The first items in the template are the commands ‘.Dd’, ‘.Dt’, and ‘.Os’;
319     the document date, the operating system the man page or subject source is
320     developed or modified for, and the man page title (in upper case) along
321     with the section of the manual the page belongs in.  These commands iden‐
322     tify the page and are discussed below in TITLE MACROS.
323
324     The remaining items in the template are section headers (.Sh); of which
325     NAME, SYNOPSIS, and DESCRIPTION are mandatory.  The headers are discussed
326     in PAGE STRUCTURE DOMAIN, after presentation of MANUAL DOMAIN.  Several
327     content macros are used to demonstrate page layout macros; reading about
328     content macros before page layout macros is recommended.
329

CONVENTIONS

331     In the description of all macros below, optional arguments are put into
332     brackets.  An ellipsis (‘...’) represents zero or more additional argu‐
333     ments.  Alternative values for a parameter are separated with ‘|’.  If
334     there are alternative values for a mandatory parameter, braces are used
335     (together with ‘|’) to enclose the value set.  Meta-variables are speci‐
336     fied within angles.
337
338     Example:
339
340           .Xx ⟨foo⟩ {bar1 | bar2} [-test1 [-test2 | -test3]] ...
341
342     Except stated explicitly, all macros are parsed and callable.
343
344     Note that a macro takes effect up to the next nested macro.  For example,
345     ‘.Ic foo Aq bar’ doesn't produce ‘foo <bar>’ but ‘foo ⟨bar⟩’.  Conse‐
346     quently, a warning message is emitted for most commands if the first
347     argument is a macro itself since it cancels the effect of the calling
348     command completely.  Another consequence is that quoting macros never
349     insert literal quotes; ‘foo <bar>’ has been produced by ‘.Ic "foo
350     <bar>"’.
351
352     Most macros have a default width value which can be used to specify a
353     label width (-width) or offset (-offset) for the ‘.Bl’ and ‘.Bd’ macros.
354     It is recommended not to use this rather obscure feature to avoid depen‐
355     dencies on local modifications of the -mdoc package.
356

TITLE MACROS

358     The title macros are part of the page structure domain but are presented
359     first and separately for someone who wishes to start writing a man page
360     yesterday.  Three header macros designate the document title or manual
361     page title, the operating system, and the date of authorship.  These
362     macros are called once at the very beginning of the document and are used
363     to construct headers and footers only.
364
365     .Dt [⟨document title⟩] [⟨section number⟩] [⟨volume⟩]
366             The document title is the subject of the man page and must be in
367             CAPITALS due to troff limitations.  If omitted, ‘UNTITLED’ is
368             used.  The section number may be a number in the range 1, ..., 9
369             or ‘unass’, ‘draft’, or ‘paper’.  If it is specified, and no vol‐
370             ume name is given, a default volume name is used.
371
372             Under BSD, the following sections are defined:
373
374             1   BSD General Commands Manual
375             2   BSD System Calls Manual
376             3   BSD Library Functions Manual
377             4   BSD Kernel Interfaces Manual
378             5   BSD File Formats Manual
379             6   BSD Games Manual
380             7   BSD Miscellaneous Information Manual
381             8   BSD System Manager's Manual
382             9   BSD Kernel Developer's Manual
383
384             A volume name may be arbitrary or one of the following:
385
386             USD     User's Supplementary Documents
387             PS1     Programmer's Supplementary Documents
388             AMD     Ancestral Manual Documents
389             SMM     System Manager's Manual
390             URM     User's Reference Manual
391             PRM     Programmer's Manual
392             KM      Kernel Manual
393             IND     Manual Master Index
394             LOCAL   Local Manual
395             CON     Contributed Software Manual
396
397             For compatibility, ‘MMI’ can be used for ‘IND’, and ‘LOC’ for
398             ‘LOCAL’.  Values from the previous table will specify a new vol‐
399             ume name.  If the third parameter is a keyword designating a com‐
400             puter architecture, its value is prepended to the default volume
401             name as specified by the second parameter.  By default, the fol‐
402             lowing architecture keywords are defined:
403
404                   acorn26, acorn32, algor, alpha, amd64, amiga, amigappc,
405                   arc, arm, arm26, arm32, armish, atari, aviion, beagle,
406                   bebox, cats, cesfic, cobalt, dreamcast, emips, evbarm,
407                   evbmips, evbppc, evbsh3, ews4800mips, hp300, hp700, hpcarm,
408                   hpcmips, hpcsh, hppa, hppa64, i386, ia64, ibmnws, iyonix,
409                   landisk, loongson, luna68k, luna88k, m68k, mac68k, macppc,
410                   mips, mips64, mipsco, mmeye, mvme68k, mvme88k, mvmeppc,
411                   netwinder, news68k, newsmips, next68k, ofppc, palm, pc532,
412                   playstation2, pmax, pmppc, powerpc, prep, rs6000,
413                   sandpoint, sbmips, sgi, sgimips, sh3, shark, socppc,
414                   solbourne, sparc, sparc64, sun2, sun3, tahoe, vax, x68k,
415                   x86_64, xen, zaurus
416
417             If the section number is neither a numeric expression in the
418             range 1 to 9 nor one of the above described keywords, the third
419             parameter is used verbatim as the volume name.
420
421             In the following examples, the left (which is identical to the
422             right) and the middle part of the manual page header strings are
423             shown.  Note how ‘\&’ prevents the digit 7 from being a valid
424             numeric expression.
425
426                   .Dt FOO 7       ‘FOO(7)’ ‘BSD Miscellaneous Information
427                                   Manual’
428                   .Dt FOO 7 bar   ‘FOO(7)’ ‘BSD Miscellaneous Information
429                                   Manual’
430                   .Dt FOO \&7 bar
431                                   ‘FOO(7)’ ‘bar’
432                   .Dt FOO 2 i386  ‘FOO(2)’ ‘BSD/i386 System Calls Manual’
433                   .Dt FOO "" bar  ‘FOO’ ‘bar’
434
435             Local, OS-specific additions might be found in the file
436             mdoc.local; look for strings named ‘volume-ds-XXX’ (for the for‐
437             mer type) and ‘volume-as-XXX’ (for the latter type); ‘XXX’ then
438             denotes the keyword to be used with the ‘.Dt’ macro.
439
440             This macro is neither callable nor parsed.
441
442     .Os [⟨operating system⟩] [⟨release⟩]
443             If the first parameter is empty, the default ‘BSD’ is used.  This
444             may be overridden in the local configuration file, mdoc.local.
445             In general, the name of the operating system should be the common
446             acronym, e.g. BSD or ATT.  The release should be the standard
447             release nomenclature for the system specified.  In the following
448             table, the possible second arguments for some predefined operat‐
449             ing systems are listed.  Similar to ‘.Dt’, local additions might
450             be defined in mdoc.local; look for strings named
451             ‘operating-system-XXX-YYY’, where ‘XXX’ is the acronym for the
452             operating system and ‘YYY’ the release ID.
453
454                   ATT        7th, 7, III, 3, V, V.2, V.3, V.4
455
456                   BSD        3, 4, 4.1, 4.2, 4.3, 4.3t, 4.3T, 4.3r, 4.3R, 4.4
457
458                   NetBSD     0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a,
459                              1.2b, 1.2c, 1.2d, 1.2e, 1.3, 1.3a, 1.4, 1.4.1,
460                              1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6,
461                              1.6.1, 1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3,
462                              2.1, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1, 3.1.1, 4.0,
463                              4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 5.1.2, 5.1.3,
464                              5.1.4, 5.2, 5.2.1, 5.2.2, 6.0, 6.0.1, 6.0.2,
465                              6.0.3, 6.0.4, 6.0.5, 6.1, 6.1.1, 6.1.2, 6.1.3,
466                              6.1.4
467
468                   FreeBSD    1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1,
469                              2.1.5, 2.1.6, 2.1.7, 2.2, 2.2.1, 2.2.2, 2.2.5,
470                              2.2.6, 2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4,
471                              3.5, 4.0, 4.1, 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6,
472                              4.6.2, 4.7, 4.8, 4.9, 4.10, 4.11, 5.0, 5.1, 5.2,
473                              5.2.1, 5.3, 5.4, 5.5, 6.0, 6.1, 6.2, 6.3, 6.4,
474                              7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3,
475                              8.4, 9.0, 9.1, 9.2, 9.3, 10.0
476
477                   OpenBSD    2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8,
478                              2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,
479                              3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6,
480                              4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6
481
482                   DragonFly  1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.8.1,
483                              1.9, 1.10, 1.12, 1.12.2, 1.13, 2.0, 2.2, 2.3,
484                              2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.9.1, 2.10,
485                              2.10.1, 2.11, 2.12, 2.13, 3.0, 3.1, 3.2, 3.3,
486                              3.4, 3.5, 3.6, 3.7, 3.8
487
488                   Darwin     8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.5.0, 8.6.0,
489                              8.7.0, 8.8.0, 8.9.0, 8.10.0, 8.11.0, 9.0.0,
490                              9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0, 9.7.0,
491                              9.8.0, 10.1.0, 10.2.0, 10.3.0, 10.4.0, 10.5.0,
492                              10.6.0, 10.7.0, 10.8.0, 11.0.0, 11.1.0, 11.2.0,
493                              11.3.0, 11.4.0, 11.5.0, 12.0.0, 12.1.0, 12.2.0,
494                              13.0.0, 13.1.0, 13.2.0, 13.3.0, 13.4.0, 14.0.0
495
496             For ATT, an unknown second parameter will be replaced with the
497             string UNIX; for the other predefined acronyms it will be ignored
498             and a warning message emitted.  Unrecognized arguments are dis‐
499             played as given in the page footer.  For instance, a typical
500             footer might be:
501
502                   .Os BSD 4.3
503
504             giving ‘4.3 Berkeley Distribution’, or for a locally produced set
505
506                   .Os CS Department
507
508             which will produce ‘CS Department’.
509
510             If the ‘.Os’ macro is not present, the bottom left corner of the
511             manual page will be ugly.
512
513             This macro is neither callable nor parsed.
514
515     .Dd [⟨month⟩ ⟨day⟩, ⟨year⟩]
516             If ‘Dd’ has no arguments, ‘Epoch’ is used for the date string.
517             If it has exactly three arguments, they are concatenated, sepa‐
518             rated with unbreakable space:
519
520                   .Dd January 25, 2001
521
522             The month's name shall not be abbreviated.
523
524             With any other number of arguments, the current date is used,
525             ignoring the parameters.
526
527             As a special exception, the format
528
529                   .Dd $Mdocdate: ⟨month⟩ ⟨day⟩ ⟨year⟩ $
530
531             is also recognized.  It is used in OpenBSD manuals to automati‐
532             cally insert the current date when committing.
533
534             This macro is neither callable nor parsed.
535

INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS

537   What's in a Name...
538     The manual domain macro names are derived from the day to day informal
539     language used to describe commands, subroutines and related files.
540     Slightly different variations of this language are used to describe the
541     three different aspects of writing a man page.  First, there is the
542     description of -mdoc macro command usage.  Second is the description of a
543     UNIX command with -mdoc macros, and third, the description of a command
544     to a user in the verbal sense; that is, discussion of a command in the
545     text of a man page.
546
547     In the first case, troff(1) macros are themselves a type of command; the
548     general syntax for a troff command is:
549
550           .Xx argument1 argument2 ...
551
552     ‘.Xx’ is a macro command, and anything following it are arguments to be
553     processed.  In the second case, the description of a UNIX command using
554     the content macros is a bit more involved; a typical SYNOPSIS command
555     line might be displayed as:
556
557           filter [-flag] ⟨infile⟩ ⟨outfile
558
559     Here, filter is the command name and the bracketed string -flag is a flag
560     argument designated as optional by the option brackets.  In -mdoc terms,
561infile⟩ and ⟨outfile⟩ are called meta arguments; in this example, the
562     user has to replace the meta expressions given in angle brackets with
563     real file names.  Note that in this document meta arguments are used to
564     describe -mdoc commands; in most man pages, meta variables are not
565     specifically written with angle brackets.  The macros which formatted the
566     above example:
567
568           .Nm filter
569           .Op Fl flag
570           .Ao Ar infile Ac Ao Ar outfile Ac
571
572     In the third case, discussion of commands and command syntax includes
573     both examples above, but may add more detail.  The arguments ⟨infile⟩ and
574outfile⟩ from the example above might be referred to as operands or file
575     arguments.  Some command line argument lists are quite long:
576
577           make  [-eiknqrstv] [-D variable] [-d flags] [-f makefile] [-I
578                 directory] [-j max_jobs] [variable=value] [target ...]
579
580     Here one might talk about the command make and qualify the argument,
581     makefile, as an argument to the flag, -f, or discuss the optional file
582     operand target.  In the verbal context, such detail can prevent confu‐
583     sion, however the -mdoc package does not have a macro for an argument to
584     a flag.  Instead the ‘Ar’ argument macro is used for an operand or file
585     argument like target as well as an argument to a flag like variable.  The
586     make command line was produced from:
587
588           .Nm make
589           .Op Fl eiknqrstv
590           .Op Fl D Ar variable
591           .Op Fl d Ar flags
592           .Op Fl f Ar makefile
593           .Op Fl I Ar directory
594           .Op Fl j Ar max_jobs
595           .Op Ar variable Ns = Ns Ar value
596           .Bk
597           .Op Ar target ...
598           .Ek
599
600     The ‘.Bk’ and ‘.Ek’ macros are explained in Keeps.
601
602   General Syntax
603     The manual domain and general text domain macros share a similar syntax
604     with a few minor deviations; most notably, ‘.Ar’, ‘.Fl’, ‘.Nm’, and ‘.Pa’
605     differ only when called without arguments; and ‘.Fn’ and ‘.Xr’ impose an
606     order on their argument lists.  All content macros are capable of recog‐
607     nizing and properly handling punctuation, provided each punctuation char‐
608     acter is separated by a leading space.  If a command is given:
609
610           .Ar sptr, ptr),
611
612     The result is:
613
614           sptr, ptr),
615
616     The punctuation is not recognized and all is output in the font used by
617     ‘.Ar’.  If the punctuation is separated by a leading white space:
618
619           .Ar sptr , ptr ) ,
620
621     The result is:
622
623           sptr, ptr),
624
625     The punctuation is now recognized and output in the default font distin‐
626     guishing it from the argument strings.  To remove the special meaning
627     from a punctuation character escape it with ‘\&’.
628
629     The following punctuation characters are recognized by -mdoc:
630
631               .         ,         :         ;         (
632               )         [         ]         ?         !
633
634     Troff is limited as a macro language, and has difficulty when presented
635     with a string containing a member of the mathematical, logical or quota‐
636     tion set:
637
638                 {+,-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
639
640     The problem is that troff may assume it is supposed to actually perform
641     the operation or evaluation suggested by the characters.  To prevent the
642     accidental evaluation of these characters, escape them with ‘\&’.  Typi‐
643     cal syntax is shown in the first content macro displayed below, ‘.Ad’.
644

MANUAL DOMAIN

646   Addresses
647     The address macro identifies an address construct.
648
649           Usage: .Ad ⟨address⟩ ...
650
651                    .Ad addr1           addr1
652                    .Ad addr1 .         addr1.
653                    .Ad addr1 , file2   addr1, file2
654                    .Ad f1 , f2 , f3 :  f1, f2, f3:
655                    .Ad addr ) ) ,      addr)),
656
657     The default width is 12n.
658
659   Author Name
660     The ‘.An’ macro is used to specify the name of the author of the item
661     being documented, or the name of the author of the actual manual page.
662
663           Usage: .An ⟨author name⟩ ...
664
665                    .An "Joe Author"        Joe Author
666
667                    .An "Joe Author" ,      Joe Author,
668
669                    .An "Joe Author" Aq nobody@FreeBSD.org
670                                            Joe Author <nobody@FreeBSD.org>
671
672                    .An "Joe Author" ) ) ,  Joe Author)),
673
674     The default width is 12n.
675
676     In the AUTHORS section, the ‘.An’ command causes a line break allowing
677     each new name to appear on its own line.  If this is not desirable,
678
679           .An -nosplit
680
681     call will turn this off.  To turn splitting back on, write
682
683           .An -split
684
685   Arguments
686     The .Ar argument macro may be used whenever an argument is referenced.
687     If called without arguments, the ‘file ...’ string is output.
688
689           Usage: .Ar [⟨argument⟩] ...
690
691                    .Ar              file ...
692                    .Ar file1        file1
693                    .Ar file1 .      file1.
694                    .Ar file1 file2  file1 file2
695                    .Ar f1 f2 f3 :   f1 f2 f3:
696                    .Ar file ) ) ,   file)),
697
698     The default width is 12n.
699
700   Configuration Declaration (Section Four Only)
701     The ‘.Cd’ macro is used to demonstrate a config(8) declaration for a
702     device interface in a section four manual.
703
704           Usage: .Cd ⟨argument⟩ ...
705
706                    .Cd "device le0 at scode?"  device le0 at scode?
707
708     In the SYNOPSIS section a ‘.Cd’ command causes a line break before and
709     after its arguments are printed.
710
711     The default width is 12n.
712
713   Command Modifiers
714     The command modifier is identical to the ‘.Fl’ (flag) command with the
715     exception that the ‘.Cm’ macro does not assert a dash in front of every
716     argument.  Traditionally flags are marked by the preceding dash, however,
717     some commands or subsets of commands do not use them.  Command modifiers
718     may also be specified in conjunction with interactive commands such as
719     editor commands.  See Flags.
720
721     The default width is 10n.
722
723   Defined Variables
724     A variable (or constant) which is defined in an include file is specified
725     by the macro ‘.Dv’.
726
727           Usage: .Dv ⟨defined variable⟩ ...
728
729                    .Dv MAXHOSTNAMELEN  MAXHOSTNAMELEN
730                    .Dv TIOCGPGRP )     TIOCGPGRP)
731
732     The default width is 12n.
733
734   Errno's
735     The ‘.Er’ errno macro specifies the error return value for section 2, 3,
736     and 9 library routines.  The second example below shows ‘.Er’ used with
737     the ‘.Bq’ general text domain macro, as it would be used in a section two
738     manual page.
739
740           Usage: .Er ⟨errno type⟩ ...
741
742                    .Er ENOENT      ENOENT
743                    .Er ENOENT ) ;  ENOENT);
744                    .Bq Er ENOTDIR  [ENOTDIR]
745
746     The default width is 17n.
747
748   Environment Variables
749     The ‘.Ev’ macro specifies an environment variable.
750
751           Usage: .Ev ⟨argument⟩ ...
752
753                    .Ev DISPLAY        DISPLAY
754                    .Ev PATH .         PATH.
755                    .Ev PRINTER ) ) ,  PRINTER)),
756
757     The default width is 15n.
758
759   Flags
760     The ‘.Fl’ macro handles command line flags.  It prepends a dash, ‘-’, to
761     the flag.  For interactive command flags, which are not prepended with a
762     dash, the ‘.Cm’ (command modifier) macro is identical, but without the
763     dash.
764
765           Usage: .Fl ⟨argument⟩ ...
766
767                    .Fl          -
768                    .Fl cfv      -cfv
769                    .Fl cfv .    -cfv.
770                    .Cm cfv .    cfv.
771                    .Fl s v t    -s -v -t
772                    .Fl - ,      --,
773                    .Fl xyz ) ,  -xyz),
774                    .Fl |        - |
775
776     The ‘.Fl’ macro without any arguments results in a dash representing
777     stdin/stdout.  Note that giving ‘.Fl’ a single dash will result in two
778     dashes.
779
780     The default width is 12n.
781
782   Function Declarations
783     The ‘.Fd’ macro is used in the SYNOPSIS section with section two or three
784     functions.  It is neither callable nor parsed.
785
786           Usage: .Fd ⟨argument⟩ ...
787
788                    .Fd "#include <sys/types.h>"  #include <sys/types.h>
789
790     In the SYNOPSIS section a ‘.Fd’ command causes a line break if a function
791     has already been presented and a break has not occurred.  This leaves a
792     nice vertical space in between the previous function call and the decla‐
793     ration for the next function.
794
795     The ‘.In’ macro, while in the SYNOPSIS section, represents the #include
796     statement, and is the short form of the above example.  It specifies the
797     C header file as being included in a C program.  It also causes a line
798     break.
799
800     While not in the SYNOPSIS section, it represents the header file enclosed
801     in angle brackets.
802
803           Usage: .In ⟨header file⟩
804
805                    .In stdio.h  #include <stdio.h>
806                    .In stdio.h  <stdio.h>
807
808   Function Types
809     This macro is intended for the SYNOPSIS section.  It may be used anywhere
810     else in the man page without problems, but its main purpose is to present
811     the function type in kernel normal form for the SYNOPSIS of sections two
812     and three (it causes a line break, allowing the function name to appear
813     on the next line).
814
815           Usage: .Ft ⟨type⟩ ...
816
817                    .Ft struct stat  struct stat
818
819   Functions (Library Routines)
820     The ‘.Fn’ macro is modeled on ANSI C conventions.
821
822           Usage: .Fn ⟨function⟩ [⟨parameter⟩] ...
823
824                    .Fn getchar              getchar()
825                    .Fn strlen ) ,           strlen()),
826                    .Fn align "char *ptr" ,  align(char *ptr),
827
828     Note that any call to another macro signals the end of the ‘.Fn’ call (it
829     will insert a closing parenthesis at that point).
830
831     For functions with many parameters (which is rare), the macros ‘.Fo’
832     (function open) and ‘.Fc’ (function close) may be used with ‘.Fa’ (func‐
833     tion argument).
834
835     Example:
836
837           .Ft int
838           .Fo res_mkquery
839           .Fa "int op"
840           .Fa "char *dname"
841           .Fa "int class"
842           .Fa "int type"
843           .Fa "char *data"
844           .Fa "int datalen"
845           .Fa "struct rrec *newrr"
846           .Fa "char *buf"
847           .Fa "int buflen"
848           .Fc
849
850     Produces:
851
852           int res_mkquery(int op, char *dname, int class, int type,
853           char *data, int datalen, struct rrec *newrr, char *buf, int buflen)
854
855     In the SYNOPSIS section, the function will always begin at the beginning
856     of line.  If there is more than one function presented in the SYNOPSIS
857     section and a function type has not been given, a line break will occur,
858     leaving a nice vertical space between the current function name and the
859     one prior.
860
861     The default width values of ‘.Fn’ and ‘.Fo’ are 12n and 16n, respec‐
862     tively.
863
864   Function Arguments
865     The ‘.Fa’ macro is used to refer to function arguments (parameters) out‐
866     side of the SYNOPSIS section of the manual or inside the SYNOPSIS section
867     if the enclosure macros ‘.Fo’ and ‘.Fc’ instead of ‘.Fn’ are used.  ‘.Fa’
868     may also be used to refer to structure members.
869
870           Usage: .Fa ⟨function argument⟩ ...
871
872                    .Fa d_namlen ) ) ,  d_namlen)),
873                    .Fa iov_len         iov_len
874
875     The default width is 12n.
876
877   Return Values
878     The ‘.Rv’ macro generates text for use in the RETURN VALUES section.
879
880           Usage: .Rv [-std] [⟨function⟩ ...]
881
882     For example, ‘.Rv -std atexit’ produces:
883
884           The atexit() function returns the value 0 if successful; otherwise
885           the value -1 is returned and the global variable errno is set to
886           indicate the error.
887
888     The -std option is valid only for manual page sections 2 and 3.  Cur‐
889     rently, this macro does nothing if used without the -std flag.
890
891   Exit Status
892     The ‘.Ex’ macro generates text for use in the DIAGNOSTICS section.
893
894           Usage: .Ex [-std] [⟨utility⟩ ...]
895
896     For example, ‘.Ex -std cat’ produces:
897
898           The cat utility exits 0 on success, and >0 if an error occurs.
899
900     The -std option is valid only for manual page sections 1, 6 and 8.  Cur‐
901     rently, this macro does nothing if used without the -std flag.
902
903   Interactive Commands
904     The ‘.Ic’ macro designates an interactive or internal command.
905
906           Usage: .Ic ⟨argument⟩ ...
907
908                    .Ic :wq                :wq
909                    .Ic "do while {...}"   do while {...}
910                    .Ic setenv , unsetenv  setenv, unsetenv
911
912     The default width is 12n.
913
914   Library Names
915     The ‘.Lb’ macro is used to specify the library where a particular func‐
916     tion is compiled in.
917
918           Usage: .Lb ⟨argument⟩ ...
919
920     Available arguments to ‘.Lb’ and their results are:
921
922           libarchive     Reading and Writing Streaming Archives Library
923                          (libarchive, -larchive)
924           libarm         ARM Architecture Library (libarm, -larm)
925           libarm32       ARM32 Architecture Library (libarm32, -larm32)
926           libbluetooth   Bluetooth Library (libbluetooth, -lbluetooth)
927           libbsm         Basic Security Module Library (libbsm, -lbsm)
928           libc           Standard C Library (libc, -lc)
929           libc_r         Reentrant C Library (libc_r, -lc_r)
930           libcalendar    Calendar Arithmetic Library (libcalendar,
931                          -lcalendar)
932           libcam         Common Access Method User Library (libcam, -lcam)
933           libcdk         Curses Development Kit Library (libcdk, -lcdk)
934           libcipher      FreeSec Crypt Library (libcipher, -lcipher)
935           libcompat      Compatibility Library (libcompat, -lcompat)
936           libcrypt       Crypt Library (libcrypt, -lcrypt)
937           libcurses      Curses Library (libcurses, -lcurses)
938           libdevinfo     Device and Resource Information Utility Library
939                          (libdevinfo, -ldevinfo)
940           libdevstat     Device Statistics Library (libdevstat, -ldevstat)
941           libdisk        Interface to Slice and Partition Labels Library
942                          (libdisk, -ldisk)
943           libdwarf       DWARF Access Library (libdwarf, -ldwarf)
944           libedit        Command Line Editor Library (libedit, -ledit)
945           libelf         ELF Access Library (libelf, -lelf)
946           libevent       Event Notification Library (libevent, -levent)
947           libfetch       File Transfer Library for URLs (libfetch, -lfetch)
948           libform        Curses Form Library (libform, -lform)
949           libgeom        Userland API Library for kernel GEOM subsystem
950                          (libgeom, -lgeom)
951           libgpib        General-Purpose Instrument Bus (GPIB) library
952                          (libgpib, -lgpib)
953           libi386        i386 Architecture Library (libi386, -li386)
954           libintl        Internationalized Message Handling Library (libintl,
955                          -lintl)
956           libipsec       IPsec Policy Control Library (libipsec, -lipsec)
957           libipx         IPX Address Conversion Support Library (libipx,
958                          -lipx)
959           libiscsi       iSCSI protocol library (libiscsi, -liscsi)
960           libjail        Jail Library (libjail, -ljail)
961           libkiconv      Kernel side iconv library (libkiconv, -lkiconv)
962           libkse         N:M Threading Library (libkse, -lkse)
963           libkvm         Kernel Data Access Library (libkvm, -lkvm)
964           libm           Math Library (libm, -lm)
965           libm68k        m68k Architecture Library (libm68k, -lm68k)
966           libmagic       Magic Number Recognition Library (libmagic, -lmagic)
967           libmd          Message Digest (MD4, MD5, etc.) Support Library
968                          (libmd, -lmd)
969           libmemstat     Kernel Memory Allocator Statistics Library
970                          (libmemstat, -lmemstat)
971           libmenu        Curses Menu Library (libmenu, -lmenu)
972           libnetgraph    Netgraph User Library (libnetgraph, -lnetgraph)
973           libnetpgp      Netpgp signing, verification, encryption and
974                          decryption (libnetpgp, -lnetpgp)
975           libossaudio    OSS Audio Emulation Library (libossaudio,
976                          -lossaudio)
977           libpam         Pluggable Authentication Module Library (libpam,
978                          -lpam)
979           libpcap        Packet Capture Library (libpcap, -lpcap)
980           libpci         PCI Bus Access Library (libpci, -lpci)
981           libpmc         Performance Counters Library (libpmc, -lpmc)
982           libposix       POSIX Compatibility Library (libposix, -lposix)
983           libprop        Property Container Object Library (libprop, -lprop)
984           libpthread     POSIX Threads Library (libpthread, -lpthread)
985           libpuffs       puffs Convenience Library (libpuffs, -lpuffs)
986           librefuse      File System in Userspace Convenience Library
987                          (librefuse, -lrefuse)
988           libresolv      DNS Resolver Library (libresolv, -lresolv)
989           librpcsec_gss  RPC GSS-API Authentication Library (librpcsec_gss,
990                          -lrpcsec_gss)
991           librpcsvc      RPC Service Library (librpcsvc, -lrpcsvc)
992           librt          POSIX Real-time Library (librt, -lrt)
993           libsdp         Bluetooth Service Discovery Protocol User Library
994                          (libsdp, -lsdp)
995           libssp         Buffer Overflow Protection Library (libssp, -lssp)
996           libSystem      System Library (libSystem, -lSystem)
997           libtermcap     Termcap Access Library (libtermcap, -ltermcap)
998           libterminfo    Terminal Information Library (libterminfo,
999                          -lterminfo)
1000           libthr         1:1 Threading Library (libthr, -lthr)
1001           libufs         UFS File System Access Library (libufs, -lufs)
1002           libugidfw      File System Firewall Interface Library (libugidfw,
1003                          -lugidfw)
1004           libulog        User Login Record Library (libulog, -lulog)
1005           libusbhid      USB Human Interface Devices Library (libusbhid,
1006                          -lusbhid)
1007           libutil        System Utilities Library (libutil, -lutil)
1008           libvgl         Video Graphics Library (libvgl, -lvgl)
1009           libx86_64      x86_64 Architecture Library (libx86_64, -lx86_64)
1010           libz           Compression Library (libz, -lz)
1011
1012     Local, OS-specific additions might be found in the file mdoc.local; look
1013     for strings named ‘str-Lb-XXX’.  ‘XXX’ then denotes the keyword to be
1014     used with the ‘.Lb’ macro.
1015
1016     In the LIBRARY section an ‘.Lb’ command causes a line break before and
1017     after its arguments are printed.
1018
1019   Literals
1020     The ‘.Li’ literal macro may be used for special characters, variable con‐
1021     stants, etc. - anything which should be displayed as it would be typed.
1022
1023           Usage: .Li ⟨argument⟩ ...
1024
1025                    .Li \en          \n
1026                    .Li M1 M2 M3 ;   M1 M2 M3;
1027                    .Li cntrl-D ) ,  cntrl-D),
1028                    .Li 1024 ...     1024 ...
1029
1030     The default width is 16n.
1031
1032   Names
1033     The ‘.Nm’ macro is used for the document title or subject name.  It has
1034     the peculiarity of remembering the first argument it was called with,
1035     which should always be the subject name of the page.  When called without
1036     arguments, ‘.Nm’ regurgitates this initial name for the sole purpose of
1037     making less work for the author.  ‘.Nm’ causes a line break within the
1038     SYNOPSIS section.
1039
1040     Note: A section two or three document function name is addressed with the
1041     ‘.Nm’ in the NAME section, and with ‘.Fn’ in the SYNOPSIS and remaining
1042     sections.  For interactive commands, such as the ‘while’ command keyword
1043     in csh(1), the ‘.Ic’ macro should be used.  While ‘.Ic’ is nearly identi‐
1044     cal to ‘.Nm’, it can not recall the first argument it was invoked with.
1045
1046           Usage: .Nm [⟨argument⟩] ...
1047
1048                    .Nm groff_mdoc  groff_mdoc
1049                    .Nm \-mdoc      -mdoc
1050                    .Nm foo ) ) ,   foo)),
1051                    .Nm :           groff_mdoc:
1052
1053     The default width is 10n.
1054
1055   Options
1056     The ‘.Op’ macro places option brackets around any remaining arguments on
1057     the command line, and places any trailing punctuation outside the brack‐
1058     ets.  The macros ‘.Oo’ and ‘.Oc’ (which produce an opening and a closing
1059     option bracket respectively) may be used across one or more lines or to
1060     specify the exact position of the closing parenthesis.
1061
1062           Usage: .Op [⟨option⟩] ...
1063
1064                    .Op                                []
1065                    .Op Fl k                           [-k]
1066                    .Op Fl k ) .                       [-k]).
1067                    .Op Fl k Ar kookfile               [-k kookfile]
1068                    .Op Fl k Ar kookfile ,             [-k kookfile],
1069                    .Op Ar objfil Op Ar corfil         [objfil [corfil]]
1070                    .Op Fl c Ar objfil Op Ar corfil ,  [-c objfil [corfil]],
1071                    .Op word1 word2                    [word1 word2]
1072                    .Li .Op Oo Ao option Ac Oc ...     .Op [⟨option⟩] ...
1073
1074     Here a typical example of the ‘.Oo’ and ‘.Oc’ macros:
1075
1076           .Oo
1077           .Op Fl k Ar kilobytes
1078           .Op Fl i Ar interval
1079           .Op Fl c Ar count
1080           .Oc
1081
1082     Produces:
1083
1084           [[-k kilobytes] [-i interval] [-c count]]
1085
1086     The default width values of ‘.Op’ and ‘.Oo’ are 14n and 10n, respec‐
1087     tively.
1088
1089   Pathnames
1090     The ‘.Pa’ macro formats path or file names.  If called without arguments,
1091     the ‘~’ string is output, which represents the current user's home direc‐
1092     tory.
1093
1094           Usage: .Pa [⟨pathname⟩] ...
1095
1096                    .Pa                    ~
1097                    .Pa /usr/share         /usr/share
1098                    .Pa /tmp/fooXXXXX ) .  /tmp/fooXXXXX).
1099
1100     The default width is 32n.
1101
1102   Standards
1103     The ‘.St’ macro replaces standard abbreviations with their formal names.
1104
1105           Usage: .St ⟨abbreviation⟩ ...
1106
1107     Available pairs for “Abbreviation/Formal Name” are:
1108
1109     ANSI/ISO C
1110
1111           -ansiC          ANSI X3.159-1989 (“ANSI C89”)
1112           -ansiC-89       ANSI X3.159-1989 (“ANSI C89”)
1113           -isoC           ISO/IEC 9899:1990 (“ISO C90”)
1114           -isoC-90        ISO/IEC 9899:1990 (“ISO C90”)
1115           -isoC-99        ISO/IEC 9899:1999 (“ISO C99”)
1116           -isoC-2011      ISO/IEC 9899:2011 (“ISO C11”)
1117
1118     POSIX Part 1: System API
1119
1120           -iso9945-1-90   ISO/IEC 9945-1:1990 (“POSIX.1”)
1121           -iso9945-1-96   ISO/IEC 9945-1:1996 (“POSIX.1”)
1122           -p1003.1        IEEE Std 1003.1 (“POSIX.1”)
1123           -p1003.1-88     IEEE Std 1003.1-1988 (“POSIX.1”)
1124           -p1003.1-90     ISO/IEC 9945-1:1990 (“POSIX.1”)
1125           -p1003.1-96     ISO/IEC 9945-1:1996 (“POSIX.1”)
1126           -p1003.1b-93    IEEE Std 1003.1b-1993 (“POSIX.1”)
1127           -p1003.1c-95    IEEE Std 1003.1c-1995 (“POSIX.1”)
1128           -p1003.1g-2000  IEEE Std 1003.1g-2000 (“POSIX.1”)
1129           -p1003.1i-95    IEEE Std 1003.1i-1995 (“POSIX.1”)
1130           -p1003.1-2001   IEEE Std 1003.1-2001 (“POSIX.1”)
1131           -p1003.1-2004   IEEE Std 1003.1-2004 (“POSIX.1”)
1132           -p1003.1-2008   IEEE Std 1003.1-2008 (“POSIX.1”)
1133
1134     POSIX Part 2: Shell and Utilities
1135
1136           -iso9945-2-93   ISO/IEC 9945-2:1993 (“POSIX.2”)
1137           -p1003.2        IEEE Std 1003.2 (“POSIX.2”)
1138           -p1003.2-92     IEEE Std 1003.2-1992 (“POSIX.2”)
1139           -p1003.2a-92    IEEE Std 1003.2a-1992 (“POSIX.2”)
1140
1141     X/Open
1142
1143           -susv2          Version 2 of the Single UNIX Specification
1144                           (“SUSv2”)
1145           -susv3          Version 3 of the Single UNIX Specification
1146                           (“SUSv3”)
1147           -svid4          System V Interface Definition, Fourth Edition
1148                           (“SVID4”)
1149           -xbd5           X/Open Base Definitions Issue 5 (“XBD5”)
1150           -xcu5           X/Open Commands and Utilities Issue 5 (“XCU5”)
1151           -xcurses4.2     X/Open Curses Issue 4, Version 2 (“XCURSES4.2”)
1152           -xns5           X/Open Networking Services Issue 5 (“XNS5”)
1153           -xns5.2         X/Open Networking Services Issue 5.2 (“XNS5.2”)
1154           -xpg3           X/Open Portability Guide Issue 3 (“XPG3”)
1155           -xpg4           X/Open Portability Guide Issue 4 (“XPG4”)
1156           -xpg4.2         X/Open Portability Guide Issue 4, Version 2
1157                           (“XPG4.2”)
1158           -xsh5           X/Open System Interfaces and Headers Issue 5
1159                           (“XSH5”)
1160
1161     Miscellaneous
1162
1163           -ieee754        IEEE Std 754-1985
1164           -iso8601
1165           -iso8802-3      ISO/IEC 8802-3:1989
1166
1167   Variable Types
1168     The ‘.Vt’ macro may be used whenever a type is referenced.  In the
1169     SYNOPSIS section, it causes a line break (useful for old style variable
1170     declarations).
1171
1172           Usage: .Vt ⟨type⟩ ...
1173
1174                    .Vt extern char *optarg ;  extern char *optarg;
1175                    .Vt FILE *                 FILE *
1176
1177   Variables
1178     Generic variable reference.
1179
1180           Usage: .Va ⟨variable⟩ ...
1181
1182                    .Va count             count
1183                    .Va settimer ,        settimer,
1184                    .Va "int *prt" ) :    int *prt):
1185                    .Va "char s" ] ) ) ,  char s])),
1186
1187     The default width is 12n.
1188
1189   Manual Page Cross References
1190     The ‘.Xr’ macro expects the first argument to be a manual page name.  The
1191     optional second argument, if a string (defining the manual section), is
1192     put into parentheses.
1193
1194           Usage: .Xr ⟨man page name⟩ [⟨section⟩] ...
1195
1196                    .Xr mdoc        mdoc
1197                    .Xr mdoc ,      mdoc,
1198                    .Xr mdoc 7      mdoc(7)
1199                    .Xr xinit 1x ;  xinit(1x);
1200
1201     The default width is 10n.
1202

GENERAL TEXT DOMAIN

1204   AT&T Macro
1205           Usage: .At [⟨version⟩] ...
1206
1207                    .At       AT&T UNIX
1208                    .At v6 .  Version 6 AT&T UNIX.
1209
1210     The following values for ⟨version⟩ are possible:
1211
1212           32v, v1, v2, v3, v4, v5, v6, v7, III, V, V.1, V.2, V.3, V.4
1213
1214   BSD Macro
1215           Usage: .Bx {-alpha | -beta | -devel} ...
1216                  .Bx [⟨version⟩ [⟨release⟩]] ...
1217
1218                    .Bx         BSD
1219                    .Bx 4.3 .   4.3BSD.
1220                    .Bx -devel  BSD (currently under development)
1221
1222     ⟨version⟩ will be prepended to the string ‘BSD’.  The following values
1223     for ⟨release⟩ are possible:
1224
1225           Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2
1226
1227   NetBSD Macro
1228           Usage: .Nx [⟨version⟩] ...
1229
1230                    .Nx        NetBSD
1231                    .Nx 1.4 .  NetBSD 1.4.
1232
1233     For possible values of ⟨version⟩ see the description of the ‘.Os’ command
1234     above in section TITLE MACROS.
1235
1236   FreeBSD Macro
1237           Usage: .Fx [⟨version⟩] ...
1238
1239                    .Fx        FreeBSD
1240                    .Fx 2.2 .  FreeBSD 2.2.
1241
1242     For possible values of ⟨version⟩ see the description of the ‘.Os’ command
1243     above in section TITLE MACROS.
1244
1245   DragonFly Macro
1246           Usage: .Dx [⟨version⟩] ...
1247
1248                    .Dx        DragonFly
1249                    .Dx 1.4 .  DragonFly 1.4.
1250
1251     For possible values of ⟨version⟩ see the description of the ‘.Os’ command
1252     above in section TITLE MACROS.
1253
1254   OpenBSD Macro
1255           Usage: .Ox [⟨version⟩] ...
1256
1257                    .Ox 1.0  OpenBSD 1.0
1258
1259   BSD/OS Macro
1260           Usage: .Bsx [⟨version⟩] ...
1261
1262                    .Bsx 1.0  BSD/OS 1.0
1263
1264   UNIX Macro
1265           Usage: .Ux ...
1266
1267                    .Ux  UNIX
1268
1269   Emphasis Macro
1270     Text may be stressed or emphasized with the ‘.Em’ macro.  The usual font
1271     for emphasis is italic.
1272
1273           Usage: .Em ⟨argument⟩ ...
1274
1275                    .Em does not          does not
1276                    .Em exceed 1024 .     exceed 1024.
1277                    .Em vide infra ) ) ,  vide infra)),
1278
1279     The default width is 10n.
1280
1281   Font Mode
1282     The ‘.Bf’ font mode must be ended with the ‘.Ef’ macro (the latter takes
1283     no arguments).  Font modes may be nested within other font modes.
1284
1285     ‘.Bf’ has the following syntax:
1286
1287           .Bf ⟨font mode⟩
1288
1289     ⟨font mode⟩ must be one of the following three types:
1290
1291           Em | -emphasis  Same as if the ‘.Em’ macro was used for the entire
1292                           block of text.
1293           Li | -literal   Same as if the ‘.Li’ macro was used for the entire
1294                           block of text.
1295           Sy | -symbolic  Same as if the ‘.Sy’ macro was used for the entire
1296                           block of text.
1297
1298     Both macros are neither callable nor parsed.
1299
1300   Enclosure and Quoting Macros
1301     The concept of enclosure is similar to quoting.  The object being to
1302     enclose one or more strings between a pair of characters like quotes or
1303     parentheses.  The terms quoting and enclosure are used interchangeably
1304     throughout this document.  Most of the one-line enclosure macros end in
1305     small letter ‘q’ to give a hint of quoting, but there are a few irregu‐
1306     larities.  For each enclosure macro there is also a pair of open and
1307     close macros which end in small letters ‘o’ and ‘c’ respectively.
1308
1309     Quote   Open   Close   Function                  Result
1310     .Aq     .Ao    .Ac     Angle Bracket Enclosure   <string>
1311     .Bq     .Bo    .Bc     Bracket Enclosure         [string]
1312     .Brq    .Bro   .Brc    Brace Enclosure           {string}
1313     .Dq     .Do    .Dc     Double Quote              "string"
1314     .Eq     .Eo    .Ec     Enclose String (in XX)    XXstring
1315     .Pq     .Po    .Pc     Parenthesis Enclosure     (string)
1316     .Ql                    Quoted Literal            “string” or string
1317     .Qq     .Qo    .Qc     Straight Double Quote     "string"
1318     .Sq     .So    .Sc     Single Quote              'string'
1319
1320     All macros ending with ‘q’ and ‘o’ have a default width value of 12n.
1321
1322     .Eo, .Ec  These macros expect the first argument to be the opening and
1323               closing strings respectively.
1324
1325     .Es, .En  Due to the nine-argument limit in the original troff program
1326               two other macros have been implemented which are now rather
1327               obsolete: ‘.Es’ takes the first and second parameter as the
1328               left and right enclosure string, which are then used to enclose
1329               the arguments of ‘.En’.  The default width value is 12n for
1330               both macros.
1331
1332     .Eq       The first and second arguments of this macro are the opening
1333               and closing strings respectively, followed by the arguments to
1334               be enclosed.
1335
1336     .Ql       The quoted literal macro behaves differently in troff and nroff
1337               mode.  If formatted with nroff, a quoted literal is always
1338               quoted.  If formatted with troff, an item is only quoted if the
1339               width of the item is less than three constant width characters.
1340               This is to make short strings more visible where the font
1341               change to literal (constant width) is less noticeable.
1342
1343               The default width is 16n.
1344
1345     .Pf       The prefix macro suppresses the whitespace between its first
1346               and second argument:
1347
1348                     .Pf ( Fa name2  (name2
1349
1350               The default width is 12n.
1351
1352               The ‘.Ns’ macro (see below) performs the analogous suffix func‐
1353               tion.
1354
1355     .Ap       The ‘.Ap’ macro inserts an apostrophe and exits any special
1356               text modes, continuing in ‘.No’ mode.
1357
1358     Examples of quoting:
1359
1360           .Aq                      ⟨⟩
1361           .Aq Pa ctype.h ) ,       ⟨ctype.h⟩),
1362           .Bq                      []
1363           .Bq Em Greek , French .  [Greek, French].
1364           .Dq                      “”
1365           .Dq string abc .         “string abc”.
1366           .Dq ´^[A-Z]´             “´^[A-Z]´”
1367           .Ql man mdoc             ‘man mdoc’
1368           .Qq                      ""
1369           .Qq string ) ,           "string"),
1370           .Qq string Ns ),         "string),"
1371           .Sq                      ‘’
1372           .Sq string               ‘string’
1373           .Em or Ap ing            or'ing
1374
1375     For a good example of nested enclosure macros, see the ‘.Op’ option
1376     macro.  It was created from the same underlying enclosure macros as those
1377     presented in the list above.  The ‘.Xo’ and ‘.Xc’ extended argument list
1378     macros are discussed below.
1379
1380   No-Op or Normal Text Macro
1381     The ‘.No’ macro can be used in a macro command line for parameters which
1382     should not be formatted.  Be careful to add ‘\&’ to the word ‘No’ if you
1383     really want that English word (and not the macro) as a parameter.
1384
1385           Usage: .No ⟨argument⟩ ...
1386
1387                    .No test Ta with Ta tabs  test     with     tabs
1388
1389     The default width is 12n.
1390
1391   No-Space Macro
1392     The ‘.Ns’ macro suppresses insertion of a space between the current posi‐
1393     tion and its first parameter.  For example, it is useful for old style
1394     argument lists where there is no space between the flag and argument:
1395
1396           Usage: ... ⟨argument⟩ Ns [⟨argument⟩] ...
1397                  .Ns ⟨argument⟩ ...
1398
1399                    .Op Fl I Ns Ar directory  [-Idirectory]
1400
1401     Note: The ‘.Ns’ macro always invokes the ‘.No’ macro after eliminating
1402     the space unless another macro name follows it.  If used as a command
1403     (i.e., the second form above in the ‘Usage’ line), ‘.Ns’ is identical to
1404     ‘.No’.
1405
1406   Section Cross References
1407     The ‘.Sx’ macro designates a reference to a section header within the
1408     same document.
1409
1410           Usage: .Sx ⟨section reference⟩ ...
1411
1412                    .Sx FILES  FILES
1413
1414     The default width is 16n.
1415
1416   Symbolics
1417     The symbolic emphasis macro is generally a boldface macro in either the
1418     symbolic sense or the traditional English usage.
1419
1420           Usage: .Sy ⟨symbol⟩ ...
1421
1422                    .Sy Important Notice  Important Notice
1423
1424     The default width is 6n.
1425
1426   Mathematical Symbols
1427     Use this macro for mathematical symbols and similar things.
1428
1429           Usage: .Ms ⟨math symbol⟩ ...
1430
1431                    .Ms sigma  sigma
1432
1433     The default width is 6n.
1434
1435   References and Citations
1436     The following macros make a modest attempt to handle references.  At
1437     best, the macros make it convenient to manually drop in a subset of
1438     refer(1) style references.
1439
1440           .Rs     Reference start (does not take arguments).  Causes a line
1441                   break in the SEE ALSO section and begins collection of ref‐
1442                   erence information until the reference end macro is read.
1443           .Re     Reference end (does not take arguments).  The reference is
1444                   printed.
1445           .%A     Reference author name; one name per invocation.
1446           .%B     Book title.
1447           .%C     City/place.
1448           .%D     Date.
1449           .%I     Issuer/publisher name.
1450           .%J     Journal name.
1451           .%N     Issue number.
1452           .%O     Optional information.
1453           .%P     Page number.
1454           .%Q     Corporate or foreign author.
1455           .%R     Report name.
1456           .%T     Title of article.
1457           .%U     Optional hypertext reference.
1458           .%V     Volume.
1459
1460     Macros beginning with ‘%’ are not callable but accept multiple arguments
1461     in the usual way.  Only the ‘.Tn’ macro is handled properly as a parame‐
1462     ter; other macros will cause strange output.  ‘.%B’ and ‘.%T’ can be used
1463     outside of the ‘.Rs/.Re’ environment.
1464
1465     Example:
1466
1467           .Rs
1468           .%A "Matthew Bar"
1469           .%A "John Foo"
1470           .%T "Implementation Notes on foobar(1)"
1471           .%R "Technical Report ABC-DE-12-345"
1472           .%Q "Drofnats College"
1473           .%C "Nowhere"
1474           .%D "April 1991"
1475           .Re
1476
1477     produces
1478
1479           Matthew Bar and John Foo, Implementation Notes on foobar(1),
1480           Technical Report ABC-DE-12-345, Drofnats College, April 1991.
1481
1482   Trade Names (or Acronyms and Type Names)
1483     The trade name macro prints its arguments in a smaller font.  Its
1484     intended use is to imitate a small caps fonts for uppercase acronyms.
1485
1486           Usage: .Tn ⟨symbol⟩ ...
1487
1488                    .Tn DEC    DEC
1489                    .Tn ASCII  ASCII
1490
1491     The default width is 10n.
1492
1493   Extended Arguments
1494     The .Xo and .Xc macros allow one to extend an argument list on a macro
1495     boundary for the ‘.It’ macro (see below).  Note that .Xo and .Xc are
1496     implemented similarly to all other macros opening and closing an enclo‐
1497     sure (without inserting characters, of course).  This means that the fol‐
1498     lowing is true for those macros also.
1499
1500     Here is an example of ‘.Xo’ using the space mode macro to turn spacing
1501     off:
1502
1503           .Sm off
1504           .It Xo Sy I Ar operation
1505           .No \en Ar count No \en
1506           .Xc
1507           .Sm on
1508
1509     produces
1510
1511           Ioperation\ncount\n
1512
1513     Another one:
1514
1515           .Sm off
1516           .It Cm S No / Ar old_pattern Xo
1517           .No / Ar new_pattern
1518           .No / Op Cm g
1519           .Xc
1520           .Sm on
1521
1522     produces
1523
1524           S/old_pattern/new_pattern/[g]
1525
1526     Another example of ‘.Xo’ and enclosure macros: Test the value of a vari‐
1527     able.
1528
1529           .It Xo
1530           .Ic .ifndef
1531           .Oo \&! Oc Ns Ar variable Oo
1532           .Ar operator variable ...
1533           .Oc Xc
1534
1535     produces
1536
1537           .ifndef [!]variable [operator variable ...]
1538

PAGE STRUCTURE DOMAIN

1540   Section Headers
1541     The following ‘.Sh’ section header macros are required in every man page.
1542     The remaining section headers are recommended at the discretion of the
1543     author writing the manual page.  The ‘.Sh’ macro is parsed but not gener‐
1544     ally callable.  It can be used as an argument in a call to ‘.Sh’ only; it
1545     then reactivates the default font for ‘.Sh’.
1546
1547     The default width is 8n.
1548
1549     .Sh NAME           The ‘.Sh NAME’ macro is mandatory.  If not specified,
1550                        headers, footers and page layout defaults will not be
1551                        set and things will be rather unpleasant.  The NAME
1552                        section consists of at least three items.  The first
1553                        is the ‘.Nm’ name macro naming the subject of the man
1554                        page.  The second is the name description macro,
1555                        ‘.Nd’, which separates the subject name from the third
1556                        item, which is the description.  The description
1557                        should be the most terse and lucid possible, as the
1558                        space available is small.
1559
1560                        ‘.Nd’ first prints ‘-’, then all its arguments.
1561
1562     .Sh LIBRARY        This section is for section two and three function
1563                        calls.  It should consist of a single ‘.Lb’ macro
1564                        call; see Library Names.
1565
1566     .Sh SYNOPSIS       The SYNOPSIS section describes the typical usage of
1567                        the subject of a man page.  The macros required are
1568                        either ‘.Nm’, ‘.Cd’, or ‘.Fn’ (and possibly ‘.Fo’,
1569                        ‘.Fc’, ‘.Fd’, and ‘.Ft’).  The function name macro
1570                        ‘.Fn’ is required for manual page sections 2 and 3;
1571                        the command and general name macro ‘.Nm’ is required
1572                        for sections 1, 5, 6, 7, and 8.  Section 4 manuals
1573                        require a ‘.Nm’, ‘.Fd’ or a ‘.Cd’ configuration device
1574                        usage macro.  Several other macros may be necessary to
1575                        produce the synopsis line as shown below:
1576
1577                              cat [-benstuv] [-] file ...
1578
1579                        The following macros were used:
1580
1581                              .Nm cat
1582                              .Op Fl benstuv
1583                              .Op Fl
1584                              .Ar
1585
1586     .Sh DESCRIPTION    In most cases the first text in the DESCRIPTION sec‐
1587                        tion is a brief paragraph on the command, function or
1588                        file, followed by a lexical list of options and
1589                        respective explanations.  To create such a list, the
1590                        ‘.Bl’ (begin list), ‘.It’ (list item) and ‘.El’ (end
1591                        list) macros are used (see Lists and Columns below).
1592
1593     .Sh IMPLEMENTATION NOTES
1594                        Implementation specific information should be placed
1595                        here.
1596
1597     .Sh RETURN VALUES  Sections 2, 3 and 9 function return values should go
1598                        here.  The ‘.Rv’ macro may be used to generate text
1599                        for use in the RETURN VALUES section for most section
1600                        2 and 3 library functions; see Return Values.
1601
1602     The following ‘.Sh’ section headers are part of the preferred manual page
1603     layout and must be used appropriately to maintain consistency.  They are
1604     listed in the order in which they would be used.
1605
1606     .Sh ENVIRONMENT    The ENVIRONMENT section should reveal any related
1607                        environment variables and clues to their behavior
1608                        and/or usage.
1609
1610     .Sh FILES          Files which are used or created by the man page sub‐
1611                        ject should be listed via the ‘.Pa’ macro in the FILES
1612                        section.
1613
1614     .Sh EXAMPLES       There are several ways to create examples.  See the
1615                        EXAMPLES section below for details.
1616
1617     .Sh DIAGNOSTICS    Diagnostic messages from a command should be placed in
1618                        this section.  The ‘.Ex’ macro may be used to generate
1619                        text for use in the DIAGNOSTICS section for most sec‐
1620                        tion 1, 6 and 8 commands; see Exit Status.
1621
1622     .Sh COMPATIBILITY  Known compatibility issues (e.g. deprecated options or
1623                        parameters) should be listed here.
1624
1625     .Sh ERRORS         Specific error handling, especially from library func‐
1626                        tions (man page sections 2, 3, and 9) should go here.
1627                        The ‘.Er’ macro is used to specify an error (errno).
1628
1629     .Sh SEE ALSO       References to other material on the man page topic and
1630                        cross references to other relevant man pages should be
1631                        placed in the SEE ALSO section.  Cross references are
1632                        specified using the ‘.Xr’ macro.  Currently refer(1)
1633                        style references are not accommodated.
1634
1635                        It is recommended that the cross references are sorted
1636                        on the section number, then alphabetically on the
1637                        names within a section, and placed in that order and
1638                        comma separated.  Example:
1639
1640                        ls(1), ps(1), group(5), passwd(5)
1641
1642     .Sh STANDARDS      If the command, library function or file adheres to a
1643                        specific implementation such as IEEE Std 1003.2
1644                        (“POSIX.2”) or ANSI X3.159-1989 (“ANSI C89”) this
1645                        should be noted here.  If the command does not adhere
1646                        to any standard, its history should be noted in the
1647                        HISTORY section.
1648
1649     .Sh HISTORY        Any command which does not adhere to any specific
1650                        standards should be outlined historically in this sec‐
1651                        tion.
1652
1653     .Sh AUTHORS        Credits should be placed here.  Use the ‘.An’ macro
1654                        for names and the ‘.Aq’ macro for e-mail addresses
1655                        within optional contact information.  Explicitly indi‐
1656                        cate whether the person authored the initial manual
1657                        page or the software or whatever the person is being
1658                        credited for.
1659
1660     .Sh BUGS           Blatant problems with the topic go here.
1661
1662     User-specified ‘.Sh’ sections may be added; for example, this section was
1663     set with:
1664
1665                    .Sh "PAGE STRUCTURE DOMAIN"
1666
1667   Subsection Headers
1668     Subsection headers have exactly the same syntax as section headers: ‘.Ss’
1669     is parsed but not generally callable.  It can be used as an argument in a
1670     call to ‘.Ss’ only; it then reactivates the default font for ‘.Ss’.
1671
1672     The default width is 8n.
1673
1674   Paragraphs and Line Spacing
1675     .Pp  The ‘.Pp’ paragraph command may be used to specify a line space
1676          where necessary.  The macro is not necessary after a ‘.Sh’ or ‘.Ss’
1677          macro or before a ‘.Bl’ or ‘.Bd’ macro (which both assert a vertical
1678          distance unless the -compact flag is given).
1679
1680          The macro is neither callable nor parsed and takes no arguments; an
1681          alternative name is ‘.Lp’.
1682
1683   Keeps
1684     The only keep that is implemented at this time is for words.  The macros
1685     are ‘.Bk’ (begin keep) and ‘.Ek’ (end keep).  The only option that ‘.Bk’
1686     accepts currently is -words (this is also the default if no option is
1687     given) which is useful for preventing line breaks in the middle of
1688     options.  In the example for the make command line arguments (see What's
1689     in a Name), the keep prevented nroff from placing up the flag and the
1690     argument on separate lines.
1691
1692     Both macros are neither callable nor parsed.
1693
1694     More work needs to be done with the keep macros; specifically, a -line
1695     option should be added.
1696
1697   Examples and Displays
1698     There are seven types of displays.
1699
1700     .D1  (This is D-one.)  Display one line of indented text.  This macro is
1701          parsed but not callable.
1702
1703                -ldghfstru
1704
1705          The above was produced by: .D1 Fl ldghfstru.
1706
1707     .Dl  (This is D-ell.)  Display one line of indented literal text.  The
1708          ‘.Dl’ example macro has been used throughout this file.  It allows
1709          the indentation (display) of one line of text.  Its default font is
1710          set to constant width (literal).  ‘.Dl’ is parsed but not callable.
1711
1712                % ls -ldg /usr/local/bin
1713
1714          The above was produced by: .Dl % ls \-ldg /usr/local/bin.
1715
1716     .Bd  Begin display.  The ‘.Bd’ display must be ended with the ‘.Ed’
1717          macro.  It has the following syntax:
1718
1719                .Bd {-literal | -filled | -unfilled | -ragged | -centered}
1720                     [-offset ⟨string⟩] [-file ⟨file name⟩] [-compact]
1721
1722          -ragged            Fill, but do not adjust the right margin (only
1723                             left-justify).
1724          -centered          Center lines between the current left and right
1725                             margin.  Note that each single line is centered.
1726          -unfilled          Do not fill; display a block of text as typed,
1727                             using line breaks as specified by the user.  This
1728                             can produce overlong lines without warning mes‐
1729                             sages.
1730          -filled            Display a filled block.  The block of text is
1731                             formatted (i.e., the text is justified on both
1732                             the left and right side).
1733          -literal           Display block with literal font (usually fixed-
1734                             width).  Useful for source code or simple tabbed
1735                             or spaced text.
1736          -file file name⟩  The file whose name follows the -file flag is
1737                             read and displayed before any data enclosed with
1738                             ‘.Bd’ and ‘.Ed’, using the selected display type.
1739                             Any troff/-mdoc commands in the file will be pro‐
1740                             cessed.
1741          -offset string⟩   If -offset is specified with one of the following
1742                             strings, the string is interpreted to indicate
1743                             the level of indentation for the forthcoming
1744                             block of text:
1745
1746                             left        Align block on the current left mar‐
1747                                         gin; this is the default mode of
1748                                         ‘.Bd’.
1749                             center      Supposedly center the block.  At this
1750                                         time unfortunately, the block merely
1751                                         gets left aligned about an imaginary
1752                                         center margin.
1753                             indent      Indent by one default indent value or
1754                                         tab.  The default indent value is
1755                                         also used for the ‘.D1’ and ‘.Dl’
1756                                         macros, so one is guaranteed the two
1757                                         types of displays will line up.  The
1758                                         indentation value is normally set
1759                                         to 6n or about two thirds of an inch
1760                                         (six constant width characters).
1761                             indent-two  Indent two times the default indent
1762                                         value.
1763                             right       This left aligns the block about two
1764                                         inches from the right side of the
1765                                         page.  This macro needs work and per‐
1766                                         haps may never do the right thing
1767                                         within troff.
1768
1769                             If ⟨string⟩ is a valid numeric expression instead
1770                             (with a scale indicator other thanu’), use that
1771                             value for indentation.  The most useful scale
1772                             indicators are ‘m’ and ‘n’, specifying the so-
1773                             called Em and En square.  This is approximately
1774                             the width of the letters ‘m’ and ‘n’ respectively
1775                             of the current font (for nroff output, both scale
1776                             indicators give the same values).  If ⟨string⟩
1777                             isn't a numeric expression, it is tested whether
1778                             it is an -mdoc macro name, and the default offset
1779                             value associated with this macro is used.
1780                             Finally, if all tests fail, the width of ⟨string⟩
1781                             (typeset with a fixed-width font) is taken as the
1782                             offset.
1783          -compact           Suppress insertion of vertical space before begin
1784                             of display.
1785
1786     .Ed  End display (takes no arguments).
1787
1788   Lists and Columns
1789     There are several types of lists which may be initiated with the ‘.Bl’
1790     begin-list macro.  Items within the list are specified with the ‘.It’
1791     item macro, and each list must end with the ‘.El’ macro.  Lists may be
1792     nested within themselves and within displays.  The use of columns inside
1793     of lists or lists inside of columns is unproven.
1794
1795     In addition, several list attributes may be specified such as the width
1796     of a tag, the list offset, and compactness (blank lines between items
1797     allowed or disallowed).  Most of this document has been formatted with a
1798     tag style list (-tag).
1799
1800     It has the following syntax forms:
1801
1802           .Bl {-hang | -ohang | -tag | -diag | -inset} [-width ⟨string⟩]
1803                [-offset ⟨string⟩] [-compact]
1804           .Bl -column [-offset ⟨string⟩] ⟨string1⟩ ⟨string2⟩ ...
1805           .Bl {-item | -enum [-nested] | -bullet | -hyphen | -dash} [-offset
1806                ⟨string⟩] [-compact]
1807
1808     And now a detailed description of the list types.
1809
1810     -bullet  A bullet list.
1811
1812                    .Bl -bullet -offset indent -compact
1813                    .It
1814                    Bullet one goes here.
1815                    .It
1816                    Bullet two here.
1817                    .El
1818
1819              Produces:
1820
1821                    ·   Bullet one goes here.
1822                    ·   Bullet two here.
1823
1824     -dash (or -hyphen)
1825              A dash list.
1826
1827                    .Bl -dash -offset indent -compact
1828                    .It
1829                    Dash one goes here.
1830                    .It
1831                    Dash two here.
1832                    .El
1833
1834              Produces:
1835
1836                    -   Dash one goes here.
1837                    -   Dash two here.
1838
1839     -enum    An enumerated list.
1840
1841                    .Bl -enum -offset indent -compact
1842                    .It
1843                    Item one goes here.
1844                    .It
1845                    And item two here.
1846                    .El
1847
1848              The result:
1849
1850                    1.   Item one goes here.
1851                    2.   And item two here.
1852
1853              If you want to nest enumerated lists, use the -nested flag
1854              (starting with the second-level list):
1855
1856                    .Bl -enum -offset indent -compact
1857                    .It
1858                    Item one goes here
1859                    .Bl -enum -nested -compact
1860                    .It
1861                    Item two goes here.
1862                    .It
1863                    And item three here.
1864                    .El
1865                    .It
1866                    And item four here.
1867                    .El
1868
1869              Result:
1870
1871                    1.   Item one goes here.
1872                         1.1.   Item two goes here.
1873                         1.2.   And item three here.
1874                    2.   And item four here.
1875
1876     -item    A list of type -item without list markers.
1877
1878                    .Bl -item -offset indent
1879                    .It
1880                    Item one goes here.
1881                    Item one goes here.
1882                    Item one goes here.
1883                    .It
1884                    Item two here.
1885                    Item two here.
1886                    Item two here.
1887                    .El
1888
1889              Produces:
1890
1891                    Item one goes here.  Item one goes here.  Item one goes
1892                    here.
1893
1894                    Item two here.  Item two here.  Item two here.
1895
1896     -tag     A list with tags.  Use -width to specify the tag width.
1897
1898                    SL    sleep time of the process (seconds blocked)
1899                    PAGEIN
1900                          number of disk I/O's resulting from references by
1901                          the process to pages not loaded in core.
1902                    UID   numerical user-id of process owner
1903                    PPID  numerical id of parent of process priority (non-pos‐
1904                          itive when in non-interruptible wait)
1905
1906              The raw text:
1907
1908                    .Bl -tag -width "PPID" -compact -offset indent
1909                    .It SL
1910                    sleep time of the process (seconds blocked)
1911                    .It PAGEIN
1912                    number of disk
1913                    .Tn I/O Ns 's
1914                    resulting from references by the process
1915                    to pages not loaded in core.
1916                    .It UID
1917                    numerical user-id of process owner
1918                    .It PPID
1919                    numerical id of parent of process priority
1920                    (non-positive when in non-interruptible wait)
1921                    .El
1922
1923     -diag    Diag lists create section four diagnostic lists and are similar
1924              to inset lists except callable macros are ignored.  The -width
1925              flag is not meaningful in this context.
1926
1927              Example:
1928
1929                    .Bl -diag
1930                    .It You can't use Sy here.
1931                    The message says all.
1932                    .El
1933
1934              produces
1935
1936              You can't use Sy here.  The message says all.
1937
1938     -hang    A list with hanging tags.
1939
1940                    Hanged  labels appear similar to tagged lists when the
1941                            label is smaller than the label width.
1942
1943                    Longer hanged list labels blend into the paragraph unlike
1944                            tagged paragraph labels.
1945
1946              And the unformatted text which created it:
1947
1948                    .Bl -hang -offset indent
1949                    .It Em Hanged
1950                    labels appear similar to tagged lists when the
1951                    label is smaller than the label width.
1952                    .It Em Longer hanged list labels
1953                    blend into the paragraph unlike
1954                    tagged paragraph labels.
1955                    .El
1956
1957     -ohang   Lists with overhanging tags do not use indentation for the
1958              items; tags are written to a separate line.
1959
1960                    SL
1961                    sleep time of the process (seconds blocked)
1962
1963                    PAGEIN
1964                    number of disk I/O's resulting from references by the
1965                    process to pages not loaded in core.
1966
1967                    UID
1968                    numerical user-id of process owner
1969
1970                    PPID
1971                    numerical id of parent of process priority (non-positive
1972                    when in non-interruptible wait)
1973
1974              The raw text:
1975
1976                    .Bl -ohang -offset indent
1977                    .It Sy SL
1978                    sleep time of the process (seconds blocked)
1979                    .It Sy PAGEIN
1980                    number of disk
1981                    .Tn I/O Ns 's
1982                    resulting from references by the process
1983                    to pages not loaded in core.
1984                    .It Sy UID
1985                    numerical user-id of process owner
1986                    .It Sy PPID
1987                    numerical id of parent of process priority
1988                    (non-positive when in non-interruptible wait)
1989                    .El
1990
1991     -inset   Here is an example of inset labels:
1992
1993                    Tag The tagged list (also called a tagged paragraph) is
1994                    the most common type of list used in the Berkeley manuals.
1995                    Use a -width attribute as described below.
1996
1997                    Diag Diag lists create section four diagnostic lists and
1998                    are similar to inset lists except callable macros are
1999                    ignored.
2000
2001                    Hang Hanged labels are a matter of taste.
2002
2003                    Ohang Overhanging labels are nice when space is con‐
2004                    strained.
2005
2006                    Inset Inset labels are useful for controlling blocks of
2007                    paragraphs and are valuable for converting -mdoc manuals
2008                    to other formats.
2009
2010              Here is the source text which produced the above example:
2011
2012                    .Bl -inset -offset indent
2013                    .It Em Tag
2014                    The tagged list (also called a tagged paragraph)
2015                    is the most common type of list used in the
2016                    Berkeley manuals.
2017                    .It Em Diag
2018                    Diag lists create section four diagnostic lists
2019                    and are similar to inset lists except callable
2020                    macros are ignored.
2021                    .It Em Hang
2022                    Hanged labels are a matter of taste.
2023                    .It Em Ohang
2024                    Overhanging labels are nice when space is constrained.
2025                    .It Em Inset
2026                    Inset labels are useful for controlling blocks of
2027                    paragraphs and are valuable for converting
2028                    .Nm -mdoc
2029                    manuals to other formats.
2030                    .El
2031
2032     -column  This list type generates multiple columns.  The number of col‐
2033              umns and the width of each column is determined by the arguments
2034              to the -column list, ⟨string1⟩, ⟨string2⟩, etc.  If ⟨stringN
2035              starts with a ‘.’ (dot) immediately followed by a valid -mdoc
2036              macro name, interpret ⟨stringN⟩ and use the width of the result.
2037              Otherwise, the width of ⟨stringN⟩ (typeset with a fixed-width
2038              font) is taken as the Nth column width.
2039
2040              Each ‘.It’ argument is parsed to make a row, each column within
2041              the row is a separate argument separated by a tab or the ‘.Ta’
2042              macro.
2043
2044              The table:
2045
2046                    String    Nroff    Troff
2047                    <=        <=       ≤
2048                    >=        >=       ≥
2049
2050              was produced by:
2051
2052              .Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
2053              .It Sy String Ta Sy Nroff Ta Sy Troff
2054              .It Li <= Ta <= Ta \*(<=
2055              .It Li >= Ta >= Ta \*(>=
2056              .El
2057
2058              Don't abuse this list type!  For more complicated cases it might
2059              be far better and easier to use tbl(1), the table preprocessor.
2060
2061     Other keywords:
2062
2063     -width string⟩   If ⟨string⟩ starts with a ‘.’ (dot) immediately fol‐
2064                       lowed by a valid -mdoc macro name, interpret ⟨string
2065                       and use the width of the result.  Almost all lists in
2066                       this document use this option.
2067
2068                       Example:
2069
2070                             .Bl -tag -width ".Fl test Ao Ar string Ac"
2071                             .It Fl test Ao Ar string Ac
2072                             This is a longer sentence to show how the
2073                             .Fl width
2074                             flag works in combination with a tag list.
2075                             .El
2076
2077                       gives:
2078
2079                       -test string⟩  This is a longer sentence to show how
2080                                       the -width flag works in combination
2081                                       with a tag list.
2082
2083                       (Note that the current state of -mdoc is saved before
2084string⟩ is interpreted; afterwards, all variables are
2085                       restored again.  However, boxes (used for enclosures)
2086                       can't be saved in GNU troff(1); as a consequence, argu‐
2087                       ments must always be balanced to avoid nasty errors.
2088                       For example, do not write ‘.Ao Ar string’ but ‘.Ao Ar
2089                       string Xc’ instead if you really need only an opening
2090                       angle bracket.)
2091
2092                       Otherwise, if ⟨string⟩ is a valid numeric expression
2093                       (with a scale indicator other thanu’), use that value
2094                       for indentation.  The most useful scale indicators are
2095                       ‘m’ and ‘n’, specifying the so-called Em and En square.
2096                       This is approximately the width of the letters ‘m’ and
2097                       ‘n’ respectively of the current font (for nroff output,
2098                       both scale indicators give the same values).  If
2099string⟩ isn't a numeric expression, it is tested
2100                       whether it is an -mdoc macro name, and the default
2101                       width value associated with this macro is used.
2102                       Finally, if all tests fail, the width of ⟨string
2103                       (typeset with a fixed-width font) is taken as the
2104                       width.
2105
2106                       If a width is not specified for the tag list type,
2107                       every time ‘.It’ is invoked, an attempt is made to
2108                       determine an appropriate width.  If the first argument
2109                       to ‘.It’ is a callable macro, the default width for
2110                       that macro will be used; otherwise, the default width
2111                       of ‘.No’ is used.
2112
2113     -offset string⟩  If ⟨string⟩ is indent, a default indent value (normally
2114                       set to 6n, similar to the value used in ‘.Dl’ or ‘.Bd’)
2115                       is used.  If ⟨string⟩ is a valid numeric expression
2116                       instead (with a scale indicator other thanu’), use
2117                       that value for indentation.  The most useful scale
2118                       indicators are ‘m’ and ‘n’, specifying the so-called Em
2119                       and En square.  This is approximately the width of the
2120                       letters ‘m’ and ‘n’ respectively of the current font
2121                       (for nroff output, both scale indicators give the same
2122                       values).  If ⟨string⟩ isn't a numeric expression, it is
2123                       tested whether it is an -mdoc macro name, and the
2124                       default offset value associated with this macro is
2125                       used.  Finally, if all tests fail, the width of
2126string⟩ (typeset with a fixed-width font) is taken as
2127                       the offset.
2128
2129     -compact          Suppress insertion of vertical space before the list
2130                       and between list items.
2131

MISCELLANEOUS MACROS

2133     Here a list of the remaining macros which do not fit well into one of the
2134     above sections.  We couldn't find real examples for the following macros:
2135     ‘.Me’ and ‘.Ot’.  They are documented here for completeness - if you know
2136     how to use them properly please send a mail to bug-groff@gnu.org (includ‐
2137     ing an example).
2138
2139     .Bt  prints
2140
2141                is currently in beta test.
2142
2143          It is neither callable nor parsed and takes no arguments.
2144
2145     .Fr
2146
2147                Usage: .Fr ⟨function return value⟩ ...
2148
2149          Don't use this macro.  It allows a break right before the return
2150          value (usually a single digit) which is bad typographical behaviour.
2151          Use ‘\~’ to tie the return value to the previous word.
2152
2153     .Hf  Use this macro to include a (header) file literally.  It first
2154          prints ‘File:’ followed by the file name, then the contents of
2155          ⟨file⟩.
2156
2157                Usage: .Hf ⟨file⟩
2158
2159          It is neither callable nor parsed.
2160
2161     .Lk  To be written.
2162
2163     .Me  Exact usage unknown.  The documentation in the -mdoc source file
2164          describes it as a macro for “menu entries”.
2165
2166          Its default width is 6n.
2167
2168     .Mt  To be written.
2169
2170     .Ot  Exact usage unknown.  The documentation in the -mdoc source file
2171          describes it as “old function type (fortran)”.
2172
2173     .Sm  Activate (toggle) space mode.
2174
2175                Usage: .Sm [on | off] ...
2176
2177          If space mode is off, no spaces between macro arguments are
2178          inserted.  If called without a parameter (or if the next parameter
2179          is neither ‘on’ nor ‘off’, ‘.Sm’ toggles space mode.
2180
2181     .Ud  prints
2182
2183                currently under development.
2184
2185          It is neither callable nor parsed and takes no arguments.
2186

PREDEFINED STRINGS

2188     The following strings are predefined:
2189
2190     String   Nroff      Troff   Meaning
2191     <=       <=         ≤       less equal
2192     >=       >=         ≥       greater equal
2193     Rq       ''         ”       right double quote
2194     Lq       ``         “       left double quote
2195     ua       ^          ↑       upwards arrow
2196     aa       ´          ´       acute accent
2197     ga       `          `       grave accent
2198     q        "          "       straight double quote
2199     Pi       pi         π       greek pi
2200     Ne       !=         ≠       not equal
2201     Le       <=         ≤       less equal
2202     Ge       >=         ≥       greater equal
2203     Lt       <          <       less than
2204     Gt       >          >       greater than
2205     Pm       +-         ±       plus minus
2206     If       infinity   ∞       infinity
2207     Am       &          &       ampersand
2208     Na       NaN        NaN     not a number
2209     Ba       |          |       vertical bar
2210
2211     The names of the columns Nroff and Troff are a bit misleading; Nroff
2212     shows the ASCII representation, while Troff gives the best glyph form
2213     available.  For example, a Unicode enabled TTY-device will have proper
2214     glyph representations for all strings, whereas the enhancement for a
2215     Latin1 TTY-device is only the plus-minus sign.
2216
2217     String names which consist of two characters can be written as ‘\*(xx’;
2218     string names which consist of one character can be written as ‘\*x’.  A
2219     generic syntax for a string name of any length is ‘\*[xxx]’ (this is a
2220     GNU troff(1) extension).
2221

DIAGNOSTICS

2223     The debugging macro ‘.Db’ available in previous versions of -mdoc has
2224     been removed since GNU troff(1) provides better facilities to check
2225     parameters; additionally, many error and warning messages have been added
2226     to this macro package, making it both more robust and verbose.
2227
2228     The only remaining debugging macro is ‘.Rd’ which yields a register dump
2229     of all global registers and strings.  A normal user will never need it.
2230

FORMATTING WITH GROFF, TROFF, AND NROFF

2232     By default, the package inhibits page breaks, headers, and footers if
2233     displayed with a TTY device like ‘latin1’ or ‘unicode’, to make the man‐
2234     ual more efficient for viewing on-line.  This behaviour can be changed
2235     (e.g. to create a hardcopy of the TTY output) by setting the register
2236     ‘cR’ to zero while calling groff(1), resulting in multiple pages instead
2237     of a single, very long page:
2238
2239           groff -Tlatin1 -rcR=0 -mdoc foo.man > foo.txt
2240
2241     For double-sided printing, set register ‘D’ to 1:
2242
2243           groff -Tps -rD1 -mdoc foo.man > foo.ps
2244
2245     To change the document font size to 11pt or 12pt, set register ‘S’
2246     accordingly:
2247
2248           groff -Tdvi -rS11 -mdoc foo.man > foo.dvi
2249
2250     Register ‘S’ is ignored for TTY devices.
2251
2252     The line and title length can be changed by setting the registers ‘LL’
2253     and ‘LT’, respectively:
2254
2255           groff -Tutf8 -rLL=100n -rLT=100n -mdoc foo.man | less
2256
2257     If not set, both registers default to 78n for TTY devices and 6.5i other‐
2258     wise.
2259

FILES

2261     doc.tmac          The main manual macro package.
2262     mdoc.tmac         A wrapper file to call doc.tmac.
2263     mdoc/doc-common   Common strings, definitions, stuff related typographic
2264                       output.
2265     mdoc/doc-nroff    Definitions used for a TTY output device.
2266     mdoc/doc-ditroff  Definitions used for all other devices.
2267     mdoc.local        Local additions and customizations.
2268     andoc.tmac        Use this file if you don't know whether the -mdoc or
2269                       the -man package should be used.  Multiple man pages
2270                       (in either format) can be handled.
2271

SEE ALSO

2273     groff(1), man(1), troff(1), groff_man(7)
2274

BUGS

2276     Section 3f has not been added to the header routines.
2277
2278     ‘.Nm’ font should be changed in NAME section.
2279
2280     ‘.Fn’ needs to have a check to prevent splitting up if the line length is
2281     too short.  Occasionally it separates the last parenthesis, and sometimes
2282     looks ridiculous if a line is in fill mode.
2283
2284     The list and display macros do not do any keeps and certainly should be
2285     able to.
2286
2287BSD                            November 2, 2010                            BSD
Impressum