1 .\" $Id: mdoc.7,v 1.128 2010/07/01 15:38:56 schwarze 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 1 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
1143 Begins a keep block, containing a collection of macros or text
1144 to be kept together in the output.
1145 One argument is required; additional arguments are ignored.
1146 Currently, the only argument implemented is
1148 requesting to keep together all words of the contained text
1149 on the same output line.
1152 argument to keep together all lines of the contained text
1153 on the same page has been desired for a long time,
1154 but has never been implemented.
1157 .Bd -literal -offset indent
1159 \&.Op o Ar output_file
1163 Begins a list composed of one or more list entries.
1164 A list is associated with a type, which is a required argument.
1167 defined per-type as accepting a literal or
1171 also accepting a literal or
1173 value setting the list's global offset; and
1175 suppressing the default vertical space printed before each list entry.
1176 A list entry is specified by the
1178 macro, which consists of a head and optional body (depending on the list
1180 A list must specify one of the following list types:
1181 .Bl -tag -width 12n -offset indent
1183 A list offset by a bullet.
1184 The head of list entries must be empty.
1185 List entry bodies are positioned after the bullet.
1188 argument varies the width of list bodies' left-margins.
1193 argument has no effect.
1194 The number of columns is specified as parameters to the
1197 These dictate the width of columns either as
1200 If the initial macro of a
1206 context spanning each line is implied until an
1208 line macro is encountered, at which point list bodies are interpreted as
1213 A list offset by a dash (hyphen).
1214 The head of list entries must be empty.
1215 List entry bodies are positioned past the dash.
1218 argument varies the width of list bodies' left-margins.
1222 but with additional formatting to the head.
1225 argument varies the width of list bodies' left-margins.
1227 An enumerated list offset by the enumeration from 1.
1228 The head of list entries must be empty.
1229 List entry bodies are positioned after the enumeration.
1232 argument varies the width of list bodies' left-margins.
1236 but instead of list bodies positioned after the head, they trail the
1240 argument varies the width of list bodies' left-margins.
1245 List bodies follow the list head.
1248 argument is ignored.
1250 This produces blocks of text.
1251 The head of list entries must be empty.
1254 argument is ignored.
1256 List bodies are positioned on the line following the head.
1259 argument is ignored.
1261 A list offset by list entry heads. List entry bodies are positioned
1262 after the head as specified by the
1270 Begins a block enclosed by square brackets.
1271 Does not have any head arguments.
1274 .Bd -literal -offset indent
1282 Encloses its arguments in square brackets.
1285 .D1 \&.Bq 1 , \&Dv BUFSIZ
1288 this macro is sometimes abused to emulate optional arguments for
1289 commands; the correct macros to use for this purpose are
1300 block. Does not have any tail arguments.
1302 Begins a block enclosed by curly braces.
1303 Does not have any head arguments.
1306 .Bd -literal -offset indent
1314 Encloses its arguments in curly braces.
1317 .D1 \&.Brq 1 , ... , \&Va n
1322 Format the BSD/OS version provided as an argument, or a default value if
1323 no argument is provided.
1340 .Dq is currently in beta test.
1342 Format the BSD version provided as an argument, or a default value if no
1343 argument is provided.
1359 Configuration declaration.
1360 This denotes strings accepted by
1364 .D1 \&.Cd device le0 at scode?
1367 this macro is commonly abused by using quoted literals to retain
1368 white-space and align consecutive
1371 This practise is discouraged.
1374 Useful when specifying configuration options or keys.
1377 .D1 \&.Cm ControlPath
1378 .D1 \&.Cm ControlMaster
1383 One-line indented display.
1384 This is formatted by the default rules and is useful for simple indented
1386 It is followed by a newline.
1389 .D1 \&.D1 \&Fl abcdefgh
1396 Start a debugging context.
1397 This macro is parsed, but generally ignored.
1398 Its syntax is as follows:
1400 .D1 Pf \. Sx \&Db Cm on | off
1404 block. Does not have any tail arguments.
1407 This is the mandatory first macro of any
1410 Its syntax is as follows:
1412 .D1 Pf \. Sx \&Dd Cm date
1418 which signifies the current manual revision date dictated by
1420 or instead a valid canonical date as specified by
1422 If a date does not conform, the current date is used instead.
1425 .D1 \&.Dd $\&Mdocdate$
1426 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1427 .D1 \&.Dd July 21, 2007
1434 One-line intended display.
1435 This is formatted as literal text and is useful for commands and
1437 It is followed by a newline.
1440 .D1 \&.Dl % mandoc mdoc.7 | less
1447 Begins a block enclosed by double quotes. Does not have any head
1451 .D1 \&.D1 \&Do April is the cruellest month \&Dc \e(em T.S. Eliot
1456 Encloses its arguments in double quotes.
1459 .Bd -literal -offset indent -compact
1460 \&.Dq April is the cruellest month
1468 This is the mandatory second macro of any
1471 Its syntax is as follows:
1472 .Bd -ragged -offset indent
1478 .Op Cm volume | arch
1483 Its arguments are as follows:
1484 .Bl -tag -width Ds -offset Ds
1486 The document's title (name), defaulting to
1489 It should be capitalised.
1500 .Pq Perl libraries ,
1510 .Pq system utilities ,
1512 .Pq kernel functions ,
1514 .Pq X Window System ,
1516 .Pq X Window System ,
1526 It should correspond to the manual's filename suffix and defaults to
1530 This overrides the volume inferred from
1532 This field is optional, and if specified, must be one of
1534 .Pq users' supplementary documents ,
1536 .Pq programmers' supplementary documents ,
1538 .Pq administrators' supplementary documents ,
1540 .Pq system managers' manuals ,
1542 .Pq users' reference manuals ,
1544 .Pq programmers' reference manuals ,
1546 .Pq kernel manuals ,
1557 .Pq contributed manuals .
1559 This specifies a specific relevant architecture.
1562 is not provided, it may be used in its place, else it may be used
1564 It, too, is optional.
1599 .D1 \&.Dt FOO 9 i386
1606 Defined variables such as preprocessor constants.
1610 .D1 \&.Dv STDOUT_FILENO
1615 Format the DragonFly BSD version provided as an argument, or a default
1616 value if no argument is provided.
1635 Ends a keep context started by
1638 Ends a list context started by
1646 Denotes text that should be emphasised.
1647 Note that this is a presentation term and should not be used for
1648 stylistically decorating technical terms.
1656 Display error constants.
1666 Environmental variables such as those specified in
1673 Inserts text regarding a utility's exit values.
1674 This macro must have first the
1676 argument specified, then an optional
1680 is not provided, the document's name as stipulated in
1685 Its syntax is as follows:
1686 .Bd -ragged -offset indent
1692 This may be invoked for names with or without the corresponding type.
1693 It is also used to specify the field name of a structure.
1696 macro is used in the
1700 section when documenting multi-line function prototypes.
1701 If invoked with multiple arguments, the arguments are separated by a
1703 Furthermore, if the following macro is another
1705 the last argument will also have a trailing comma.
1708 .D1 \&.Fa \(dqconst char *p\(dq
1709 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1716 Historically used to document include files.
1717 This usage has been deprecated in favour of
1719 Do not use this macro.
1722 .Sx MANUAL STRUCTURE
1727 Used when listing arguments to command-line utilities.
1728 Prints a fixed-width hyphen
1730 directly followed by each argument.
1731 If no arguments are provided, a hyphen is printed followed by a space.
1732 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1739 .D1 \&.Op \&Fl o \&Ns \&Ar file
1745 Its syntax is as follows:
1746 .Bd -ragged -offset indent
1750 .Op Oo Cm argtype Oc Cm argname
1753 Function arguments are surrounded in parenthesis and
1754 are delimited by commas.
1755 If no arguments are specified, blank parenthesis are output.
1758 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1759 .D1 \&.Fn funcname "int arg0"
1760 .D1 \&.Fn funcname arg0
1761 .Bd -literal -offset indent -compact
1767 .Sx MANUAL STRUCTURE
1771 Begin a function block.
1772 This is a multi-line version of
1774 Its syntax is as follows:
1776 .D1 Pf \. Sx \&Fo Cm funcname
1778 Invocations usually occur in the following context:
1779 .Bd -ragged -offset indent
1780 .Pf \. Sx \&Ft Cm functype
1782 .Pf \. Sx \&Fo Cm funcname
1784 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1796 .Sx MANUAL STRUCTURE ,
1802 Its syntax is as follows:
1804 .D1 Pf \. Sx \&Ft Cm functype
1808 .Bd -literal -offset indent -compact
1814 .Sx MANUAL STRUCTURE ,
1819 Format the FreeBSD version provided as an argument, or a default value
1820 if no argument is provided.
1843 section (only if invoked as the line macro), the first argument is
1846 the arguments is enclosed in angled braces.
1852 .Sx MANUAL STRUCTURE .
1855 The syntax of this macro depends on the list type.
1864 have the following syntax:
1866 .D1 Pf \. Sx \&It Cm args
1875 have the following syntax:
1879 with subsequent lines interpreted within the scope of the
1881 until either a closing
1888 list has the following syntax:
1890 .D1 Pf \. Sx \&It Op Cm args
1892 Subsequent lines are interpreted as with
1895 The line arguments correspond to the list's left-hand side; body
1896 arguments correspond to the list's contents.
1900 list is the most complicated.
1901 Its syntax is as follows:
1903 .D1 Pf \. Sx \&It Op Cm args
1907 are phrases, a mix of macros and text corresponding to a line column,
1908 delimited by tabs or the special
1911 Lines subsequent the
1913 are interpreted within the scope of the last phrase.
1914 Calling the pseudo-macro
1916 will open a new phrase scope (this must occur on a macro line to be
1917 interpreted as a macro). Note that the tab phrase delimiter may only be
1921 Subsequent this, only the
1923 pseudo-macro may be used to delimit phrases.
1924 Furthermore, note that quoted sections propagate over tab-delimited
1929 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
1931 will preserve the semicolon whitespace except for the last.
1937 The syntax is as follows:
1939 .D1 Pf \. Sx \&Lb Cm library
1943 parameter may be a system library, such as
1947 in which case a small library description is printed next to the linker
1948 invocation; or a custom library, in which case the library name is
1950 This is most commonly used in the
1952 section as described in
1953 .Sx MANUAL STRUCTURE .
1961 Its syntax is as follows:
1963 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
1966 .D1 \&.Lk http://bsd.lv "The BSD.lv Project"
1967 .D1 \&.Lk http://bsd.lv
1977 Its syntax is as follows:
1979 .D1 Pf \. Sx \&Mt Cm address
1982 .D1 \&.Mt discuss@manpages.bsd.lv
1985 The name of the manual page, or \(em in particular in section 1, 6,
1986 and 8 pages \(em of an additional command or feature documented in
1988 When first invoked, the
1990 macro expects a single argument, the name of the manual page.
1991 Usually, the first invocation happens in the
1993 section of the page.
1994 The specified name will be remembered and used whenever the macro is
1995 called again without arguments later in the page.
1999 .Sx Block full-implicit
2000 semantics when invoked as the first macro on an input line in the
2002 section; otherwise, it uses ordinary
2007 .Bd -literal -offset indent
2016 of section 2, 3 and 9 manual pages, use the
2020 to mark up the name of the manual page.
2024 Format the NetBSD version provided as an argument, or a default value if
2025 no argument is provided.
2044 Document operating system version.
2045 This is the mandatory third macro of
2049 Its syntax is as follows:
2051 .D1 Pf \. Sx \&Os Op Cm system
2055 parameter specifies the relevant operating system or environment.
2056 Left unspecified, it defaults to the local operating system version.
2057 This is the suggested form.
2061 .D1 \&.Os KTH/CSC/TCS
2072 this macro has been deprecated.
2074 Format the OpenBSD version provided as an argument, or a default value
2075 if no argument is provided.
2104 Does not have any tail arguments.
2106 Begins a bibliographic
2109 Does not have any head arguments.
2110 The block macro may only contain
2126 child macros (at least one must be specified).
2129 .Bd -literal -offset indent -compact
2131 \&.%A J. E. Hopcroft
2133 \&.%B Introduction to Automata Theory, Languages, and Computation
2134 \&.%I Addison-Wesley
2135 \&.%C Reading, Massachusettes
2142 block is used within a SEE ALSO section, a vertical space is asserted
2143 before the rendered output, else the block continues on the current
2158 .Dq currently under development.
2160 Format the UNIX name.
2161 Accepts no argument.
2178 This is also used for indicating global variables in the
2180 section, in which case a variable name is also specified.
2181 Note that it accepts
2182 .Sx Block partial-implicit
2183 syntax when invoked as the first macro in the
2185 section, else it accepts ordinary
2189 Note that this should not be confused with
2191 which is used for function return types.
2194 .D1 \&.Vt unsigned char
2195 .D1 \&.Vt extern const char * const sys_signame[] \&;
2198 .Sx MANUAL STRUCTURE
2202 Close a scope opened by
2205 Open an extension scope.
2206 This macro originally existed to extend the 9-argument limit of troff;
2207 since this limit has been lifted, the macro has been deprecated.
2209 Link to another manual
2210 .Pq Qq cross-reference .
2211 Its syntax is as follows:
2213 .D1 Pf \. Sx \&Xr Cm name section
2219 are the name and section of the linked manual.
2222 is followed by non-punctuation, an
2224 is inserted into the token stream.
2225 This behaviour is for compatibility with
2230 .D1 \&.Xr mandoc 1 \&;
2231 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2235 This section documents compatibility between mandoc and other other
2236 troff implementations, at this time limited to GNU troff
2240 refers to groff versions before the
2243 .Pq somewhere between 1.15 and 1.19 .
2245 Heirloom troff, the other significant troff implementation accepting
2246 \-mdoc, is similar to historic groff.
2250 Old groff fails to assert a newline before
2251 .Sx \&Bd Fl ragged compact .
2253 groff behaves inconsistently when encountering
2257 regarding spacing between arguments.
2258 In mandoc, this is not the case: each argument is consistently followed
2259 by a single space and the trailing
2261 suppresses prior spacing.
2263 groff behaves inconsistently when encountering
2269 at times newline(s) are suppressed depending on whether a prior
2272 In mandoc, this is not the case.
2277 for the normalised behaviour.
2279 Historic groff does not break before an
2281 when not invoked as the line macro in the
2285 Historic groff formats the
2287 badly: trailing arguments are trashed and
2289 is not specially treated.
2291 groff does not accept the
2293 pseudo-macro as a line macro.
2298 is no longer accepted.
2302 macro does not format its arguments when used in the FILES section under
2306 Historic groff does not print a dash for empty
2309 mandoc and newer groff implementations do.
2311 groff behaves irregularly when specifying
2314 within line-macro scopes.
2315 mandoc follows a consistent system.
2317 In mandoc, negative scaling units are truncated to zero; groff would
2318 move to prior lines.
2321 scaling unit, while accepted, is rendered as the default unit.
2323 In quoted literals, groff allowed pair-wise double-quotes to produce a
2324 standalone double-quote in formatted output.
2325 This idiosyncratic behaviour is not applicable in mandoc.
2329 .Fl offset Ar center
2332 are disregarded in mandoc.
2335 argument is not supported in mandoc.
2336 Lastly, since text is not right-justified in mandoc (or even groff),
2345 Historic groff has many un-callable macros.
2346 Most of these (excluding some block-level macros) are now callable.
2352 but has been a proper delimiter since then.
2355 is assumed for all lists (it wasn't in historic groff): any list may be
2358 lists will restart the sequence only for the sub-list.
2362 incorrectly by following it with a reserved character and expecting the
2363 delimiter to render.
2364 This is not supported in mandoc.
2372 macros were stipulated only to occur in certain manual sections.
2373 mandoc does not have these restrictions.
2375 Newer groff and mandoc print
2377 prior to unknown arguments of
2379 older groff did nothing.
2387 reference was written by
2388 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
2390 .\" XXX: this really isn't the place for these caveats.
2394 .\" There are many ambiguous parts of mdoc.
2397 .\" .Bl -dash -compact
2402 .\" as function arguments are variables.
2407 .\" as function return types are still types. Furthermore, the
2409 .\" should be removed and
2411 .\" which ostensibly follows it, should follow the same convention as
2415 .\" should formalise that only one or two arguments are acceptable: a
2416 .\" variable name and optional, preceding type.
2419 .\" is ambiguous. It's commonly used to indicate an include file in the
2420 .\" synopsis section.
2422 .\" should be used, instead.
2428 .\" makes sense. The remaining ones should be removed.
2434 .\" macros should be deprecated.
2438 .\" macro lacks clarity. It should be absolutely clear which title will
2439 .\" render when formatting the manual page.
2443 .\" should be provided for Linux (\(`a la
2448 .\" There's no way to refer to references in
2452 .\" The \-split and \-nosplit dictates via
2454 .\" are re-set when entering and leaving the AUTHORS section.