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