]> git.cameronkatri.com Git - mandoc.git/blob - mdoc.7
Added documentation bits.
[mandoc.git] / mdoc.7
1 .\" $Id: mdoc.7,v 1.102 2010/05/14 14:21:17 kristaps Exp $
2 .\"
3 .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\"
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.
8 .\"
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.
16 .\"
17 .Dd $Mdocdate: May 14 2010 $
18 .Dt MDOC 7
19 .Os
20 .Sh NAME
21 .Nm mdoc
22 .Nd mdoc language reference
23 .Sh DESCRIPTION
24 The
25 .Nm mdoc
26 language is used to format
27 .Bx
28 .Ux
29 manuals. In this reference document, we describe its syntax, structure,
30 and usage. Our reference implementation is mandoc; the
31 .Sx COMPATIBILITY
32 section describes compatibility with other troff \-mdoc implementations.
33 .Pp
34 An
35 .Nm
36 document follows simple rules: lines beginning with the control
37 character
38 .Sq \.
39 are parsed for macros. Other lines are interpreted within the scope of
40 prior macros:
41 .Bd -literal -offset indent
42 \&.Sh Macro lines change control state.
43 Other lines are interpreted within the current state.
44 .Ed
45 .Sh LANGUAGE SYNTAX
46 .Nm
47 documents may contain only graphable 7-bit ASCII characters, the space
48 character, and, in certain circumstances, the tab character. All
49 manuals must have
50 .Ux
51 line terminators.
52 .Ss Comments
53 Text following a
54 .Sq \e" ,
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,
57 .Sq \&.\e" ,
58 is also ignored. Macro lines with only a control charater and optionally
59 whitespace are stripped from input.
60 .Ss Reserved Characters
61 Within a macro line, the following characters are reserved:
62 .Pp
63 .Bl -tag -width Ds -offset indent -compact
64 .It \&.
65 .Pq period
66 .It \&,
67 .Pq comma
68 .It \&:
69 .Pq colon
70 .It \&;
71 .Pq semicolon
72 .It \&(
73 .Pq left-parenthesis
74 .It \&)
75 .Pq right-parenthesis
76 .It \&[
77 .Pq left-bracket
78 .It \&]
79 .Pq right-bracket
80 .It \&?
81 .Pq question
82 .It \&!
83 .Pq exclamation
84 .It \&|
85 .Pq vertical bar
86 .El
87 .Pp
88 Use of reserved characters is described in
89 .Sx MACRO SYNTAX .
90 For general use in macro lines, these characters must either be escaped
91 with a non-breaking space
92 .Pq Sq \e&
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
97 .Sq \e
98 followed by either an open-parenthesis
99 .Sq \&(
100 for two-character sequences; an open-bracket
101 .Sq \&[
102 for n-character sequences (terminated at a close-bracket
103 .Sq \&] ) ;
104 or a single one-character sequence.
105 See
106 .Xr mandoc_char 7
107 for a complete list.
108 Examples include
109 .Sq \e(em
110 .Pq em-dash
111 and
112 .Sq \ee
113 .Pq back-slash .
114 .Ss Text Decoration
115 Terms may be text-decorated using the
116 .Sq \ef
117 escape followed by an indicator: B (bold), I, (italic), R (Roman), or P
118 (revert to previous mode):
119 .Pp
120 .D1 \efBbold\efR \efIitalic\efP
121 .Pp
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
127 .Sx \&Bf
128 .Cm \&Sy ,
129 in-scope invocations of
130 .Sq \ef
131 are only valid within the font scope of the macro.
132 If
133 .Sq \ef
134 is specified outside of any font scope, such as in unenclosed, free-form
135 text, it will affect the remainder of the document.
136 .Pp
137 Text may also be sized with the
138 .Sq \es
139 escape, whose syntax is one of
140 .Sq \es+-n
141 for one-digit numerals;
142 .Sq \es(+-nn
143 or
144 .Sq \es+-(nn
145 for two-digit numerals; and
146 .Sq \es[+-N] ,
147 .Sq \es+-[N] ,
148 .Sq \es'+-N' ,
149 or
150 .Sq \es+-'N'
151 for arbitrary-digit numerals:
152 .Pp
153 .D1 \es+1bigger\es-1
154 .D1 \es[+10]much bigger\es[-10]
155 .D1 \es+(10much bigger\es-(10
156 .D1 \es+'100'much much bigger\es-'100'
157 .Pp
158 Note these forms are
159 .Em not
160 recommended for
161 .Nm ,
162 which encourages semantic annotation.
163 .Ss Predefined Strings
164 Historically,
165 .Xr groff 1
166 also defined a set of package-specific
167 .Dq predefined strings ,
168 which, like
169 .Sx Special Characters ,
170 demark special output characters and strings by way of input codes.
171 Predefined strings are escaped with the slash-asterisk,
172 .Sq \e* :
173 single-character
174 .Sq \e*X ,
175 two-character
176 .Sq \e*(XX ,
177 and N-character
178 .Sq \e*[N] .
179 See
180 .Xr mandoc_char 7
181 for a complete list.
182 Examples include
183 .Sq \e*(Am
184 .Pq ampersand
185 and
186 .Sq \e*(Ba
187 .Pq vertical bar .
188 .Ss Whitespace
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.
194 .Pp
195 In macro lines, whitespace delimits arguments and is discarded.
196 If arguments are quoted, whitespace within the quotes is retained.
197 .Ss Quotation
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.
203 .Pp
204 This produces tokens
205 .Sq a" ,
206 .Sq b c ,
207 .Sq de ,
208 and
209 .Sq fg" .
210 Note that any quoted term, be it argument or macro, is indiscriminately
211 considered literal text.
212 Thus, the following produces
213 .Sq \&Em a :
214 .Bd -literal -offset indent
215 \&.Em "Em a"
216 .Ed
217 .Pp
218 In free-form mode, quotes are regarded as opaque text.
219 .Ss Dates
220 There are several macros in
221 .Nm
222 that require a date argument.
223 The canonical form for dates is the American format:
224 .Pp
225 .D1 Cm Month Day , Year
226 .Pp
227 The
228 .Cm Day
229 value is an optionally zero-padded numeral.
230 The
231 .Cm Month
232 value is the full month name.
233 The
234 .Cm Year
235 value is the full four-digit year.
236 .Pp
237 Reduced form dates are broken-down canonical form dates:
238 .Pp
239 .D1 Cm Month , Year
240 .D1 Cm Year
241 .Pp
242 Some examples of valid dates follow:
243 .Pp
244 .D1 "May, 2009" Pq reduced form
245 .D1 "2009" Pq reduced form
246 .D1 "May 20, 2009" Pq canonical form
247 .Ss Scaling Widths
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
251 \&.Bl -tag -width 2i
252 .Ed
253 .Pp
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:
259 .Pp
260 .Bl -tag -width Ds -offset indent -compact
261 .It c
262 centimetre
263 .It i
264 inch
265 .It P
266 pica (~1/6 inch)
267 .It p
268 point (~1/72 inch)
269 .It f
270 synonym for
271 .Sq u
272 .It v
273 default vertical span
274 .It m
275 width of rendered
276 .Sq m
277 .Pq em
278 character
279 .It n
280 width of rendered
281 .Sq n
282 .Pq en
283 character
284 .It u
285 default horizontal span
286 .It M
287 mini-em (~1/100 em)
288 .El
289 .Pp
290 Using anything other than
291 .Sq m ,
292 .Sq n ,
293 .Sq u ,
294 or
295 .Sq v
296 is necessarily non-portable across output media.
297 See
298 .Sx COMPATIBILITY .
299 .Ss Sentence Spacing
300 When composing a manual, make sure that your sentences end at the end of
301 a line.
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.
305 .Pp
306 The proper spacing is also intelligently preserved if a sentence ends at
307 the boundary of a macro line.
308 .Sh MANUAL STRUCTURE
309 A well-formed
310 .Nm
311 document consists of a document prologue followed by one or more
312 sections.
313 .Pp
314 The prologue, which consists of (in order) the
315 .Sx \&Dd ,
316 .Sx \&Dt ,
317 and
318 .Sx \&Os
319 macros, is required for every document.
320 .Pp
321 The first section (sections are denoted by
322 .Sx \&Sh )
323 must be the NAME section, consisting of at least one
324 .Sx \&Nm
325 followed by
326 .Sx \&Nd .
327 .Pp
328 Following that, convention dictates specifying at least the SYNOPSIS and
329 DESCRIPTION sections, although this varies between manual sections.
330 .Pp
331 The following is a well-formed skeleton
332 .Nm
333 file:
334 .Bd -literal -offset indent
335 \&.Dd $\&Mdocdate$
336 \&.Dt mdoc 7
337 \&.Os
338 \&.
339 \&.Sh NAME
340 \&.Nm foo
341 \&.Nd a description goes here
342 \&.\e\*q The next is for sections 2 & 3 only.
343 \&.\e\*q .Sh LIBRARY
344 \&.
345 \&.Sh SYNOPSIS
346 \&.Nm foo
347 \&.Op Fl options
348 \&.Ar
349 \&.
350 \&.Sh DESCRIPTION
351 The
352 \&.Nm
353 utility processes files ...
354 \&.\e\*q .Sh IMPLEMENTATION NOTES
355 \&.\e\*q The next is for sections 2, 3, & 9 only.
356 \&.\e\*q .Sh RETURN VALUES
357 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
358 \&.\e\*q .Sh ENVIRONMENT
359 \&.\e\*q .Sh FILES
360 \&.\e\*q The next is for sections 1 & 8 only.
361 \&.\e\*q .Sh EXIT STATUS
362 \&.\e\*q .Sh EXAMPLES
363 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
364 \&.\e\*q .Sh DIAGNOSTICS
365 \&.\e\*q The next is for sections 2, 3, & 9 only.
366 \&.\e\*q .Sh ERRORS
367 \&.\e\*q .Sh SEE ALSO
368 \&.\e\*q .Xr foobar 1
369 \&.\e\*q .Sh STANDARDS
370 \&.\e\*q .Sh HISTORY
371 \&.\e\*q .Sh AUTHORS
372 \&.\e\*q .Sh CAVEATS
373 \&.\e\*q .Sh BUGS
374 \&.\e\*q .Sh SECURITY CONSIDERATIONS
375 .Ed
376 .Pp
377 The sections in a
378 .Nm
379 document are conventionally ordered as they appear above.
380 Sections should be composed as follows:
381 .Bl -ohang -offset Ds
382 .It Em NAME
383 The name(s) and a short description of the documented material.
384 The syntax for this as follows:
385 .Bd -literal -offset indent
386 \&.Nm name0
387 \&.Nm name1
388 \&.Nm name2
389 \&.Nd a short description
390 .Ed
391 .Pp
392 The
393 .Sx \&Nm
394 macro(s) must precede the
395 .Sx \&Nd
396 macro.
397 .Pp
398 See
399 .Sx \&Nm
400 and
401 .Sx \&Nd .
402 .It Em LIBRARY
403 The name of the library containing the documented material, which is
404 assumed to be a function in a section 2 or 3 manual.
405 The syntax for this is as follows:
406 .Bd -literal -offset indent
407 \&.Lb libarm
408 .Ed
409 .Pp
410 See
411 .Sx \&Lb .
412 .It Em SYNOPSIS
413 Documents the utility invocation syntax, function call syntax, or device
414 configuration.
415 .Pp
416 For the first, utilities (sections 1, 6, and 8), this is
417 generally structured as follows:
418 .Bd -literal -offset indent
419 \&.Nm foo
420 \&.Op Fl v
421 \&.Op Fl o Ar file
422 \&.Op Ar
423 \&.Nm bar
424 \&.Op Fl v
425 \&.Op Fl o Ar file
426 \&.Op Ar
427 .Ed
428 .Pp
429 For the second, function calls (sections 2, 3, 9):
430 .Bd -literal -offset indent
431 \&.Vt extern const char *global;
432 \&.In header.h
433 \&.Ft "char *"
434 \&.Fn foo "const char *src"
435 \&.Ft "char *"
436 \&.Fn bar "const char *src"
437 .Ed
438 .Pp
439 And for the third, configurations (section 4):
440 .Bd -literal -offset indent
441 \&.Cd \*qit* at isa? port 0x2e\*q
442 \&.Cd \*qit* at isa? port 0x4e\*q
443 .Ed
444 .Pp
445 Manuals not in these sections generally don't need a
446 .Em SYNOPSIS .
447 .Pp
448 See
449 .Sx \&Op ,
450 .Sx \&Cd ,
451 .Sx \&Fn ,
452 .Sx \&Ft ,
453 and
454 .Sx \&Vt .
455 .It Em DESCRIPTION
456 This expands upon the brief, one-line description in
457 .Em NAME .
458 It usually contains a break-down of the options (if documenting a
459 command), such as:
460 .Bd -literal -offset indent
461 The arguments are as follows:
462 \&.Bl \-tag \-width Ds
463 \&.It Fl v
464 Print verbose information.
465 \&.El
466 .Ed
467 .Pp
468 Manuals not documenting a command won't include the above fragment.
469 .It Em IMPLEMENTATION NOTES
470 Implementation-specific notes should be kept here.
471 This is useful when implementing standard functions that may have side
472 effects or notable algorithmic implications.
473 .It Em RETURN VALUES
474 This section is the dual of
475 .Em EXIT STATUS ,
476 which is used for commands.
477 It documents the return values of functions in sections 2, 3, and 9.
478 .Pp
479 See
480 .Sx \&Rv .
481 .It Em ENVIRONMENT
482 Documents any usages of environment variables, e.g.,
483 .Xr environ 7 .
484 .Pp
485 See
486 .Sx \&Ev .
487 .It Em FILES
488 Documents files used.
489 It's helpful to document both the file and a short description of how
490 the file is used (created, modified, etc.).
491 .Pp
492 See
493 .Sx \&Pa .
494 .It Em EXIT STATUS
495 Command exit status for section 1, 6, and 8 manuals.
496 This section is the dual of
497 .Em RETURN VALUES ,
498 which is used for functions.
499 Historically, this information was described in
500 .Em DIAGNOSTICS ,
501 a practise that is now discouraged.
502 .Pp
503 See
504 .Sx \&Ex .
505 .It Em EXAMPLES
506 Example usages.
507 This often contains snippets of well-formed, well-tested invocations.
508 Make doubly sure that your examples work properly!
509 .It Em DIAGNOSTICS
510 Documents error conditions.
511 This is most useful in section 4 manuals.
512 Historically, this section was used in place of
513 .Em EXIT STATUS
514 for manuals in sections 1, 6, and 8; however, this practise is
515 discouraged.
516 .Pp
517 See
518 .Sx \&Bl
519 .Fl diag .
520 .It Em ERRORS
521 Documents error handling in sections 2, 3, and 9.
522 .Pp
523 See
524 .Sx \&Er .
525 .It Em SEE ALSO
526 References other manuals with related topics.
527 This section should exist for most manuals.
528 Cross-references should conventionally be ordered first by section, then
529 alphabetically.
530 .Pp
531 See
532 .Sx \&Xr .
533 .It Em STANDARDS
534 References any standards implemented or used.
535 If not adhering to any standards, the
536 .Em HISTORY
537 section should be used instead.
538 .Pp
539 See
540 .Sx \&St .
541 .It Em HISTORY
542 The history of any manual without a
543 .Em STANDARDS
544 section should be described in this section.
545 .It Em AUTHORS
546 Credits to authors, if applicable, should appear in this section.
547 Authors should generally be noted by both name and an e-mail address.
548 .Pp
549 See
550 .Sx \&An .
551 .It Em CAVEATS
552 Explanations of common misuses and misunderstandings should be explained
553 in this section.
554 .It Em BUGS
555 Extant bugs should be described in this section.
556 .It Em SECURITY CONSIDERATIONS
557 Documents any security precautions that operators should consider.
558 .El
559 .Sh MACRO SYNTAX
560 Macros are one to three three characters in length and begin with a
561 control character ,
562 .Sq \&. ,
563 at the beginning of the line.
564 An arbitrary amount of whitespace may sit between the control character
565 and the macro name.
566 Thus, the following are equivalent:
567 .Bd -literal -offset indent
568 \&.Pp
569 \&.\ \ \ \&Pp
570 .Ed
571 .Pp
572 The syntax of a macro depends on its classification.
573 In this section,
574 .Sq \-arg
575 refers to macro arguments, which may be followed by zero or more
576 .Sq parm
577 parameters;
578 .Sq \&Yo
579 opens the scope of a macro; and if specified,
580 .Sq \&Yc
581 closes it out.
582 .Pp
583 The
584 .Em Callable
585 column indicates that the macro may be called subsequent to the initial
586 line-macro.
587 If a macro is not callable, then its invocation after the initial line
588 macro is interpreted as opaque text, such that
589 .Sq \&.Fl \&Sh
590 produces
591 .Sq Fl \&Sh .
592 .Pp
593 The
594 .Em Parsable
595 column indicates whether the macro may be followed by further
596 (ostensibly callable) macros.
597 If a macro is not parsable, subsequent macro invocations on the line
598 will be interpreted as opaque text.
599 .Pp
600 The
601 .Em Scope
602 column, if applicable, describes closure rules.
603 .Ss Block full-explicit
604 Multi-line scope closed by an explicit closing macro.
605 All macros contains bodies; only
606 .Sx \&Bf
607 contains a head.
608 .Bd -literal -offset indent
609 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
610 \(lBbody...\(rB
611 \&.Yc
612 .Ed
613 .Pp
614 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsableX" "closed by XXX"
615 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
616 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
617 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
618 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
619 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
620 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
621 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
622 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
623 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
624 .El
625 .Ss Block full-implicit
626 Multi-line scope closed by end-of-file or implicitly by another macro.
627 All macros have bodies; some
628 .Po
629 .Sx \&It Fl bullet ,
630 .Fl hyphen ,
631 .Fl dash ,
632 .Fl enum ,
633 .Fl item
634 .Pc
635 don't have heads; only one
636 .Po
637 .Sx \&It Fl column
638 .Pc
639 has multiple heads.
640 .Bd -literal -offset indent
641 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
642 \(lBbody...\(rB
643 .Ed
644 .Pp
645 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsableX" "closed by XXXXXXXXXXX"
646 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
647 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
648 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
649 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
650 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
651 .El
652 .Ss Block partial-explicit
653 Like block full-explicit, but also with single-line scope.
654 Each has at least a body and, in limited circumstances, a head
655 .Po
656 .Sx \&Fo ,
657 .Sx \&Eo
658 .Pc
659 and/or tail
660 .Pq Sx \&Ec .
661 .Bd -literal -offset indent
662 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
663 \(lBbody...\(rB
664 \&.Yc \(lBtail...\(rB
665
666 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
667 \(lBbody...\(rB \&Yc \(lBtail...\(rB
668 .Ed
669 .Pp
670 .Bl -column "MacroX" "CallableX" "ParsableX" "closed by XXXX" -compact -offset indent
671 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
672 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
673 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
674 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
675 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
676 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
677 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
678 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
679 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
680 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
681 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
682 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
683 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
684 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
685 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
686 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
687 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
688 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
689 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
690 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
691 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
692 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
693 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
694 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
695 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
696 .El
697 .Ss Block partial-implicit
698 Like block full-implicit, but with single-line scope closed by
699 .Sx Reserved Characters
700 or end of line.
701 .Bd -literal -offset indent
702 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
703 .Ed
704 .Pp
705 .Bl -column "MacroX" "CallableX" "ParsableX" -compact -offset indent
706 .It Em Macro Ta Em Callable Ta Em Parsable
707 .It Sx \&Aq Ta Yes Ta Yes
708 .It Sx \&Bq Ta Yes Ta Yes
709 .It Sx \&Brq Ta Yes Ta Yes
710 .It Sx \&D1 Ta \&No Ta \&Yes
711 .It Sx \&Dl Ta \&No Ta Yes
712 .It Sx \&Dq Ta Yes Ta Yes
713 .It Sx \&Op Ta Yes Ta Yes
714 .It Sx \&Pq Ta Yes Ta Yes
715 .It Sx \&Ql Ta Yes Ta Yes
716 .It Sx \&Qq Ta Yes Ta Yes
717 .It Sx \&Sq Ta Yes Ta Yes
718 .It Sx \&Vt Ta Yes Ta Yes
719 .El
720 .Pp
721 Note that the
722 .Sx \&Vt
723 macro is a
724 .Sx Block partial-implicit
725 only when invoked as the first macro
726 in a SYNOPSIS section line, else it is
727 .Sx In-line .
728 .Ss In-line
729 Closed by
730 .Sx Reserved Characters ,
731 end of line, fixed argument lengths, and/or subsequent macros.
732 In-line macros have only text children.
733 If a number (or inequality) of arguments is
734 .Pq n ,
735 then the macro accepts an arbitrary number of arguments.
736 .Bd -literal -offset indent
737 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lbres...\(rb
738
739 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
740
741 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
742 .Ed
743 .Pp
744 .Bl -column "MacroX" "CallableX" "ParsableX" "Arguments" -compact -offset indent
745 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Arguments
746 .It Sx \&%A Ta \&No Ta \&No Ta >0
747 .It Sx \&%B Ta \&No Ta \&No Ta >0
748 .It Sx \&%C Ta \&No Ta \&No Ta >0
749 .It Sx \&%D Ta \&No Ta \&No Ta >0
750 .It Sx \&%I Ta \&No Ta \&No Ta >0
751 .It Sx \&%J Ta \&No Ta \&No Ta >0
752 .It Sx \&%N Ta \&No Ta \&No Ta >0
753 .It Sx \&%O Ta \&No Ta \&No Ta >0
754 .It Sx \&%P Ta \&No Ta \&No Ta >0
755 .It Sx \&%Q Ta \&No Ta \&No Ta >0
756 .It Sx \&%R Ta \&No Ta \&No Ta >0
757 .It Sx \&%T Ta \&No Ta \&No Ta >0
758 .It Sx \&%U Ta \&No Ta \&No Ta >0
759 .It Sx \&%V Ta \&No Ta \&No Ta >0
760 .It Sx \&Ad Ta Yes Ta Yes Ta n
761 .It Sx \&An Ta Yes Ta Yes Ta n
762 .It Sx \&Ap Ta Yes Ta Yes Ta 0
763 .It Sx \&Ar Ta Yes Ta Yes Ta n
764 .It Sx \&At Ta Yes Ta Yes Ta 1
765 .It Sx \&Bsx Ta Yes Ta Yes Ta n
766 .It Sx \&Bt Ta \&No Ta \&No Ta 0
767 .It Sx \&Bx Ta Yes Ta Yes Ta n
768 .It Sx \&Cd Ta Yes Ta Yes Ta >0
769 .It Sx \&Cm Ta Yes Ta Yes Ta n
770 .It Sx \&Db Ta \&No Ta \&No Ta 1
771 .It Sx \&Dd Ta \&No Ta \&No Ta >0
772 .It Sx \&Dt Ta \&No Ta \&No Ta n
773 .It Sx \&Dv Ta Yes Ta Yes Ta n
774 .It Sx \&Dx Ta Yes Ta Yes Ta n
775 .It Sx \&Em Ta Yes Ta Yes Ta >0
776 .It Sx \&En Ta \&No Ta \&No Ta 0
777 .It Sx \&Er Ta Yes Ta Yes Ta >0
778 .It Sx \&Es Ta \&No Ta \&No Ta 0
779 .It Sx \&Ev Ta Yes Ta Yes Ta n
780 .It Sx \&Ex Ta \&No Ta \&No Ta n
781 .It Sx \&Fa Ta Yes Ta Yes Ta n
782 .It Sx \&Fd Ta \&No Ta \&No Ta >0
783 .It Sx \&Fl Ta Yes Ta Yes Ta n
784 .It Sx \&Fn Ta Yes Ta Yes Ta >0
785 .It Sx \&Fr Ta \&No Ta \&No Ta n
786 .It Sx \&Ft Ta Yes Ta Yes Ta n
787 .It Sx \&Fx Ta Yes Ta Yes Ta n
788 .It Sx \&Hf Ta \&No Ta \&No Ta n
789 .It Sx \&Ic Ta Yes Ta Yes Ta >0
790 .It Sx \&In Ta \&No Ta \&No Ta n
791 .It Sx \&Lb Ta \&No Ta \&No Ta 1
792 .It Sx \&Li Ta Yes Ta Yes Ta n
793 .It Sx \&Lk Ta Yes Ta Yes Ta n
794 .It Sx \&Lp Ta \&No Ta \&No Ta 0
795 .It Sx \&Ms Ta Yes Ta Yes Ta >0
796 .It Sx \&Mt Ta Yes Ta Yes Ta >0
797 .It Sx \&Nm Ta Yes Ta Yes Ta n
798 .It Sx \&No Ta Yes Ta Yes Ta 0
799 .It Sx \&Ns Ta Yes Ta Yes Ta 0
800 .It Sx \&Nx Ta Yes Ta Yes Ta n
801 .It Sx \&Os Ta \&No Ta \&No Ta n
802 .It Sx \&Ot Ta \&No Ta \&No Ta n
803 .It Sx \&Ox Ta Yes Ta Yes Ta n
804 .It Sx \&Pa Ta Yes Ta Yes Ta n
805 .It Sx \&Pf Ta Yes Ta Yes Ta 1
806 .It Sx \&Pp Ta \&No Ta \&No Ta 0
807 .It Sx \&Rv Ta \&No Ta \&No Ta n
808 .It Sx \&Sm Ta \&No Ta \&No Ta 1
809 .It Sx \&St Ta \&No Ta Yes Ta 1
810 .It Sx \&Sx Ta Yes Ta Yes Ta >0
811 .It Sx \&Sy Ta Yes Ta Yes Ta >0
812 .It Sx \&Tn Ta Yes Ta Yes Ta >0
813 .It Sx \&Ud Ta \&No Ta \&No Ta 0
814 .It Sx \&Ux Ta Yes Ta Yes Ta n
815 .It Sx \&Va Ta Yes Ta Yes Ta n
816 .It Sx \&Vt Ta Yes Ta Yes Ta >0
817 .It Sx \&Xr Ta Yes Ta Yes Ta >0
818 .It Sx \&br Ta \&No Ta \&No Ta 0
819 .It Sx \&sp Ta \&No Ta \&No Ta 1
820 .El
821 .Sh REFERENCE
822 This section is a canonical reference of all macros, arranged
823 alphabetically.
824 For the scoping of individual macros, see
825 .Sx MACRO SYNTAX .
826 .Ss \&%A
827 Author name of an
828 .Sx \&Rs
829 block. Multiple authors should each be accorded their own
830 .Sx \%%A
831 line. Author names should be ordered with full or abbreviated
832 forename(s) first, then full surname.
833 .Ss \&%B
834 Book title of an
835 .Sx \&Rs
836 block. This macro may also be used in a non-bibliographic context when
837 referring to book titles.
838 .Ss \&%C
839 Publication city or location of an
840 .Sx \&Rs
841 block.
842 .Pp
843 .Em Remarks :
844 this macro is not implemented in
845 .Xr groff 1 .
846 .Ss \&%D
847 Publication date of an
848 .Sx \&Rs
849 block. This should follow the reduced or canonical form syntax
850 described in
851 .Sx Dates .
852 .Ss \&%I
853 Publisher or issuer name of an
854 .Sx \&Rs
855 block.
856 .Ss \&%J
857 Journal name of an
858 .Sx \&Rs
859 block.
860 .Ss \&%N
861 Issue number (usually for journals) of an
862 .Sx \&Rs
863 block.
864 .Ss \&%O
865 Optional information of an
866 .Sx \&Rs
867 block.
868 .Ss \&%P
869 Book or journal page number of an
870 .Sx \&Rs
871 block.
872 .Ss \&%Q
873 Institutional author (school, government, etc.) of an
874 .Sx \&Rs
875 block. Multiple institutional authors should each be accorded their own
876 .Sx \&%Q
877 line.
878 .Ss \&%R
879 Technical report name of an
880 .Sx \&Rs
881 block.
882 .Ss \&%T
883 Article title of an
884 .Sx \&Rs
885 block. This macro may also be used in a non-bibliographical context
886 when referring to article titles.
887 .Ss \&%U
888 URI of reference document.
889 .Ss \&%V
890 Volume number of an
891 .Sx \&Rs
892 block.
893 .Ss \&Ac
894 Closes an
895 .Sx \&Ao
896 block. Does not have any tail arguments.
897 .Ss \&Ad
898 Address construct: usually in the context of an computational address in
899 memory, not a physical (post) address.
900 .Pp
901 Examples:
902 .D1 \&.Ad [0,$]
903 .D1 \&.Ad 0x00000000
904 .Ss \&An
905 Author name.
906 This macro may alternatively accepts the following arguments, although
907 these may not be specified along with a parameter:
908 .Bl -tag -width 12n -offset indent
909 .It Fl split
910 Renders a line break before each author listing.
911 .It Fl nosplit
912 The opposite of
913 .Fl split .
914 .El
915 .Pp
916 In the AUTHORS section, the default is not to split the first author
917 listing, but all subsequent author listings, whether or not they're
918 interspersed by other macros or text, are split.
919 Thus, specifying
920 .Fl split
921 will cause the first listing also to be split.
922 If not in the AUTHORS section, the default is not to split.
923 .Pp
924 Examples:
925 .D1 \&.An -nosplit
926 .D1 \&.An J. D. Ullman .
927 .Pp
928 .Em Remarks :
929 the effects of
930 .Fl split
931 or
932 .Fl nosplit
933 are re-set when entering the AUTHORS section, so if one specifies
934 .Sx \&An Fl nosplit
935 in the general document body, it must be re-specified in the AUTHORS
936 section.
937 .Ss \&Ao
938 Begins a block enclosed by angled brackets.
939 Does not have any head arguments.
940 .Pp
941 Examples:
942 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
943 .Pp
944 See also
945 .Sx \&Aq .
946 .Ss \&Ap
947 Inserts an apostrophe without any surrounding white-space.
948 This is generally used as a grammatic device when referring to the verb
949 form of a function:
950 .Bd -literal -offset indent
951 \&.Fn execve Ap d
952 .Ed
953 .Ss \&Aq
954 Encloses its arguments in angled brackets.
955 .Pp
956 Examples:
957 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
958 .Pp
959 .Em Remarks :
960 this macro is often abused for rendering URIs, which should instead use
961 .Sx \&Lk
962 or
963 .Sx \&Mt ,
964 or to note pre-processor
965 .Dq Li #include
966 statements, which should use
967 .Sx \&In .
968 .Pp
969 See also
970 .Sx \&Ao .
971 .Ss \&Ar
972 Command arguments.
973 If an argument is not provided, the string
974 .Dq file ...
975 is used as a default.
976 .Pp
977 Examples:
978 .D1 \&.Fl o \&Ns \&Ar file1
979 .D1 \&.Ar
980 .D1 \&.Ar arg1 , arg2 .
981 .Ss \&At
982 Formats an AT&T version.
983 Accepts at most one parameter:
984 .Bl -tag -width 12n -offset indent
985 .It Cm v[1-7] | 32v
986 A version of
987 .At .
988 .It Cm V[.[1-4]]?
989 A system version of
990 .At .
991 .El
992 .Pp
993 Note that these parameters do not begin with a hyphen.
994 .Pp
995 Examples:
996 .D1 \&.At
997 .D1 \&.At V.1
998 .Pp
999 See also
1000 .Sx \&Bsx ,
1001 .Sx \&Bx ,
1002 .Sx \&Dx ,
1003 .Sx \&Fx ,
1004 .Sx \&Nx ,
1005 .Sx \&Ox ,
1006 and
1007 .Sx \&Ux .
1008 .Ss \&Bc
1009 Closes a
1010 .Sx \&Bo
1011 block. Does not have any tail arguments.
1012 .Ss \&Bd
1013 Begins a display block.
1014 A display is collection of macros or text which may be collectively
1015 offset or justified in a manner different from that
1016 of the enclosing context.
1017 By default, the block is preceded by a vertical space.
1018 .Pp
1019 Each display is associated with a type, which must be one of the
1020 following arguments:
1021 .Bl -tag -width 12n -offset indent
1022 .It Fl ragged
1023 Only left-justify the block.
1024 .It Fl unfilled
1025 Do not justify the block at all.
1026 .It Fl filled
1027 Left- and right-justify the block.
1028 .It Fl literal
1029 Alias for
1030 .Fl unfilled .
1031 .It Fl centered
1032 Centre-justify each line.
1033 .El
1034 .Pp
1035 The type must be provided first.
1036 Secondary arguments are as follows:
1037 .Bl -tag -width 12n -offset indent
1038 .It Fl offset Ar width
1039 Offset by the value of
1040 .Ar width ,
1041 which is interpreted as one of the following, specified in order:
1042 .Bl -item
1043 .It
1044 As one of the pre-defined strings
1045 .Ar indent ,
1046 the width of standard indentation;
1047 .Ar indent-two ,
1048 twice
1049 .Ar indent ;
1050 .Ar left ,
1051 which has no effect ;
1052 .Ar right ,
1053 which justifies to the right margin; and
1054 .Ar center ,
1055 which aligns around an imagined centre axis.
1056 .It
1057 As a precalculated width for a named macro.
1058 The most popular is the imaginary macro
1059 .Ar \&Ds ,
1060 which resolves to
1061 .Ar 6n .
1062 .It
1063 As a scaling unit following the syntax described in
1064 .Sx Scaling Widths .
1065 .It
1066 As the calculated string length of the opaque string.
1067 .El
1068 .Pp
1069 If unset, it will revert to the value of
1070 .Ar 8n
1071 as described in
1072 .Sx Scaling Widths .
1073 .It Fl compact
1074 Do not assert a vertical space before the block.
1075 .It Fl file Ar file
1076 Prepend the file
1077 .Ar file
1078 before any text or macros within the block.
1079 .El
1080 .Pp
1081 Examples:
1082 .Bd -literal -offset indent
1083 \&.Bd \-unfilled \-offset two-indent \-compact
1084 Hello world.
1085 \&.Ed
1086 .Ed
1087 .Pp
1088 See also
1089 .Sx \&D1
1090 and
1091 .Sx \&Dl .
1092 .Ss \&Bf
1093 .Ss \&Bk
1094 .Ss \&Bl
1095 .\" Begins a list composed of one or more list entries. A list entry is
1096 .\" specified by the
1097 .\" .Sx \&It
1098 .\" macro, which consists of a head and optional body. By default, a list
1099 .\" is preceded by a blank line. A list must specify one of the following
1100 .\" list types:
1101 .\" .Bl -tag -width 12n
1102 .\" .It Fl bullet
1103 .\" A list offset by a bullet. The head of list entries must be empty.
1104 .\" List entry bodies are justified after the bullet.
1105 .\" .It Fl column
1106 .\" A columnated list. The number of columns is specified as arguments to
1107 .\" the
1108 .\" .Sx \&Bl
1109 .\" macro (the deprecated form of following the invocation of
1110 .\" .Fl column
1111 .\" is also accepted). Arguments dictate the width of columns specified in
1112 .\" list entries. List entry bodies must be left empty. Columns specified
1113 .\" in the list entry head are justified to their position in the sequence
1114 .\" of columns.
1115 .\" .It Fl dash
1116 .\" A list offset by a dash (hyphen). The head of list entries must be
1117 .\" empty. List entry bodies are justified past the dash.
1118 .\" .It Fl diag
1119 .\" Like
1120 .\" .Fl inset
1121 .\" lists, but with additional formatting to the head.
1122 .\" .It Fl enum
1123 .\" A list offset by a number indicating list entry position. The head of
1124 .\" list entries must be empty. List entry bodies are justified past the
1125 .\" enumeration.
1126 .\" .It Fl hang
1127 .\" Like
1128 .\" .Fl tag ,
1129 .\" but instead of list bodies justifying to the head on the first line,
1130 .\" they trail the head text.
1131 .\" .It Fl hyphen
1132 .\" Synonym for
1133 .\" .Fl dash .
1134 .\" .It Fl inset
1135 .\" Like
1136 .\" .Fl tag ,
1137 .\" but list entry bodies aren't justified.
1138 .\" .It Fl item
1139 .\" An un-justified list. This produces blocks of text.
1140 .\" .It Fl ohang
1141 .\" List bodies are placed on the line following the head.
1142 .\" .It Fl tag
1143 .\" A list offset by list entry heads. List entry bodies are justified
1144 .\" after the head.
1145 .\" .El
1146 .\" .Pp
1147 .\" More...
1148 .\" .
1149 .Ss \&Bo
1150 Begins a block enclosed by square brackets.
1151 Does not have any head arguments.
1152 .Pp
1153 Examples:
1154 .Bd -literal -offset indent
1155 \&.Bo 1 ,
1156 \&.Dv BUFSIZ \&Bc
1157 .Ed
1158 .Pp
1159 See also
1160 .Sx \&Bq .
1161 .Ss \&Bq
1162 Encloses its arguments in square brackets.
1163 .Pp
1164 Examples:
1165 .D1 \&.Bq 1 , \&Dv BUFSIZ
1166 .Pp
1167 .Em Remarks :
1168 this macro is sometimes abused to emulate optional arguments for
1169 commands; the correct macros to use for this purpose are
1170 .Sx \&Op ,
1171 .Sx \&Oo ,
1172 and
1173 .Sx \&Oc .
1174 .Pp
1175 See also
1176 .Sx \&Bo .
1177 .Ss \&Brc
1178 Closes a
1179 .Sx \&Bro
1180 block. Does not have any tail arguments.
1181 .Ss \&Bro
1182 Begins a block enclosed by curly braces.
1183 Does not have any head arguments.
1184 .Pp
1185 Examples:
1186 .Bd -literal -offset indent
1187 \&.Bro 1 , ... ,
1188 \&.Va n \&Brc
1189 .Ed
1190 .Pp
1191 See also
1192 .Sx \&Brq .
1193 .Ss \&Brq
1194 Encloses its arguments in curly braces.
1195 .Pp
1196 Examples:
1197 .D1 \&.Brq 1 , ... , \&Va n
1198 .Pp
1199 See also
1200 .Sx \&Bro .
1201 .Ss \&Bsx
1202 Format the BSD/OS version provided as an argument, or a default value if
1203 no argument is provided.
1204 .Pp
1205 Examples:
1206 .D1 \&.Bsx 1.0
1207 .D1 \&.Bsx
1208 .Pp
1209 See also
1210 .Sx \&At ,
1211 .Sx \&Bx ,
1212 .Sx \&Dx ,
1213 .Sx \&Fx ,
1214 .Sx \&Nx ,
1215 .Sx \&Ox ,
1216 and
1217 .Sx \&Ux .
1218 .Ss \&Bt
1219 Prints
1220 .Dq is currently in beta test.
1221 .Ss \&Bx
1222 Format the BSD version provided as an argument, or a default value if no
1223 argument is provided.
1224 .Pp
1225 Examples:
1226 .D1 \&.Bx 4.4
1227 .D1 \&.Bx
1228 .Pp
1229 See also
1230 .Sx \&At ,
1231 .Sx \&Bsx ,
1232 .Sx \&Dx ,
1233 .Sx \&Fx ,
1234 .Sx \&Nx ,
1235 .Sx \&Ox ,
1236 and
1237 .Sx \&Ux .
1238 .Ss \&Cd
1239 Configuration declaration.
1240 This denotes strings accepted by
1241 .Xr config 8 .
1242 .Pp
1243 Examples:
1244 .D1 \&.Cd device le0 at scode?
1245 .Pp
1246 .Em Remarks :
1247 this macro is commonly abused by using quoted literals to retain
1248 white-space and align consecutive
1249 .Sx \&Cd
1250 declarations.
1251 This practise is discouraged.
1252 .Ss \&Cm
1253 Command modifiers.
1254 Useful when specifying configuration options or keys.
1255 .Pp
1256 Examples:
1257 .D1 \&.Cm ControlPath
1258 .D1 \&.Cm ControlMaster
1259 .Pp
1260 See also
1261 .Sx \&Fl .
1262 .Ss \&D1
1263 One-line indented display.
1264 This is formatted by the default rules and is useful for simple indented
1265 statements.
1266 It is followed by a newline.
1267 .Pp
1268 Examples:
1269 .D1 \&.D1 \&Fl abcdefgh
1270 .Pp
1271 See also
1272 .Sx \&Bd
1273 and
1274 .Sx \&Dl .
1275 .Ss \&Db
1276 .Ss \&Dc
1277 Closes a
1278 .Sx \&Do
1279 block. Does not have any tail arguments.
1280 .Ss \&Dd
1281 Document date.
1282 This is the mandatory first macro of any
1283 .Nm
1284 manual.
1285 Its calling syntax is as follows:
1286 .Pp
1287 .D1 \. Ns Sx \&Dd Cm date
1288 .Pp
1289 The
1290 .Cm date
1291 field may be either
1292 .Ar $\&Mdocdate$ ,
1293 which signifies the current manual revision date dictated by
1294 .Xr cvs 1 ,
1295 or instead a valid canonical date as specified by
1296 .Sx Dates .
1297 If a date does not conform, the current date is used instead.
1298 .Pp
1299 Examples:
1300 .D1 \&.Dd $\&Mdocdate$
1301 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1302 .D1 \&.Dd July 21, 2007
1303 .Pp
1304 See also
1305 .Sx \&Dt
1306 and
1307 .Sx \&Os .
1308 .Ss \&Dl
1309 One-line intended display.
1310 This is formatted as literal text and is useful for commands and
1311 invocations.
1312 It is followed by a newline.
1313 .Pp
1314 Examples:
1315 .D1 \&.Dl % mandoc mdoc.7 | less
1316 .Pp
1317 See also
1318 .Sx \&Bd
1319 and
1320 .Sx \&D1 .
1321 .Ss \&Do
1322 Begins a block enclosed by double quotes. Does not have any head
1323 arguments.
1324 .Pp
1325 Examples:
1326 .D1 \&.D1 \&Do April is the cruellest month \&Dc \e(em T.S. Eliot
1327 .Pp
1328 See also
1329 .Sx \&Dq .
1330 .Ss \&Dq
1331 Encloses its arguments in double quotes.
1332 .Pp
1333 Examples:
1334 .Bd -literal -offset indent -compact
1335 \&.Dq April is the cruellest month
1336 \e(em T.S. Eliot
1337 .Ed
1338 .Pp
1339 See also
1340 .Sx \&Do .
1341 .Ss \&Dt
1342 Document title.
1343 This is the mandatory second macro of any
1344 .Nm
1345 file.
1346 Its calling syntax is as follows:
1347 .Pp
1348 .D1 \. Ns Sx \&Dt Cm title section Op Cm volume | arch
1349 .Pp
1350 Its arguments are as follows:
1351 .Bl -tag -width Ds -offset Ds
1352 .It Cm title
1353 The document's title (name).
1354 This should be capitalised and is required.
1355 .It Cm section
1356 The manual section.
1357 This may be one of
1358 .Ar 1
1359 .Pq utilities ,
1360 .Ar 2
1361 .Pq system calls ,
1362 .Ar 3
1363 .Pq libraries ,
1364 .Ar 3p
1365 .Pq Perl libraries ,
1366 .Ar 4
1367 .Pq devices ,
1368 .Ar 5
1369 .Pq file formats ,
1370 .Ar 6
1371 .Pq games ,
1372 .Ar 7
1373 .Pq miscellaneous ,
1374 .Ar 8
1375 .Pq system utilities ,
1376 .Ar 9
1377 .Pq kernel functions ,
1378 .Ar X11
1379 .Pq X Window System ,
1380 .Ar X11R6
1381 .Pq X Window System ,
1382 .Ar unass
1383 .Pq unassociated ,
1384 .Ar local
1385 .Pq local system ,
1386 .Ar draft
1387 .Pq draft manual ,
1388 or
1389 .Ar paper
1390 .Pq paper .
1391 It is also required and should correspond to the manual's filename
1392 suffix.
1393 .It Cm volume
1394 This overrides the volume inferred from
1395 .Ar section .
1396 This field is optional, and if specified, must be one of
1397 .Ar USD
1398 .Pq users' supplementary documents ,
1399 .Ar PS1
1400 .Pq programmers' supplementary documents ,
1401 .Ar AMD
1402 .Pq administrators' supplementary documents ,
1403 .Ar SMM
1404 .Pq system managers' manuals ,
1405 .Ar URM
1406 .Pq users' reference manuals ,
1407 .Ar PRM
1408 .Pq programmers' reference manuals ,
1409 .Ar KM
1410 .Pq kernel manuals ,
1411 .Ar IND
1412 .Pq master index ,
1413 .Ar MMI
1414 .Pq master index ,
1415 .Ar LOCAL
1416 .Pq local manuals ,
1417 .Ar LOC
1418 .Pq local manuals ,
1419 or
1420 .Ar CON
1421 .Pq contributed manuals .
1422 .It Cm arch
1423 This specifies a specific relevant architecture.
1424 If
1425 .Cm volume
1426 is not provided, it may be used in its place, else it may be used
1427 subsequent that.
1428 It, too, is optional.
1429 It must be one of
1430 .Ar alpha ,
1431 .Ar amd64 ,
1432 .Ar amiga ,
1433 .Ar arc ,
1434 .Ar arm ,
1435 .Ar armish ,
1436 .Ar aviion ,
1437 .Ar hp300 ,
1438 .Ar hppa ,
1439 .Ar hppa64 ,
1440 .Ar i386 ,
1441 .Ar landisk ,
1442 .Ar loongson ,
1443 .Ar luna88k ,
1444 .Ar mac68k ,
1445 .Ar macppc ,
1446 .Ar mvme68k ,
1447 .Ar mvme88k ,
1448 .Ar mvmeppc ,
1449 .Ar pmax ,
1450 .Ar sgi ,
1451 .Ar socppc ,
1452 .Ar sparc ,
1453 .Ar sparc64 ,
1454 .Ar sun3 ,
1455 .Ar vax ,
1456 or
1457 .Ar zaurus .
1458 .El
1459 .Pp
1460 Examples:
1461 .D1 \&.Dt FOO 1
1462 .D1 \&.Dt FOO 4 KM
1463 .D1 \&.Dt FOO 9 i386
1464 .D1 \&.Dt FOO 9 KM i386
1465 .Pp
1466 See also
1467 .Sx \&Dd
1468 and
1469 .Sx \&Os .
1470 .Ss \&Dv
1471 Defined variables such as preprocessor constants.
1472 .Pp
1473 Examples:
1474 .D1 \&.Dv BUFSIZ
1475 .D1 \&.Dv STDOUT_FILENO
1476 .Pp
1477 See also
1478 .Sx \&Er .
1479 .Ss \&Dx
1480 Format the DragonFly BSD version provided as an argument, or a default
1481 value if no argument is provided.
1482 .Pp
1483 Examples:
1484 .D1 \&.Dx 2.4.1
1485 .D1 \&.Dx
1486 .Pp
1487 See also
1488 .Sx \&At ,
1489 .Sx \&Bsx ,
1490 .Sx \&Bx ,
1491 .Sx \&Fx ,
1492 .Sx \&Nx ,
1493 .Sx \&Ox ,
1494 and
1495 .Sx \&Ux .
1496 .Ss \&Ec
1497 .Ss \&Ed
1498 .Ss \&Ef
1499 .Ss \&Ek
1500 .Ss \&El
1501 .Ss \&Em
1502 Denotes text that should be emphasised.
1503 Note that this is a presentation term and should not be used for
1504 stylistically decorating technical terms.
1505 .Pp
1506 Examples:
1507 .D1 \&.Em Warnings!
1508 .D1 \&.Em Remarks :
1509 .Ss \&En
1510 .Ss \&Eo
1511 .Ss \&Er
1512 Display error constants.
1513 .Pp
1514 Examples:
1515 .D1 \&.Er EPERM
1516 .D1 \&.Er ENOENT
1517 .Pp
1518 See also
1519 .Sx \&Dv .
1520 .Ss \&Es
1521 .Ss \&Ev
1522 Environmental variables such as those specified in
1523 .Xr environ 7 .
1524 .Pp
1525 Examples:
1526 .D1 \&.Ev DISPLAY
1527 .D1 \&.Ev PATH
1528 .Ss \&Ex
1529 Inserts text regarding a utility's exit values.
1530 This macro must have first the
1531 .Fl std
1532 argument specified, then an optional
1533 .Ar utility .
1534 If
1535 .Ar utility
1536 is not provided, the document's name as stipulated in
1537 .Sx \&Nm
1538 is provided.
1539 .Ss \&Fa
1540 .Ss \&Fc
1541 .Ss \&Fd
1542 .Ss \&Fl
1543 Command-line flag.
1544 Used when listing arguments to command-line utilities.
1545 Prints a fixed-width hyphen
1546 .Sq \-
1547 directly followed by each argument.
1548 If no arguments are provided, a hyphen is printed followed by a space.
1549 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1550 output.
1551 .Pp
1552 Examples:
1553 .D1 \&.Fl a b c
1554 .D1 \&.Fl \&Pf a b
1555 .D1 \&.Fl
1556 .D1 \&.Op \&Fl o \&Ns \&Ar file
1557 .Pp
1558 See also
1559 .Sx \&Cm .
1560 .Ss \&Fn
1561 .Ss \&Fo
1562 .Ss \&Fr
1563 .Ss \&Ft
1564 .Ss \&Fx
1565 Format the FreeBSD version provided as an argument, or a default value
1566 if no argument is provided.
1567 .Pp
1568 Examples:
1569 .D1 \&.Fx 7.1
1570 .D1 \&.Fx
1571 .Pp
1572 See also
1573 .Sx \&At ,
1574 .Sx \&Bsx ,
1575 .Sx \&Bx ,
1576 .Sx \&Dx ,
1577 .Sx \&Nx ,
1578 .Sx \&Ox ,
1579 and
1580 .Sx \&Ux .
1581 .Ss \&Hf
1582 .Ss \&Ic
1583 .Ss \&In
1584 .Ss \&It
1585 .Ss \&Lb
1586 .Ss \&Li
1587 .Ss \&Lk
1588 Format a hyperlink.
1589 The calling syntax is as follows:
1590 .Pp
1591 .D1 \. Ns Sx \&Lk Cm uri Op Cm name
1592 .Pp
1593 Examples:
1594 .D1 \&.Lk http://bsd.lv "The BSD.lv Project"
1595 .D1 \&.Lk http://bsd.lv
1596 .Pp
1597 See also
1598 .Sx \&Mt .
1599 .Ss \&Lp
1600 .Ss \&Ms
1601 .Ss \&Mt
1602 .Ss \&Nd
1603 .Ss \&Nm
1604 .Ss \&No
1605 .Ss \&Ns
1606 .Ss \&Nx
1607 Format the NetBSD version provided as an argument, or a default value if
1608 no argument is provided.
1609 .Pp
1610 Examples:
1611 .D1 \&.Nx 5.01
1612 .D1 \&.Nx
1613 .Pp
1614 See also
1615 .Sx \&At ,
1616 .Sx \&Bsx ,
1617 .Sx \&Bx ,
1618 .Sx \&Dx ,
1619 .Sx \&Fx ,
1620 .Sx \&Ox ,
1621 and
1622 .Sx \&Ux .
1623 .Ss \&Oc
1624 .Ss \&Oo
1625 .Ss \&Op
1626 .Ss \&Os
1627 Document operating system version.
1628 This is the mandatory third macro of
1629 any
1630 .Nm
1631 file. Its calling syntax is as follows:
1632 .Pp
1633 .D1 \. Ns Sx \&Os Op Cm system
1634 .Pp
1635 The optional
1636 .Cm system
1637 parameter specifies the relevant operating system or environment.
1638 Left unspecified, it defaults to the local operating system version.
1639 This is the suggested form.
1640 .Pp
1641 Examples:
1642 .D1 \&.Os
1643 .D1 \&.Os KTH/CSC/TCS
1644 .D1 \&.Os BSD 4.3
1645 .Pp
1646 See also
1647 .Sx \&Dd
1648 and
1649 .Sx \&Dt .
1650 .Ss \&Ot
1651 Unknown usage.
1652 .Pp
1653 .Em Remarks :
1654 this macro has been deprecated.
1655 .Ss \&Ox
1656 Format the OpenBSD version provided as an argument, or a default value
1657 if no argument is provided.
1658 .Pp
1659 Examples:
1660 .D1 \&.Ox 4.5
1661 .D1 \&.Ox
1662 .Pp
1663 See also
1664 .Sx \&At ,
1665 .Sx \&Bsx ,
1666 .Sx \&Bx ,
1667 .Sx \&Dx ,
1668 .Sx \&Fx ,
1669 .Sx \&Nx ,
1670 and
1671 .Sx \&Ux .
1672 .Ss \&Pa
1673 .Ss \&Pc
1674 .Ss \&Pf
1675 .Ss \&Po
1676 .Ss \&Pp
1677 .Ss \&Pq
1678 .Ss \&Qc
1679 .Ss \&Ql
1680 .Ss \&Qo
1681 .Ss \&Qq
1682 .Ss \&Re
1683 Closes a
1684 .Sx \&Rs
1685 block.
1686 Does not have any tail arguments.
1687 .Ss \&Rs
1688 Begins a bibliographic
1689 .Pq Dq reference
1690 block.
1691 Does not have any head arguments.
1692 The block macro may only contain
1693 .Sx \&%A ,
1694 .Sx \&%B ,
1695 .Sx \&%C ,
1696 .Sx \&%D ,
1697 .Sx \&%I ,
1698 .Sx \&%J ,
1699 .Sx \&%N ,
1700 .Sx \&%O ,
1701 .Sx \&%P ,
1702 .Sx \&%Q ,
1703 .Sx \&%R ,
1704 .Sx \&%T ,
1705 and
1706 .Sx \&%V
1707 child macros (at least one must be specified).
1708 .Pp
1709 Examples:
1710 .Bd -literal -offset indent -compact
1711 \&.Rs
1712 \&.%A J. E. Hopcroft
1713 \&.%A J. D. Ullman
1714 \&.%B Introduction to Automata Theory, Languages, and Computation
1715 \&.%I Addison-Wesley
1716 \&.%C Reading, Massachusettes
1717 \&.%D 1979
1718 \&.Re
1719 .Ed
1720 .Pp
1721 If an
1722 .Sx \&Rs
1723 block is used within a SEE ALSO section, a vertical space is asserted
1724 before the rendered output, else the block continues on the current
1725 line.
1726 .Ss \&Rv
1727 .Ss \&Sc
1728 .Ss \&Sh
1729 .Ss \&Sm
1730 .Ss \&So
1731 .Ss \&Sq
1732 .Ss \&Ss
1733 .Ss \&St
1734 .Ss \&Sx
1735 .Ss \&Sy
1736 .Ss \&Tn
1737 .Ss \&Ud
1738 .Ss \&Ux
1739 Format the UNIX name.
1740 Accepts no argument.
1741 .Pp
1742 Examples:
1743 .D1 \&.Ux
1744 .Pp
1745 See also
1746 .Sx \&At ,
1747 .Sx \&Bsx ,
1748 .Sx \&Bx ,
1749 .Sx \&Dx ,
1750 .Sx \&Fx ,
1751 .Sx \&Nx ,
1752 and
1753 .Sx \&Ox .
1754 .Ss \&Va
1755 .Ss \&Vt
1756 A variable type.
1757 This is also used for indicating global variables in the SYNOPSIS
1758 section, in which case a variable name is also specified.
1759 Note that it accepts
1760 .Sx Block partial-implicit
1761 syntax when invoked as the first macro in the SYNOPSIS section, else it
1762 accepts ordinary
1763 .Sx In-line
1764 syntax.
1765 .Pp
1766 Note that this should not be confused with
1767 .Sx \&Ft ,
1768 which is used for function return types.
1769 .Pp
1770 Examples:
1771 .D1 \&.Vt unsigned char
1772 .D1 \&.Vt extern const char * const sys_signame[] ;
1773 .Pp
1774 See also
1775 .Sx \&Ft
1776 and
1777 .Sx \&Va .
1778 .Ss \&Xc
1779 Close a scope opened by
1780 .Sx \&Xo .
1781 .Ss \&Xo
1782 Open an extension scope.
1783 This macro originally existed to extend the 9-argument limit of troff;
1784 since this limit has been lifted, the macro has been deprecated.
1785 .Ss \&Xr
1786 Link to another manual
1787 .Pq Qq cross-reference .
1788 Its calling syntax is
1789 .Pp
1790 .D1 \. Ns Sx \&Xr Cm name section
1791 .Pp
1792 The
1793 .Cm name
1794 and
1795 .Cm section
1796 are the name and section of the linked manual.
1797 If
1798 .Cm section
1799 is followed by non-punctuation, an
1800 .Sx \&Ns
1801 is inserted into the token stream.
1802 This behaviour is for compatibility with
1803 .Xr groff 1 .
1804 .Pp
1805 Examples:
1806 .D1 \&.Xr mandoc 1
1807 .D1 \&.Xr mandoc 1 ;
1808 .D1 \&.Xr mandoc 1 \&Ns s behaviour
1809 .Ss \&br
1810 .Ss \&sp
1811 .Sh COMPATIBILITY
1812 This section documents compatibility between mandoc and other other
1813 troff implementations, at this time limited to GNU troff
1814 .Pq Qq groff .
1815 The term
1816 .Qq historic groff
1817 refers to groff versions before the
1818 .Pa doc.tmac
1819 file re-write
1820 .Pq somewhere between 1.15 and 1.19 .
1821 .Pp
1822 Heirloom troff, the other significant troff implementation accepting
1823 \-mdoc, is similar to historic groff.
1824 .Pp
1825 .Bl -dash -compact
1826 .It
1827 The comment syntax
1828 .Sq \e."
1829 is no longer accepted.
1830 .It
1831 In groff, the
1832 .Sx \&Pa
1833 macro does not format its arguments when used in the FILES section under
1834 certain list types.
1835 mandoc does.
1836 .It
1837 Historic groff does not print a dash for empty
1838 .Sx \&Fl
1839 arguments.
1840 mandoc and newer groff implementations do.
1841 .It
1842 groff behaves irregularly when specifying
1843 .Sq \ef
1844 .Sx Text Decoration
1845 within line-macro scopes.
1846 mandoc follows a consistent system.
1847 .It
1848 In mandoc, negative scaling units are truncated to zero; groff would
1849 move to prior lines.
1850 Furthermore, the
1851 .Sq f
1852 scaling unit, while accepted, is rendered as the default unit.
1853 .It
1854 In quoted literals, groff allowed pair-wise double-quotes to produce a
1855 standalone double-quote in formatted output.
1856 This idiosyncratic behaviour is not applicable in mandoc.
1857 .It
1858 Display types
1859 .Sx \&Bd
1860 .Fl center
1861 and
1862 .Fl right
1863 are aliases for
1864 .Fl left
1865 in manodc. Furthermore, the
1866 .Fl file Ar file
1867 argument is ignored.
1868 Lastly, since text is not right-justified in mandoc (or even groff),
1869 .Fl ragged
1870 and
1871 .Fl filled
1872 are aliases, as are
1873 .Fl literal
1874 and
1875 .Fl unfilled .
1876 .It
1877 Historic groff has many un-callable macros.
1878 Most of these (excluding some block-level macros) are now callable.
1879 .It
1880 The vertical bar
1881 .Sq \(ba
1882 made historic groff
1883 .Qq go orbital
1884 but has been a proper delimiter since then.
1885 .It
1886 .Sx \&It Fl nested
1887 is assumed for all lists (it wasn't in historic groff): any list may be
1888 nested and
1889 .Fl enum
1890 lists will restart the sequence only for the sub-list.
1891 .It
1892 Some manuals use
1893 .Sx \&Li
1894 incorrectly by following it with a reserved character and expecting the
1895 delimiter to render.
1896 This is not supported in mandoc.
1897 .It
1898 In groff, the
1899 .Sx \&Fo
1900 macro only produces the first parameter.
1901 This is not the case in mandoc.
1902 .It
1903 In groff, the
1904 .Sx \&Cd ,
1905 .Sx \&Er ,
1906 and
1907 .Sx \&Ex
1908 macros were stipulated only to occur in certain manual sections.
1909 mandoc does not have these restrictions.
1910 .El
1911 .Sh SEE ALSO
1912 .Xr mandoc 1 ,
1913 .Xr mandoc_char 7
1914 .Sh AUTHORS
1915 The
1916 .Nm
1917 reference was written by
1918 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
1919 .\"
1920 .\" XXX: this really isn't the place for these caveats.
1921 .\" .
1922 .\" .
1923 .\" .Sh CAVEATS
1924 .\" There are many ambiguous parts of mdoc.
1925 .\" .
1926 .\" .Pp
1927 .\" .Bl -dash -compact
1928 .\" .It
1929 .\" .Sq \&Fa
1930 .\" should be
1931 .\" .Sq \&Va
1932 .\" as function arguments are variables.
1933 .\" .It
1934 .\" .Sq \&Ft
1935 .\" should be
1936 .\" .Sq \&Vt
1937 .\" as function return types are still types. Furthermore, the
1938 .\" .Sq \&Ft
1939 .\" should be removed and
1940 .\" .Sq \&Fo ,
1941 .\" which ostensibly follows it, should follow the same convention as
1942 .\" .Sq \&Va .
1943 .\" .It
1944 .\" .Sq \&Va
1945 .\" should formalise that only one or two arguments are acceptable: a
1946 .\" variable name and optional, preceding type.
1947 .\" .It
1948 .\" .Sq \&Fd
1949 .\" is ambiguous. It's commonly used to indicate an include file in the
1950 .\" synopsis section.
1951 .\" .Sq \&In
1952 .\" should be used, instead.
1953 .\" .It
1954 .\" Only the
1955 .\" .Sq \-literal
1956 .\" argument to
1957 .\" .Sq \&Bd
1958 .\" makes sense. The remaining ones should be removed.
1959 .\" .It
1960 .\" The
1961 .\" .Sq \&Xo
1962 .\" and
1963 .\" .Sq \&Xc
1964 .\" macros should be deprecated.
1965 .\" .It
1966 .\" The
1967 .\" .Sq \&Dt
1968 .\" macro lacks clarity. It should be absolutely clear which title will
1969 .\" render when formatting the manual page.
1970 .\" .It
1971 .\" A
1972 .\" .Sq \&Lx
1973 .\" should be provided for Linux (\(`a la
1974 .\" .Sq \&Ox ,
1975 .\" .Sq \&Nx
1976 .\" etc.).
1977 .\" .It
1978 .\" There's no way to refer to references in
1979 .\" .Sq \&Rs/Re
1980 .\" blocks.
1981 .\" .It
1982 .\" The \-split and \-nosplit dictates via
1983 .\" .Sq \&An
1984 .\" are re-set when entering and leaving the AUTHORS section.
1985 .\" .El
1986 .\" .