1 .\" $Id: mdoc.7,v 1.129 2010/07/02 13:07:46 kristaps Exp $
3 .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: July 2 2010 $
22 .Nd mdoc language reference
26 language is used to format
29 manuals. In this reference document, we describe its syntax, structure,
30 and usage. Our reference implementation is mandoc; the
32 section describes compatibility with other troff \-mdoc implementations.
36 document follows simple rules: lines beginning with the control
39 are parsed for macros. Other lines are interpreted within the scope of
41 .Bd -literal -offset indent
42 \&.Sh Macro lines change control state.
43 Other lines are interpreted within the current state.
47 documents may contain only graphable 7-bit ASCII characters, the space
48 character, and, in certain circumstances, the tab character. All
55 whether in a macro or free-form text line, is ignored to the end of
56 line. A macro line with only a control character and comment escape,
58 is also ignored. Macro lines with only a control character and optionally
59 whitespace are stripped from input.
60 .Ss Reserved Characters
61 Within a macro line, the following characters are reserved:
63 .Bl -tag -width Ds -offset indent -compact
88 Use of reserved characters is described in
90 For general use in macro lines, these characters must either be escaped
91 with a non-breaking space
93 or, if applicable, an appropriate escape sequence used.
94 .Ss Special Characters
95 Special characters may occur in both macro and free-form lines.
96 Sequences begin with the escape character
98 followed by either an open-parenthesis
100 for two-character sequences; an open-bracket
102 for n-character sequences (terminated at a close-bracket
104 or a single one-character sequence.
115 Terms may be text-decorated using the
117 escape followed by an indicator: B (bold), I, (italic), R (Roman), or P
118 (revert to previous mode):
120 .D1 \efBbold\efR \efIitalic\efP
122 A numerical representation 3, 2, or 1 (bold, italic, and Roman,
123 respectively) may be used instead.
124 A text decoration is valid within
125 the current font scope only: if a macro opens a font scope alongside
126 its own scope, such as
129 in-scope invocations of
131 are only valid within the font scope of the macro.
134 is specified outside of any font scope, such as in unenclosed, free-form
135 text, it will affect the remainder of the document.
137 Text may also be sized with the
139 escape, whose syntax is one of
141 for one-digit numerals;
145 for two-digit numerals; and
151 for arbitrary-digit numerals:
154 .D1 \es[+10]much bigger\es[-10]
155 .D1 \es+(10much bigger\es-(10
156 .D1 \es+'100'much much bigger\es-'100'
162 which encourages semantic annotation.
163 .Ss Predefined Strings
166 also defined a set of package-specific
167 .Dq predefined strings ,
169 .Sx Special Characters ,
170 mark special output characters and strings by way of input codes.
171 Predefined strings are escaped with the slash-asterisk,
189 Whitespace consists of the space character.
190 In free-form lines, whitespace is preserved within a line; un-escaped
191 trailing spaces are stripped from input (unless in a literal context).
192 Blank free-form lines, which may include whitespace, are only permitted
193 within literal contexts.
195 In macro lines, whitespace delimits arguments and is discarded.
196 If arguments are quoted, whitespace within the quotes is retained.
198 Macro arguments may be quoted with a double-quote to group
199 space-delimited terms or to retain blocks of whitespace.
200 A quoted argument begins with a double-quote preceded by whitespace.
201 The next double-quote not pair-wise adjacent to another double-quote
202 terminates the literal, regardless of surrounding whitespace.
210 Note that any quoted term, be it argument or macro, is indiscriminately
211 considered literal text.
212 Thus, the following produces
214 .Bd -literal -offset indent
218 In free-form mode, quotes are regarded as opaque text.
220 There are several macros in
222 that require a date argument.
223 The canonical form for dates is the American format:
225 .D1 Cm Month Day , Year
229 value is an optionally zero-padded numeral.
232 value is the full month name.
235 value is the full four-digit year.
237 Reduced form dates are broken-down canonical form dates:
242 Some examples of valid dates follow:
244 .D1 "May, 2009" Pq reduced form
245 .D1 "2009" Pq reduced form
246 .D1 "May 20, 2009" Pq canonical form
248 Many macros support scaled widths for their arguments, such as
249 stipulating a two-inch list indentation with the following:
250 .Bd -literal -offset indent
254 The syntax for scaled widths is
255 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
256 where a decimal must be preceded or proceeded by at least one digit.
257 Negative numbers, while accepted, are truncated to zero.
258 The following scaling units are accepted:
260 .Bl -tag -width Ds -offset indent -compact
273 default vertical span
285 default horizontal span
290 Using anything other than
296 is necessarily non-portable across output media.
300 When composing a manual, make sure that your sentences end at the end of
302 By doing so, front-ends will be able to apply the proper amount of
303 spacing after the end of sentence (unescaped) period, exclamation mark,
304 or question mark followed by zero or more non-sentence closing
311 The proper spacing is also intelligently preserved if a sentence ends at
312 the boundary of a macro line, e.g.,
315 .D1 \&Fl T \&Ns \&Cm ascii \.
319 document consists of a document prologue followed by one or more
322 The prologue, which consists of (in order) the
327 macros, is required for every document.
329 The first section (sections are denoted by
331 must be the NAME section, consisting of at least one
336 Following that, convention dictates specifying at least the
340 sections, although this varies between manual sections.
342 The following is a well-formed skeleton
345 .Bd -literal -offset indent
351 \&.Nd a description goes here
352 \&.\e\*q The next is for sections 2, 3, & 9 only.
361 utility processes files ...
362 \&.\e\*q .Sh IMPLEMENTATION NOTES
363 \&.\e\*q The next is for sections 2, 3, & 9 only.
364 \&.\e\*q .Sh RETURN VALUES
365 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
366 \&.\e\*q .Sh ENVIRONMENT
368 \&.\e\*q The next is for sections 1 & 8 only.
369 \&.\e\*q .Sh EXIT STATUS
370 \&.\e\*q .Sh EXAMPLES
371 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
372 \&.\e\*q .Sh DIAGNOSTICS
373 \&.\e\*q The next is for sections 2, 3, & 9 only.
375 \&.\e\*q .Sh SEE ALSO
376 \&.\e\*q .Xr foobar 1
377 \&.\e\*q .Sh STANDARDS
382 \&.\e\*q .Sh SECURITY CONSIDERATIONS
387 document are conventionally ordered as they appear above.
388 Sections should be composed as follows:
389 .Bl -ohang -offset Ds
391 The name(s) and a short description of the documented material.
392 The syntax for this as follows:
393 .Bd -literal -offset indent
397 \&.Nd a short description
402 macro(s) must precede the
411 The name of the library containing the documented material, which is
412 assumed to be a function in a section 2, 3, or 9 manual.
413 The syntax for this is as follows:
414 .Bd -literal -offset indent
421 Documents the utility invocation syntax, function call syntax, or device
424 For the first, utilities (sections 1, 6, and 8), this is
425 generally structured as follows:
426 .Bd -literal -offset indent
437 For the second, function calls (sections 2, 3, 9):
438 .Bd -literal -offset indent
439 \&.Vt extern const char *global;
442 \&.Fn foo "const char *src"
444 \&.Fn bar "const char *src"
447 And for the third, configurations (section 4):
448 .Bd -literal -offset indent
449 \&.Cd \*qit* at isa? port 0x2e\*q
450 \&.Cd \*qit* at isa? port 0x4e\*q
453 Manuals not in these sections generally don't need a
456 Some macros are displayed differently in the
458 section, particularly
468 All of these macros are output on their own line. If two such
469 dissimilar macros are pair-wise invoked (except for
475 they are separated by a vertical space, unless in the case of
480 which are always separated by vertical space.
482 When text and macros following an
484 macro starting an input line span multiple output lines,
485 all output lines but the first will be indented to align
486 with the text immediately following the
488 macro, up to the next
493 macro or the end of an enclosing block, whichever comes first.
495 This expands upon the brief, one-line description in
497 It usually contains a break-down of the options (if documenting a
499 .Bd -literal -offset indent
500 The arguments are as follows:
501 \&.Bl \-tag \-width Ds
503 Print verbose information.
507 Manuals not documenting a command won't include the above fragment.
508 .It Em IMPLEMENTATION NOTES
509 Implementation-specific notes should be kept here.
510 This is useful when implementing standard functions that may have side
511 effects or notable algorithmic implications.
513 This section is the dual of
515 which is used for commands.
516 It documents the return values of functions in sections 2, 3, and 9.
521 Documents any usages of environment variables, e.g.,
527 Documents files used.
528 It's helpful to document both the file and a short description of how
529 the file is used (created, modified, etc.).
534 Command exit status for section 1, 6, and 8 manuals.
535 This section is the dual of
537 which is used for functions.
538 Historically, this information was described in
540 a practise that is now discouraged.
546 This often contains snippets of well-formed, well-tested invocations.
547 Make doubly sure that your examples work properly!
549 Documents error conditions.
550 This is most useful in section 4 manuals.
551 Historically, this section was used in place of
553 for manuals in sections 1, 6, and 8; however, this practise is
560 Documents error handling in sections 2, 3, and 9.
565 References other manuals with related topics.
566 This section should exist for most manuals.
567 Cross-references should conventionally be ordered first by section, then
573 References any standards implemented or used.
574 If not adhering to any standards, the
576 section should be used instead.
581 The history of any manual without a
583 section should be described in this section.
585 Credits to authors, if applicable, should appear in this section.
586 Authors should generally be noted by both name and an e-mail address.
591 Explanations of common misuses and misunderstandings should be explained
594 Extant bugs should be described in this section.
595 .It Em SECURITY CONSIDERATIONS
596 Documents any security precautions that operators should consider.
599 Macros are one to three three characters in length and begin with a
602 at the beginning of the line.
603 An arbitrary amount of whitespace may sit between the control character
605 Thus, the following are equivalent:
606 .Bd -literal -offset indent
611 The syntax of a macro depends on its classification.
614 refers to macro arguments, which may be followed by zero or more
618 opens the scope of a macro; and if specified,
624 column indicates that the macro may be called subsequent to the initial
626 If a macro is not callable, then its invocation after the initial line
627 macro is interpreted as opaque text, such that
634 column indicates whether the macro may be followed by further
635 (ostensibly callable) macros.
636 If a macro is not parsable, subsequent macro invocations on the line
637 will be interpreted as opaque text.
641 column, if applicable, describes closure rules.
642 .Ss Block full-explicit
643 Multi-line scope closed by an explicit closing macro.
644 All macros contains bodies; only
647 .Bd -literal -offset indent
648 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
653 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsableX" "closed by XXX"
654 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
655 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
656 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
657 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
658 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
659 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
660 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
661 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
662 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
664 .Ss Block full-implicit
665 Multi-line scope closed by end-of-file or implicitly by another macro.
666 All macros have bodies; some
674 don't have heads; only one
679 .Bd -literal -offset indent
680 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
684 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsableX" "closed by XXXXXXXXXXX"
685 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
686 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
687 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
688 .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss
689 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
690 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
696 .Sx Block full-implicit
697 macro only when invoked as the first macro
700 section line, else it is
702 .Ss Block partial-explicit
703 Like block full-explicit, but also with single-line scope.
704 Each has at least a body and, in limited circumstances, a head
711 .Bd -literal -offset indent
712 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
714 \&.Yc \(lBtail...\(rB
716 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
717 \(lBbody...\(rB \&Yc \(lBtail...\(rB
720 .Bl -column "MacroX" "CallableX" "ParsableX" "closed by XXXX" -compact -offset indent
721 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
722 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
723 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
724 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
725 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
726 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
727 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
728 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
729 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
730 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
731 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
732 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
733 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
734 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
735 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
736 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
737 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
738 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
739 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
740 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
741 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
742 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
743 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
744 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
745 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
747 .Ss Block partial-implicit
748 Like block full-implicit, but with single-line scope closed by
749 .Sx Reserved Characters
751 .Bd -literal -offset indent
752 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
755 .Bl -column "MacroX" "CallableX" "ParsableX" -compact -offset indent
756 .It Em Macro Ta Em Callable Ta Em Parsable
757 .It Sx \&Aq Ta Yes Ta Yes
758 .It Sx \&Bq Ta Yes Ta Yes
759 .It Sx \&Brq Ta Yes Ta Yes
760 .It Sx \&D1 Ta \&No Ta \&Yes
761 .It Sx \&Dl Ta \&No Ta Yes
762 .It Sx \&Dq Ta Yes Ta Yes
763 .It Sx \&Op Ta Yes Ta Yes
764 .It Sx \&Pq Ta Yes Ta Yes
765 .It Sx \&Ql Ta Yes Ta Yes
766 .It Sx \&Qq Ta Yes Ta Yes
767 .It Sx \&Sq Ta Yes Ta Yes
768 .It Sx \&Vt Ta Yes Ta Yes
774 .Sx Block partial-implicit
775 only when invoked as the first macro
778 section line, else it is
782 .Sx Reserved Characters ,
783 end of line, fixed argument lengths, and/or subsequent macros.
784 In-line macros have only text children.
785 If a number (or inequality) of arguments is
787 then the macro accepts an arbitrary number of arguments.
788 .Bd -literal -offset indent
789 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lbres...\(rb
791 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
793 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
796 .Bl -column "MacroX" "CallableX" "ParsableX" "Arguments" -compact -offset indent
797 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Arguments
798 .It Sx \&%A Ta \&No Ta \&No Ta >0
799 .It Sx \&%B Ta \&No Ta \&No Ta >0
800 .It Sx \&%C Ta \&No Ta \&No Ta >0
801 .It Sx \&%D Ta \&No Ta \&No Ta >0
802 .It Sx \&%I Ta \&No Ta \&No Ta >0
803 .It Sx \&%J Ta \&No Ta \&No Ta >0
804 .It Sx \&%N Ta \&No Ta \&No Ta >0
805 .It Sx \&%O Ta \&No Ta \&No Ta >0
806 .It Sx \&%P Ta \&No Ta \&No Ta >0
807 .It Sx \&%Q Ta \&No Ta \&No Ta >0
808 .It Sx \&%R Ta \&No Ta \&No Ta >0
809 .It Sx \&%T Ta \&No Ta \&No Ta >0
810 .It Sx \&%U Ta \&No Ta \&No Ta >0
811 .It Sx \&%V Ta \&No Ta \&No Ta >0
812 .It Sx \&Ad Ta Yes Ta Yes Ta n
813 .It Sx \&An Ta Yes Ta Yes Ta n
814 .It Sx \&Ap Ta Yes Ta Yes Ta 0
815 .It Sx \&Ar Ta Yes Ta Yes Ta n
816 .It Sx \&At Ta Yes Ta Yes Ta 1
817 .It Sx \&Bsx Ta Yes Ta Yes Ta n
818 .It Sx \&Bt Ta \&No Ta \&No Ta 0
819 .It Sx \&Bx Ta Yes Ta Yes Ta n
820 .It Sx \&Cd Ta Yes Ta Yes Ta >0
821 .It Sx \&Cm Ta Yes Ta Yes Ta n
822 .It Sx \&Db Ta \&No Ta \&No Ta 1
823 .It Sx \&Dd Ta \&No Ta \&No Ta >0
824 .It Sx \&Dt Ta \&No Ta \&No Ta n
825 .It Sx \&Dv Ta Yes Ta Yes Ta n
826 .It Sx \&Dx Ta Yes Ta Yes Ta n
827 .It Sx \&Em Ta Yes Ta Yes Ta >0
828 .It Sx \&En Ta \&No Ta \&No Ta 0
829 .It Sx \&Er Ta Yes Ta Yes Ta >0
830 .It Sx \&Es Ta \&No Ta \&No Ta 0
831 .It Sx \&Ev Ta Yes Ta Yes Ta n
832 .It Sx \&Ex Ta \&No Ta \&No Ta n
833 .It Sx \&Fa Ta Yes Ta Yes Ta n
834 .It Sx \&Fd Ta \&No Ta \&No Ta >0
835 .It Sx \&Fl Ta Yes Ta Yes Ta n
836 .It Sx \&Fn Ta Yes Ta Yes Ta >0
837 .It Sx \&Fr Ta \&No Ta \&No Ta n
838 .It Sx \&Ft Ta Yes Ta Yes Ta n
839 .It Sx \&Fx Ta Yes Ta Yes Ta n
840 .It Sx \&Hf Ta \&No Ta \&No Ta n
841 .It Sx \&Ic Ta Yes Ta Yes Ta >0
842 .It Sx \&In Ta \&No Ta \&No Ta n
843 .It Sx \&Lb Ta \&No Ta \&No Ta 1
844 .It Sx \&Li Ta Yes Ta Yes Ta n
845 .It Sx \&Lk Ta Yes Ta Yes Ta n
846 .It Sx \&Lp Ta \&No Ta \&No Ta 0
847 .It Sx \&Ms Ta Yes Ta Yes Ta >0
848 .It Sx \&Mt Ta Yes Ta Yes Ta >0
849 .It Sx \&Nm Ta Yes Ta Yes Ta n
850 .It Sx \&No Ta Yes Ta Yes Ta 0
851 .It Sx \&Ns Ta Yes Ta Yes Ta 0
852 .It Sx \&Nx Ta Yes Ta Yes Ta n
853 .It Sx \&Os Ta \&No Ta \&No Ta n
854 .It Sx \&Ot Ta \&No Ta \&No Ta n
855 .It Sx \&Ox Ta Yes Ta Yes Ta n
856 .It Sx \&Pa Ta Yes Ta Yes Ta n
857 .It Sx \&Pf Ta Yes Ta Yes Ta 1
858 .It Sx \&Pp Ta \&No Ta \&No Ta 0
859 .It Sx \&Rv Ta \&No Ta \&No Ta n
860 .It Sx \&Sm Ta \&No Ta \&No Ta 1
861 .It Sx \&St Ta \&No Ta Yes Ta 1
862 .It Sx \&Sx Ta Yes Ta Yes Ta >0
863 .It Sx \&Sy Ta Yes Ta Yes Ta >0
864 .It Sx \&Tn Ta Yes Ta Yes Ta >0
865 .It Sx \&Ud Ta \&No Ta \&No Ta 0
866 .It Sx \&Ux Ta Yes Ta Yes Ta n
867 .It Sx \&Va Ta Yes Ta Yes Ta n
868 .It Sx \&Vt Ta Yes Ta Yes Ta >0
869 .It Sx \&Xr Ta Yes Ta Yes Ta >0
870 .It Sx \&br Ta \&No Ta \&No Ta 0
871 .It Sx \&sp Ta \&No Ta \&No Ta 1
874 This section is a canonical reference of all macros, arranged
876 For the scoping of individual macros, see
881 block. Multiple authors should each be accorded their own
883 line. Author names should be ordered with full or abbreviated
884 forename(s) first, then full surname.
888 block. This macro may also be used in a non-bibliographic context when
889 referring to book titles.
891 Publication city or location of an
896 this macro is not implemented in
899 Publication date of an
901 block. This should follow the reduced or canonical form syntax
905 Publisher or issuer name of an
913 Issue number (usually for journals) of an
917 Optional information of an
921 Book or journal page number of an
925 Institutional author (school, government, etc.) of an
927 block. Multiple institutional authors should each be accorded their own
931 Technical report name of an
937 block. This macro may also be used in a non-bibliographical context
938 when referring to article titles.
940 URI of reference document.
948 block. Does not have any tail arguments.
950 Address construct: usually in the context of an computational address in
951 memory, not a physical (post) address.
958 This macro may alternatively accepts the following arguments, although
959 these may not be specified along with a parameter:
960 .Bl -tag -width 12n -offset indent
962 Renders a line break before each author listing.
968 In the AUTHORS section, the default is not to split the first author
969 listing, but all subsequent author listings, whether or not they're
970 interspersed by other macros or text, are split.
973 will cause the first listing also to be split.
974 If not in the AUTHORS section, the default is not to split.
978 .D1 \&.An J. D. Ullman .
985 are re-set when entering the AUTHORS section, so if one specifies
987 in the general document body, it must be re-specified in the AUTHORS
990 Begins a block enclosed by angled brackets.
991 Does not have any head arguments.
994 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
999 Inserts an apostrophe without any surrounding white-space.
1000 This is generally used as a grammatical device when referring to the verb
1002 .Bd -literal -offset indent
1006 Encloses its arguments in angled brackets.
1009 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
1012 this macro is often abused for rendering URIs, which should instead use
1016 or to note pre-processor
1018 statements, which should use
1025 If an argument is not provided, the string
1027 is used as a default.
1030 .D1 \&.Fl o \&Ns \&Ar file1
1032 .D1 \&.Ar arg1 , arg2 .
1034 Formats an AT&T version.
1035 Accepts at most one parameter:
1036 .Bl -tag -width 12n -offset indent
1045 Note that these parameters do not begin with a hyphen.
1063 block. Does not have any tail arguments.
1065 Begins a display block.
1066 A display is collection of macros or text which may be collectively
1067 offset or justified in a manner different from that
1068 of the enclosing context.
1069 By default, the block is preceded by a vertical space.
1071 Each display is associated with a type, which must be one of the
1072 following arguments:
1073 .Bl -tag -width 12n -offset indent
1075 Only left-justify the block.
1077 Do not justify the block at all.
1079 Left- and right-justify the block.
1084 Centre-justify each line.
1087 The type must be provided first.
1088 Secondary arguments are as follows:
1089 .Bl -tag -width 12n -offset indent
1090 .It Fl offset Ar width
1091 Offset by the value of
1093 which is interpreted as one of the following, specified in order:
1096 As one of the pre-defined strings
1098 the width of standard indentation;
1103 which has no effect ;
1105 which justifies to the right margin; and
1107 which aligns around an imagined centre axis.
1109 As a precalculated width for a named macro.
1110 The most popular is the imaginary macro
1115 As a scaling unit following the syntax described in
1116 .Sx Scaling Widths .
1118 As the calculated string length of the opaque string.
1121 If not provided an argument, it will be ignored.
1123 Do not assert a vertical space before the block.
1127 before any text or macros within the block.
1131 .Bd -literal -offset indent
1132 \&.Bd \-unfilled \-offset two-indent \-compact
1142 Change the font mode for a scoped block of text.
1143 Its syntax is as follows:
1144 .Bd -ragged -offset indent
1147 .Fl emphasis | literal | symbolic |
1148 .Cm \&Em | \&Li | \&Sy
1156 argument are equivalent, as are
1164 Without an argument, this macro does nothing.
1165 The font mode continues until broken by a new font mode in a nested
1176 Begins a keep block, containing a collection of macros or text
1177 to be kept together in the output.
1178 One argument is required; additional arguments are ignored.
1179 Currently, the only argument implemented is
1181 requesting to keep together all words of the contained text
1182 on the same output line.
1185 argument to keep together all lines of the contained text
1186 on the same page has been desired for a long time,
1187 but has never been implemented.
1190 .Bd -literal -offset indent
1192 \&.Op o Ar output_file
1199 Begins a list composed of one or more list entries.
1200 A list is associated with a type, which is a required argument.
1203 defined per-type as accepting a literal or
1207 also accepting a literal or
1209 value setting the list's global offset; and
1211 suppressing the default vertical space printed before each list entry.
1212 A list entry is specified by the
1214 macro, which consists of a head and optional body (depending on the list
1216 A list must specify one of the following list types:
1217 .Bl -tag -width 12n -offset indent
1219 A list offset by a bullet.
1220 The head of list entries must be empty.
1221 List entry bodies are positioned after the bullet.
1224 argument varies the width of list bodies' left-margins.
1229 argument has no effect.
1230 The number of columns is specified as parameters to the
1233 These dictate the width of columns either as
1236 If the initial macro of a
1242 context spanning each line is implied until an
1244 line macro is encountered, at which point list bodies are interpreted as
1249 A list offset by a dash (hyphen).
1250 The head of list entries must be empty.
1251 List entry bodies are positioned past the dash.
1254 argument varies the width of list bodies' left-margins.
1258 but with additional formatting to the head.
1261 argument varies the width of list bodies' left-margins.
1263 An enumerated list offset by the enumeration from 1.
1264 The head of list entries must be empty.
1265 List entry bodies are positioned after the enumeration.
1268 argument varies the width of list bodies' left-margins.
1272 but instead of list bodies positioned after the head, they trail the
1276 argument varies the width of list bodies' left-margins.
1281 List bodies follow the list head.
1284 argument is ignored.
1286 This produces blocks of text.
1287 The head of list entries must be empty.
1290 argument is ignored.
1292 List bodies are positioned on the line following the head.
1295 argument is ignored.
1297 A list offset by list entry heads. List entry bodies are positioned
1298 after the head as specified by the
1306 Begins a block enclosed by square brackets.
1307 Does not have any head arguments.
1310 .Bd -literal -offset indent
1318 Encloses its arguments in square brackets.
1321 .D1 \&.Bq 1 , \&Dv BUFSIZ
1324 this macro is sometimes abused to emulate optional arguments for
1325 commands; the correct macros to use for this purpose are
1336 block. Does not have any tail arguments.
1338 Begins a block enclosed by curly braces.
1339 Does not have any head arguments.
1342 .Bd -literal -offset indent
1350 Encloses its arguments in curly braces.
1353 .D1 \&.Brq 1 , ... , \&Va n
1358 Format the BSD/OS version provided as an argument, or a default value if
1359 no argument is provided.
1376 .Dq is currently in beta test.
1378 Format the BSD version provided as an argument, or a default value if no
1379 argument is provided.
1395 Configuration declaration.
1396 This denotes strings accepted by
1400 .D1 \&.Cd device le0 at scode?
1403 this macro is commonly abused by using quoted literals to retain
1404 white-space and align consecutive
1407 This practise is discouraged.
1410 Useful when specifying configuration options or keys.
1413 .D1 \&.Cm ControlPath
1414 .D1 \&.Cm ControlMaster
1419 One-line indented display.
1420 This is formatted by the default rules and is useful for simple indented
1422 It is followed by a newline.
1425 .D1 \&.D1 \&Fl abcdefgh
1432 Start a debugging context.
1433 This macro is parsed, but generally ignored.
1434 Its syntax is as follows:
1436 .D1 Pf \. Sx \&Db Cm on | off
1440 block. Does not have any tail arguments.
1443 This is the mandatory first macro of any
1446 Its syntax is as follows:
1448 .D1 Pf \. Sx \&Dd Cm date
1454 which signifies the current manual revision date dictated by
1456 or instead a valid canonical date as specified by
1458 If a date does not conform, the current date is used instead.
1461 .D1 \&.Dd $\&Mdocdate$
1462 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1463 .D1 \&.Dd July 21, 2007
1470 One-line intended display.
1471 This is formatted as literal text and is useful for commands and
1473 It is followed by a newline.
1476 .D1 \&.Dl % mandoc mdoc.7 | less
1483 Begins a block enclosed by double quotes. Does not have any head
1487 .D1 \&.D1 \&Do April is the cruellest month \&Dc \e(em T.S. Eliot
1492 Encloses its arguments in double quotes.
1495 .Bd -literal -offset indent -compact
1496 \&.Dq April is the cruellest month
1504 This is the mandatory second macro of any
1507 Its syntax is as follows:
1508 .Bd -ragged -offset indent
1514 .Op Cm volume | arch
1519 Its arguments are as follows:
1520 .Bl -tag -width Ds -offset Ds
1522 The document's title (name), defaulting to
1525 It should be capitalised.
1536 .Pq Perl libraries ,
1546 .Pq system utilities ,
1548 .Pq kernel functions ,
1550 .Pq X Window System ,
1552 .Pq X Window System ,
1562 It should correspond to the manual's filename suffix and defaults to
1566 This overrides the volume inferred from
1568 This field is optional, and if specified, must be one of
1570 .Pq users' supplementary documents ,
1572 .Pq programmers' supplementary documents ,
1574 .Pq administrators' supplementary documents ,
1576 .Pq system managers' manuals ,
1578 .Pq users' reference manuals ,
1580 .Pq programmers' reference manuals ,
1582 .Pq kernel manuals ,
1593 .Pq contributed manuals .
1595 This specifies a specific relevant architecture.
1598 is not provided, it may be used in its place, else it may be used
1600 It, too, is optional.
1635 .D1 \&.Dt FOO 9 i386
1642 Defined variables such as preprocessor constants.
1646 .D1 \&.Dv STDOUT_FILENO
1651 Format the DragonFly BSD version provided as an argument, or a default
1652 value if no argument is provided.
1670 Ends a font mode context started by
1673 Ends a keep context started by
1676 Ends a list context started by
1684 Denotes text that should be emphasised.
1685 Note that this is a presentation term and should not be used for
1686 stylistically decorating technical terms.
1694 Display error constants.
1704 Environmental variables such as those specified in
1711 Inserts text regarding a utility's exit values.
1712 This macro must have first the
1714 argument specified, then an optional
1718 is not provided, the document's name as stipulated in
1723 Its syntax is as follows:
1724 .Bd -ragged -offset indent
1730 This may be invoked for names with or without the corresponding type.
1731 It is also used to specify the field name of a structure.
1734 macro is used in the
1738 section when documenting multi-line function prototypes.
1739 If invoked with multiple arguments, the arguments are separated by a
1741 Furthermore, if the following macro is another
1743 the last argument will also have a trailing comma.
1746 .D1 \&.Fa \(dqconst char *p\(dq
1747 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1754 Historically used to document include files.
1755 This usage has been deprecated in favour of
1757 Do not use this macro.
1760 .Sx MANUAL STRUCTURE
1765 Used when listing arguments to command-line utilities.
1766 Prints a fixed-width hyphen
1768 directly followed by each argument.
1769 If no arguments are provided, a hyphen is printed followed by a space.
1770 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1777 .D1 \&.Op \&Fl o \&Ns \&Ar file
1783 Its syntax is as follows:
1784 .Bd -ragged -offset indent
1788 .Op Oo Cm argtype Oc Cm argname
1791 Function arguments are surrounded in parenthesis and
1792 are delimited by commas.
1793 If no arguments are specified, blank parenthesis are output.
1796 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1797 .D1 \&.Fn funcname "int arg0"
1798 .D1 \&.Fn funcname arg0
1799 .Bd -literal -offset indent -compact
1805 .Sx MANUAL STRUCTURE
1809 Begin a function block.
1810 This is a multi-line version of
1812 Its syntax is as follows:
1814 .D1 Pf \. Sx \&Fo Cm funcname
1816 Invocations usually occur in the following context:
1817 .Bd -ragged -offset indent
1818 .Pf \. Sx \&Ft Cm functype
1820 .Pf \. Sx \&Fo Cm funcname
1822 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1834 .Sx MANUAL STRUCTURE ,
1840 Its syntax is as follows:
1842 .D1 Pf \. Sx \&Ft Cm functype
1846 .Bd -literal -offset indent -compact
1852 .Sx MANUAL STRUCTURE ,
1857 Format the FreeBSD version provided as an argument, or a default value
1858 if no argument is provided.
1881 section (only if invoked as the line macro), the first argument is
1884 the arguments is enclosed in angled braces.
1890 .Sx MANUAL STRUCTURE .
1893 The syntax of this macro depends on the list type.
1902 have the following syntax:
1904 .D1 Pf \. Sx \&It Cm args
1913 have the following syntax:
1917 with subsequent lines interpreted within the scope of the
1919 until either a closing
1926 list has the following syntax:
1928 .D1 Pf \. Sx \&It Op Cm args
1930 Subsequent lines are interpreted as with
1933 The line arguments correspond to the list's left-hand side; body
1934 arguments correspond to the list's contents.
1938 list is the most complicated.
1939 Its syntax is as follows:
1941 .D1 Pf \. Sx \&It Op Cm args
1945 are phrases, a mix of macros and text corresponding to a line column,
1946 delimited by tabs or the special
1949 Lines subsequent the
1951 are interpreted within the scope of the last phrase.
1952 Calling the pseudo-macro
1954 will open a new phrase scope (this must occur on a macro line to be
1955 interpreted as a macro). Note that the tab phrase delimiter may only be
1959 Subsequent this, only the
1961 pseudo-macro may be used to delimit phrases.
1962 Furthermore, note that quoted sections propagate over tab-delimited
1967 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
1969 will preserve the semicolon whitespace except for the last.
1975 The syntax is as follows:
1977 .D1 Pf \. Sx \&Lb Cm library
1981 parameter may be a system library, such as
1985 in which case a small library description is printed next to the linker
1986 invocation; or a custom library, in which case the library name is
1988 This is most commonly used in the
1990 section as described in
1991 .Sx MANUAL STRUCTURE .
1999 Its syntax is as follows:
2001 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
2004 .D1 \&.Lk http://bsd.lv "The BSD.lv Project"
2005 .D1 \&.Lk http://bsd.lv
2015 Its syntax is as follows:
2017 .D1 Pf \. Sx \&Mt Cm address
2020 .D1 \&.Mt discuss@manpages.bsd.lv
2023 The name of the manual page, or \(em in particular in section 1, 6,
2024 and 8 pages \(em of an additional command or feature documented in
2026 When first invoked, the
2028 macro expects a single argument, the name of the manual page.
2029 Usually, the first invocation happens in the
2031 section of the page.
2032 The specified name will be remembered and used whenever the macro is
2033 called again without arguments later in the page.
2037 .Sx Block full-implicit
2038 semantics when invoked as the first macro on an input line in the
2040 section; otherwise, it uses ordinary
2045 .Bd -literal -offset indent
2054 of section 2, 3 and 9 manual pages, use the
2058 to mark up the name of the manual page.
2062 Format the NetBSD version provided as an argument, or a default value if
2063 no argument is provided.
2082 Document operating system version.
2083 This is the mandatory third macro of
2087 Its syntax is as follows:
2089 .D1 Pf \. Sx \&Os Op Cm system
2093 parameter specifies the relevant operating system or environment.
2094 Left unspecified, it defaults to the local operating system version.
2095 This is the suggested form.
2099 .D1 \&.Os KTH/CSC/TCS
2110 this macro has been deprecated.
2112 Format the OpenBSD version provided as an argument, or a default value
2113 if no argument is provided.
2142 Does not have any tail arguments.
2144 Begins a bibliographic
2147 Does not have any head arguments.
2148 The block macro may only contain
2164 child macros (at least one must be specified).
2167 .Bd -literal -offset indent -compact
2169 \&.%A J. E. Hopcroft
2171 \&.%B Introduction to Automata Theory, Languages, and Computation
2172 \&.%I Addison-Wesley
2173 \&.%C Reading, Massachusettes
2180 block is used within a SEE ALSO section, a vertical space is asserted
2181 before the rendered output, else the block continues on the current
2196 .Dq currently under development.
2198 Format the UNIX name.
2199 Accepts no argument.
2216 This is also used for indicating global variables in the
2218 section, in which case a variable name is also specified.
2219 Note that it accepts
2220 .Sx Block partial-implicit
2221 syntax when invoked as the first macro in the
2223 section, else it accepts ordinary
2227 Note that this should not be confused with
2229 which is used for function return types.
2232 .D1 \&.Vt unsigned char
2233 .D1 \&.Vt extern const char * const sys_signame[] \&;
2236 .Sx MANUAL STRUCTURE
2240 Close a scope opened by
2243 Open an extension scope.
2244 This macro originally existed to extend the 9-argument limit of troff;
2245 since this limit has been lifted, the macro has been deprecated.
2247 Link to another manual
2248 .Pq Qq cross-reference .
2249 Its syntax is as follows:
2251 .D1 Pf \. Sx \&Xr Cm name section
2257 are the name and section of the linked manual.
2260 is followed by non-punctuation, an
2262 is inserted into the token stream.
2263 This behaviour is for compatibility with
2268 .D1 \&.Xr mandoc 1 \&;
2269 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2273 This section documents compatibility between mandoc and other other
2274 troff implementations, at this time limited to GNU troff
2278 refers to groff versions before the
2281 .Pq somewhere between 1.15 and 1.19 .
2283 Heirloom troff, the other significant troff implementation accepting
2284 \-mdoc, is similar to historic groff.
2288 Old groff fails to assert a newline before
2289 .Sx \&Bd Fl ragged compact .
2291 groff behaves inconsistently when encountering
2295 regarding spacing between arguments.
2296 In mandoc, this is not the case: each argument is consistently followed
2297 by a single space and the trailing
2299 suppresses prior spacing.
2301 groff behaves inconsistently when encountering
2307 at times newline(s) are suppressed depending on whether a prior
2310 In mandoc, this is not the case.
2315 for the normalised behaviour.
2317 Historic groff does not break before an
2319 when not invoked as the line macro in the
2323 Historic groff formats the
2325 badly: trailing arguments are trashed and
2327 is not specially treated.
2329 groff does not accept the
2331 pseudo-macro as a line macro.
2336 is no longer accepted.
2340 macro does not format its arguments when used in the FILES section under
2344 Historic groff does not print a dash for empty
2347 mandoc and newer groff implementations do.
2349 groff behaves irregularly when specifying
2352 within line-macro scopes.
2353 mandoc follows a consistent system.
2355 In mandoc, negative scaling units are truncated to zero; groff would
2356 move to prior lines.
2359 scaling unit, while accepted, is rendered as the default unit.
2361 In quoted literals, groff allowed pair-wise double-quotes to produce a
2362 standalone double-quote in formatted output.
2363 This idiosyncratic behaviour is not applicable in mandoc.
2367 .Fl offset Ar center
2370 are disregarded in mandoc.
2373 argument is not supported in mandoc.
2374 Lastly, since text is not right-justified in mandoc (or even groff),
2383 Historic groff has many un-callable macros.
2384 Most of these (excluding some block-level macros) are now callable.
2390 but has been a proper delimiter since then.
2393 is assumed for all lists (it wasn't in historic groff): any list may be
2396 lists will restart the sequence only for the sub-list.
2400 incorrectly by following it with a reserved character and expecting the
2401 delimiter to render.
2402 This is not supported in mandoc.
2410 macros were stipulated only to occur in certain manual sections.
2411 mandoc does not have these restrictions.
2413 Newer groff and mandoc print
2415 prior to unknown arguments of
2417 older groff did nothing.
2425 reference was written by
2426 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
2428 .\" XXX: this really isn't the place for these caveats.
2432 .\" There are many ambiguous parts of mdoc.
2435 .\" .Bl -dash -compact
2440 .\" as function arguments are variables.
2445 .\" as function return types are still types. Furthermore, the
2447 .\" should be removed and
2449 .\" which ostensibly follows it, should follow the same convention as
2453 .\" should formalise that only one or two arguments are acceptable: a
2454 .\" variable name and optional, preceding type.
2457 .\" is ambiguous. It's commonly used to indicate an include file in the
2458 .\" synopsis section.
2460 .\" should be used, instead.
2466 .\" makes sense. The remaining ones should be removed.
2472 .\" macros should be deprecated.
2476 .\" macro lacks clarity. It should be absolutely clear which title will
2477 .\" render when formatting the manual page.
2481 .\" should be provided for Linux (\(`a la
2486 .\" There's no way to refer to references in
2490 .\" The \-split and \-nosplit dictates via
2492 .\" are re-set when entering and leaving the AUTHORS section.