]> git.cameronkatri.com Git - mandoc.git/blob - mdoc.7
b0a6fa7dc93ea98f769f1de33e97107c18019662
[mandoc.git] / mdoc.7
1 .\" $Id: mdoc.7,v 1.18 2009/03/27 13:44:24 kristaps Exp $
2 .\"
3 .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@openbsd.org>
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
7 .\" above copyright notice and this permission notice appear in all
8 .\" copies.
9 .\"
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 .\" WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 .\" AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 .\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 .\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 .\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 .\" PERFORMANCE OF THIS SOFTWARE.
18 .\"
19 .Dd $Mdocdate: March 27 2009 $
20 .Dt mdoc 7
21 .Os
22 .\" SECTION
23 .Sh NAME
24 .Nm mdoc
25 .Nd mdoc language reference
26 .\" SECTION
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 the syntax, ontology
34 and structure of the
35 .Nm
36 language.
37 .\" PARAGRAPH
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 XXX
47 \&.Sh Macro lines change control state.
48 Other lines are interpreted within the current state.
49 .Ed
50 .\" SECTION
51 .Sh INPUT ENCODING
52 .Nm
53 documents may contain only graphable 7-bit ASCII characters, the space
54 character
55 .Sq \ ,
56 and, in certain circumstances, the tab character
57 .Sq \et .
58 All manuals must have
59 .Sq \en
60 line termination.
61 .Pp
62 The only time a blank line is acceptable is within
63 the context of
64 .Sq \&.Bd \-literal
65 or
66 .Sq \&.Bd \-unfilled .
67 .Pp
68 Tab characters
69 .Pq \et
70 are only acceptable when delimiting
71 .Sq \&.Bl \-column
72 and in
73 .Sq \&.Bd \-literal
74 or
75 .Sq \&.Bd \-unfilled
76 contexts.
77 .\" SUB-SECTION
78 .Ss Reserved Characters
79 Within a macro line, the following characters are reserved:
80 .Bl -tag -width 12n -offset XXXX -compact
81 .It \&.
82 .Pq period
83 .It \&,
84 .Pq comma
85 .It \&:
86 .Pq colon
87 .It \&;
88 .Pq semicolon
89 .It \&(
90 .Pq left-parenthesis
91 .It \&)
92 .Pq right-parenthesis
93 .It \&[
94 .Pq left-bracket
95 .It \&]
96 .Pq right-bracket
97 .It \&?
98 .Pq question
99 .It \&!
100 .Pq exclamation
101 .El
102 .\" PARAGRAPH
103 .Pp
104 Use of reserved characters is described in
105 .Sx Closure .
106 For general non-reserved use, characters must either be escaped with a
107 non-breaking space
108 .Pq Sq \e&
109 or, if applicable, an appropriate escape-sequence used.
110 .\" SUB-SECTION
111 .Ss Special Characters
112 Special character sequences begin with the escape character
113 .Sq \e
114 followed by either an open-parenthesis
115 .Sq \&(
116 for two-character sequences; an open-bracket
117 .Sq \&[
118 for n-character sequences (terminated at a close-bracket
119 .Sq \&] ) ;
120 or a single one-character sequence.
121 .Pp
122 Characters may alternatively be escaped by a slash-asterisk,
123 .Sq \e* ,
124 with the same combinations as described above. This form is deprecated.
125 .Pp
126 The following is a table of all available escapes.
127 .Pp
128 Grammatic:
129 .Bl -tag -width 12n -offset "XXXX" -compact
130 .It \e(em
131 .Pq em-dash
132 .It \e(en
133 .Pq en-dash
134 .It \e-
135 .Pq hyphen
136 .It \e\e
137 .Pq back-slash
138 .It \e'
139 .Pq apostrophe
140 .It \e`
141 .Pq back-tick
142 .It \e
143 .Pq space
144 .It \e.
145 .Pq period
146 .It \e(r!
147 .Pq upside-down exclamation
148 .It \e(r?
149 .Pq upside-down question
150 .El
151 .\" PARAGRAPH
152 .Pp
153 Enclosures:
154 .Bl -tag -width 12n -offset "XXXX" -compact
155 .It \e(lh
156 .Pq left hand
157 .It \e(rh
158 .Pq right hand
159 .It \e(Fo
160 .Pq left guillemet
161 .It \e(Fc
162 .Pq right guillemet
163 .It \e(fo
164 .Pq left guilsing
165 .It \e(fc
166 .Pq right guilsing
167 .It \e(rC
168 .Pq right brace
169 .It \e(lC
170 .Pq left brace
171 .It \e(ra
172 .Pq right angle
173 .It \e(la
174 .Pq left angle
175 .It \e(rB
176 .Pq right bracket
177 .It \e(lB
178 .Pq left bracket
179 .It \eq
180 .Pq double-quote
181 .It \e(lq
182 .Pq left double-quote
183 .It \e(Lq
184 .Pq left double-quote, deprecated
185 .It \e(rq
186 .Pq right double-quote
187 .It \e(Rq
188 .Pq right double-quote, deprecated
189 .It \e(oq
190 .Pq left single-quote
191 .It \e(aq
192 .Pq right single-quote
193 .It \e(Bq
194 .Pq right low double-quote
195 .It \e(bq
196 .Pq right low single-quote
197 .El
198 .\" PARAGRAPH
199 .Pp
200 Indicatives:
201 .Bl -tag -width 12n -offset "XXXX" -compact
202 .It \e(<-
203 .Pq left arrow
204 .It \e(->
205 .Pq right arrow
206 .It \e(ua
207 .Pq up arrow
208 .It \e(da
209 .Pq down arrow
210 .It \e(<>
211 .Pq left-right arrow
212 .It \e(lA
213 .Pq left double-arrow
214 .It \e(rA
215 .Pq right double-arrow
216 .It \e(uA
217 .Pq up double-arrow
218 .It \e(dA
219 .Pq down double-arrow
220 .It \e(hA
221 .Pq left-right double-arrow
222 .El
223 .\" PARAGRAPH
224 .Pp
225 Mathematical:
226 .Bl -tag -width 12n -offset "XXXX" -compact
227 .It \e(es
228 .Pq empty set
229 .It \e(ca
230 .Pq intersection
231 .It \e(cu
232 .Pq union
233 .It \e(gr
234 .Pq gradient
235 .It \e(pd
236 .Pq partial differential
237 .It \e(ap
238 .Pq similarity
239 .It \e(=)
240 .Pq proper superset
241 .It \e((=
242 .Pq proper subset
243 .It \e(eq
244 .Pq equals
245 .It \e(di
246 .Pq division
247 .It \e(mu
248 .Pq multiplication
249 .It \e(pl
250 .Pq addition
251 .It \e(nm
252 .Pq not element
253 .It \e(mo
254 .Pq element
255 .It \e(Im
256 .Pq imaginary
257 .It \e(Re
258 .Pq real
259 .It \e(Ah
260 .Pq aleph
261 .It \e(te
262 .Pq existential quantifier
263 .It \e(fa
264 .Pq universal quantifier
265 .It \e(AN
266 .Pq logical AND
267 .It \e(OR
268 .Pq logical OR
269 .It \e(no
270 .Pq logical NOT
271 .It \e(st
272 .Pq such that
273 .It \e(tf
274 .Pq therefore
275 .It \e(~~
276 .Pq approximate
277 .It \e(~=
278 .Pq approximately equals
279 .It \e(=~
280 .Pq congruent
281 .It \e(Gt
282 .Pq greater-than, deprecated
283 .It \e(Lt
284 .Pq less-than, deprecated
285 .It \e(<=
286 .Pq less-than-equal
287 .It \e(Le
288 .Pq less-than-equal, deprecated
289 .It \e(>=
290 .Pq greater-than-equal
291 .It \e(Ge
292 .Pq greater-than-equal
293 .It \e(==
294 .Pq equal
295 .It \e(!=
296 .Pq not equal
297 .It \e(Ne
298 .Pq not equal, deprecated
299 .It \e(if
300 .Pq infinity
301 .It \e(If
302 .Pq infinity, deprecated
303 .It \e(na
304 .Pq NaN , an extension
305 .It \e(Na
306 .Pq NaN, deprecated
307 .It \e(+-
308 .Pq plus-minus
309 .It \e(Pm
310 .Pq plus-minus, deprecated
311 .It \e(**
312 .Pq asterisk
313 .El
314 .\" PARAGRAPH
315 .Pp
316 Ligatures:
317 .Bl -tag -width 12n -offset "XXXX" -compact
318 .It \e(ss
319 .Pq German eszett
320 .It \e(AE
321 .Pq upper-case AE
322 .It \e(ae
323 .Pq lower-case AE
324 .It \e(OE
325 .Pq upper-case OE
326 .It \e(oe
327 .Pq lower-case OE
328 .It \e(ff
329 .Pq ff ligature
330 .It \e(fi
331 .Pq fi ligature
332 .It \e(fl
333 .Pq fl ligature
334 .It \e(Fi
335 .Pq ffi ligature
336 .It \e(Fl
337 .Pq ffl ligature
338 .El
339 .\" PARAGRAPH
340 .Pp
341 Diacritics and letters:
342 .Bl -tag -width 12n -offset "XXXX" -compact
343 .It \e(ga
344 .Pq grave accent
345 .It \e(aa
346 .Pq accute accent
347 .It \e(a"
348 .Pq umlaut accent
349 .It \e(ad
350 .Pq dieresis accent
351 .It \e(a~
352 .Pq tilde accent
353 .It \e(a^
354 .Pq circumflex accent
355 .It \e(ac
356 .Pq cedilla accent
357 .It \e(ad
358 .Pq dieresis accent
359 .It \e(ah
360 .Pq caron accent
361 .It \e(ao
362 .Pq ring accent
363 .It \e(ho
364 .Pq hook accent
365 .It \e(ab
366 .Pq breve accent
367 .It \e(a-
368 .Pq macron accent
369 .It \e(-D
370 .Pq upper-case eth
371 .It \e(Sd
372 .Pq lower-case eth
373 .It \e(TP
374 .Pq upper-case thorn
375 .It \e(Tp
376 .Pq lower-case thorn
377 .It \e('A
378 .Pq upper-case acute A
379 .It \e('E
380 .Pq upper-case acute E
381 .It \e('I
382 .Pq upper-case acute I
383 .It \e('O
384 .Pq upper-case acute O
385 .It \e('U
386 .Pq upper-case acute U
387 .It \e('a
388 .Pq lower-case acute a
389 .It \e('e
390 .Pq lower-case acute e
391 .It \e('i
392 .Pq lower-case acute i
393 .It \e('o
394 .Pq lower-case acute o
395 .It \e('u
396 .Pq lower-case acute u
397 .It \e(`A
398 .Pq upper-case grave A
399 .It \e(`E
400 .Pq upper-case grave E
401 .It \e(`I
402 .Pq upper-case grave I
403 .It \e(`O
404 .Pq upper-case grave O
405 .It \e(`U
406 .Pq upper-case grave U
407 .It \e(`a
408 .Pq lower-case grave a
409 .It \e(`e
410 .Pq lower-case grave e
411 .It \e(`i
412 .Pq lower-case grave i
413 .It \e(`o
414 .Pq lower-case grave o
415 .It \e(`u
416 .Pq lower-case grave u
417 .It \e(~A
418 .Pq upper-case tilde A
419 .It \e(~N
420 .Pq upper-case tilde N
421 .It \e(~O
422 .Pq upper-case tilde O
423 .It \e(~a
424 .Pq lower-case tilde a
425 .It \e(~n
426 .Pq lower-case tilde n
427 .It \e(~o
428 .Pq lower-case tilde o
429 .It \e(:A
430 .Pq upper-case dieresis A
431 .It \e(:E
432 .Pq upper-case dieresis E
433 .It \e(:I
434 .Pq upper-case dieresis I
435 .It \e(:O
436 .Pq upper-case dieresis O
437 .It \e(:U
438 .Pq upper-case dieresis U
439 .It \e(:a
440 .Pq lower-case dieresis a
441 .It \e(:e
442 .Pq lower-case dieresis e
443 .It \e(:i
444 .Pq lower-case dieresis i
445 .It \e(:o
446 .Pq lower-case dieresis o
447 .It \e(:u
448 .Pq lower-case dieresis u
449 .It \e(:y
450 .Pq lower-case dieresis y
451 .It \e(^A
452 .Pq upper-case circumflex A
453 .It \e(^E
454 .Pq upper-case circumflex E
455 .It \e(^I
456 .Pq upper-case circumflex I
457 .It \e(^O
458 .Pq upper-case circumflex O
459 .It \e(^U
460 .Pq upper-case circumflex U
461 .It \e(^a
462 .Pq lower-case circumflex a
463 .It \e(^e
464 .Pq lower-case circumflex e
465 .It \e(^i
466 .Pq lower-case circumflex i
467 .It \e(^o
468 .Pq lower-case circumflex o
469 .It \e(^u
470 .Pq lower-case circumflex u
471 .It \e(,C
472 .Pq upper-case cedilla C
473 .It \e(,c
474 .Pq lower-case cedilla c
475 .It \e(/L
476 .Pq upper-case stroke L
477 .It \e(/l
478 .Pq lower-case stroke l
479 .It \e(/O
480 .Pq upper-case stroke O
481 .It \e(/o
482 .Pq lower-case stroke o
483 .It \e(oA
484 .Pq upper-case ring A
485 .It \e(oa
486 .Pq lower-case ring a
487 .El
488 .\" PARAGRAPH
489 .Pp
490 Monetary:
491 .Bl -tag -width 12n -offset "XXXX" -compact
492 .It \e(Cs
493 .Pq Scandinavian
494 .It \e(Do
495 .Pq dollar
496 .It \e(Po
497 .Pq pound
498 .It \e(Ye
499 .Pq yen
500 .It \e(Fn
501 .Pq florin
502 .It \e(ct
503 .Pq cent
504 .El
505 .\" PARAGRAPH
506 .Pp
507 Special symbols:
508 .Bl -tag -width 12n -offset "XXXX" -compact
509 .It \e0
510 .Pq white-space
511 .It \e(de
512 .Pq degree
513 .It \e(ps
514 .Pq paragraph
515 .It \e(sc
516 .Pq section
517 .It \e(dg
518 .Pq dagger
519 .It \e(dd
520 .Pq double dagger
521 .It \e(ci
522 .Pq circle
523 .It \e(ba
524 .Pq bar
525 .It \e(bb
526 .Pq broken bar
527 .It \e(Ba
528 .Pq bar, deprecated
529 .It \e(co
530 .Pq copyright
531 .It \e(rg
532 .Pq registered
533 .It \e(tm
534 .Pq trademarked
535 .It \e&
536 .Pq non-breaking space
537 .It \ee
538 .Pq escape
539 .It \e(Am
540 .Pq ampersand, deprecated
541 .El
542 .\" SECTION
543 .Sh STRUCTURE
544 Macros are classified in an ontology described by their scope rules.
545 Some macros are allowed to deviate from their classifications to
546 preserve backward-compatibility with old macro combinations still found
547 in the manual corpus. These are specifically noted on a per-macro
548 basis.
549 .\" SUB-SECTION
550 .Ss Scope
551 .Bl -inset
552 .\" LIST-ITEM
553 .It Em Block
554 macros enclose other block macros, in-line macros or text, and
555 may span multiple lines.
556 .Bl -inset -offset XXXX
557 .\" LIST-ITEM
558 .It Em Full-block
559 macros always span multiple lines. They consist of zero or
560 more
561 .Qq heads ,
562 subsequent macros or text on the same line following invocation; an
563 optional
564 .Qq body ,
565 which spans subsequent lines of text or macros; and an optional
566 .Qq tail ,
567 macros or text on the same line following closure.
568 .\" LIST-ITEM
569 .It Em Partial-block
570 macros may span multiple lines. They consists of a optional
571 .Qq head ,
572 text immediately following invocation; always a
573 .Qq body ,
574 text or macros following the head on the same and subsequent lines; and
575 optionally a
576 .Qq tail ,
577 text immediately following closure.
578 .\" LIST-ITEM
579 .It Em In-line
580 macros may only enclose text and span at most a single line.
581 .El
582 .El
583 .\" SUB-SECTION
584 .Ss Closure
585 Closure of a macro's scope depends first on its classification, then
586 on whether it's parsable. In this table,
587 .Sq BFE
588 refers to block full-explicit and so on.
589 .\" PARAGRAPH
590 .Pp
591 .Bl -tag -width 12n -offset XXXX -compact
592 .It BPE , BFE
593 corresponding explicit closure macro
594 .It BFI
595 end-of-file or a corresponding implicit closure macro
596 .It BPI
597 end-of-line (body may be closed by >0 space-separated
598 .Sx Reserved Characters ,
599 although block scope will still be open)
600 .It INL
601 end-of-line
602 .El
603 .\" PARAGRAPH
604 .Pp
605 If a macro (block or in-line) is parsable, it may also be closed out by
606 one of the following scenarios (unless specifically noted otherwise):
607 .\" PARAGRAPH
608 .Pp
609 .Bl -dash -offset XXXX -compact
610 .It
611 a sequence of >0 space-separated
612 .Sx Reserved Characters ,
613 .It
614 another macro,
615 .It
616 end-of-line, or
617 .It
618 completion of a set number of arguments.
619 .El
620 .\" PARAGRAPH
621 .Pp
622 If >0 space-separated
623 .Sx Reserved Characters
624 are followed by non-reserved characters, the behaviour differs per
625 macro. In general, scope of the macro is closed and re-opened:
626 subsequent tokens are interpreted as if the scope had just been opened.
627 In other circumstances, scope is simply closed out.
628 .\" SECTION
629 .Sh SYNTAX
630 Macros are two or three characters in length. The syntax of macro
631 invocation depends on its classification.
632 .Qq \-arg
633 refers to the macro arguments (which may contain zero or more values).
634 In these illustrations,
635 .Sq \&.Yo
636 opens the scope of a macro, and if specified,
637 .Sq \&.Yc
638 closes it out (closure may be implicit at end-of-line or end-of-file).
639 .\" PARAGRAPH
640 .Pp
641 Block full-explicit (may contain head, body, tail).
642 .Bd -literal -offset XXXX
643 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBhead...\(rB
644 \(lBbody...\(rB
645 \&.Yc \(lBtail...\(rB
646 .Ed
647 .\" PARAGRAPH
648 .Pp
649 Block full-implicit (may contain zero or more heads, body, no tail).
650 .Bd -literal -offset XXXX
651 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
652 \(lBbody...\(rB
653 \&.Yc
654 .Ed
655 .\" PARAGRAPH
656 .Pp
657 Block partial-explicit (may contain head, multi-line body, tail).
658 .Bd -literal -offset XXXX
659 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBhead...\(rB
660 \(lBbody...\(rB
661 \&.Yc \(lBtail...\(rB
662
663 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBhead...\(rB \
664 \(lBbody...\(rB \&Yc \(lBtail...\(rB
665 .Ed
666 .\" PARAGRAPH
667 .Pp
668 Block partial-implicit (no head, body, no tail). Note that the body
669 section may be followed by zero or more
670 .Sx Reserved Words .
671 These are in the block scope, but not in the body scope.
672 .Bd -literal -offset XXXX
673 \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBreserved...\(rB
674 .Ed
675 .\" PARAGRAPH
676 .Pp
677 In-lines have \(>=0 scoped arguments.
678 .Bd -literal -offset XXX
679 \&.Yy \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB
680
681 \&.Yy \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
682 .Ed
683 .\"
684 .Sh MACROS
685 This section contains a complete list of all
686 .Nm
687 macros, arranged ontologically. A
688 .Qq callable
689 macro is invoked subsequent to the initial macro-line macro. A
690 .Qq parsable
691 macro may be followed by further (ostensibly callable) macros.
692 .\" SUB-SECTION
693 .Ss Block full-implicit
694 The head of these macros follows invocation; the body is the content of
695 subsequent lines prior to closure. None of these macros have tails;
696 some
697 .Po
698 .Sq \&.It \-bullet ,
699 .Sq \-hyphen ,
700 .Sq \-dash ,
701 .Sq \-enum ,
702 .Sq \-item
703 .Pc
704 don't have heads.
705 .Pp
706 .Bl -column "MacroX" "CallableX" "ParsableX" "Closing" -compact -offset XXXX
707 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Closing
708 .It \&.Sh Ta \&No Ta \&No Ta \&.Sh
709 .It \&.Ss Ta \&No Ta \&No Ta \&.Sh, \&.Ss
710 .It \&.It Ta \&No Ta Yes Ta \&.It, \&.El
711 .El
712 .\" SUB-SECTION
713 .Ss Block full-explicit
714 None of these macros are callable or parsed. The last column indicates
715 the explicit scope rules. All contains bodies, some may contain heads
716 .Pq So \&Bf Sc .
717 .Pp
718 .Bl -column "MacroX" "CallableX" "ParsableX" "closed by XXX" -compact -offset XXXX
719 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
720 .It \&.Bd Ta \&No Ta \&No Ta closed by \&.Ed
721 .It \&.Ed Ta \&No Ta \&No Ta opened by \&.Bd
722 .It \&.Bl Ta \&No Ta \&No Ta closed by \&.El
723 .It \&.El Ta \&No Ta \&No Ta opened by \&.Bl
724 .It \&.Bf Ta \&No Ta \&No Ta closed by \&.Ef
725 .It \&.Ef Ta \&No Ta \&No Ta opened by \&.Bf
726 .It \&.Bk Ta \&No Ta \&No Ta closed by \&.Ek
727 .It \&.Ek Ta \&No Ta \&No Ta opened by \&.Bk
728 .El
729 .\" SUB-SECTION
730 .Ss Block partial-implicit
731 All of these are callable and parsed for further macros. Their scopes
732 close at the invocation's end-of-line.
733 .Pp
734 .Bl -column "MacroX" "CallableX" "ParsableX" -compact -offset XXXX
735 .It Em Macro Ta Em Callable Ta Em Parsable
736 .It \&.Aq Ta Yes Ta Yes
737 .It \&.Op Ta Yes Ta Yes
738 .It \&.Bq Ta Yes Ta Yes
739 .It \&.Dq Ta Yes Ta Yes
740 .It \&.Pq Ta Yes Ta Yes
741 .It \&.Qq Ta Yes Ta Yes
742 .It \&.Sq Ta Yes Ta Yes
743 .It \&.Brq Ta Yes Ta Yes
744 .It \&.D1 Ta \&No Ta \&Yes
745 .It \&.Dl Ta \&No Ta Yes
746 .It \&.Ql Ta Yes Ta Yes
747 .El
748 .\" PARAGRAPH
749 .Pp
750 The
751 .Sq \&.Op
752 may be broken by
753 .Sq \&.Oc
754 as in the following example:
755 .Bd -literal -offset XXXX
756 \&.Oo
757 \&.Op Fl a Oc
758 .Ed
759 .Pp
760 In the above example, the scope of
761 .Sq \&.Op
762 is technically broken by
763 .Sq \&.Oc ,
764 however, due to the overwhelming existence of this sequence, it's
765 allowed.
766 .\" SUB-SECTION
767 .Ss Block partial-explicit
768 Each of these contains at least a body and, in limited circumstances, a
769 head
770 .Pq So \&.Fo Sc , So \&.Eo Sc
771 and/or tail
772 .Pq So \&.Ec Sc .
773 .Pp
774 .Bl -column "MacroX" "CallableX" "ParsableX" "closed by XXXX" -compact -offset XXXX
775 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Scope
776 .It \&.Ao Ta Yes Ta Yes Ta closed by \&.Ac
777 .It \&.Ac Ta Yes Ta Yes Ta opened by \&.Ao
778 .It \&.Bc Ta Yes Ta Yes Ta closed by \&.Bo
779 .It \&.Bo Ta Yes Ta Yes Ta opened by \&.Bc
780 .It \&.Pc Ta Yes Ta Yes Ta closed by \&.Po
781 .It \&.Po Ta Yes Ta Yes Ta opened by \&.Pc
782 .It \&.Do Ta Yes Ta Yes Ta closed by \&.Dc
783 .It \&.Dc Ta Yes Ta Yes Ta opened by \&.Do
784 .It \&.Xo Ta Yes Ta Yes Ta closed by \&.Xc
785 .It \&.Xc Ta Yes Ta Yes Ta opened by \&.Xo
786 .It \&.Bro Ta Yes Ta Yes Ta closed by \&.Brc
787 .It \&.Brc Ta Yes Ta Yes Ta opened by \&.Bro
788 .It \&.Oc Ta Yes Ta Yes Ta closed by \&.Oo
789 .It \&.Oo Ta Yes Ta Yes Ta opened by \&.Oc
790 .It \&.So Ta Yes Ta Yes Ta closed by \&.Sc
791 .It \&.Sc Ta Yes Ta Yes Ta opened by \&.So
792 .It \&.Fc Ta Yes Ta Yes Ta opened by \&.Fo
793 .It \&.Fo Ta \&No Ta \&No Ta closed by \&.Fc
794 .It \&.Ec Ta Yes Ta Yes Ta opened by \&.Eo
795 .It \&.Eo Ta Yes Ta Yes Ta closed by \&.Ec
796 .It \&.Qc Ta Yes Ta Yes Ta opened by \&.Oo
797 .It \&.Qo Ta Yes Ta Yes Ta closed by \&.Oc
798 .It \&.Re Ta \&No Ta \&No Ta opened by \&.Rs
799 .It \&.Rs Ta \&No Ta \&No Ta closed by \&.Re
800 .El
801 .\" SUB-SECTION
802 .Ss In-line
803 In-line macros have only text children. If a number (or inequality) of
804 arguments is
805 .Pq n ,
806 then the macro accepts an arbitrary number of arguments.
807 .Pp
808 .Bl -column "MacroX" "CallableX" "ParsableX" "Arguments" -compact -offset XXXX
809 .It Em Macro Ta Em Callable Ta Em Parsable Ta Em Arguments
810 .It \&.Dd Ta \&No Ta \&No Ta >0
811 .It \&.Dt Ta \&No Ta \&No Ta n
812 .It \&.Os Ta \&No Ta \&No Ta n
813 .It \&.Pp Ta \&No Ta \&No Ta 0
814 .It \&.Ad Ta Yes Ta Yes Ta n
815 .It \&.An Ta \&No Ta Yes Ta n
816 .It \&.Ar Ta Yes Ta Yes Ta n
817 .It \&.Cd Ta Yes Ta \&No Ta >0
818 .It \&.Cm Ta Yes Ta Yes Ta n
819 .It \&.Dv Ta Yes Ta Yes Ta n
820 .It \&.Er Ta Yes Ta Yes Ta >0
821 .It \&.Ev Ta Yes Ta Yes Ta n
822 .It \&.Ex Ta \&No Ta \&No Ta 0
823 .It \&.Fa Ta Yes Ta Yes Ta n
824 .It \&.Fd Ta \&No Ta \&No Ta >0
825 .It \&.Fl Ta Yes Ta Yes Ta n
826 .It \&.Fn Ta Yes Ta Yes Ta >0
827 .It \&.Ft Ta \&No Ta Yes Ta n
828 .It \&.Ic Ta Yes Ta Yes Ta >0
829 .It \&.In Ta \&No Ta \&No Ta n
830 .It \&.Li Ta Yes Ta Yes Ta n
831 .It \&.Nd Ta \&No Ta \&No Ta n
832 .It \&.Nm Ta Yes Ta Yes Ta n
833 .It \&.Ot Ta \&No Ta \&No Ta n
834 .It \&.Pa Ta Yes Ta Yes Ta n
835 .It \&.Rv Ta \&No Ta \&No Ta 0
836 .It \&.St Ta \&No Ta Yes Ta 1
837 .It \&.Va Ta Yes Ta Yes Ta n
838 .It \&.Vt Ta Yes Ta Yes Ta >0
839 .It \&.Xr Ta Yes Ta Yes Ta >0, <3
840 .It \&.%A Ta \&No Ta \&No Ta >0
841 .It \&.%B Ta \&No Ta \&No Ta >0
842 .It \&.%C Ta \&No Ta \&No Ta >0
843 .It \&.%D Ta \&No Ta \&No Ta >0
844 .It \&.%I Ta \&No Ta \&No Ta >0
845 .It \&.%J Ta \&No Ta \&No Ta >0
846 .It \&.%N Ta \&No Ta \&No Ta >0
847 .It \&.%O Ta \&No Ta \&No Ta >0
848 .It \&.%P Ta \&No Ta \&No Ta >0
849 .It \&.%R Ta \&No Ta \&No Ta >0
850 .It \&.%T Ta \&No Ta \&No Ta >0
851 .It \&.%V Ta \&No Ta \&No Ta >0
852 .It \&.At Ta Yes Ta Yes Ta 1
853 .It \&.Bsx Ta Yes Ta Yes Ta n
854 .It \&.Bx Ta Yes Ta Yes Ta n
855 .It \&.Db Ta \&No Ta \&No Ta 1
856 .It \&.Em Ta Yes Ta Yes Ta n
857 .It \&.Fx Ta Yes Ta Yes Ta n
858 .It \&.Ms Ta \&No Ta Yes Ta >0
859 .It \&.No Ta Yes Ta Yes Ta 0
860 .It \&.Ns Ta Yes Ta Yes Ta 0
861 .It \&.Nx Ta Yes Ta Yes Ta n
862 .It \&.Ox Ta Yes Ta Yes Ta n
863 .It \&.Pf Ta \&No Ta Yes Ta 1
864 .It \&.Sm Ta \&No Ta \&No Ta 1
865 .It \&.Sx Ta Yes Ta Yes Ta >0
866 .It \&.Sy Ta Yes Ta Yes Ta >0
867 .It \&.Tn Ta Yes Ta Yes Ta >0
868 .It \&.Ux Ta Yes Ta Yes Ta n
869 .It \&.Dx Ta Yes Ta Yes Ta n
870 .It \&.Bt Ta \&No Ta \&No Ta 0
871 .It \&.Hf Ta \&No Ta \&No Ta n
872 .It \&.Fr Ta \&No Ta \&No Ta n
873 .It \&.Ud Ta \&No Ta \&No Ta 0
874 .It \&.Lb Ta \&No Ta \&No Ta 1
875 .It \&.Ap Ta Yes Ta Yes Ta 0
876 .It \&.Lp Ta \&No Ta \&No Ta 0
877 .It \&.Lk Ta \&No Ta Yes Ta >0
878 .It \&.Mt Ta \&No Ta Yes Ta >0
879 .It \&.Es Ta \&No Ta \&No Ta 0
880 .It \&.En Ta \&No Ta \&No Ta 0
881 .El
882 .Pp
883 The
884 .Sq \&.Ot ,
885 .Sq \&.Fr ,
886 .Sq \&.Es
887 and
888 .Sq \&.En ,
889 macros are obsolete.
890 .\" SECTION
891 .Sh COMPATIBILITY
892 The mdoc language was traditionally a
893 .Qq roff
894 macro package; most existing manuals were written with mdoc syntax
895 dictated by system-dependent roff installations. This section documents
896 compatibility with these systems.
897 .Pp
898 .Bl -dash -compact
899 .\" LIST-ITEM
900 .It
901 .Sq \&.Fo
902 and
903 .Sq \&.St
904 historically weren't always callable. Both are now correctly callable.
905 .\" LIST-ITEM
906 .It
907 .Sq \&.It \-nested
908 is assumed for all lists: any list may be nested and
909 .Sq \-enum
910 lists will restart the sequence only for the sub-list.
911 .\" LIST-ITEM
912 .It
913 .Sq \&.It \-column
914 syntax where column widths may be preceeded by other arguments (instead
915 of proceeded) is not supported.
916 .\" LIST-ITEM
917 .It
918 The
919 .Sq \&.At
920 macro only accepts a single parameter.
921 .\" LIST-ITEM
922 .It
923 The system-name macros (
924 .Ns Sq \&.At ,
925 .Sq \&.Bsx ,
926 .Sq \&.Bx ,
927 .Sq \&.Fx ,
928 .Sq \&.Nx ,
929 .Sq \&.Ox ,
930 and
931 .Sq \&.Ux )
932 are callable.
933 .\" LIST-ITEM
934 .It
935 Some manuals use
936 .Sq \&.Li
937 incorrectly by following it with a reserved character and expecting the
938 delimiter to render. This is not supported.
939 .\" LIST-ITEM
940 .It
941 .Sq \&.Cd
942 is callable.
943 .El
944 .\" SECTION
945 .Sh SEE ALSO
946 .Xr mandoc 1
947 .\" SECTION
948 .Sh AUTHORS
949 The
950 .Nm
951 utility was written by
952 .An Kristaps Dzonsons Aq kristaps@openbsd.org .
953 .\" SECTION
954 .Sh CAVEATS
955 There are several ambiguous parts of mdoc.
956 .Pp
957 .Bl -dash -compact
958 .\" LIST-ITEM
959 .It
960 .Sq \&.Fa
961 should be
962 .Sq \&.Va
963 as function arguments are variables.
964 .\" LIST-ITEM
965 .It
966 .Sq \&.Ft
967 should be
968 .Sq \&.Vt
969 as function return types are still types. Furthermore, the
970 .Sq \&.Ft
971 should be removed and
972 .Sq \&.Fo ,
973 which ostensibly follows it, should follow the same convention as
974 .Sq \&.Va .
975 .\" LIST-ITEM
976 .It
977 .Sq \&.Va
978 should formalise that only one or two arguments are acceptable: a
979 variable name and optional, preceeding type.
980 .\" LIST-ITEM
981 .It
982 .Sq \&.Fd
983 is ambiguous. It's commonly used to indicate an include file in the
984 synopsis section.
985 .Sq \&.In
986 should be used, instead.
987 .\" LIST-ITEM
988 .It
989 Only the
990 .Sq \-literal
991 argument to
992 .Sq \&.Bd
993 makes sense. The remaining ones should be removed.
994 .\" LIST-ITEM
995 .It
996 The
997 .Sq \&.Xo
998 and
999 .Sq \&.Xc
1000 macros should be deprecated.
1001 .\" LIST-ITEM
1002 .It
1003 The
1004 .Sq \&.Dt
1005 macro lacks clarity. It should be absolutely clear which title will
1006 render when formatting the manual page.
1007 .\" LIST-ITEM
1008 .It
1009 A
1010 .Sq \&.Lx
1011 should be provided for Linux (\(`a la
1012 .Sq \&.Ox ,
1013 .Sq \&.Nx
1014 etc.).
1015 .\" LIST-ITEM
1016 .It
1017 There's no way to refer to references in
1018 .Sq \&.Rs/.Re
1019 blocks.
1020 .El