]> git.cameronkatri.com Git - mandoc.git/blob - mdoc.7
329bedbb3a29905ac899094c55f29a4b1d40d58f
[mandoc.git] / mdoc.7
1 .\" $OpenBSD: mdoc.7,v 1.56 2010/11/28 15:45:26 schwarze Exp $
2 .\"
3 .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
5 .\"
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
9 .\"
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .\"
18 .Dd $Mdocdate: November 30 2010 $
19 .Dt MDOC 7
20 .Os
21 .Sh NAME
22 .Nm mdoc
23 .Nd mdoc language reference
24 .Sh DESCRIPTION
25 The
26 .Nm mdoc
27 language is used to format
28 .Bx
29 .Ux
30 manuals.
31 This reference document describes its syntax, structure, and
32 usage.
33 The reference implementation is
34 .Xr mandoc 1 ;
35 the
36 .Sx COMPATIBILITY
37 section describes compatibility with other troff \-mdoc implementations.
38 .Pp
39 An
40 .Nm
41 document follows simple rules: lines beginning with the control
42 character
43 .Sq \.
44 are parsed for macros.
45 Other lines are interpreted within the scope of
46 prior macros:
47 .Bd -literal -offset indent
48 \&.Sh Macro lines change control state.
49 Other lines are interpreted within the current state.
50 .Ed
51 .Sh LANGUAGE SYNTAX
52 .Nm
53 documents may contain only graphable 7-bit ASCII characters, the space
54 character, and, in certain circumstances, the tab character.
55 All manuals must have
56 .Ux
57 line terminators.
58 .Ss Comments
59 Text following a
60 .Sq \e\*q ,
61 whether in a macro or free-form text line, is ignored to the end of
62 line.
63 A macro line with only a control character and comment escape,
64 .Sq \&.\e\*q ,
65 is also ignored.
66 Macro lines with only a control character and optional whitespace are
67 stripped from input.
68 .Ss Reserved Characters
69 Within a macro line, the following characters are reserved:
70 .Pp
71 .Bl -tag -width Ds -offset indent -compact
72 .It \&.
73 .Pq period
74 .It \&,
75 .Pq comma
76 .It \&:
77 .Pq colon
78 .It \&;
79 .Pq semicolon
80 .It \&(
81 .Pq left-parenthesis
82 .It \&)
83 .Pq right-parenthesis
84 .It \&[
85 .Pq left-bracket
86 .It \&]
87 .Pq right-bracket
88 .It \&?
89 .Pq question
90 .It \&!
91 .Pq exclamation
92 .It \&|
93 .Pq vertical bar
94 .El
95 .Pp
96 Use of reserved characters is described in
97 .Sx MACRO SYNTAX .
98 For general use in macro lines, these characters can either be escaped
99 with a non-breaking space
100 .Pq Sq \e&
101 or, if applicable, an appropriate escape sequence can be used.
102 .Ss Special Characters
103 Special characters may occur in both macro and free-form lines.
104 Sequences begin with the escape character
105 .Sq \e
106 followed by either an open-parenthesis
107 .Sq \&(
108 for two-character sequences; an open-bracket
109 .Sq \&[
110 for n-character sequences (terminated at a close-bracket
111 .Sq \&] ) ;
112 or a single one character sequence.
113 See
114 .Xr mandoc_char 7
115 for a complete list.
116 Examples include
117 .Sq \e(em
118 .Pq em-dash
119 and
120 .Sq \ee
121 .Pq back-slash .
122 .Ss Text Decoration
123 Terms may be text-decorated using the
124 .Sq \ef
125 escape followed by an indicator: B (bold), I (italic), R (Roman), or P
126 (revert to previous mode):
127 .Pp
128 .D1 \efBbold\efR \efIitalic\efP
129 .Pp
130 A numerical representation 3, 2, or 1 (bold, italic, and Roman,
131 respectively) may be used instead.
132 A text decoration is valid within
133 the current font scope only: if a macro opens a font scope alongside
134 its own scope, such as
135 .Sx \&Bf
136 .Cm \&Sy ,
137 in-scope invocations of
138 .Sq \ef
139 are only valid within the font scope of the macro.
140 If
141 .Sq \ef
142 is specified outside of any font scope, such as in unenclosed, free-form
143 text, it will affect the remainder of the document.
144 .Pp
145 Note this form is
146 .Em not
147 recommended for
148 .Nm ,
149 which encourages semantic annotation.
150 .Ss Predefined Strings
151 Historically,
152 troff
153 also defined a set of package-specific
154 .Dq predefined strings ,
155 which, like
156 .Sx Special Characters ,
157 mark special output characters and strings by way of input codes.
158 Predefined strings are escaped with the slash-asterisk,
159 .Sq \e* :
160 single-character
161 .Sq \e*X ,
162 two-character
163 .Sq \e*(XX ,
164 and N-character
165 .Sq \e*[N] .
166 See
167 .Xr mandoc_char 7
168 for a complete list.
169 Examples include
170 .Sq \e*(Am
171 .Pq ampersand
172 and
173 .Sq \e*(Ba
174 .Pq vertical bar .
175 .Ss Whitespace
176 Whitespace consists of the space character.
177 In free-form lines, whitespace is preserved within a line; unescaped
178 trailing spaces are stripped from input (unless in a literal context).
179 Blank free-form lines, which may include whitespace, are only permitted
180 within literal contexts.
181 .Pp
182 In macro lines, whitespace delimits arguments and is discarded.
183 If arguments are quoted, whitespace within the quotes is retained.
184 .Ss Quotation
185 Macro arguments may be quoted with double-quotes to group
186 space-delimited terms or to retain blocks of whitespace.
187 A quoted argument begins with a double-quote preceded by whitespace.
188 The next double-quote not pairwise adjacent to another double-quote
189 terminates the literal, regardless of surrounding whitespace.
190 .Pp
191 Note that any quoted text, even if it would cause a macro invocation
192 when unquoted, is considered literal text.
193 Thus, the following produces
194 .Sq Op "Fl a" :
195 .Bd -literal -offset indent
196 \&.Op "Fl a"
197 .Ed
198 .Pp
199 In free-form mode, quotes are regarded as opaque text.
200 .Ss Dates
201 There are several macros in
202 .Nm
203 that require a date argument.
204 The canonical form for dates is the American format:
205 .Pp
206 .D1 Cm Month Day , Year
207 .Pp
208 The
209 .Cm Day
210 value is an optionally zero-padded numeral.
211 The
212 .Cm Month
213 value is the full month name.
214 The
215 .Cm Year
216 value is the full four-digit year.
217 .Pp
218 Reduced form dates are broken-down canonical form dates:
219 .Pp
220 .D1 Cm Month , Year
221 .D1 Cm Year
222 .Pp
223 Some examples of valid dates follow:
224 .Pp
225 .D1 "May, 2009" Pq reduced form
226 .D1 "2009" Pq reduced form
227 .D1 "May 20, 2009" Pq canonical form
228 .Ss Scaling Widths
229 Many macros support scaled widths for their arguments, such as
230 stipulating a two-inch list indentation with the following:
231 .Bd -literal -offset indent
232 \&.Bl -tag -width 2i
233 .Ed
234 .Pp
235 The syntax for scaled widths is
236 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
237 where a decimal must be preceded or proceeded by at least one digit.
238 Negative numbers, while accepted, are truncated to zero.
239 The following scaling units are accepted:
240 .Pp
241 .Bl -tag -width Ds -offset indent -compact
242 .It c
243 centimetre
244 .It i
245 inch
246 .It P
247 pica (~1/6 inch)
248 .It p
249 point (~1/72 inch)
250 .It f
251 synonym for
252 .Sq u
253 .It v
254 default vertical span
255 .It m
256 width of rendered
257 .Sq m
258 .Pq em
259 character
260 .It n
261 width of rendered
262 .Sq n
263 .Pq en
264 character
265 .It u
266 default horizontal span
267 .It M
268 mini-em (~1/100 em)
269 .El
270 .Pp
271 Using anything other than
272 .Sq m ,
273 .Sq n ,
274 .Sq u ,
275 or
276 .Sq v
277 is necessarily non-portable across output media.
278 See
279 .Sx COMPATIBILITY .
280 .Ss Sentence Spacing
281 When composing a manual, make sure that sentences end at the end of
282 a line.
283 By doing so, front-ends will be able to apply the proper amount of
284 spacing after the end of sentence (unescaped) period, exclamation mark,
285 or question mark followed by zero or more non-sentence closing
286 delimiters (
287 .Ns Sq \&) ,
288 .Sq \&] ,
289 .Sq \&' ,
290 .Sq \&" ) .
291 .Pp
292 The proper spacing is also intelligently preserved if a sentence ends at
293 the boundary of a macro line.
294 For example:
295 .Pp
296 .D1 \&Xr mandoc 1 \.
297 .D1 \&Fl T \&Ns \&Cm ascii \.
298 .Sh MANUAL STRUCTURE
299 A well-formed
300 .Nm
301 document consists of a document prologue followed by one or more
302 sections.
303 .Pp
304 The prologue, which consists of the
305 .Sx \&Dd ,
306 .Sx \&Dt ,
307 and
308 .Sx \&Os
309 macros in that order, is required for every document.
310 .Pp
311 The first section (sections are denoted by
312 .Sx \&Sh )
313 must be the NAME section, consisting of at least one
314 .Sx \&Nm
315 followed by
316 .Sx \&Nd .
317 .Pp
318 Following that, convention dictates specifying at least the
319 .Em SYNOPSIS
320 and
321 .Em DESCRIPTION
322 sections, although this varies between manual sections.
323 .Pp
324 The following is a well-formed skeleton
325 .Nm
326 file:
327 .Bd -literal -offset indent
328 \&.Dd $\&Mdocdate$
329 \&.Dt mdoc 7
330 \&.Os
331 \&.Sh NAME
332 \&.Nm foo
333 \&.Nd a description goes here
334 \&.\e\*q .Sh LIBRARY
335 \&.\e\*q For sections 2, 3, & 9 only.
336 \&.\e\*q Not used in OpenBSD.
337 \&.Sh SYNOPSIS
338 \&.Nm foo
339 \&.Op Fl options
340 \&.Ar
341 \&.Sh DESCRIPTION
342 The
343 \&.Nm
344 utility processes files ...
345 \&.\e\*q .Sh IMPLEMENTATION NOTES
346 \&.\e\*q Not used in OpenBSD.
347 \&.\e\*q .Sh RETURN VALUES
348 \&.\e\*q For sections 2, 3, & 9 only.
349 \&.\e\*q .Sh ENVIRONMENT
350 \&.\e\*q For sections 1, 6, 7, & 8 only.
351 \&.\e\*q .Sh FILES
352 \&.\e\*q .Sh EXIT STATUS
353 \&.\e\*q For sections 1, 6, & 8 only.
354 \&.\e\*q .Sh EXAMPLES
355 \&.\e\*q .Sh DIAGNOSTICS
356 \&.\e\*q For sections 1, 4, 6, 7, & 8 only.
357 \&.\e\*q .Sh ERRORS
358 \&.\e\*q For sections 2, 3, & 9 only.
359 \&.\e\*q .Sh SEE ALSO
360 \&.\e\*q .Xr foobar 1
361 \&.\e\*q .Sh STANDARDS
362 \&.\e\*q .Sh HISTORY
363 \&.\e\*q .Sh AUTHORS
364 \&.\e\*q .Sh CAVEATS
365 \&.\e\*q .Sh BUGS
366 \&.\e\*q .Sh SECURITY CONSIDERATIONS
367 \&.\e\*q Not used in OpenBSD.
368 .Ed
369 .Pp
370 The sections in an
371 .Nm
372 document are conventionally ordered as they appear above.
373 Sections should be composed as follows:
374 .Bl -ohang -offset Ds
375 .It Em NAME
376 The name(s) and a one line description of the documented material.
377 The syntax for this as follows:
378 .Bd -literal -offset indent
379 \&.Nm name0 ,
380 \&.Nm name1 ,
381 \&.Nm name2
382 \&.Nd a one line description
383 .Ed
384 .Pp
385 The
386 .Sx \&Nm
387 macro(s) must precede the
388 .Sx \&Nd
389 macro.
390 .Pp
391 See
392 .Sx \&Nm
393 and
394 .Sx \&Nd .
395 .It Em LIBRARY
396 The name of the library containing the documented material, which is
397 assumed to be a function in a section 2, 3, or 9 manual.
398 The syntax for this is as follows:
399 .Bd -literal -offset indent
400 \&.Lb libarm
401 .Ed
402 .Pp
403 See
404 .Sx \&Lb .
405 .It Em SYNOPSIS
406 Documents the utility invocation syntax, function call syntax, or device
407 configuration.
408 .Pp
409 For the first, utilities (sections 1, 6, and 8), this is
410 generally structured as follows:
411 .Bd -literal -offset indent
412 \&.Nm foo
413 \&.Op Fl v
414 \&.Op Fl o Ar file
415 \&.Op Ar
416 \&.Nm bar
417 \&.Op Fl v
418 \&.Op Fl o Ar file
419 \&.Op Ar
420 .Ed
421 .Pp
422 For the second, function calls (sections 2, 3, 9):
423 .Bd -literal -offset indent
424 \&.In header.h
425 \&.Vt extern const char *global;
426 \&.Ft "char *"
427 \&.Fn foo "const char *src"
428 \&.Ft "char *"
429 \&.Fn bar "const char *src"
430 .Ed
431 .Pp
432 And for the third, configurations (section 4):
433 .Bd -literal -offset indent
434 \&.Cd \*qit* at isa? port 0x2e\*q
435 \&.Cd \*qit* at isa? port 0x4e\*q
436 .Ed
437 .Pp
438 Manuals not in these sections generally don't need a
439 .Em SYNOPSIS .
440 .Pp
441 Some macros are displayed differently in the
442 .Em SYNOPSIS
443 section, particularly
444 .Sx \&Nm ,
445 .Sx \&Cd ,
446 .Sx \&Fd ,
447 .Sx \&Fn ,
448 .Sx \&Fo ,
449 .Sx \&In ,
450 .Sx \&Vt ,
451 and
452 .Sx \&Ft .
453 All of these macros are output on their own line.
454 If two such dissimilar macros are pairwise invoked (except for
455 .Sx \&Ft
456 before
457 .Sx \&Fo
458 or
459 .Sx \&Fn ) ,
460 they are separated by a vertical space, unless in the case of
461 .Sx \&Fo ,
462 .Sx \&Fn ,
463 and
464 .Sx \&Ft ,
465 which are always separated by vertical space.
466 .Pp
467 When text and macros following an
468 .Sx \&Nm
469 macro starting an input line span multiple output lines,
470 all output lines but the first will be indented to align
471 with the text immediately following the
472 .Sx \&Nm
473 macro, up to the next
474 .Sx \&Nm ,
475 .Sx \&Sh ,
476 or
477 .Sx \&Ss
478 macro or the end of an enclosing block, whichever comes first.
479 .It Em DESCRIPTION
480 This expands upon the brief, one line description in
481 .Em NAME .
482 It usually contains a breakdown of the options (if documenting a
483 command), such as:
484 .Bd -literal -offset indent
485 The arguments are as follows:
486 \&.Bl \-tag \-width Ds
487 \&.It Fl v
488 Print verbose information.
489 \&.El
490 .Ed
491 .Pp
492 Manuals not documenting a command won't include the above fragment.
493 .It Em IMPLEMENTATION NOTES
494 Implementation-specific notes should be kept here.
495 This is useful when implementing standard functions that may have side
496 effects or notable algorithmic implications.
497 .It Em RETURN VALUES
498 This section documents the
499 return values of functions in sections 2, 3, and 9.
500 .Pp
501 See
502 .Sx \&Rv .
503 .It Em ENVIRONMENT
504 Lists the environment variables used by the utility,
505 and explains the syntax and semantics of their values.
506 The
507 .Xr environ 7
508 manual provides examples of typical content and formatting.
509 .Pp
510 See
511 .Sx \&Ev .
512 .It Em FILES
513 Documents files used.
514 It's helpful to document both the file name and a short description of how
515 the file is used (created, modified, etc.).
516 .Pp
517 See
518 .Sx \&Pa .
519 .It Em EXIT STATUS
520 This section documents the
521 command exit status for section 1, 6, and 8 utilities.
522 Historically, this information was described in
523 .Em DIAGNOSTICS ,
524 a practise that is now discouraged.
525 .Pp
526 See
527 .Sx \&Ex .
528 .It Em EXAMPLES
529 Example usages.
530 This often contains snippets of well-formed, well-tested invocations.
531 Make sure that examples work properly!
532 .It Em DIAGNOSTICS
533 Documents error conditions.
534 This is most useful in section 4 manuals.
535 Historically, this section was used in place of
536 .Em EXIT STATUS
537 for manuals in sections 1, 6, and 8; however, this practise is
538 discouraged.
539 .Pp
540 See
541 .Sx \&Bl
542 .Fl diag .
543 .It Em ERRORS
544 Documents error handling in sections 2, 3, and 9.
545 .Pp
546 See
547 .Sx \&Er .
548 .It Em SEE ALSO
549 References other manuals with related topics.
550 This section should exist for most manuals.
551 Cross-references should conventionally be ordered first by section, then
552 alphabetically.
553 .Pp
554 See
555 .Sx \&Xr .
556 .It Em STANDARDS
557 References any standards implemented or used.
558 If not adhering to any standards, the
559 .Em HISTORY
560 section should be used instead.
561 .Pp
562 See
563 .Sx \&St .
564 .It Em HISTORY
565 A brief history of the subject, including where support first appeared.
566 .It Em AUTHORS
567 Credits to the person or persons who wrote the code and/or documentation.
568 Authors should generally be noted by both name and email address.
569 .Pp
570 See
571 .Sx \&An .
572 .It Em CAVEATS
573 Common misuses and misunderstandings should be explained
574 in this section.
575 .It Em BUGS
576 Known bugs, limitations, and work-arounds should be described
577 in this section.
578 .It Em SECURITY CONSIDERATIONS
579 Documents any security precautions that operators should consider.
580 .El
581 .Sh MACRO SYNTAX
582 Macros are one to three three characters in length and begin with a
583 control character,
584 .Sq \&. ,
585 at the beginning of the line.
586 An arbitrary amount of whitespace may sit between the control character
587 and the macro name.
588 Thus, the following are equivalent:
589 .Bd -literal -offset indent
590 \&.Pp
591 \&.\ \ \ \&Pp
592 .Ed
593 .Pp
594 The syntax of a macro depends on its classification.
595 In this section,
596 .Sq \-arg
597 refers to macro arguments, which may be followed by zero or more
598 .Sq parm
599 parameters;
600 .Sq \&Yo
601 opens the scope of a macro; and if specified,
602 .Sq \&Yc
603 closes it out.
604 .Pp
605 The
606 .Em Callable
607 column indicates that the macro may also be called by passing its name
608 as an argument to another macro.
609 If a macro is not callable but its name appears as an argument
610 to another macro, it is interpreted as opaque text.
611 For example,
612 .Sq \&.Fl \&Sh
613 produces
614 .Sq Fl \&Sh .
615 .Pp
616 The
617 .Em Parsed
618 column indicates whether the macro may call other macros by receiving
619 their names as arguments.
620 If a macro is not parsed but the name of another macro appears
621 as an argument, it is interpreted as opaque text.
622 .Pp
623 The
624 .Em Scope
625 column, if applicable, describes closure rules.
626 .Ss Block full-explicit
627 Multi-line scope closed by an explicit closing macro.
628 All macros contains bodies; only
629 .Sx \&Bf
630 contains a head.
631 .Bd -literal -offset indent
632 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
633 \(lBbody...\(rB
634 \&.Yc
635 .Ed
636 .Pp
637 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXX"
638 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
639 .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed
640 .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef
641 .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek
642 .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El
643 .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd
644 .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf
645 .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk
646 .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl
647 .El
648 .Ss Block full-implicit
649 Multi-line scope closed by end-of-file or implicitly by another macro.
650 All macros have bodies; some
651 .Po
652 .Sx \&It Fl bullet ,
653 .Fl hyphen ,
654 .Fl dash ,
655 .Fl enum ,
656 .Fl item
657 .Pc
658 don't have heads; only one
659 .Po
660 .Sx \&It
661 in
662 .Sx \&Bl Fl column
663 .Pc
664 has multiple heads.
665 .Bd -literal -offset indent
666 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
667 \(lBbody...\(rB
668 .Ed
669 .Pp
670 .Bl -column -compact -offset indent "MacroX" "CallableX" "ParsedX" "closed by XXXXXXXXXXX"
671 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
672 .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El
673 .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh
674 .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss
675 .It Sx \&Sh Ta \&No Ta \&No Ta closed by Sx \&Sh
676 .It Sx \&Ss Ta \&No Ta \&No Ta closed by Sx \&Sh , Sx \&Ss
677 .El
678 .Pp
679 Note that the
680 .Sx \&Nm
681 macro is a
682 .Sx Block full-implicit
683 macro only when invoked as the first macro
684 in a
685 .Em SYNOPSIS
686 section line, else it is
687 .Sx In-line .
688 .Ss Block partial-explicit
689 Like block full-explicit, but also with single-line scope.
690 Each has at least a body and, in limited circumstances, a head
691 .Po
692 .Sx \&Fo ,
693 .Sx \&Eo
694 .Pc
695 and/or tail
696 .Pq Sx \&Ec .
697 .Bd -literal -offset indent
698 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
699 \(lBbody...\(rB
700 \&.Yc \(lBtail...\(rB
701
702 \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
703 \(lBbody...\(rB \&Yc \(lBtail...\(rB
704 .Ed
705 .Pp
706 .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -compact -offset indent
707 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
708 .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao
709 .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac
710 .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo
711 .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc
712 .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro
713 .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc
714 .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do
715 .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc
716 .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo
717 .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec
718 .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo
719 .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc
720 .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo
721 .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc
722 .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po
723 .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc
724 .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo
725 .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc
726 .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs
727 .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re
728 .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So
729 .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc
730 .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo
731 .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc
732 .El
733 .Ss Block partial-implicit
734 Like block full-implicit, but with single-line scope closed by
735 .Sx Reserved Characters
736 or end of line.
737 .Bd -literal -offset indent
738 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
739 .Ed
740 .Pp
741 .Bl -column "MacroX" "CallableX" "ParsedX" -compact -offset indent
742 .It Em Macro Ta Em Callable Ta Em Parsed
743 .It Sx \&Aq Ta Yes Ta Yes
744 .It Sx \&Bq Ta Yes Ta Yes
745 .It Sx \&Brq Ta Yes Ta Yes
746 .It Sx \&D1 Ta \&No Ta \&Yes
747 .It Sx \&Dl Ta \&No Ta Yes
748 .It Sx \&Dq Ta Yes Ta Yes
749 .It Sx \&Op Ta Yes Ta Yes
750 .It Sx \&Pq Ta Yes Ta Yes
751 .It Sx \&Ql Ta Yes Ta Yes
752 .It Sx \&Qq Ta Yes Ta Yes
753 .It Sx \&Sq Ta Yes Ta Yes
754 .It Sx \&Vt Ta Yes Ta Yes
755 .El
756 .Pp
757 Note that the
758 .Sx \&Vt
759 macro is a
760 .Sx Block partial-implicit
761 only when invoked as the first macro
762 in a
763 .Em SYNOPSIS
764 section line, else it is
765 .Sx In-line .
766 .Ss In-line
767 Closed by
768 .Sx Reserved Characters ,
769 end of line, fixed argument lengths, and/or subsequent macros.
770 In-line macros have only text children.
771 If a number (or inequality) of arguments is
772 .Pq n ,
773 then the macro accepts an arbitrary number of arguments.
774 .Bd -literal -offset indent
775 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lBres...\(rB
776
777 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
778
779 \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
780 .Ed
781 .Pp
782 .Bl -column "MacroX" "CallableX" "ParsedX" "Arguments" -compact -offset indent
783 .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Arguments
784 .It Sx \&%A Ta \&No Ta \&No Ta >0
785 .It Sx \&%B Ta \&No Ta \&No Ta >0
786 .It Sx \&%C Ta \&No Ta \&No Ta >0
787 .It Sx \&%D Ta \&No Ta \&No Ta >0
788 .It Sx \&%I Ta \&No Ta \&No Ta >0
789 .It Sx \&%J Ta \&No Ta \&No Ta >0
790 .It Sx \&%N Ta \&No Ta \&No Ta >0
791 .It Sx \&%O Ta \&No Ta \&No Ta >0
792 .It Sx \&%P Ta \&No Ta \&No Ta >0
793 .It Sx \&%Q Ta \&No Ta \&No Ta >0
794 .It Sx \&%R Ta \&No Ta \&No Ta >0
795 .It Sx \&%T Ta \&No Ta \&No Ta >0
796 .It Sx \&%U Ta \&No Ta \&No Ta >0
797 .It Sx \&%V Ta \&No Ta \&No Ta >0
798 .It Sx \&Ad Ta Yes Ta Yes Ta n
799 .It Sx \&An Ta Yes Ta Yes Ta n
800 .It Sx \&Ap Ta Yes Ta Yes Ta 0
801 .It Sx \&Ar Ta Yes Ta Yes Ta n
802 .It Sx \&At Ta Yes Ta Yes Ta 1
803 .It Sx \&Bsx Ta Yes Ta Yes Ta n
804 .It Sx \&Bt Ta \&No Ta \&No Ta 0
805 .It Sx \&Bx Ta Yes Ta Yes Ta n
806 .It Sx \&Cd Ta Yes Ta Yes Ta >0
807 .It Sx \&Cm Ta Yes Ta Yes Ta n
808 .It Sx \&Db Ta \&No Ta \&No Ta 1
809 .It Sx \&Dd Ta \&No Ta \&No Ta n
810 .It Sx \&Dt Ta \&No Ta \&No Ta n
811 .It Sx \&Dv Ta Yes Ta Yes Ta n
812 .It Sx \&Dx Ta Yes Ta Yes Ta n
813 .It Sx \&Em Ta Yes Ta Yes Ta >0
814 .It Sx \&En Ta \&No Ta \&No Ta 0
815 .It Sx \&Er Ta Yes Ta Yes Ta >0
816 .It Sx \&Es Ta \&No Ta \&No Ta 0
817 .It Sx \&Ev Ta Yes Ta Yes Ta n
818 .It Sx \&Ex Ta \&No Ta \&No Ta n
819 .It Sx \&Fa Ta Yes Ta Yes Ta n
820 .It Sx \&Fd Ta \&No Ta \&No Ta >0
821 .It Sx \&Fl Ta Yes Ta Yes Ta n
822 .It Sx \&Fn Ta Yes Ta Yes Ta >0
823 .It Sx \&Fr Ta \&No Ta \&No Ta n
824 .It Sx \&Ft Ta Yes Ta Yes Ta n
825 .It Sx \&Fx Ta Yes Ta Yes Ta n
826 .It Sx \&Hf Ta \&No Ta \&No Ta n
827 .It Sx \&Ic Ta Yes Ta Yes Ta >0
828 .It Sx \&In Ta \&No Ta \&No Ta n
829 .It Sx \&Lb Ta \&No Ta \&No Ta 1
830 .It Sx \&Li Ta Yes Ta Yes Ta n
831 .It Sx \&Lk Ta Yes Ta Yes Ta n
832 .It Sx \&Lp Ta \&No Ta \&No Ta 0
833 .It Sx \&Ms Ta Yes Ta Yes Ta >0
834 .It Sx \&Mt Ta Yes Ta Yes Ta >0
835 .It Sx \&Nm Ta Yes Ta Yes Ta n
836 .It Sx \&No Ta Yes Ta Yes Ta 0
837 .It Sx \&Ns Ta Yes Ta Yes Ta 0
838 .It Sx \&Nx Ta Yes Ta Yes Ta n
839 .It Sx \&Os Ta \&No Ta \&No Ta n
840 .It Sx \&Ot Ta \&No Ta \&No Ta n
841 .It Sx \&Ox Ta Yes Ta Yes Ta n
842 .It Sx \&Pa Ta Yes Ta Yes Ta n
843 .It Sx \&Pf Ta Yes Ta Yes Ta 1
844 .It Sx \&Pp Ta \&No Ta \&No Ta 0
845 .It Sx \&Rv Ta \&No Ta \&No Ta n
846 .It Sx \&Sm Ta \&No Ta \&No Ta 1
847 .It Sx \&St Ta \&No Ta Yes Ta 1
848 .It Sx \&Sx Ta Yes Ta Yes Ta >0
849 .It Sx \&Sy Ta Yes Ta Yes Ta >0
850 .It Sx \&Tn Ta Yes Ta Yes Ta >0
851 .It Sx \&Ud Ta \&No Ta \&No Ta 0
852 .It Sx \&Ux Ta Yes Ta Yes Ta n
853 .It Sx \&Va Ta Yes Ta Yes Ta n
854 .It Sx \&Vt Ta Yes Ta Yes Ta >0
855 .It Sx \&Xr Ta Yes Ta Yes Ta >0
856 .It Sx \&br Ta \&No Ta \&No Ta 0
857 .It Sx \&sp Ta \&No Ta \&No Ta 1
858 .El
859 .Sh REFERENCE
860 This section is a canonical reference of all macros, arranged
861 alphabetically.
862 For the scoping of individual macros, see
863 .Sx MACRO SYNTAX .
864 .Ss \&%A
865 Author name of an
866 .Sx \&Rs
867 block.
868 Multiple authors should each be accorded their own
869 .Sx \%%A
870 line.
871 Author names should be ordered with full or abbreviated forename(s)
872 first, then full surname.
873 .Ss \&%B
874 Book title of an
875 .Sx \&Rs
876 block.
877 This macro may also be used in a non-bibliographic context when
878 referring to book titles.
879 .Ss \&%C
880 Publication city or location of an
881 .Sx \&Rs
882 block.
883 .Ss \&%D
884 Publication date of an
885 .Sx \&Rs
886 block.
887 This should follow the reduced or canonical form syntax described in
888 .Sx Dates .
889 .Ss \&%I
890 Publisher or issuer name of an
891 .Sx \&Rs
892 block.
893 .Ss \&%J
894 Journal name of an
895 .Sx \&Rs
896 block.
897 .Ss \&%N
898 Issue number (usually for journals) of an
899 .Sx \&Rs
900 block.
901 .Ss \&%O
902 Optional information of an
903 .Sx \&Rs
904 block.
905 .Ss \&%P
906 Book or journal page number of an
907 .Sx \&Rs
908 block.
909 .Ss \&%Q
910 Institutional author (school, government, etc.) of an
911 .Sx \&Rs
912 block.
913 Multiple institutional authors should each be accorded their own
914 .Sx \&%Q
915 line.
916 .Ss \&%R
917 Technical report name of an
918 .Sx \&Rs
919 block.
920 .Ss \&%T
921 Article title of an
922 .Sx \&Rs
923 block.
924 This macro may also be used in a non-bibliographical context when
925 referring to article titles.
926 .Ss \&%U
927 URI of reference document.
928 .Ss \&%V
929 Volume number of an
930 .Sx \&Rs
931 block.
932 .Ss \&Ac
933 Close an
934 .Sx \&Ao
935 block.
936 Does not have any tail arguments.
937 .Ss \&Ad
938 Memory address.
939 Do not use this for postal addresses.
940 .Pp
941 Examples:
942 .D1 \&.Ad [0,$]
943 .D1 \&.Ad 0x00000000
944 .Ss \&An
945 Author name.
946 Requires either the name of an author or one of the following arguments:
947 .Pp
948 .Bl -tag -width "-nosplitX" -offset indent -compact
949 .It Fl split
950 Start a new output line before each subsequent invocation of
951 .Sx \&An .
952 .It Fl nosplit
953 The opposite of
954 .Fl split .
955 .El
956 .Pp
957 The default is
958 .Fl nosplit .
959 The effect of selecting either of the
960 .Fl split
961 modes ends at the beginning of the
962 .Em AUTHORS
963 section.
964 In the
965 .Em AUTHORS
966 section, the default is
967 .Fl nosplit
968 for the first author listing and
969 .Fl split
970 for all other author listings.
971 .Pp
972 Examples:
973 .D1 \&.An -nosplit
974 .D1 \&.An Kristaps Dzonsons \&Aq kristaps@bsd.lv
975 .Ss \&Ao
976 Begin a block enclosed by angle brackets.
977 Does not have any head arguments.
978 .Pp
979 Examples:
980 .D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac
981 .Pp
982 See also
983 .Sx \&Aq .
984 .Ss \&Ap
985 Inserts an apostrophe without any surrounding whitespace.
986 This is generally used as a grammatical device when referring to the verb
987 form of a function.
988 .Pp
989 Examples:
990 .D1 \&.Fn execve \&Ap d
991 .Ss \&Aq
992 Encloses its arguments in angle brackets.
993 .Pp
994 Examples:
995 .D1 \&.Fl -key= \&Ns \&Aq \&Ar val
996 .Pp
997 .Em Remarks :
998 this macro is often abused for rendering URIs, which should instead use
999 .Sx \&Lk
1000 or
1001 .Sx \&Mt ,
1002 or to note pre-processor
1003 .Dq Li #include
1004 statements, which should use
1005 .Sx \&In .
1006 .Pp
1007 See also
1008 .Sx \&Ao .
1009 .Ss \&Ar
1010 Command arguments.
1011 If an argument is not provided, the string
1012 .Dq file ...\&
1013 is used as a default.
1014 .Pp
1015 Examples:
1016 .D1 \&.Fl o \&Ns \&Ar file1
1017 .D1 \&.Ar
1018 .D1 \&.Ar arg1 , arg2 .
1019 .Ss \&At
1020 Formats an AT&T version.
1021 Accepts one optional argument:
1022 .Pp
1023 .Bl -tag -width "v[1-7] | 32vX" -offset indent -compact
1024 .It Cm v[1-7] | 32v
1025 A version of
1026 .At .
1027 .It Cm V[.[1-4]]?
1028 A version of
1029 .At V .
1030 .El
1031 .Pp
1032 Note that these arguments do not begin with a hyphen.
1033 .Pp
1034 Examples:
1035 .D1 \&.At
1036 .D1 \&.At V.1
1037 .Pp
1038 See also
1039 .Sx \&Bsx ,
1040 .Sx \&Bx ,
1041 .Sx \&Dx ,
1042 .Sx \&Fx ,
1043 .Sx \&Nx ,
1044 .Sx \&Ox ,
1045 and
1046 .Sx \&Ux .
1047 .Ss \&Bc
1048 Close a
1049 .Sx \&Bo
1050 block.
1051 Does not have any tail arguments.
1052 .Ss \&Bd
1053 Begin a display block.
1054 Its syntax is as follows:
1055 .Bd -ragged -offset indent
1056 .Pf \. Sx \&Bd
1057 .Fl Ns Ar type
1058 .Op Fl offset Ar width
1059 .Op Fl compact
1060 .Ed
1061 .Pp
1062 Display blocks are used to select a different indentation and
1063 justification than the one used by the surrounding text.
1064 They may contain both macro lines and free-form text lines.
1065 By default, a display block is preceded by a vertical space.
1066 .Pp
1067 The
1068 .Ar type
1069 must be one of the following:
1070 .Bl -tag -width 13n -offset indent
1071 .It Fl centered
1072 Centre-justify each line.
1073 Using this display type is not recommended; many
1074 .Nm
1075 implementations render it poorly.
1076 .It Fl filled
1077 Left- and right-justify the block.
1078 .It Fl literal
1079 Do not justify the block at all.
1080 Preserve white space and newlines as they appear in the input, including
1081 if it follows a macro.
1082 .It Fl ragged
1083 Only left-justify the block.
1084 .It Fl unfilled
1085 An alias for
1086 .Fl literal .
1087 .El
1088 .Pp
1089 The
1090 .Ar type
1091 must be provided first.
1092 Additional arguments may follow:
1093 .Bl -tag -width 13n -offset indent
1094 .It Fl offset Ar width
1095 Indent the display by the
1096 .Ar width ,
1097 which may be one of the following:
1098 .Bl -item
1099 .It
1100 One of the pre-defined strings
1101 .Cm indent ,
1102 the width of standard indentation;
1103 .Cm indent-two ,
1104 twice
1105 .Cm indent ;
1106 .Cm left ,
1107 which has no effect;
1108 .Cm right ,
1109 which justifies to the right margin; or
1110 .Cm center ,
1111 which aligns around an imagined centre axis.
1112 .It
1113 A macro invocation, which selects a predefined width
1114 associated with that macro.
1115 The most popular is the imaginary macro
1116 .Ar \&Ds ,
1117 which resolves to
1118 .Sy 6n .
1119 .It
1120 A width using the syntax described in
1121 .Sx Scaling Widths .
1122 .It
1123 An arbitrary string, which indents by the length of this string.
1124 .El
1125 .Pp
1126 When the argument is missing,
1127 .Fl offset
1128 is ignored.
1129 .It Fl compact
1130 Do not assert vertical space before the display.
1131 .El
1132 .Pp
1133 Examples:
1134 .Bd -literal -offset indent
1135 \&.Bd \-literal \-offset indent \-compact
1136 Hello world.
1137 \&.Ed
1138 .Ed
1139 .Pp
1140 See also
1141 .Sx \&D1
1142 and
1143 .Sx \&Dl .
1144 .Ss \&Bf
1145 Change the font mode for a scoped block of text.
1146 Its syntax is as follows:
1147 .Bd -ragged -offset indent
1148 .Pf \. Sx \&Bf
1149 .Oo
1150 .Fl emphasis | literal | symbolic |
1151 .Cm \&Em | \&Li | \&Sy
1152 .Oc
1153 .Ed
1154 .Pp
1155 The
1156 .Fl emphasis
1157 and
1158 .Cm \&Em
1159 argument are equivalent, as are
1160 .Fl symbolic
1161 and
1162 .Cm \&Sy ,
1163 and
1164 .Fl literal
1165 and
1166 .Cm \&Li .
1167 Without an argument, this macro does nothing.
1168 The font mode continues until broken by a new font mode in a nested
1169 scope or
1170 .Sx \&Ef
1171 is encountered.
1172 .Pp
1173 See also
1174 .Sx \&Li ,
1175 .Sx \&Ef ,
1176 .Sx \&Em ,
1177 and
1178 .Sx \&Sy .
1179 .Ss \&Bk
1180 Keep the output generated from each macro input line together
1181 on one single output line.
1182 Line breaks in free-form text lines are unaffected.
1183 The syntax is as follows:
1184 .Pp
1185 .D1 Pf \. Sx \&Bk Fl words
1186 .Pp
1187 The
1188 .Fl words
1189 argument is required; additional arguments are ignored.
1190 .Pp
1191 The following example will not break within each
1192 .Sx \&Op
1193 macro line:
1194 .Bd -literal -offset indent
1195 \&.Bk \-words
1196 \&.Op Fl f Ar flags
1197 \&.Op Fl o Ar output
1198 \&.Ek
1199 .Ed
1200 .Pp
1201 Be careful in using over-long lines within a keep block!
1202 Doing so will clobber the right margin.
1203 .Ss \&Bl
1204 Begin a list.
1205 Lists consist of items started by the
1206 .Sx \&It
1207 macro, containing a head or a body or both.
1208 The list syntax is as follows:
1209 .Bd -ragged -offset indent
1210 .Pf \. Sx \&Bl
1211 .Fl Ns Ar type
1212 .Op Fl width Ar val
1213 .Op Fl offset Ar val
1214 .Op Fl compact
1215 .Op HEAD ...
1216 .Ed
1217 .Pp
1218 The list
1219 .Ar type
1220 is mandatory and must be specified first.
1221 The
1222 .Fl width
1223 and
1224 .Fl offset
1225 arguments accept
1226 .Sx Scaling Widths
1227 or use the length of the given string.
1228 The
1229 .Fl offset
1230 is a global indentation for the whole list, affecting both item heads
1231 and bodies.
1232 For those list types supporting it, the
1233 .Fl width
1234 argument requests an additional indentation of item bodies,
1235 to be added to the
1236 .Fl offset .
1237 Unless the
1238 .Fl compact
1239 argument is specified, list entries are separated by vertical space.
1240 .Pp
1241 A list must specify one of the following list types:
1242 .Bl -tag -width 12n -offset indent
1243 .It Fl bullet
1244 No item heads can be specified, but a bullet will be printed at the head
1245 of each item.
1246 Item bodies start on the same output line as the bullet
1247 and are indented according to the
1248 .Fl width
1249 argument.
1250 .It Fl column
1251 A columnated list.
1252 The
1253 .Fl width
1254 argument has no effect; instead, each argument specifies the width
1255 of one column, using either the
1256 .Sx Scaling Widths
1257 syntax or the string length of the argument.
1258 If the first line of the body of a
1259 .Fl column
1260 list is not an
1261 .Sx \&It
1262 macro line,
1263 .Sx \&It
1264 contexts spanning one input line each are implied until an
1265 .Sx \&It
1266 macro line is encountered, at which point items start being interpreted as
1267 described in the
1268 .Sx \&It
1269 documentation.
1270 .It Fl dash
1271 Like
1272 .Fl bullet ,
1273 except that dashes are used in place of bullets.
1274 .It Fl diag
1275 Like
1276 .Fl inset ,
1277 except that item heads are not parsed for macro invocations.
1278 .\" but with additional formatting to the head.
1279 .It Fl enum
1280 A numbered list.
1281 Formatted like
1282 .Fl bullet ,
1283 except that cardinal numbers are used in place of bullets,
1284 starting at 1.
1285 .It Fl hang
1286 Like
1287 .Fl tag ,
1288 except that the first lines of item bodies are not indented, but follow
1289 the item heads like in
1290 .Fl inset
1291 lists.
1292 .It Fl hyphen
1293 Synonym for
1294 .Fl dash .
1295 .It Fl inset
1296 Item bodies follow items heads on the same line, using normal inter-word
1297 spacing.
1298 Bodies are not indented, and the
1299 .Fl width
1300 argument is ignored.
1301 .It Fl item
1302 No item heads can be specified, and none are printed.
1303 Bodies are not indented, and the
1304 .Fl width
1305 argument is ignored.
1306 .It Fl ohang
1307 Item bodies start on the line following item heads and are not indented.
1308 The
1309 .Fl width
1310 argument is ignored.
1311 .It Fl tag
1312 Item bodies are indented according to the
1313 .Fl width
1314 argument.
1315 When an item head fits inside the indentation, the item body follows
1316 this head on the same output line.
1317 Otherwise, the body starts on the output line following the head.
1318 .El
1319 .Pp
1320 See also
1321 .Sx \&El
1322 and
1323 .Sx \&It .
1324 .Ss \&Bo
1325 Begin a block enclosed by square brackets.
1326 Does not have any head arguments.
1327 .Pp
1328 Examples:
1329 .Bd -literal -offset indent -compact
1330 \&.Bo 1 ,
1331 \&.Dv BUFSIZ \&Bc
1332 .Ed
1333 .Pp
1334 See also
1335 .Sx \&Bq .
1336 .Ss \&Bq
1337 Encloses its arguments in square brackets.
1338 .Pp
1339 Examples:
1340 .D1 \&.Bq 1 , \&Dv BUFSIZ
1341 .Pp
1342 .Em Remarks :
1343 this macro is sometimes abused to emulate optional arguments for
1344 commands; the correct macros to use for this purpose are
1345 .Sx \&Op ,
1346 .Sx \&Oo ,
1347 and
1348 .Sx \&Oc .
1349 .Pp
1350 See also
1351 .Sx \&Bo .
1352 .Ss \&Brc
1353 Close a
1354 .Sx \&Bro
1355 block.
1356 Does not have any tail arguments.
1357 .Ss \&Bro
1358 Begin a block enclosed by curly braces.
1359 Does not have any head arguments.
1360 .Pp
1361 Examples:
1362 .Bd -literal -offset indent -compact
1363 \&.Bro 1 , ... ,
1364 \&.Va n \&Brc
1365 .Ed
1366 .Pp
1367 See also
1368 .Sx \&Brq .
1369 .Ss \&Brq
1370 Encloses its arguments in curly braces.
1371 .Pp
1372 Examples:
1373 .D1 \&.Brq 1 , ... , \&Va n
1374 .Pp
1375 See also
1376 .Sx \&Bro .
1377 .Ss \&Bsx
1378 Format the BSD/OS version provided as an argument, or a default value if
1379 no argument is provided.
1380 .Pp
1381 Examples:
1382 .D1 \&.Bsx 1.0
1383 .D1 \&.Bsx
1384 .Pp
1385 See also
1386 .Sx \&At ,
1387 .Sx \&Bx ,
1388 .Sx \&Dx ,
1389 .Sx \&Fx ,
1390 .Sx \&Nx ,
1391 .Sx \&Ox ,
1392 and
1393 .Sx \&Ux .
1394 .Ss \&Bt
1395 Prints
1396 .Dq is currently in beta test .
1397 .Ss \&Bx
1398 Format the BSD version provided as an argument, or a default value if no
1399 argument is provided.
1400 .Pp
1401 Examples:
1402 .D1 \&.Bx 4.4
1403 .D1 \&.Bx
1404 .Pp
1405 See also
1406 .Sx \&At ,
1407 .Sx \&Bsx ,
1408 .Sx \&Dx ,
1409 .Sx \&Fx ,
1410 .Sx \&Nx ,
1411 .Sx \&Ox ,
1412 and
1413 .Sx \&Ux .
1414 .Ss \&Cd
1415 Kernel configuration declaration.
1416 This denotes strings accepted by
1417 .Xr config 8 .
1418 .Pp
1419 Examples:
1420 .D1 \&.Cd device le0 at scode?
1421 .Pp
1422 .Em Remarks :
1423 this macro is commonly abused by using quoted literals to retain
1424 whitespace and align consecutive
1425 .Sx \&Cd
1426 declarations.
1427 This practise is discouraged.
1428 .Ss \&Cm
1429 Command modifiers.
1430 Useful when specifying configuration options or keys.
1431 .Pp
1432 Examples:
1433 .D1 \&.Cm ControlPath
1434 .D1 \&.Cm ControlMaster
1435 .Pp
1436 See also
1437 .Sx \&Fl .
1438 .Ss \&D1
1439 One-line indented display.
1440 This is formatted by the default rules and is useful for simple indented
1441 statements.
1442 It is followed by a newline.
1443 .Pp
1444 Examples:
1445 .D1 \&.D1 \&Fl abcdefgh
1446 .Pp
1447 See also
1448 .Sx \&Bd
1449 and
1450 .Sx \&Dl .
1451 .Ss \&Db
1452 Switch debugging mode.
1453 Its syntax is as follows:
1454 .Pp
1455 .D1 Pf \. Sx \&Db Cm on | off
1456 .Pp
1457 This macro is ignored by
1458 .Xr mandoc 1 .
1459 .Ss \&Dc
1460 Close a
1461 .Sx \&Do
1462 block.
1463 Does not have any tail arguments.
1464 .Ss \&Dd
1465 Document date.
1466 This is the mandatory first macro of any
1467 .Nm
1468 manual.
1469 Its syntax is as follows:
1470 .Pp
1471 .D1 Pf \. Sx \&Dd Op Ar date
1472 .Pp
1473 The
1474 .Ar date
1475 may be either
1476 .Ar $\&Mdocdate$ ,
1477 which signifies the current manual revision date dictated by
1478 .Xr cvs 1 ,
1479 or instead a valid canonical date as specified by
1480 .Sx Dates .
1481 If a date does not conform or is empty, the current date is used.
1482 .Pp
1483 Examples:
1484 .D1 \&.Dd $\&Mdocdate$
1485 .D1 \&.Dd $\&Mdocdate: July 21 2007$
1486 .D1 \&.Dd July 21, 2007
1487 .Pp
1488 See also
1489 .Sx \&Dt
1490 and
1491 .Sx \&Os .
1492 .Ss \&Dl
1493 One-line intended display.
1494 This is formatted as literal text and is useful for commands and
1495 invocations.
1496 It is followed by a newline.
1497 .Pp
1498 Examples:
1499 .D1 \&.Dl % mandoc mdoc.7 \e(ba less
1500 .Pp
1501 See also
1502 .Sx \&Bd
1503 and
1504 .Sx \&D1 .
1505 .Ss \&Do
1506 Begin a block enclosed by double quotes.
1507 Does not have any head arguments.
1508 .Pp
1509 Examples:
1510 .Bd -literal -offset indent -compact
1511 \&.Do
1512 April is the cruellest month
1513 \&.Dc
1514 \e(em T.S. Eliot
1515 .Ed
1516 .Pp
1517 See also
1518 .Sx \&Dq .
1519 .Ss \&Dq
1520 Encloses its arguments in
1521 .Dq typographic
1522 double-quotes.
1523 .Pp
1524 Examples:
1525 .Bd -literal -offset indent -compact
1526 \&.Dq April is the cruellest month
1527 \e(em T.S. Eliot
1528 .Ed
1529 .Pp
1530 See also
1531 .Sx \&Qq ,
1532 .Sx \&Sq ,
1533 and
1534 .Sx \&Do .
1535 .Ss \&Dt
1536 Document title.
1537 This is the mandatory second macro of any
1538 .Nm
1539 file.
1540 Its syntax is as follows:
1541 .Bd -ragged -offset indent
1542 .Pf \. Sx \&Dt
1543 .Oo
1544 .Ar title
1545 .Oo
1546 .Ar section
1547 .Op Ar volume | arch
1548 .Oc
1549 .Oc
1550 .Ed
1551 .Pp
1552 Its arguments are as follows:
1553 .Bl -tag -width Ds -offset Ds
1554 .It Ar title
1555 The document's title (name), defaulting to
1556 .Dq UNKNOWN
1557 if unspecified.
1558 It should be capitalised.
1559 .It Ar section
1560 The manual section.
1561 This may be one of
1562 .Ar 1
1563 .Pq utilities ,
1564 .Ar 2
1565 .Pq system calls ,
1566 .Ar 3
1567 .Pq libraries ,
1568 .Ar 3p
1569 .Pq Perl libraries ,
1570 .Ar 4
1571 .Pq devices ,
1572 .Ar 5
1573 .Pq file formats ,
1574 .Ar 6
1575 .Pq games ,
1576 .Ar 7
1577 .Pq miscellaneous ,
1578 .Ar 8
1579 .Pq system utilities ,
1580 .Ar 9
1581 .Pq kernel functions ,
1582 .Ar X11
1583 .Pq X Window System ,
1584 .Ar X11R6
1585 .Pq X Window System ,
1586 .Ar unass
1587 .Pq unassociated ,
1588 .Ar local
1589 .Pq local system ,
1590 .Ar draft
1591 .Pq draft manual ,
1592 or
1593 .Ar paper
1594 .Pq paper .
1595 It should correspond to the manual's filename suffix and defaults to
1596 .Dq 1
1597 if unspecified.
1598 .It Ar volume
1599 This overrides the volume inferred from
1600 .Ar section .
1601 This field is optional, and if specified, must be one of
1602 .Ar USD
1603 .Pq users' supplementary documents ,
1604 .Ar PS1
1605 .Pq programmers' supplementary documents ,
1606 .Ar AMD
1607 .Pq administrators' supplementary documents ,
1608 .Ar SMM
1609 .Pq system managers' manuals ,
1610 .Ar URM
1611 .Pq users' reference manuals ,
1612 .Ar PRM
1613 .Pq programmers' reference manuals ,
1614 .Ar KM
1615 .Pq kernel manuals ,
1616 .Ar IND
1617 .Pq master index ,
1618 .Ar MMI
1619 .Pq master index ,
1620 .Ar LOCAL
1621 .Pq local manuals ,
1622 .Ar LOC
1623 .Pq local manuals ,
1624 or
1625 .Ar CON
1626 .Pq contributed manuals .
1627 .It Ar arch
1628 This specifies a specific relevant architecture.
1629 If
1630 .Ar volume
1631 is not provided, it may be used in its place, else it may be used
1632 subsequent that.
1633 It, too, is optional.
1634 It must be one of
1635 .Ar alpha ,
1636 .Ar amd64 ,
1637 .Ar amiga ,
1638 .Ar arc ,
1639 .Ar arm ,
1640 .Ar armish ,
1641 .Ar aviion ,
1642 .Ar hp300 ,
1643 .Ar hppa ,
1644 .Ar hppa64 ,
1645 .Ar i386 ,
1646 .Ar landisk ,
1647 .Ar loongson ,
1648 .Ar luna88k ,
1649 .Ar mac68k ,
1650 .Ar macppc ,
1651 .Ar mips64 ,
1652 .Ar mvme68k ,
1653 .Ar mvme88k ,
1654 .Ar mvmeppc ,
1655 .Ar pmax ,
1656 .Ar sgi ,
1657 .Ar socppc ,
1658 .Ar sparc ,
1659 .Ar sparc64 ,
1660 .Ar sun3 ,
1661 .Ar vax ,
1662 or
1663 .Ar zaurus .
1664 .El
1665 .Pp
1666 Examples:
1667 .D1 \&.Dt FOO 1
1668 .D1 \&.Dt FOO 4 KM
1669 .D1 \&.Dt FOO 9 i386
1670 .Pp
1671 See also
1672 .Sx \&Dd
1673 and
1674 .Sx \&Os .
1675 .Ss \&Dv
1676 Defined variables such as preprocessor constants.
1677 .Pp
1678 Examples:
1679 .D1 \&.Dv BUFSIZ
1680 .D1 \&.Dv STDOUT_FILENO
1681 .Pp
1682 See also
1683 .Sx \&Er .
1684 .Ss \&Dx
1685 Format the DragonFly BSD version provided as an argument, or a default
1686 value if no argument is provided.
1687 .Pp
1688 Examples:
1689 .D1 \&.Dx 2.4.1
1690 .D1 \&.Dx
1691 .Pp
1692 See also
1693 .Sx \&At ,
1694 .Sx \&Bsx ,
1695 .Sx \&Bx ,
1696 .Sx \&Fx ,
1697 .Sx \&Nx ,
1698 .Sx \&Ox ,
1699 and
1700 .Sx \&Ux .
1701 .Ss \&Ec
1702 Close a scope started by
1703 .Sx \&Eo .
1704 Its syntax is as follows:
1705 .Pp
1706 .D1 Pf \. Sx \&Ec Op Ar TERM
1707 .Pp
1708 The
1709 .Ar TERM
1710 argument is used as the enclosure tail, for example, specifying \e(rq
1711 will emulate
1712 .Sx \&Dc .
1713 .Ss \&Ed
1714 End a display context started by
1715 .Sx \&Bd .
1716 .Ss \&Ef
1717 End a font mode context started by
1718 .Sx \&Bf .
1719 .Ss \&Ek
1720 End a keep context started by
1721 .Sx \&Bk .
1722 .Ss \&El
1723 End a list context started by
1724 .Sx \&Bl .
1725 .Pp
1726 See also
1727 .Sx \&Bl
1728 and
1729 .Sx \&It .
1730 .Ss \&Em
1731 Denotes text that should be emphasised.
1732 Note that this is a presentation term and should not be used for
1733 stylistically decorating technical terms.
1734 .Pp
1735 Examples:
1736 .D1 \&.Em Warnings!
1737 .D1 \&.Em Remarks :
1738 .Pp
1739 See also
1740 .Sx \&Bf ,
1741 .Sx \&Sy ,
1742 and
1743 .Sx \&Li .
1744 .Ss \&En
1745 This macro is obsolete and not implemented in
1746 .Xr mandoc 1 .
1747 .Ss \&Eo
1748 An arbitrary enclosure.
1749 Its syntax is as follows:
1750 .Pp
1751 .D1 Pf \. Sx \&Eo Op Ar TERM
1752 .Pp
1753 The
1754 .Ar TERM
1755 argument is used as the enclosure head, for example, specifying \e(lq
1756 will emulate
1757 .Sx \&Do .
1758 .Ss \&Er
1759 Display error constants.
1760 .Pp
1761 Examples:
1762 .D1 \&.Er EPERM
1763 .D1 \&.Er ENOENT
1764 .Pp
1765 See also
1766 .Sx \&Dv .
1767 .Ss \&Es
1768 This macro is obsolete and not implemented.
1769 .Ss \&Ev
1770 Environmental variables such as those specified in
1771 .Xr environ 7 .
1772 .Pp
1773 Examples:
1774 .D1 \&.Ev DISPLAY
1775 .D1 \&.Ev PATH
1776 .Ss \&Ex
1777 Insert a standard sentence regarding exit values.
1778 Its syntax is as follows:
1779 .Pp
1780 .D1 Pf \. Sx \&Ex Fl std Op Ar utility
1781 .Pp
1782 When
1783 .Ar utility
1784 is not specified, the document's name set by
1785 .Sx \&Nm
1786 is used.
1787 .Pp
1788 See also
1789 .Sx \&Rv .
1790 .Ss \&Fa
1791 Function argument.
1792 Its syntax is as follows:
1793 .Bd -ragged -offset indent
1794 .Pf \. Sx \&Fa
1795 .Op Cm argtype
1796 .Cm argname
1797 .Ed
1798 .Pp
1799 This may be invoked for names with or without the corresponding type.
1800 It is also used to specify the field name of a structure.
1801 Most often, the
1802 .Sx \&Fa
1803 macro is used in the
1804 .Em SYNOPSIS
1805 within
1806 .Sx \&Fo
1807 section when documenting multi-line function prototypes.
1808 If invoked with multiple arguments, the arguments are separated by a
1809 comma.
1810 Furthermore, if the following macro is another
1811 .Sx \&Fa ,
1812 the last argument will also have a trailing comma.
1813 .Pp
1814 Examples:
1815 .D1 \&.Fa \(dqconst char *p\(dq
1816 .D1 \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1817 .D1 \&.Fa foo
1818 .Pp
1819 See also
1820 .Sx \&Fo .
1821 .Ss \&Fc
1822 End a function context started by
1823 .Sx \&Fo .
1824 .Ss \&Fd
1825 Historically used to document include files.
1826 This usage has been deprecated in favour of
1827 .Sx \&In .
1828 Do not use this macro.
1829 .Pp
1830 See also
1831 .Sx MANUAL STRUCTURE
1832 and
1833 .Sx \&In .
1834 .Ss \&Fl
1835 Command-line flag.
1836 Used when listing arguments to command-line utilities.
1837 Prints a fixed-width hyphen
1838 .Sq \-
1839 directly followed by each argument.
1840 If no arguments are provided, a hyphen is printed followed by a space.
1841 If the argument is a macro, a hyphen is prefixed to the subsequent macro
1842 output.
1843 .Pp
1844 Examples:
1845 .D1 \&.Fl a b c
1846 .D1 \&.Fl \&Pf a b
1847 .D1 \&.Fl
1848 .D1 \&.Op \&Fl o \&Ns \&Ar file
1849 .Pp
1850 See also
1851 .Sx \&Cm .
1852 .Ss \&Fn
1853 A function name.
1854 Its syntax is as follows:
1855 .Bd -ragged -offset indent
1856 .Pf \. Ns Sx \&Fn
1857 .Op Cm functype
1858 .Cm funcname
1859 .Op Oo Cm argtype Oc Cm argname
1860 .Ed
1861 .Pp
1862 Function arguments are surrounded in parenthesis and
1863 are delimited by commas.
1864 If no arguments are specified, blank parenthesis are output.
1865 .Pp
1866 Examples:
1867 .D1 \&.Fn "int funcname" "int arg0" "int arg1"
1868 .D1 \&.Fn funcname "int arg0"
1869 .D1 \&.Fn funcname arg0
1870 .Bd -literal -offset indent -compact
1871 \&.Ft functype
1872 \&.Fn funcname
1873 .Ed
1874 .Pp
1875 When referring to a function documented in another manual page, use
1876 .Sx \&Xr
1877 instead.
1878 See also
1879 .Sx MANUAL STRUCTURE
1880 and
1881 .Sx \&Ft .
1882 .Ss \&Fo
1883 Begin a function block.
1884 This is a multi-line version of
1885 .Sx \&Fn .
1886 Its syntax is as follows:
1887 .Pp
1888 .D1 Pf \. Sx \&Fo Cm funcname
1889 .Pp
1890 Invocations usually occur in the following context:
1891 .Bd -ragged -offset indent
1892 .Pf \. Sx \&Ft Cm functype
1893 .br
1894 .Pf \. Sx \&Fo Cm funcname
1895 .br
1896 .Pf \. Sx \&Fa Oo Cm argtype Oc Cm argname
1897 .br
1898 \.\.\.
1899 .br
1900 .Pf \. Sx \&Fc
1901 .Ed
1902 .Pp
1903 A
1904 .Sx \&Fo
1905 scope is closed by
1906 .Pp
1907 See also
1908 .Sx MANUAL STRUCTURE ,
1909 .Sx \&Fa ,
1910 .Sx \&Fc ,
1911 and
1912 .Sx \&Ft .
1913 .Ss \&Ft
1914 A function type.
1915 Its syntax is as follows:
1916 .Pp
1917 .D1 Pf \. Sx \&Ft Cm functype
1918 .Pp
1919 Examples:
1920 .D1 \&.Ft int
1921 .Bd -literal -offset indent -compact
1922 \&.Ft functype
1923 \&.Fn funcname
1924 .Ed
1925 .Pp
1926 See also
1927 .Sx MANUAL STRUCTURE ,
1928 .Sx \&Fn ,
1929 and
1930 .Sx \&Fo .
1931 .Ss \&Fx
1932 Format the
1933 .Fx
1934 version provided as an argument, or a default value
1935 if no argument is provided.
1936 .Pp
1937 Examples:
1938 .D1 \&.Fx 7.1
1939 .D1 \&.Fx
1940 .Pp
1941 See also
1942 .Sx \&At ,
1943 .Sx \&Bsx ,
1944 .Sx \&Bx ,
1945 .Sx \&Dx ,
1946 .Sx \&Nx ,
1947 .Sx \&Ox ,
1948 and
1949 .Sx \&Ux .
1950 .Ss \&Hf
1951 This macro is obsolete and not implemented.
1952 .Ss \&Ic
1953 Designate an internal or interactive command.
1954 This is similar to
1955 .Sx \&Cm
1956 but used for instructions rather than values.
1957 .Pp
1958 Examples:
1959 .D1 \&.Ic hash
1960 .D1 \&.Ic alias
1961 .Pp
1962 Note that using
1963 .Sx \&Bd Fl literal
1964 or
1965 .Sx \&D1
1966 is preferred for displaying code; the
1967 .Sx \&Ic
1968 macro is used when referring to specific instructions.
1969 .Ss \&In
1970 An
1971 .Dq include
1972 file.
1973 In the
1974 .Em SYNOPSIS
1975 section (only if invoked as the line macro), the first argument is
1976 preceded by
1977 .Dq #include ,
1978 the arguments is enclosed in angle brackets.
1979 .Pp
1980 Examples:
1981 .D1 \&.In sys/types
1982 .Pp
1983 See also
1984 .Sx MANUAL STRUCTURE .
1985 .Ss \&It
1986 A list item.
1987 The syntax of this macro depends on the list type.
1988 .Pp
1989 Lists
1990 of type
1991 .Fl hang ,
1992 .Fl ohang ,
1993 .Fl inset ,
1994 and
1995 .Fl diag
1996 have the following syntax:
1997 .Pp
1998 .D1 Pf \. Sx \&It Cm args
1999 .Pp
2000 Lists of type
2001 .Fl bullet ,
2002 .Fl dash ,
2003 .Fl enum ,
2004 .Fl hyphen
2005 and
2006 .Fl item
2007 have the following syntax:
2008 .Pp
2009 .D1 Pf \. Sx \&It
2010 .Pp
2011 with subsequent lines interpreted within the scope of the
2012 .Sx \&It
2013 until either a closing
2014 .Sx \&El
2015 or another
2016 .Sx \&It .
2017 .Pp
2018 The
2019 .Fl tag
2020 list has the following syntax:
2021 .Pp
2022 .D1 Pf \. Sx \&It Op Cm args
2023 .Pp
2024 Subsequent lines are interpreted as with
2025 .Fl bullet
2026 and family.
2027 The line arguments correspond to the list's left-hand side; body
2028 arguments correspond to the list's contents.
2029 .Pp
2030 The
2031 .Fl column
2032 list is the most complicated.
2033 Its syntax is as follows:
2034 .Pp
2035 .D1 Pf \. Sx \&It Op Cm args
2036 .Pp
2037 The
2038 .Cm args
2039 are phrases, a mix of macros and text corresponding to a line column,
2040 delimited by tabs or the special
2041 .Sq \&Ta
2042 pseudo-macro.
2043 Lines subsequent the
2044 .Sx \&It
2045 are interpreted within the scope of the last phrase.
2046 Calling the pseudo-macro
2047 .Sq \&Ta
2048 will open a new phrase scope (this must occur on a macro line to be
2049 interpreted as a macro).
2050 Note that the tab phrase delimiter may only be used within the
2051 .Sx \&It
2052 line itself.
2053 Subsequent this, only the
2054 .Sq \&Ta
2055 pseudo-macro may be used to delimit phrases.
2056 Furthermore, note that quoted sections propagate over tab-delimited
2057 phrases on an
2058 .Sx \&It ,
2059 for example,
2060 .Pp
2061 .D1 .It \(dqcol1 ; <TAB> col2 ;\(dq \&;
2062 .Pp
2063 will preserve the semicolon whitespace except for the last.
2064 .Pp
2065 See also
2066 .Sx \&Bl .
2067 .Ss \&Lb
2068 Specify a library.
2069 The syntax is as follows:
2070 .Pp
2071 .D1 Pf \. Sx \&Lb Cm library
2072 .Pp
2073 The
2074 .Cm library
2075 parameter may be a system library, such as
2076 .Cm libz
2077 or
2078 .Cm libpam ,
2079 in which case a small library description is printed next to the linker
2080 invocation; or a custom library, in which case the library name is
2081 printed in quotes.
2082 This is most commonly used in the
2083 .Em SYNOPSIS
2084 section as described in
2085 .Sx MANUAL STRUCTURE .
2086 .Pp
2087 Examples:
2088 .D1 \&.Lb libz
2089 .D1 \&.Lb mdoc
2090 .Ss \&Li
2091 Denotes text that should be in a literal font mode.
2092 Note that this is a presentation term and should not be used for
2093 stylistically decorating technical terms.
2094 .Pp
2095 See also
2096 .Sx \&Bf ,
2097 .Sx \&Sy ,
2098 and
2099 .Sx \&Em .
2100 .Ss \&Lk
2101 Format a hyperlink.
2102 Its syntax is as follows:
2103 .Pp
2104 .D1 Pf \. Sx \&Lk Cm uri Op Cm name
2105 .Pp
2106 Examples:
2107 .D1 \&.Lk http://bsd.lv \*qThe BSD.lv Project\*q
2108 .D1 \&.Lk http://bsd.lv
2109 .Pp
2110 See also
2111 .Sx \&Mt .
2112 .Ss \&Lp
2113 Synonym for
2114 .Sx \&Pp .
2115 .Ss \&Ms
2116 Display a mathematical symbol.
2117 Its syntax is as follows:
2118 .Pp
2119 .D1 Pf \. Sx \&Ms Cm symbol
2120 .Pp
2121 Examples:
2122 .D1 \&.Ms sigma
2123 .D1 \&.Ms aleph
2124 .Ss \&Mt
2125 Format a
2126 .Dq mailto:
2127 hyperlink.
2128 If an argument is not provided, the string
2129 .Dq \(ti
2130 is used as a default.
2131 Its syntax is as follows:
2132 .Pp
2133 .D1 Pf \. Sx \&Mt Cm address
2134 .Pp
2135 Examples:
2136 .D1 \&.Mt discuss@manpages.bsd.lv
2137 .Ss \&Nd
2138 A one line description of the manual's content.
2139 This may only be invoked in the
2140 .Em SYNOPSIS
2141 section subsequent the
2142 .Sx \&Nm
2143 macro.
2144 .Pp
2145 Examples:
2146 .D1 \&.Sx \&Nd mdoc language reference
2147 .D1 \&.Sx \&Nd format and display UNIX manuals
2148 .Pp
2149 The
2150 .Sx \&Nd
2151 macro technically accepts child macros and terminates with a subsequent
2152 .Sx \&Sh
2153 invocation.
2154 Do not assume this behaviour: some
2155 .Xr whatis 1
2156 database generators are not smart enough to parse more than the line
2157 arguments and will display macros verbatim.
2158 .Pp
2159 See also
2160 .Sx \&Nm .
2161 .Ss \&Nm
2162 The name of the manual page, or \(em in particular in section 1, 6,
2163 and 8 pages \(em of an additional command or feature documented in
2164 the manual page.
2165 When first invoked, the
2166 .Sx \&Nm
2167 macro expects a single argument, the name of the manual page.
2168 Usually, the first invocation happens in the
2169 .Em NAME
2170 section of the page.
2171 The specified name will be remembered and used whenever the macro is
2172 called again without arguments later in the page.
2173 The
2174 .Sx \&Nm
2175 macro uses
2176 .Sx Block full-implicit
2177 semantics when invoked as the first macro on an input line in the
2178 .Em SYNOPSIS
2179 section; otherwise, it uses ordinary
2180 .Sx In-line
2181 semantics.
2182 .Pp
2183 Examples:
2184 .Bd -literal -offset indent
2185 \&.Sh SYNOPSIS
2186 \&.Nm cat
2187 \&.Op Fl benstuv
2188 \&.Op Ar
2189 .Ed
2190 .Pp
2191 In the
2192 .Em SYNOPSIS
2193 of section 2, 3 and 9 manual pages, use the
2194 .Sx \&Fn
2195 macro rather than
2196 .Sx \&Nm
2197 to mark up the name of the manual page.
2198 .Ss \&No
2199 A
2200 .Dq noop
2201 macro used to terminate prior macro contexts.
2202 .Pp
2203 Examples:
2204 .D1 \&.Sx \&Fl ab \&No cd \&Fl ef
2205 .Ss \&Ns
2206 Suppress a space.
2207 Following invocation, text is interpreted as free-form text until a
2208 macro is encountered.
2209 .Pp
2210 Examples:
2211 .D1 \&.Fl o \&Ns \&Ar output
2212 .Pp
2213 See also
2214 .Sx \&No
2215 and
2216 .Sx \&Sm .
2217 .Ss \&Nx
2218 Format the
2219 .Nx
2220 version provided as an argument, or a default value if
2221 no argument is provided.
2222 .Pp
2223 Examples:
2224 .D1 \&.Nx 5.01
2225 .D1 \&.Nx
2226 .Pp
2227 See also
2228 .Sx \&At ,
2229 .Sx \&Bsx ,
2230 .Sx \&Bx ,
2231 .Sx \&Dx ,
2232 .Sx \&Fx ,
2233 .Sx \&Ox ,
2234 and
2235 .Sx \&Ux .
2236 .Ss \&Oc
2237 Close multi-line
2238 .Sx \&Oo
2239 context.
2240 .Ss \&Oo
2241 Multi-line version of
2242 .Sx \&Op .
2243 .Pp
2244 Examples:
2245 .Bd -literal -offset indent -compact
2246 \&.Oo
2247 \&.Op Fl flag Ns Ar value
2248 \&.Oc
2249 .Ed
2250 .Ss \&Op
2251 Command-line option.
2252 Used when listing options to command-line utilities.
2253 Prints the argument(s) in brackets.
2254 .Pp
2255 Examples:
2256 .D1 \&.Op \&Fl a \&Ar b
2257 .D1 \&.Op \&Ar a | b
2258 .Pp
2259 See also
2260 .Sx \&Oo .
2261 .Ss \&Os
2262 Document operating system version.
2263 This is the mandatory third macro of
2264 any
2265 .Nm
2266 file.
2267 Its syntax is as follows:
2268 .Pp
2269 .D1 Pf \. Sx \&Os Op Cm system Op Cm version
2270 .Pp
2271 The optional
2272 .Cm system
2273 parameter specifies the relevant operating system or environment.
2274 Left unspecified, it defaults to the local operating system version.
2275 This is the suggested form.
2276 .Pp
2277 Examples:
2278 .D1 \&.Os
2279 .D1 \&.Os KTH/CSC/TCS
2280 .D1 \&.Os BSD 4.3
2281 .Pp
2282 See also
2283 .Sx \&Dd
2284 and
2285 .Sx \&Dt .
2286 .Ss \&Ot
2287 Unknown usage.
2288 .Pp
2289 .Em Remarks :
2290 this macro has been deprecated.
2291 .Ss \&Ox
2292 Format the
2293 .Ox
2294 version provided as an argument, or a default value
2295 if no argument is provided.
2296 .Pp
2297 Examples:
2298 .D1 \&.Ox 4.5
2299 .D1 \&.Ox
2300 .Pp
2301 See also
2302 .Sx \&At ,
2303 .Sx \&Bsx ,
2304 .Sx \&Bx ,
2305 .Sx \&Dx ,
2306 .Sx \&Fx ,
2307 .Sx \&Nx ,
2308 and
2309 .Sx \&Ux .
2310 .Ss \&Pa
2311 A file-system path.
2312 If an argument is not provided, the string
2313 .Dq \(ti
2314 is used as a default.
2315 .Pp
2316 Examples:
2317 .D1 \&.Pa /usr/bin/mandoc
2318 .D1 \&.Pa /usr/share/man/man7/mdoc.7
2319 .Pp
2320 See also
2321 .Sx \&Lk .
2322 .Ss \&Pc
2323 Close parenthesised context opened by
2324 .Sx \&Po .
2325 .Ss \&Pf
2326 Removes the space
2327 .Pq Dq prefix
2328 between its arguments.
2329 Its syntax is as follows:
2330 .Pp
2331 .D1 Pf \. \&Pf Cm prefix suffix
2332 .Pp
2333 The
2334 .Cm suffix
2335 argument may be a macro.
2336 .Pp
2337 Examples:
2338 .D1 \&.Pf \e. \&Sx \&Pf \&Cm prefix suffix
2339 .Ss \&Po
2340 Multi-line version of
2341 .Sx \&Pq .
2342 .Ss \&Pp
2343 Break a paragraph.
2344 This will assert vertical space between prior and subsequent macros
2345 and/or text.
2346 .Ss \&Pq
2347 Parenthesised enclosure.
2348 .Pp
2349 See also
2350 .Sx \&Po .
2351 .Ss \&Qc
2352 Close quoted context opened by
2353 .Sx \&Qo .
2354 .Ss \&Ql
2355 Format a single-quoted literal.
2356 See also
2357 .Sx \&Qq
2358 and
2359 .Sx \&Sq .
2360 .Ss \&Qo
2361 Multi-line version of
2362 .Sx \&Qq .
2363 .Ss \&Qq
2364 Encloses its arguments in
2365 .Dq typewriter
2366 double-quotes.
2367 Consider using
2368 .Sx \&Dq .
2369 .Pp
2370 See also
2371 .Sx \&Dq ,
2372 .Sx \&Sq ,
2373 and
2374 .Sx \&Qo .
2375 .Ss \&Re
2376 Close an
2377 .Sx \&Rs
2378 block.
2379 Does not have any tail arguments.
2380 .Ss \&Rs
2381 Begin a bibliographic
2382 .Pq Dq reference
2383 block.
2384 Does not have any head arguments.
2385 The block macro may only contain
2386 .Sx \&%A ,
2387 .Sx \&%B ,
2388 .Sx \&%C ,
2389 .Sx \&%D ,
2390 .Sx \&%I ,
2391 .Sx \&%J ,
2392 .Sx \&%N ,
2393 .Sx \&%O ,
2394 .Sx \&%P ,
2395 .Sx \&%Q ,
2396 .Sx \&%R ,
2397 .Sx \&%T ,
2398 .Sx \&%U ,
2399 and
2400 .Sx \&%V
2401 child macros (at least one must be specified).
2402 .Pp
2403 Examples:
2404 .Bd -literal -offset indent -compact
2405 \&.Rs
2406 \&.%A J. E. Hopcroft
2407 \&.%A J. D. Ullman
2408 \&.%B Introduction to Automata Theory, Languages, and Computation
2409 \&.%I Addison-Wesley
2410 \&.%C Reading, Massachusettes
2411 \&.%D 1979
2412 \&.Re
2413 .Ed
2414 .Pp
2415 If an
2416 .Sx \&Rs
2417 block is used within a SEE ALSO section, a vertical space is asserted
2418 before the rendered output, else the block continues on the current
2419 line.
2420 .Ss \&Rv
2421 Inserts text regarding a function call's return value.
2422 This macro must consist of the
2423 .Fl std
2424 argument followed by an optional
2425 .Ar function .
2426 If
2427 .Ar function
2428 is not provided, the document's name as stipulated by the first
2429 .Sx \&Nm
2430 is provided.
2431 .Pp
2432 See also
2433 .Sx \&Ex .
2434 .Ss \&Sc
2435 Close single-quoted context opened by
2436 .Sx \&So .
2437 .Ss \&Sh
2438 Begin a new section.
2439 For a list of conventional manual sections, see
2440 .Sx MANUAL STRUCTURE .
2441 These sections should be used unless it's absolutely necessary that
2442 custom sections be used.
2443 .Pp
2444 Section names should be unique so that they may be keyed by
2445 .Sx \&Sx .
2446 .Pp
2447 See also
2448 .Sx \&Pp ,
2449 .Sx \&Ss ,
2450 and
2451 .Sx \&Sx .
2452 .Ss \&Sm
2453 Switches the spacing mode for output generated from macros.
2454 Its syntax is as follows:
2455 .Pp
2456 .D1 Pf \. Sx \&Sm Cm on | off
2457 .Pp
2458 By default, spacing is
2459 .Cm on .
2460 When switched
2461 .Cm off ,
2462 no white space is inserted between macro arguments and between the
2463 output generated from adjacent macros, but free-form text lines
2464 still get normal spacing between words and sentences.
2465 .Ss \&So
2466 Multi-line version of
2467 .Sx \&Sq .
2468 .Ss \&Sq
2469 Encloses its arguments in
2470 .Dq typewriter
2471 single-quotes.
2472 .Pp
2473 See also
2474 .Sx \&Dq ,
2475 .Sx \&Qq ,
2476 and
2477 .Sx \&So .
2478 .Ss \&Ss
2479 Begin a new sub-section.
2480 Unlike with
2481 .Sx \&Sh ,
2482 there's no convention for sub-sections.
2483 Conventional sections, as described in
2484 .Sx MANUAL STRUCTURE ,
2485 rarely have sub-sections.
2486 .Pp
2487 Sub-section names should be unique so that they may be keyed by
2488 .Sx \&Sx .
2489 .Pp
2490 See also
2491 .Sx \&Pp ,
2492 .Sx \&Sh ,
2493 and
2494 .Sx \&Sx .
2495 .Ss \&St
2496 Replace an abbreviation for a standard with the full form.
2497 The following standards are recognised:
2498 .Pp
2499 .Bl -tag -width "-p1003.1g-2000X" -compact
2500 .It \-p1003.1-88
2501 .St -p1003.1-88
2502 .It \-p1003.1-90
2503 .St -p1003.1-90
2504 .It \-p1003.1-96
2505 .St -p1003.1-96
2506 .It \-p1003.1-2001
2507 .St -p1003.1-2001
2508 .It \-p1003.1-2004
2509 .St -p1003.1-2004
2510 .It \-p1003.1-2008
2511 .St -p1003.1-2008
2512 .It \-p1003.1
2513 .St -p1003.1
2514 .It \-p1003.1b
2515 .St -p1003.1b
2516 .It \-p1003.1b-93
2517 .St -p1003.1b-93
2518 .It \-p1003.1c-95
2519 .St -p1003.1c-95
2520 .It \-p1003.1g-2000
2521 .St -p1003.1g-2000
2522 .It \-p1003.1i-95
2523 .St -p1003.1i-95
2524 .It \-p1003.2-92
2525 .St -p1003.2-92
2526 .It \-p1003.2a-92
2527 .St -p1003.2a-92
2528 .It \-p1387.2-95
2529 .St -p1387.2-95
2530 .It \-p1003.2
2531 .St -p1003.2
2532 .It \-p1387.2
2533 .St -p1387.2
2534 .It \-isoC
2535 .St -isoC
2536 .It \-isoC-90
2537 .St -isoC-90
2538 .It \-isoC-amd1
2539 .St -isoC-amd1
2540 .It \-isoC-tcor1
2541 .St -isoC-tcor1
2542 .It \-isoC-tcor2
2543 .St -isoC-tcor2
2544 .It \-isoC-99
2545 .St -isoC-99
2546 .It \-iso9945-1-90
2547 .St -iso9945-1-90
2548 .It \-iso9945-1-96
2549 .St -iso9945-1-96
2550 .It \-iso9945-2-93
2551 .St -iso9945-2-93
2552 .It \-ansiC
2553 .St -ansiC
2554 .It \-ansiC-89
2555 .St -ansiC-89
2556 .It \-ansiC-99
2557 .St -ansiC-99
2558 .It \-ieee754
2559 .St -ieee754
2560 .It \-iso8802-3
2561 .St -iso8802-3
2562 .It \-ieee1275-94
2563 .St -ieee1275-94
2564 .It \-xpg3
2565 .St -xpg3
2566 .It \-xpg4
2567 .St -xpg4
2568 .It \-xpg4.2
2569 .St -xpg4.2
2570 .St -xpg4.3
2571 .It \-xbd5
2572 .St -xbd5
2573 .It \-xcu5
2574 .St -xcu5
2575 .It \-xsh5
2576 .St -xsh5
2577 .It \-xns5
2578 .St -xns5
2579 .It \-xns5.2
2580 .St -xns5.2
2581 .It \-xns5.2d2.0
2582 .St -xns5.2d2.0
2583 .It \-xcurses4.2
2584 .St -xcurses4.2
2585 .It \-susv2
2586 .St -susv2
2587 .It \-susv3
2588 .St -susv3
2589 .It \-svid4
2590 .St -svid4
2591 .El
2592 .Ss \&Sx
2593 Reference a section or sub-section.
2594 The referenced section or sub-section name must be identical to the
2595 enclosed argument, including whitespace.
2596 .Pp
2597 Examples:
2598 .D1 \&.Sx MANUAL STRUCTURE
2599 .Ss \&Sy
2600 Format enclosed arguments in symbolic
2601 .Pq Dq boldface .
2602 Note that this is a presentation term and should not be used for
2603 stylistically decorating technical terms.
2604 .Pp
2605 See also
2606 .Sx \&Bf ,
2607 .Sx \&Li ,
2608 and
2609 .Sx \&Em .
2610 .Ss \&Tn
2611 Format a tradename.
2612 .Pp
2613 Examples:
2614 .D1 \&.Tn IBM
2615 .Ss \&Ud
2616 Prints out
2617 .Dq currently under development .
2618 .Ss \&Ux
2619 Format the UNIX name.
2620 Accepts no argument.
2621 .Pp
2622 Examples:
2623 .D1 \&.Ux
2624 .Pp
2625 See also
2626 .Sx \&At ,
2627 .Sx \&Bsx ,
2628 .Sx \&Bx ,
2629 .Sx \&Dx ,
2630 .Sx \&Fx ,
2631 .Sx \&Nx ,
2632 and
2633 .Sx \&Ox .
2634 .Ss \&Va
2635 A variable name.
2636 .Pp
2637 Examples:
2638 .D1 \&.Va foo
2639 .D1 \&.Va const char *bar ;
2640 .Ss \&Vt
2641 A variable type.
2642 This is also used for indicating global variables in the
2643 .Em SYNOPSIS
2644 section, in which case a variable name is also specified.
2645 Note that it accepts
2646 .Sx Block partial-implicit
2647 syntax when invoked as the first macro in the
2648 .Em SYNOPSIS
2649 section, else it accepts ordinary
2650 .Sx In-line
2651 syntax.
2652 .Pp
2653 Note that this should not be confused with
2654 .Sx \&Ft ,
2655 which is used for function return types.
2656 .Pp
2657 Examples:
2658 .D1 \&.Vt unsigned char
2659 .D1 \&.Vt extern const char * const sys_signame[] \&;
2660 .Pp
2661 See also
2662 .Sx MANUAL STRUCTURE
2663 and
2664 .Sx \&Va .
2665 .Ss \&Xc
2666 Close a scope opened by
2667 .Sx \&Xo .
2668 .Ss \&Xo
2669 Extend the header of an
2670 .Sx \&It
2671 macro or the body of a partial-implicit block macro
2672 beyond the end of the input line.
2673 This macro originally existed to work around the 9-argument limit
2674 of historic
2675 .Xr roff 7 .
2676 .Ss \&Xr
2677 Link to another manual
2678 .Pq Qq cross-reference .
2679 Its syntax is as follows:
2680 .Pp
2681 .D1 Pf \. Sx \&Xr Cm name section
2682 .Pp
2683 The
2684 .Cm name
2685 and
2686 .Cm section
2687 are the name and section of the linked manual.
2688 If
2689 .Cm section
2690 is followed by non-punctuation, an
2691 .Sx \&Ns
2692 is inserted into the token stream.
2693 This behaviour is for compatibility with
2694 GNU troff.
2695 .Pp
2696 Examples:
2697 .D1 \&.Xr mandoc 1
2698 .D1 \&.Xr mandoc 1 \&;
2699 .D1 \&.Xr mandoc 1 \&Ns s behaviour
2700 .Ss \&br
2701 Emits a line-break.
2702 This macro should not be used; it is implemented for compatibility with
2703 historical manuals.
2704 .Pp
2705 Consider using
2706 .Sx \&Pp
2707 in the event of natural paragraph breaks.
2708 .Ss \&sp
2709 Emits vertical space.
2710 This macro should not be used; it is implemented for compatibility with
2711 historical manuals.
2712 Its syntax is as follows:
2713 .Pp
2714 .D1 Pf \. Sx \&sp Op Cm height
2715 .Pp
2716 The
2717 .Cm height
2718 argument must be formatted as described in
2719 .Sx Scaling Widths .
2720 If unspecified,
2721 .Sx \&sp
2722 asserts a single vertical space.
2723 .Sh COMPATIBILITY
2724 This section documents compatibility between mandoc and other other
2725 troff implementations, at this time limited to GNU troff
2726 .Pq Qq groff .
2727 The term
2728 .Qq historic groff
2729 refers to groff versions before 1.17,
2730 which featured a significant update of the
2731 .Pa doc.tmac
2732 file.
2733 .Pp
2734 Heirloom troff, the other significant troff implementation accepting
2735 \-mdoc, is similar to historic groff.
2736 .Pp
2737 The following problematic behaviour is found in groff:
2738 .ds hist (Historic groff only.)
2739 .Pp
2740 .Bl -dash -compact
2741 .It
2742 .Sx \&At
2743 with unknown arguments produces no output at all.
2744 \*[hist]
2745 Newer groff and mandoc print
2746 .Qq AT&T UNIX
2747 and the arguments.
2748 .It
2749 .Sx \&Bd Fl column
2750 does not recognize trailing punctuation characters when they immediately
2751 precede tabulator characters, but treats them as normal text and
2752 outputs a space before them.
2753 .It
2754 .Sx \&Bd Fl ragged compact
2755 does not start a new line.
2756 \*[hist]
2757 .It
2758 .Sx \&Dd
2759 without an argument prints
2760 .Dq Epoch .
2761 In mandoc, it resolves to the current date.
2762 .It
2763 .Sx \&Fl
2764 does not print a dash for an empty argument.
2765 \*[hist]
2766 .It
2767 .Sx \&Fn
2768 does not start a new line unless invoked as the line macro in the
2769 .Em SYNOPSIS
2770 section.
2771 \*[hist]
2772 .It
2773 .Sx \&Fo
2774 with
2775 .Pf non- Sx \&Fa
2776 children causes inconsistent spacing between arguments.
2777 In mandoc, a single space is always inserted between arguments.
2778 .It
2779 .Sx \&Ft
2780 in the
2781 .Em SYNOPSIS
2782 causes inconsistent vertical spacing, depending on whether a prior
2783 .Sx \&Fn
2784 has been invoked.
2785 See
2786 .Sx \&Ft
2787 and
2788 .Sx \&Fn
2789 for the normalised behaviour in mandoc.
2790 .It
2791 .Sx \&In
2792 ignores additional arguments and is not treated specially in the
2793 .Em SYNOPSIS .
2794 \*[hist]
2795 .It
2796 .Sx \&It
2797 sometimes requires a
2798 .Fl nested
2799 flag.
2800 \*[hist]
2801 In new groff and mandoc, any list may be nested by default and
2802 .Fl enum
2803 lists will restart the sequence only for the sub-list.
2804 .It
2805 .Sx \&Li
2806 followed by a reserved character is incorrectly used in some manuals
2807 instead of properly quoting that character, which sometimes works with
2808 historic groff.
2809 .It
2810 .Sx \&Lk
2811 only accepts a single link-name argument; the remainder is misformatted.
2812 .It
2813 .Sx \&Pa
2814 does not format its arguments when used in the FILES section under
2815 certain list types.
2816 .It
2817 .Sx \&Ta
2818 can only be called by other macros, but not at the beginning of a line.
2819 .It
2820 .Sx \&%C
2821 is not implemented.
2822 .It
2823 Historic groff only allows up to eight or nine arguments per macro input
2824 line, depending on the exact situation.
2825 Providing more arguments causes garbled output.
2826 The number of arguments on one input line is not limited with mandoc.
2827 .It
2828 Historic groff has many un-callable macros.
2829 Most of these (excluding some block-level macros) are callable
2830 in new groff and mandoc.
2831 .It
2832 .Sq \(ba
2833 (vertical bar) is not fully supported as a delimiter.
2834 \*[hist]
2835 .It
2836 .Sq \ef
2837 .Pq font face
2838 and
2839 .Sq \ef
2840 .Pq font family face
2841 .Sx Text Decoration
2842 escapes behave irregularly when specified within line-macro scopes.
2843 .It
2844 Negative scaling units return to prior lines.
2845 Instead, mandoc truncates them to zero.
2846 .El
2847 .Pp
2848 The following features are unimplemented in mandoc:
2849 .Pp
2850 .Bl -dash -compact
2851 .It
2852 .Sx \&Bd
2853 .Fl file Ar file .
2854 .It
2855 .Sx \&Bd
2856 .Fl offset Ar center
2857 and
2858 .Fl offset Ar right .
2859 Groff does not implement centered and flush-right rendering either,
2860 but produces large indentations.
2861 .It
2862 The
2863 .Sq \eh
2864 .Pq horizontal position ,
2865 .Sq \ev
2866 .Pq vertical position ,
2867 .Sq \em
2868 .Pq text colour ,
2869 .Sq \eM
2870 .Pq text filling colour ,
2871 .Sq \ez
2872 .Pq zero-length character ,
2873 .Sq \ew
2874 .Pq string length ,
2875 .Sq \ek
2876 .Pq horizontal position marker ,
2877 .Sq \eo
2878 .Pq text overstrike ,
2879 and
2880 .Sq \es
2881 .Pq text size
2882 escape sequences are all discarded in mandoc.
2883 .It
2884 The
2885 .Sq \ef
2886 scaling unit is accepted by mandoc, but rendered as the default unit.
2887 .It
2888 In quoted literals, groff allows pairwise double-quotes to produce a
2889 standalone double-quote in formatted output.
2890 This is not supported by mandoc.
2891 .El
2892 .Sh SEE ALSO
2893 .Xr man 1 ,
2894 .Xr mandoc 1 ,
2895 .Xr mandoc_char 7
2896 .Sh HISTORY
2897 The
2898 .Nm
2899 language first appeared as a troff macro package in
2900 .Bx 4.4 .
2901 It was later significantly updated by Werner Lemberg and Ruslan Ermilov
2902 in groff-1.17.
2903 The standalone implementation that is part of the
2904 .Xr mandoc 1
2905 utility written by Kristaps Dzonsons appeared in
2906 .Ox 4.6 .
2907 .Sh AUTHORS
2908 The
2909 .Nm
2910 reference was written by
2911 .An Kristaps Dzonsons Aq kristaps@bsd.lv .