1 .\" $Id: mdoc.7,v 1.140 2010/07/19 21:59:48 kristaps Exp $
3 .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 .Dd $Mdocdate: July 19 2010 $
23 .Nd mdoc language reference
27 language is used to format
31 In this reference document, we describe its syntax, structure, and
33 Our reference implementation is mandoc; the
35 section describes compatibility with other troff \-mdoc implementations.
39 document follows simple rules: lines beginning with the control
42 are parsed for macros.
43 Other lines are interpreted within the scope of
45 .Bd -literal -offset indent
46 \&.Sh Macro lines change control state.
47 Other lines are interpreted within the current state.
51 documents may contain only graphable 7-bit ASCII characters, the space
52 character, and, in certain circumstances, the tab character.
59 whether in a macro or free-form text line, is ignored to the end of
61 A macro line with only a control character and comment escape,
64 Macro lines with only a control character and optionally whitespace are
66 .Ss Reserved Characters
67 Within a macro line, the following characters are reserved:
69 .Bl -tag -width Ds -offset indent -compact
94 Use of reserved characters is described in
96 For general use in macro lines, these characters must either be escaped
97 with a non-breaking space
99 or, if applicable, an appropriate escape sequence used.
100 .Ss Special Characters
101 Special characters may occur in both macro and free-form lines.
102 Sequences begin with the escape character
104 followed by either an open-parenthesis
106 for two-character sequences; an open-bracket
108 for n-character sequences (terminated at a close-bracket
110 or a single one-character sequence.
121 Terms may be text-decorated using the
123 escape followed by an indicator: B (bold), I, (italic), R (Roman), or P
124 (revert to previous mode):
126 .D1 \efBbold\efR \efIitalic\efP
128 A numerical representation 3, 2, or 1 (bold, italic, and Roman,
129 respectively) may be used instead.
130 A text decoration is valid within
131 the current font scope only: if a macro opens a font scope alongside
132 its own scope, such as
135 in-scope invocations of
137 are only valid within the font scope of the macro.
140 is specified outside of any font scope, such as in unenclosed, free-form
141 text, it will affect the remainder of the document.
147 which encourages semantic annotation.
148 .Ss Predefined Strings
151 also defined a set of package-specific
152 .Dq predefined strings ,
154 .Sx Special Characters ,
155 mark special output characters and strings by way of input codes.
156 Predefined strings are escaped with the slash-asterisk,
174 Whitespace consists of the space character.
175 In free-form lines, whitespace is preserved within a line; un-escaped
176 trailing spaces are stripped from input (unless in a literal context).
177 Blank free-form lines, which may include whitespace, are only permitted
178 within literal contexts.
180 In macro lines, whitespace delimits arguments and is discarded.
181 If arguments are quoted, whitespace within the quotes is retained.
183 Macro arguments may be quoted with a double-quote to group
184 space-delimited terms or to retain blocks of whitespace.
185 A quoted argument begins with a double-quote preceded by whitespace.
186 The next double-quote not pair-wise adjacent to another double-quote
187 terminates the literal, regardless of surrounding whitespace.
195 Note that any quoted term, be it argument or macro, is indiscriminately
196 considered literal text.
197 Thus, the following produces
199 .Bd -literal -offset indent
203 In free-form mode, quotes are regarded as opaque text.
205 There are several macros in
207 that require a date argument.
208 The canonical form for dates is the American format:
210 .D1 Cm Month Day , Year
214 value is an optionally zero-padded numeral.
217 value is the full month name.
220 value is the full four-digit year.
222 Reduced form dates are broken-down canonical form dates:
227 Some examples of valid dates follow:
229 .D1 "May, 2009" Pq reduced form
230 .D1 "2009" Pq reduced form
231 .D1 "May 20, 2009" Pq canonical form
233 Many macros support scaled widths for their arguments, such as
234 stipulating a two-inch list indentation with the following:
235 .Bd -literal -offset indent
239 The syntax for scaled widths is
240 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
241 where a decimal must be preceded or proceeded by at least one digit.
242 Negative numbers, while accepted, are truncated to zero.
243 The following scaling units are accepted:
245 .Bl -tag -width Ds -offset indent -compact
258 default vertical span
270 default horizontal span
275 Using anything other than
281 is necessarily non-portable across output media.
285 When composing a manual, make sure that your sentences end at the end of
287 By doing so, front-ends will be able to apply the proper amount of
288 spacing after the end of sentence (unescaped) period, exclamation mark,
289 or question mark followed by zero or more non-sentence closing
296 The proper spacing is also intelligently preserved if a sentence ends at
297 the boundary of a macro line, e.g.,
300 .D1 \&Fl T \&Ns \&Cm ascii \.
304 document consists of a document prologue followed by one or more
307 The prologue, which consists of (in order) the
312 macros, is required for every document.
314 The first section (sections are denoted by
316 must be the NAME section, consisting of at least one
321 Following that, convention dictates specifying at least the
325 sections, although this varies between manual sections.
327 The following is a well-formed skeleton
330 .Bd -literal -offset indent
336 \&.Nd a description goes here
337 \&.\e\*q The next is for sections 2, 3, & 9 only.
346 utility processes files ...
347 \&.\e\*q .Sh IMPLEMENTATION NOTES
348 \&.\e\*q The next is for sections 2, 3, & 9 only.
349 \&.\e\*q .Sh RETURN VALUES
350 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
351 \&.\e\*q .Sh ENVIRONMENT
353 \&.\e\*q The next is for sections 1 & 8 only.
354 \&.\e\*q .Sh EXIT STATUS
355 \&.\e\*q .Sh EXAMPLES
356 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
357 \&.\e\*q .Sh DIAGNOSTICS
358 \&.\e\*q The next is for sections 2, 3, & 9 only.
360 \&.\e\*q .Sh SEE ALSO
361 \&.\e\*q .Xr foobar 1
362 \&.\e\*q .Sh STANDARDS
367 \&.\e\*q .Sh SECURITY CONSIDERATIONS
372 document are conventionally ordered as they appear above.
373 Sections should be composed as follows:
374 .Bl -ohang -offset Ds
376 The name(s) and a short description of the documented material.
377 The syntax for this as follows:
378 .Bd -literal -offset indent
382 \&.Nd a short description
387 macro(s) must precede the
396 The name of the library containing the documented material, which is
397 assumed to be a function in a section 2, 3, or 9 manual.
398 The syntax for this is as follows:
399 .Bd -literal -offset indent
406 Documents the utility invocation syntax, function call syntax, or device
409 For the first, utilities (sections 1, 6, and 8), this is
410 generally structured as follows:
411 .Bd -literal -offset indent
422 For the second, function calls (sections 2, 3, 9):
423 .Bd -literal -offset indent
424 \&.Vt extern const char *global;
427 \&.Fn foo "const char *src"
429 \&.Fn bar "const char *src"
432 And for the third, configurations (section 4):
433 .Bd -literal -offset indent
434 \&.Cd \*qit* at isa? port 0x2e\*q
435 \&.Cd \*qit* at isa? port 0x4e\*q
438 Manuals not in these sections generally don't need a
441 Some macros are displayed differently in the
443 section, particularly
453 All of these macros are output on their own line.
454 If two such dissimilar macros are pair-wise invoked (except for
460 they are separated by a vertical space, unless in the case of
465 which are always separated by vertical space.
467 When text and macros following an
469 macro starting an input line span multiple output lines,
470 all output lines but the first will be indented to align
471 with the text immediately following the
473 macro, up to the next
478 macro or the end of an enclosing block, whichever comes first.
480 This expands upon the brief, one-line description in
482 It usually contains a break-down of the options (if documenting a
484 .Bd -literal -offset indent
485 The arguments are as follows:
486 \&.Bl \-tag \-width Ds
488 Print verbose information.
492 Manuals not documenting a command won't include the above fragment.
493 .It Em IMPLEMENTATION NOTES
494 Implementation-specific notes should be kept here.
495 This is useful when implementing standard functions that may have side
496 effects or notable algorithmic implications.
498 This section is the dual of
500 which is used for commands.
501 It documents the return values of functions in sections 2, 3, and 9.
506 Documents any usages of environment variables, e.g.,
512 Documents files used.
513 It's helpful to document both the file and a short description of how
514 the file is used (created, modified, etc.).
519 Command exit status for section 1, 6, and 8 manuals.
520 This section is the dual of
522 which is used for functions.
523 Historically, this information was described in
525 a practise that is now discouraged.
531 This often contains snippets of well-formed, well-tested invocations.
532 Make doubly sure that your examples work properly!
534 Documents error conditions.
535 This is most useful in section 4 manuals.
536 Historically, this section was used in place of
538 for manuals in sections 1, 6, and 8; however, this practise is
545 Documents error handling in sections 2, 3, and 9.
550 References other manuals with related topics.
551 This section should exist for most manuals.
552 Cross-references should conventionally be ordered first by section, then
558 References any standards implemented or used.
559 If not adhering to any standards, the
561 section should be used instead.
566 The history of any manual without a
568 section should be described in this section.
570 Credits to authors, if applicable, should appear in this section.
571 Authors should generally be noted by both name and an e-mail address.
576 Explanations of common misuses and misunderstandings should be explained
579 Extant bugs should be described in this section.
580 .It Em SECURITY CONSIDERATIONS
581 Documents any security precautions that operators should consider.
584 Macros are one to three three characters in length and begin with a
587 at the beginning of the line.
588 An arbitrary amount of whitespace may sit between the control character
590 Thus, the following are equivalent:
591 .Bd -literal -offset indent
596 The syntax of a macro depends on its classification.
599 refers to macro arguments, which may be followed by zero or more
603 opens the scope of a macro; and if specified,
609 column indicates that the macro may be called subsequent to the initial
611 If a macro is not callable, then its invocation after the initial line
612 macro is interpreted as opaque text, such that
619 column indicates whether the macro may be followed by further
620 (ostensibly callable) macros.
621 If a macro is not parsable, subsequent macro invocations on the line
622 will be interpreted as opaque text.
626 column, if applicable, describes closure rules.
627 .Ss Block full-explicit
628 Multi-line scope closed by an explicit closing macro.
629 All macros contains bodies; only
632 .Bd -literal -offset indent
633 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
638 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsableX" "closed by XXX"
639 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
640 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
641 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
642 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
643 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
644 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
645 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
646 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
647 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
649 .Ss Block full-implicit
650 Multi-line scope closed by end-of-file or implicitly by another macro.
651 All macros have bodies; some
659 don't have heads; only one
664 .Bd -literal -offset indent
665 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
669 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsableX" "closed by XXXXXXXXXXX"
670 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
671 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
672 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
673 .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss
674 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
675 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
681 .Sx Block full-implicit
682 macro only when invoked as the first macro
685 section line, else it is
687 .Ss Block partial-explicit
688 Like block full-explicit, but also with single-line scope.
689 Each has at least a body and, in limited circumstances, a head
696 .Bd -literal -offset indent
697 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
699 \&.Yc \(lBtail...\(rB
701 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
702 \(lBbody...\(rB \&Yc \(lBtail...\(rB
705 .Bl -column "MacroX" "CallableX" "ParsableX" "closed by XXXX" -compact -offset indent
706 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
707 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
708 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
709 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
710 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
711 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
712 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
713 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
714 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
715 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
716 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
717 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
718 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
719 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
720 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
721 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
722 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
723 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
724 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
725 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
726 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
727 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
728 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
729 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
730 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
732 .Ss Block partial-implicit
733 Like block full-implicit, but with single-line scope closed by
734 .Sx Reserved Characters
736 .Bd -literal -offset indent
737 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
740 .Bl -column "MacroX" "CallableX" "ParsableX" -compact -offset indent
741 .It Em Macro Ta Em Callable Ta Em Parsable
742 .It Sx \&Aq Ta Yes Ta Yes
743 .It Sx \&Bq Ta Yes Ta Yes
744 .It Sx \&Brq Ta Yes Ta Yes
745 .It Sx \&D1 Ta \&No Ta \&Yes
746 .It Sx \&Dl Ta \&No Ta Yes
747 .It Sx \&Dq Ta Yes Ta Yes
748 .It Sx \&Op Ta Yes Ta Yes
749 .It Sx \&Pq Ta Yes Ta Yes
750 .It Sx \&Ql Ta Yes Ta Yes
751 .It Sx \&Qq Ta Yes Ta Yes
752 .It Sx \&Sq Ta Yes Ta Yes
753 .It Sx \&Vt Ta Yes Ta Yes
759 .Sx Block partial-implicit
760 only when invoked as the first macro
763 section line, else it is
767 .Sx Reserved Characters ,
768 end of line, fixed argument lengths, and/or subsequent macros.
769 In-line macros have only text children.
770 If a number (or inequality) of arguments is
772 then the macro accepts an arbitrary number of arguments.
773 .Bd -literal -offset indent
774 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lbres...\(rb
776 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
778 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
781 .Bl -column "MacroX" "CallableX" "ParsableX" "Arguments" -compact -offset indent
782 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Arguments
783 .It Sx \&%A Ta \&No Ta \&No Ta >0
784 .It Sx \&%B Ta \&No Ta \&No Ta >0
785 .It Sx \&%C Ta \&No Ta \&No Ta >0
786 .It Sx \&%D Ta \&No Ta \&No Ta >0
787 .It Sx \&%I Ta \&No Ta \&No Ta >0
788 .It Sx \&%J Ta \&No Ta \&No Ta >0
789 .It Sx \&%N Ta \&No Ta \&No Ta >0
790 .It Sx \&%O Ta \&No Ta \&No Ta >0
791 .It Sx \&%P Ta \&No Ta \&No Ta >0
792 .It Sx \&%Q Ta \&No Ta \&No Ta >0
793 .It Sx \&%R Ta \&No Ta \&No Ta >0
794 .It Sx \&%T Ta \&No Ta \&No Ta >0
795 .It Sx \&%U Ta \&No Ta \&No Ta >0
796 .It Sx \&%V Ta \&No Ta \&No Ta >0
797 .It Sx \&Ad Ta Yes Ta Yes Ta n
798 .It Sx \&An Ta Yes Ta Yes Ta n
799 .It Sx \&Ap Ta Yes Ta Yes Ta 0
800 .It Sx \&Ar Ta Yes Ta Yes Ta n
801 .It Sx \&At Ta Yes Ta Yes Ta 1
802 .It Sx \&Bsx Ta Yes Ta Yes Ta n
803 .It Sx \&Bt Ta \&No Ta \&No Ta 0
804 .It Sx \&Bx Ta Yes Ta Yes Ta n
805 .It Sx \&Cd Ta Yes Ta Yes Ta >0
806 .It Sx \&Cm Ta Yes Ta Yes Ta n
807 .It Sx \&Db Ta \&No Ta \&No Ta 1
808 .It Sx \&Dd Ta \&No Ta \&No Ta >0
809 .It Sx \&Dt Ta \&No Ta \&No Ta n
810 .It Sx \&Dv Ta Yes Ta Yes Ta n
811 .It Sx \&Dx Ta Yes Ta Yes Ta n
812 .It Sx \&Em Ta Yes Ta Yes Ta >0
813 .It Sx \&En Ta \&No Ta \&No Ta 0
814 .It Sx \&Er Ta Yes Ta Yes Ta >0
815 .It Sx \&Es Ta \&No Ta \&No Ta 0
816 .It Sx \&Ev Ta Yes Ta Yes Ta n
817 .It Sx \&Ex Ta \&No Ta \&No Ta n
818 .It Sx \&Fa Ta Yes Ta Yes Ta n
819 .It Sx \&Fd Ta \&No Ta \&No Ta >0
820 .It Sx \&Fl Ta Yes Ta Yes Ta n
821 .It Sx \&Fn Ta Yes Ta Yes Ta >0
822 .It Sx \&Fr Ta \&No Ta \&No Ta n
823 .It Sx \&Ft Ta Yes Ta Yes Ta n
824 .It Sx \&Fx Ta Yes Ta Yes Ta n
825 .It Sx \&Hf Ta \&No Ta \&No Ta n
826 .It Sx \&Ic Ta Yes Ta Yes Ta >0
827 .It Sx \&In Ta \&No Ta \&No Ta n
828 .It Sx \&Lb Ta \&No Ta \&No Ta 1
829 .It Sx \&Li Ta Yes Ta Yes Ta n
830 .It Sx \&Lk Ta Yes Ta Yes Ta n
831 .It Sx \&Lp Ta \&No Ta \&No Ta 0
832 .It Sx \&Ms Ta Yes Ta Yes Ta >0
833 .It Sx \&Mt Ta Yes Ta Yes Ta >0
834 .It Sx \&Nm Ta Yes Ta Yes Ta n
835 .It Sx \&No Ta Yes Ta Yes Ta 0
836 .It Sx \&Ns Ta Yes Ta Yes Ta 0
837 .It Sx \&Nx Ta Yes Ta Yes Ta n
838 .It Sx \&Os Ta \&No Ta \&No Ta n
839 .It Sx \&Ot Ta \&No Ta \&No Ta n
840 .It Sx \&Ox Ta Yes Ta Yes Ta n
841 .It Sx \&Pa Ta Yes Ta Yes Ta n
842 .It Sx \&Pf Ta Yes Ta Yes Ta 1
843 .It Sx \&Pp Ta \&No Ta \&No Ta 0
844 .It Sx \&Rv Ta \&No Ta \&No Ta n
845 .It Sx \&Sm Ta \&No Ta \&No Ta 1
846 .It Sx \&St Ta \&No Ta Yes Ta 1
847 .It Sx \&Sx Ta Yes Ta Yes Ta >0
848 .It Sx \&Sy Ta Yes Ta Yes Ta >0
849 .It Sx \&Tn Ta Yes Ta Yes Ta >0
850 .It Sx \&Ud Ta \&No Ta \&No Ta 0
851 .It Sx \&Ux Ta Yes Ta Yes Ta n
852 .It Sx \&Va Ta Yes Ta Yes Ta n
853 .It Sx \&Vt Ta Yes Ta Yes Ta >0
854 .It Sx \&Xr Ta Yes Ta Yes Ta >0
855 .It Sx \&br Ta \&No Ta \&No Ta 0
856 .It Sx \&sp Ta \&No Ta \&No Ta 1
859 This section is a canonical reference of all macros, arranged
861 For the scoping of individual macros, see
867 Multiple authors should each be accorded their own
870 Author names should be ordered with full or abbreviated forename(s)
871 first, then full surname.
876 This macro may also be used in a non-bibliographic context when
877 referring to book titles.
879 Publication city or location of an
884 this macro is not implemented in
887 Publication date of an
890 This should follow the reduced or canonical form syntax described in
893 Publisher or issuer name of an
901 Issue number (usually for journals) of an
905 Optional information of an
909 Book or journal page number of an
913 Institutional author (school, government, etc.) of an
916 Multiple institutional authors should each be accorded their own
920 Technical report name of an
927 This macro may also be used in a non-bibliographical context when
928 referring to article titles.
930 URI of reference document.
939 Does not have any tail arguments.
941 Address construct: usually in the context of an computational address in
942 memory, not a physical (post) address.
949 This macro may alternatively accepts the following arguments, although
950 these may not be specified along with a parameter:
952 .Bl -tag -width "-nosplitX" -offset indent -compact
954 Renders a line break before each author listing.
962 section, the default is not to split the first author
963 listing, but all subsequent author listings, whether or not they're
964 interspersed by other macros or text, are split.
967 will cause the first listing also to be split.
970 section, the default is not to split.
974 .D1 \&.An J. D. Ullman .
981 are re-set when entering the
983 section, so if one specifies
985 in the general document body, it must be re-specified in the
989 Begins a block enclosed by angled brackets.
990 Does not have any head arguments.
993 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
998 Inserts an apostrophe without any surrounding whitespace.
999 This is generally used as a grammatical device when referring to the verb
1003 .D1 \&.Fn execve \&Ap d
1005 Encloses its arguments in angled brackets.
1008 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
1011 this macro is often abused for rendering URIs, which should instead use
1015 or to note pre-processor
1017 statements, which should use
1024 If an argument is not provided, the string
1026 is used as a default.
1029 .D1 \&.Fl o \&Ns \&Ar file1
1031 .D1 \&.Ar arg1 , arg2 .
1033 Formats an AT&T version.
1034 Accepts at most one parameter:
1036 .Bl -tag -width "v[1-7] | 32vX" -offset indent -compact
1045 Note that these parameters do not begin with a hyphen.
1064 Does not have any tail arguments.
1066 Begins a display block.
1067 Its syntax is as follows:
1068 .Bd -ragged -offset indent
1071 .Op Fl offset Ar width
1075 A display is collection of macros or text which may be collectively
1076 offset or justified in a manner different from that
1077 of the enclosing context.
1078 By default, the block is preceded by a vertical space.
1080 Each display is associated with a type, which must be one of the
1081 following arguments:
1082 .Bl -tag -width 12n -offset indent
1084 Only left-justify the block.
1086 Do not justify the block at all.
1088 Left- and right-justify the block.
1093 Centre-justify each line.
1096 The type must be provided first.
1097 Secondary arguments are as follows:
1098 .Bl -tag -width 12n -offset indent
1099 .It Fl offset Ar val
1100 Offset by the value of
1102 which is interpreted as one of the following, specified in order:
1105 As one of the pre-defined strings
1107 the width of standard indentation;
1112 which has no effect;
1114 which justifies to the right margin; and
1116 which aligns around an imagined centre axis.
1118 As a precalculated width for a named macro.
1119 The most popular is the imaginary macro
1124 As a scaling unit following the syntax described in
1125 .Sx Scaling Widths .
1127 As the calculated string length of the opaque string.
1130 If not provided an argument, it will be ignored.
1132 Do not assert a vertical space before the block.
1136 .Bd -literal -offset indent
1137 \&.Bd \-unfilled \-offset two-indent \-compact
1147 Change the font mode for a scoped block of text.
1148 Its syntax is as follows:
1149 .Bd -ragged -offset indent
1152 .Fl emphasis | literal | symbolic |
1153 .Cm \&Em | \&Li | \&Sy
1161 argument are equivalent, as are
1169 Without an argument, this macro does nothing.
1170 The font mode continues until broken by a new font mode in a nested
1181 Begins a collection of macros or text not breaking the line.
1182 Its syntax is as follows:
1184 .D1 Pf \. Sx \&Bk Fl words
1186 Subsequent arguments are ignored.
1189 argument is required.
1191 Each line within a keep block is kept intact, so the following example
1192 will not break within each
1195 .Bd -literal -offset indent
1198 \&.Op Fl o Ar output
1202 Be careful in using over-long lines within a keep block!
1203 Doing so will clobber the right margin.
1205 Begins a list composed of one or more list entries.
1206 Its syntax is as follows:
1207 .Bd -ragged -offset indent
1211 .Op Fl offset Ar val
1216 A list is associated with a type, which is a required argument.
1219 defined per-type as accepting a literal or
1223 also accepting a literal or
1225 value setting the list's global offset; and
1227 suppressing the default vertical space printed before each list entry.
1228 A list entry is specified by the
1230 macro, which consists of a head and optional body (depending on the list
1232 A list must specify one of the following list types:
1233 .Bl -tag -width 12n -offset indent
1235 A list offset by a bullet.
1236 The head of list entries must be empty.
1237 List entry bodies are positioned after the bullet.
1240 argument varies the width of list bodies' left-margins.
1245 argument has no effect.
1246 The number of columns is specified as parameters to the
1249 These dictate the width of columns either as
1252 If the initial macro of a
1258 context spanning each line is implied until an
1260 line macro is encountered, at which point list bodies are interpreted as
1265 A list offset by a dash (hyphen).
1266 The head of list entries must be empty.
1267 List entry bodies are positioned past the dash.
1270 argument varies the width of list bodies' left-margins.
1274 but with additional formatting to the head.
1277 argument varies the width of list bodies' left-margins.
1279 An enumerated list offset by the enumeration from 1.
1280 The head of list entries must be empty.
1281 List entry bodies are positioned after the enumeration.
1284 argument varies the width of list bodies' left-margins.
1288 but instead of list bodies positioned after the head, they trail the
1292 argument varies the width of list bodies' left-margins.
1297 List bodies follow the list head.
1300 argument is ignored.
1302 This produces blocks of text.
1303 The head of list entries must be empty.
1306 argument is ignored.
1308 List bodies are positioned on the line following the head.
1311 argument is ignored.
1313 A list offset by list entry heads.
1314 List entry bodies are positioned after the head as specified by the
1322 Begins a block enclosed by square brackets.
1323 Does not have any head arguments.
1326 .Bd -literal -offset indent -compact
1334 Encloses its arguments in square brackets.
1337 .D1 \&.Bq 1 , \&Dv BUFSIZ
1340 this macro is sometimes abused to emulate optional arguments for
1341 commands; the correct macros to use for this purpose are
1353 Does not have any tail arguments.
1355 Begins a block enclosed by curly braces.
1356 Does not have any head arguments.
1359 .Bd -literal -offset indent -compact
1367 Encloses its arguments in curly braces.
1370 .D1 \&.Brq 1 , ... , \&Va n
1375 Format the BSD/OS version provided as an argument, or a default value if
1376 no argument is provided.
1393 .Dq is currently in beta test.
1395 Format the BSD version provided as an argument, or a default value if no
1396 argument is provided.
1412 Configuration declaration.
1413 This denotes strings accepted by
1417 .D1 \&.Cd device le0 at scode?
1420 this macro is commonly abused by using quoted literals to retain
1421 whitespace and align consecutive
1424 This practise is discouraged.
1427 Useful when specifying configuration options or keys.
1430 .D1 \&.Cm ControlPath
1431 .D1 \&.Cm ControlMaster
1436 One-line indented display.
1437 This is formatted by the default rules and is useful for simple indented
1439 It is followed by a newline.
1442 .D1 \&.D1 \&Fl abcdefgh
1449 Start a debugging context.
1450 This macro is parsed, but generally ignored.
1451 Its syntax is as follows:
1453 .D1 Pf \. Sx \&Db Cm on | off
1458 Does not have any tail arguments.
1461 This is the mandatory first macro of any
1464 Its syntax is as follows:
1466 .D1 Pf \. Sx \&Dd Cm date
1472 which signifies the current manual revision date dictated by
1474 or instead a valid canonical date as specified by
1476 If a date does not conform, the current date is used instead.
1479 .D1 \&.Dd $\&Mdocdate$
1480 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1481 .D1 \&.Dd July 21, 2007
1488 One-line intended display.
1489 This is formatted as literal text and is useful for commands and
1491 It is followed by a newline.
1494 .D1 \&.Dl % mandoc mdoc.7 \e(ba less
1501 Begins a block enclosed by double quotes.
1502 Does not have any head arguments.
1505 .Bd -literal -offset indent -compact
1507 April is the cruellest month
1515 Encloses its arguments in
1520 .Bd -literal -offset indent -compact
1521 \&.Dq April is the cruellest month
1532 This is the mandatory second macro of any
1535 Its syntax is as follows:
1536 .Bd -ragged -offset indent
1542 .Op Cm volume | arch
1547 Its arguments are as follows:
1548 .Bl -tag -width Ds -offset Ds
1550 The document's title (name), defaulting to
1553 It should be capitalised.
1564 .Pq Perl libraries ,
1574 .Pq system utilities ,
1576 .Pq kernel functions ,
1578 .Pq X Window System ,
1580 .Pq X Window System ,
1590 It should correspond to the manual's filename suffix and defaults to
1594 This overrides the volume inferred from
1596 This field is optional, and if specified, must be one of
1598 .Pq users' supplementary documents ,
1600 .Pq programmers' supplementary documents ,
1602 .Pq administrators' supplementary documents ,
1604 .Pq system managers' manuals ,
1606 .Pq users' reference manuals ,
1608 .Pq programmers' reference manuals ,
1610 .Pq kernel manuals ,
1621 .Pq contributed manuals .
1623 This specifies a specific relevant architecture.
1626 is not provided, it may be used in its place, else it may be used
1628 It, too, is optional.
1663 .D1 \&.Dt FOO 9 i386
1670 Defined variables such as preprocessor constants.
1674 .D1 \&.Dv STDOUT_FILENO
1679 Format the DragonFly BSD version provided as an argument, or a default
1680 value if no argument is provided.
1696 Close a scope started by
1698 Its syntax is as follows:
1700 .D1 Pf \. Sx \&Ec Op Cm TERM
1704 argument is used as the enclosure tail, for example, specifying \e(rq
1708 End a display context started by
1711 Ends a font mode context started by
1714 Ends a keep context started by
1717 Ends a list context started by
1725 Denotes text that should be emphasised.
1726 Note that this is a presentation term and should not be used for
1727 stylistically decorating technical terms.
1739 This macro is obsolete and not implemented.
1741 An arbitrary enclosure.
1742 Its syntax is as follows:
1744 .D1 Pf \. Sx \&Eo Op Cm TERM
1748 argument is used as the enclosure head, for example, specifying \e(lq
1752 Display error constants.
1761 This macro is obsolete and not implemented.
1763 Environmental variables such as those specified in
1770 Inserts text regarding a utility's exit value.
1771 This macro must consist of the
1773 argument followed by an optional
1777 is not provided, the document's name as stipulated in
1785 Its syntax is as follows:
1786 .Bd -ragged -offset indent
1792 This may be invoked for names with or without the corresponding type.
1793 It is also used to specify the field name of a structure.
1796 macro is used in the
1800 section when documenting multi-line function prototypes.
1801 If invoked with multiple arguments, the arguments are separated by a
1803 Furthermore, if the following macro is another
1805 the last argument will also have a trailing comma.
1808 .D1 \&.Fa \(dqconst char *p\(dq
1809 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1815 Ends a function context started by
1818 Historically used to document include files.
1819 This usage has been deprecated in favour of
1821 Do not use this macro.
1824 .Sx MANUAL STRUCTURE
1829 Used when listing arguments to command-line utilities.
1830 Prints a fixed-width hyphen
1832 directly followed by each argument.
1833 If no arguments are provided, a hyphen is printed followed by a space.
1834 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1841 .D1 \&.Op \&Fl o \&Ns \&Ar file
1847 Its syntax is as follows:
1848 .Bd -ragged -offset indent
1852 .Op Oo Cm argtype Oc Cm argname
1855 Function arguments are surrounded in parenthesis and
1856 are delimited by commas.
1857 If no arguments are specified, blank parenthesis are output.
1860 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1861 .D1 \&.Fn funcname "int arg0"
1862 .D1 \&.Fn funcname arg0
1863 .Bd -literal -offset indent -compact
1869 .Sx MANUAL STRUCTURE
1873 Begin a function block.
1874 This is a multi-line version of
1876 Its syntax is as follows:
1878 .D1 Pf \. Sx \&Fo Cm funcname
1880 Invocations usually occur in the following context:
1881 .Bd -ragged -offset indent
1882 .Pf \. Sx \&Ft Cm functype
1884 .Pf \. Sx \&Fo Cm funcname
1886 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1898 .Sx MANUAL STRUCTURE ,
1905 Its syntax is as follows:
1907 .D1 Pf \. Sx \&Ft Cm functype
1911 .Bd -literal -offset indent -compact
1917 .Sx MANUAL STRUCTURE ,
1922 Format the FreeBSD version provided as an argument, or a default value
1923 if no argument is provided.
1939 This macro is obsolete and not implemented.
1941 Designate an internal or interactive command.
1944 but used for instructions rather than values.
1951 .Sx \&Bd No Fl literal
1954 is preferred for displaying code; the
1956 macro is used when referring to specific instructions.
1963 section (only if invoked as the line macro), the first argument is
1966 the arguments is enclosed in angled braces.
1972 .Sx MANUAL STRUCTURE .
1975 The syntax of this macro depends on the list type.
1984 have the following syntax:
1986 .D1 Pf \. Sx \&It Cm args
1995 have the following syntax:
1999 with subsequent lines interpreted within the scope of the
2001 until either a closing
2008 list has the following syntax:
2010 .D1 Pf \. Sx \&It Op Cm args
2012 Subsequent lines are interpreted as with
2015 The line arguments correspond to the list's left-hand side; body
2016 arguments correspond to the list's contents.
2020 list is the most complicated.
2021 Its syntax is as follows:
2023 .D1 Pf \. Sx \&It Op Cm args
2027 are phrases, a mix of macros and text corresponding to a line column,
2028 delimited by tabs or the special
2031 Lines subsequent the
2033 are interpreted within the scope of the last phrase.
2034 Calling the pseudo-macro
2036 will open a new phrase scope (this must occur on a macro line to be
2037 interpreted as a macro).
2038 Note that the tab phrase delimiter may only be used within the
2041 Subsequent this, only the
2043 pseudo-macro may be used to delimit phrases.
2044 Furthermore, note that quoted sections propagate over tab-delimited
2049 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
2051 will preserve the semicolon whitespace except for the last.
2057 The syntax is as follows:
2059 .D1 Pf \. Sx \&Lb Cm library
2063 parameter may be a system library, such as
2067 in which case a small library description is printed next to the linker
2068 invocation; or a custom library, in which case the library name is
2070 This is most commonly used in the
2072 section as described in
2073 .Sx MANUAL STRUCTURE .
2079 Denotes text that should be in a literal font mode.
2080 Note that this is a presentation term and should not be used for
2081 stylistically decorating technical terms.
2090 Its syntax is as follows:
2092 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
2095 .D1 \&.Lk http://bsd.lv "The BSD.lv Project"
2096 .D1 \&.Lk http://bsd.lv
2104 Display a mathematical symbol.
2105 Its syntax is as follows:
2107 .D1 Pf \. Sx \&Ms Cm symbol
2116 Its syntax is as follows:
2118 .D1 Pf \. Sx \&Mt Cm address
2121 .D1 \&.Mt discuss@manpages.bsd.lv
2123 A one-line description of the manual's content.
2124 This may only be invoked in the
2126 section subsequent the
2131 .D1 \&.Sx \&Nd mdoc language reference
2132 .D1 \&.Sx \&Nd format and display UNIX manuals
2136 macro technically accepts child macros and terminates with a subsequent
2139 Do not assume this behaviour: some
2141 database generators are not smart enough to parse more than the line
2142 arguments and will display macros verbatim.
2147 The name of the manual page, or \(em in particular in section 1, 6,
2148 and 8 pages \(em of an additional command or feature documented in
2150 When first invoked, the
2152 macro expects a single argument, the name of the manual page.
2153 Usually, the first invocation happens in the
2155 section of the page.
2156 The specified name will be remembered and used whenever the macro is
2157 called again without arguments later in the page.
2161 .Sx Block full-implicit
2162 semantics when invoked as the first macro on an input line in the
2164 section; otherwise, it uses ordinary
2169 .Bd -literal -offset indent
2178 of section 2, 3 and 9 manual pages, use the
2182 to mark up the name of the manual page.
2186 macro used to terminate prior macro contexts.
2189 .D1 \&.Sx \&Fl ab \&No cd \&Fl ef
2192 Following invocation, text is interpreted as free-form text until a
2193 macro is encountered.
2196 .D1 \&.Fl o \&Ns \&Ar output
2203 Format the NetBSD version provided as an argument, or a default value if
2204 no argument is provided.
2224 Multi-line version of
2228 .Bd -literal -offset indent -compact
2230 \&.Op Fl flag Ns Ar value
2234 Command-line option.
2235 Used when listing options to command-line utilities.
2236 Prints the argument(s) in brackets.
2239 .D1 \&.Op \&Fl a \&Ar b
2240 .D1 \&.Op \&Ar a | b
2245 Document operating system version.
2246 This is the mandatory third macro of
2250 Its syntax is as follows:
2252 .D1 Pf \. Sx \&Os Op Cm system
2256 parameter specifies the relevant operating system or environment.
2257 Left unspecified, it defaults to the local operating system version.
2258 This is the suggested form.
2262 .D1 \&.Os KTH/CSC/TCS
2273 this macro has been deprecated.
2275 Format the OpenBSD version provided as an argument, or a default value
2276 if no argument is provided.
2295 .D1 \&.Pa /usr/bin/mandoc
2296 .D1 \&.Pa /usr/share/man/man7/mdoc.7
2301 Close parenthesised context opened by
2306 between its arguments.
2307 Its syntax is as follows:
2309 .D1 Pf \. \&Pf Cm prefix suffix
2313 argument may be a macro.
2316 .D1 \&.Pf \e. \&Sx \&Pf \&Cm prefix suffix
2318 Multi-line version of
2322 This will assert vertical space between prior and subsequent macros
2325 Parenthesised enclosure.
2330 Close quoted context opened by
2333 Format a single-quoted literal.
2339 Multi-line version of
2342 Encloses its arguments in
2357 Does not have any tail arguments.
2359 Begins a bibliographic
2362 Does not have any head arguments.
2363 The block macro may only contain
2379 child macros (at least one must be specified).
2382 .Bd -literal -offset indent -compact
2384 \&.%A J. E. Hopcroft
2386 \&.%B Introduction to Automata Theory, Languages, and Computation
2387 \&.%I Addison-Wesley
2388 \&.%C Reading, Massachusettes
2395 block is used within a SEE ALSO section, a vertical space is asserted
2396 before the rendered output, else the block continues on the current
2399 Inserts text regarding a function call's return value.
2400 This macro must consist of the
2402 argument followed by an optional
2406 is not provided, the document's name as stipulated by the first
2413 Close single-quoted context opened by
2416 Begin a new section.
2417 For a list of conventional manual sections, see
2418 .Sx MANUAL STRUCTURE .
2419 These sections should be used unless it's absolutely necessary that
2420 custom sections be used.
2422 Section names should be unique so that they may be keyed by
2431 Switches the spacing mode for output generated from macros.
2432 Its syntax is as follows:
2434 .D1 Pf \. Sx \&Sm Cm on | off
2436 By default, spacing is
2440 no white space is inserted between macro arguments and between the
2441 output generated from adjacent macros, but free-form text lines
2442 still get normal spacing between words and sentences.
2444 Multi-line version of
2447 Encloses its arguments in
2457 Begin a new sub-section.
2460 there's no convention for sub-sections.
2461 Conventional sections, as described in
2462 .Sx MANUAL STRUCTURE ,
2463 rarely have sub-sections.
2465 Sub-section names should be unique so that they may be keyed by
2474 Replace an abbreviation for a standard with the full form.
2475 The following standards are recognised:
2477 .Bl -tag -width "-p1003.1g-2000X" -compact
2571 Reference a section or sub-section.
2572 The referenced section or sub-section name must be identical to the
2573 enclosed argument, including whitespace.
2576 .D1 \&.Sx MANUAL STRUCTURE
2578 Format enclosed arguments in symbolic
2580 Note that this is a presentation term and should not be used for
2581 stylistically decorating technical terms.
2595 .Dq currently under development.
2597 Format the UNIX name.
2598 Accepts no argument.
2617 .D1 \&.Va const char *bar ;
2620 This is also used for indicating global variables in the
2622 section, in which case a variable name is also specified.
2623 Note that it accepts
2624 .Sx Block partial-implicit
2625 syntax when invoked as the first macro in the
2627 section, else it accepts ordinary
2631 Note that this should not be confused with
2633 which is used for function return types.
2636 .D1 \&.Vt unsigned char
2637 .D1 \&.Vt extern const char * const sys_signame[] \&;
2640 .Sx MANUAL STRUCTURE
2644 Close a scope opened by
2647 Open an extension scope.
2648 This macro originally existed to extend the 9-argument limit of troff;
2649 since this limit has been lifted, the macro has been deprecated.
2651 Link to another manual
2652 .Pq Qq cross-reference .
2653 Its syntax is as follows:
2655 .D1 Pf \. Sx \&Xr Cm name section
2661 are the name and section of the linked manual.
2664 is followed by non-punctuation, an
2666 is inserted into the token stream.
2667 This behaviour is for compatibility with
2672 .D1 \&.Xr mandoc 1 \&;
2673 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2676 This macro should not be used; it is implemented for compatibility with
2681 in the event of natural paragraph breaks.
2683 Emits vertical space.
2684 This macro should not be used; it is implemented for compatibility with
2686 Its syntax is as follows:
2688 .D1 Pf \. Sx \&sp Op Cm height
2692 argument must be formatted as described in
2693 .Sx Scaling Widths .
2696 asserts a single vertical space.
2698 This section documents compatibility between mandoc and other other
2699 troff implementations, at this time limited to GNU troff
2703 refers to groff versions before the
2706 .Pq somewhere between 1.15 and 1.19 .
2708 Heirloom troff, the other significant troff implementation accepting
2709 \-mdoc, is similar to historic groff.
2713 The \es (font size), \em (font colour), and \eM (font filling colour)
2714 font decoration escapes are all discarded in mandoc.
2716 Old groff fails to assert a newline before
2717 .Sx \&Bd Fl ragged compact .
2719 groff behaves inconsistently when encountering
2723 regarding spacing between arguments.
2724 In mandoc, this is not the case: each argument is consistently followed
2725 by a single space and the trailing
2727 suppresses prior spacing.
2729 groff behaves inconsistently when encountering
2735 at times newline(s) are suppressed depending on whether a prior
2738 In mandoc, this is not the case.
2743 for the normalised behaviour.
2745 Historic groff does not break before an
2747 when not invoked as the line macro in the
2751 Historic groff formats the
2753 badly: trailing arguments are trashed and
2755 is not specially treated.
2757 groff does not accept the
2759 pseudo-macro as a line macro.
2764 is no longer accepted.
2768 macro does not format its arguments when used in the FILES section under
2772 Historic groff does not print a dash for empty
2775 mandoc and newer groff implementations do.
2777 groff behaves irregularly when specifying
2780 within line-macro scopes.
2781 mandoc follows a consistent system.
2783 In mandoc, negative scaling units are truncated to zero; groff would
2784 move to prior lines.
2787 scaling unit, while accepted, is rendered as the default unit.
2789 In quoted literals, groff allowed pair-wise double-quotes to produce a
2790 standalone double-quote in formatted output.
2791 This idiosyncratic behaviour is not applicable in mandoc.
2795 .Fl offset Ar center
2798 are disregarded in mandoc.
2799 Furthermore, troff specifies a
2801 argument that is not supported in mandoc.
2802 Lastly, since text is not right-justified in mandoc (or even groff),
2811 Historic groff has many un-callable macros.
2812 Most of these (excluding some block-level macros) are now callable.
2818 but has been a proper delimiter since then.
2821 is assumed for all lists (it wasn't in historic groff): any list may be
2824 lists will restart the sequence only for the sub-list.
2828 incorrectly by following it with a reserved character and expecting the
2829 delimiter to render.
2830 This is not supported in mandoc.
2838 macros were stipulated only to occur in certain manual sections.
2839 mandoc does not have these restrictions.
2841 Newer groff and mandoc print
2843 prior to unknown arguments of
2845 older groff did nothing.
2853 reference was written by
2854 .An Kristaps Dzonsons Aq kristaps@bsd.lv .