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