]> git.cameronkatri.com Git - mandoc.git/blob - man.7
Make catman and man.cgi understand the index type-field.
[mandoc.git] / man.7
1 .\" $Id: man.7,v 1.112 2011/12/02 01:37:14 schwarze Exp $
2 .\"
3 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2011 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: December 2 2011 $
19 .Dt MAN 7
20 .Os
21 .Sh NAME
22 .Nm man
23 .Nd legacy formatting language for manual pages
24 .Sh DESCRIPTION
25 Traditionally, the
26 .Nm man
27 language has been used to write
28 .Ux
29 manuals for the
30 .Xr man 1
31 utility.
32 It supports limited control of presentational details like fonts,
33 indentation and spacing.
34 This reference document describes the structure of manual pages
35 and the syntax and usage of the man language.
36 .Pp
37 .Bf -emphasis
38 Do not use
39 .Nm
40 to write your manuals:
41 .Ef
42 It lacks support for semantic markup.
43 Use the
44 .Xr mdoc 7
45 language, instead.
46 .Pp
47 In a
48 .Nm
49 document, lines beginning with the control character
50 .Sq \&.
51 are called
52 .Dq macro lines .
53 The first word is the macro name.
54 It usually consists of two capital letters.
55 For a list of available macros, see
56 .Sx MACRO OVERVIEW .
57 The words following the macro name are arguments to the macro.
58 .Pp
59 Lines not beginning with the control character are called
60 .Dq text lines .
61 They provide free-form text to be printed; the formatting of the text
62 depends on the respective processing context:
63 .Bd -literal -offset indent
64 \&.SH Macro lines change control state.
65 Text lines are interpreted within the current state.
66 .Ed
67 .Pp
68 Many aspects of the basic syntax of the
69 .Nm
70 language are based on the
71 .Xr roff 7
72 language; see the
73 .Em LANGUAGE SYNTAX
74 and
75 .Em MACRO SYNTAX
76 sections in the
77 .Xr roff 7
78 manual for details, in particular regarding
79 comments, escape sequences, whitespace, and quoting.
80 .Sh MANUAL STRUCTURE
81 Each
82 .Nm
83 document must contain the
84 .Sx \&TH
85 macro describing the document's section and title.
86 It may occur anywhere in the document, although conventionally it
87 appears as the first macro.
88 .Pp
89 Beyond
90 .Sx \&TH ,
91 at least one macro or text line must appear in the document.
92 .Pp
93 The following is a well-formed skeleton
94 .Nm
95 file for a utility
96 .Qq progname :
97 .Bd -literal -offset indent
98 \&.TH PROGNAME 1 2009-10-10
99 \&.SH NAME
100 \efBprogname\efR \e(en a description goes here
101 \&.\e\(dq .SH LIBRARY
102 \&.\e\(dq For sections 2 & 3 only.
103 \&.\e\(dq Not used in OpenBSD.
104 \&.SH SYNOPSIS
105 \efBprogname\efR [\efB\e-options\efR] arguments...
106 \&.SH DESCRIPTION
107 The \efBfoo\efR utility processes files...
108 \&.\e\(dq .SH IMPLEMENTATION NOTES
109 \&.\e\(dq Not used in OpenBSD.
110 \&.\e\(dq .SH RETURN VALUES
111 \&.\e\(dq For sections 2, 3, & 9 only.
112 \&.\e\(dq .SH ENVIRONMENT
113 \&.\e\(dq For sections 1, 6, 7, & 8 only.
114 \&.\e\(dq .SH FILES
115 \&.\e\(dq .SH EXIT STATUS
116 \&.\e\(dq For sections 1, 6, & 8 only.
117 \&.\e\(dq .SH EXAMPLES
118 \&.\e\(dq .SH DIAGNOSTICS
119 \&.\e\(dq For sections 1, 4, 6, 7, & 8 only.
120 \&.\e\(dq .SH ERRORS
121 \&.\e\(dq For sections 2, 3, & 9 only.
122 \&.\e\(dq .SH SEE ALSO
123 \&.\e\(dq .BR foo ( 1 )
124 \&.\e\(dq .SH STANDARDS
125 \&.\e\(dq .SH HISTORY
126 \&.\e\(dq .SH AUTHORS
127 \&.\e\(dq .SH CAVEATS
128 \&.\e\(dq .SH BUGS
129 \&.\e\(dq .SH SECURITY CONSIDERATIONS
130 \&.\e\(dq Not used in OpenBSD.
131 .Ed
132 .Pp
133 The sections in a
134 .Nm
135 document are conventionally ordered as they appear above.
136 Sections should be composed as follows:
137 .Bl -ohang -offset indent
138 .It Em NAME
139 The name(s) and a short description of the documented material.
140 The syntax for this is generally as follows:
141 .Pp
142 .D1 \efBname\efR \e(en description
143 .It Em LIBRARY
144 The name of the library containing the documented material, which is
145 assumed to be a function in a section 2 or 3 manual.
146 For functions in the C library, this may be as follows:
147 .Pp
148 .D1 Standard C Library (libc, -lc)
149 .It Em SYNOPSIS
150 Documents the utility invocation syntax, function call syntax, or device
151 configuration.
152 .Pp
153 For the first, utilities (sections 1, 6, and 8), this is
154 generally structured as follows:
155 .Pp
156 .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
157 .Pp
158 For the second, function calls (sections 2, 3, 9):
159 .Pp
160 .D1 \&.B char *name(char *\efIarg\efR);
161 .Pp
162 And for the third, configurations (section 4):
163 .Pp
164 .D1 \&.B name* at cardbus ? function ?
165 .Pp
166 Manuals not in these sections generally don't need a
167 .Em SYNOPSIS .
168 .It Em DESCRIPTION
169 This expands upon the brief, one-line description in
170 .Em NAME .
171 It usually contains a break-down of the options (if documenting a
172 command).
173 .It Em IMPLEMENTATION NOTES
174 Implementation-specific notes should be kept here.
175 This is useful when implementing standard functions that may have side
176 effects or notable algorithmic implications.
177 .It Em RETURN VALUES
178 This section documents the return values of functions in sections 2, 3, and 9.
179 .It Em ENVIRONMENT
180 Documents any usages of environment variables, e.g.,
181 .Xr environ 7 .
182 .It Em FILES
183 Documents files used.
184 It's helpful to document both the file name and a short description of how
185 the file is used (created, modified, etc.).
186 .It Em EXIT STATUS
187 This section documents the command exit status for
188 section 1, 6, and 8 utilities.
189 Historically, this information was described in
190 .Em DIAGNOSTICS ,
191 a practise that is now discouraged.
192 .It Em EXAMPLES
193 Example usages.
194 This often contains snippets of well-formed,
195 well-tested invocations.
196 Make sure that examples work properly!
197 .It Em DIAGNOSTICS
198 Documents error conditions.
199 This is most useful in section 4 manuals.
200 Historically, this section was used in place of
201 .Em EXIT STATUS
202 for manuals in sections 1, 6, and 8; however, this practise is
203 discouraged.
204 .It Em ERRORS
205 Documents error handling in sections 2, 3, and 9.
206 .It Em SEE ALSO
207 References other manuals with related topics.
208 This section should exist for most manuals.
209 .Pp
210 .D1 \&.BR bar \&( 1 \&),
211 .Pp
212 Cross-references should conventionally be ordered
213 first by section, then alphabetically.
214 .It Em STANDARDS
215 References any standards implemented or used, such as
216 .Pp
217 .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
218 .Pp
219 If not adhering to any standards, the
220 .Em HISTORY
221 section should be used.
222 .It Em HISTORY
223 A brief history of the subject, including where support first appeared.
224 .It Em AUTHORS
225 Credits to the person or persons who wrote the code and/or documentation.
226 Authors should generally be noted by both name and email address.
227 .It Em CAVEATS
228 Common misuses and misunderstandings should be explained
229 in this section.
230 .It Em BUGS
231 Known bugs, limitations, and work-arounds should be described
232 in this section.
233 .It Em SECURITY CONSIDERATIONS
234 Documents any security precautions that operators should consider.
235 .El
236 .Sh MACRO OVERVIEW
237 This overview is sorted such that macros of similar purpose are listed
238 together, to help find the best macro for any given purpose.
239 Deprecated macros are not included in the overview, but can be found
240 in the alphabetical reference below.
241 .Ss Page header and footer meta-data
242 .Bl -column "PP, LP, P" description
243 .It Sx TH Ta set the title: Ar title section date Op Ar source Op Ar volume
244 .It Sx AT Ta display AT&T UNIX version in the page footer (<= 1 argument)
245 .It Sx UC Ta display BSD version in the page footer (<= 1 argument)
246 .El
247 .Ss Sections and paragraphs
248 .Bl -column "PP, LP, P" description
249 .It Sx SH Ta section header (one line)
250 .It Sx SS Ta subsection header (one line)
251 .It Sx PP , LP , P Ta start an undecorated paragraph (no arguments)
252 .It Sx RS , RE Ta reset the left margin: Op Ar width
253 .It Sx IP Ta indented paragraph: Op Ar head Op Ar width
254 .It Sx TP Ta tagged paragraph: Op Ar width
255 .It Sx HP Ta hanged paragraph: Op Ar width
256 .It Sx \&br Ta force output line break in text mode (no arguments)
257 .It Sx \&sp Ta force vertical space: Op Ar height
258 .It Sx fi , nf Ta fill mode and no-fill mode (no arguments)
259 .It Sx in Ta additional indent: Op Ar width
260 .El
261 .Ss Physical markup
262 .Bl -column "PP, LP, P" description
263 .It Sx B Ta boldface font
264 .It Sx I Ta italic font
265 .It Sx R Ta roman (default) font
266 .It Sx SB Ta small boldface font
267 .It Sx SM Ta small roman font
268 .It Sx BI Ta alternate between boldface and italic fonts
269 .It Sx BR Ta alternate between boldface and roman fonts
270 .It Sx IB Ta alternate between italic and boldface fonts
271 .It Sx IR Ta alternate between italic and roman fonts
272 .It Sx RB Ta alternate between roman and boldface fonts
273 .It Sx RI Ta alternate between roman and italic fonts
274 .El
275 .Sh MACRO REFERENCE
276 This section is a canonical reference to all macros, arranged
277 alphabetically.
278 For the scoping of individual macros, see
279 .Sx MACRO SYNTAX .
280 .Ss \&AT
281 Sets the volume for the footer for compatibility with man pages from
282 .Tn AT&T UNIX
283 releases.
284 The optional arguments specify which release it is from.
285 .Ss \&B
286 Text is rendered in bold face.
287 .Pp
288 See also
289 .Sx \&I
290 and
291 .Sx \&R .
292 .Ss \&BI
293 Text is rendered alternately in bold face and italic.
294 Thus,
295 .Sq .BI this word and that
296 causes
297 .Sq this
298 and
299 .Sq and
300 to render in bold face, while
301 .Sq word
302 and
303 .Sq that
304 render in italics.
305 Whitespace between arguments is omitted in output.
306 .Pp
307 Examples:
308 .Pp
309 .Dl \&.BI bold italic bold italic
310 .Pp
311 The output of this example will be emboldened
312 .Dq bold
313 and italicised
314 .Dq italic ,
315 with spaces stripped between arguments.
316 .Pp
317 See also
318 .Sx \&IB ,
319 .Sx \&BR ,
320 .Sx \&RB ,
321 .Sx \&RI ,
322 and
323 .Sx \&IR .
324 .Ss \&BR
325 Text is rendered alternately in bold face and roman (the default font).
326 Whitespace between arguments is omitted in output.
327 .Pp
328 See
329 .Sx \&BI
330 for an equivalent example.
331 .Pp
332 See also
333 .Sx \&BI ,
334 .Sx \&IB ,
335 .Sx \&RB ,
336 .Sx \&RI ,
337 and
338 .Sx \&IR .
339 .Ss \&DT
340 Has no effect.
341 Included for compatibility.
342 .Ss \&HP
343 Begin a paragraph whose initial output line is left-justified, but
344 subsequent output lines are indented, with the following syntax:
345 .Bd -filled -offset indent
346 .Pf \. Sx \&HP
347 .Op Cm width
348 .Ed
349 .Pp
350 The
351 .Cm width
352 argument must conform to
353 .Sx Scaling Widths .
354 If specified, it's saved for later paragraph left-margins; if unspecified, the
355 saved or default width is used.
356 .Pp
357 See also
358 .Sx \&IP ,
359 .Sx \&LP ,
360 .Sx \&P ,
361 .Sx \&PP ,
362 and
363 .Sx \&TP .
364 .Ss \&I
365 Text is rendered in italics.
366 .Pp
367 See also
368 .Sx \&B
369 and
370 .Sx \&R .
371 .Ss \&IB
372 Text is rendered alternately in italics and bold face.
373 Whitespace between arguments is omitted in output.
374 .Pp
375 See
376 .Sx \&BI
377 for an equivalent example.
378 .Pp
379 See also
380 .Sx \&BI ,
381 .Sx \&BR ,
382 .Sx \&RB ,
383 .Sx \&RI ,
384 and
385 .Sx \&IR .
386 .Ss \&IP
387 Begin an indented paragraph with the following syntax:
388 .Bd -filled -offset indent
389 .Pf \. Sx \&IP
390 .Op Cm head Op Cm width
391 .Ed
392 .Pp
393 The
394 .Cm width
395 argument defines the width of the left margin and is defined by
396 .Sx Scaling Widths .
397 It's saved for later paragraph left-margins; if unspecified, the saved or
398 default width is used.
399 .Pp
400 The
401 .Cm head
402 argument is used as a leading term, flushed to the left margin.
403 This is useful for bulleted paragraphs and so on.
404 .Pp
405 See also
406 .Sx \&HP ,
407 .Sx \&LP ,
408 .Sx \&P ,
409 .Sx \&PP ,
410 and
411 .Sx \&TP .
412 .Ss \&IR
413 Text is rendered alternately in italics and roman (the default font).
414 Whitespace between arguments is omitted in output.
415 .Pp
416 See
417 .Sx \&BI
418 for an equivalent example.
419 .Pp
420 See also
421 .Sx \&BI ,
422 .Sx \&IB ,
423 .Sx \&BR ,
424 .Sx \&RB ,
425 and
426 .Sx \&RI .
427 .Ss \&LP
428 Begin an undecorated paragraph.
429 The scope of a paragraph is closed by a subsequent paragraph,
430 sub-section, section, or end of file.
431 The saved paragraph left-margin width is reset to the default.
432 .Pp
433 See also
434 .Sx \&HP ,
435 .Sx \&IP ,
436 .Sx \&P ,
437 .Sx \&PP ,
438 and
439 .Sx \&TP .
440 .Ss \&P
441 Synonym for
442 .Sx \&LP .
443 .Pp
444 See also
445 .Sx \&HP ,
446 .Sx \&IP ,
447 .Sx \&LP ,
448 .Sx \&PP ,
449 and
450 .Sx \&TP .
451 .Ss \&PP
452 Synonym for
453 .Sx \&LP .
454 .Pp
455 See also
456 .Sx \&HP ,
457 .Sx \&IP ,
458 .Sx \&LP ,
459 .Sx \&P ,
460 and
461 .Sx \&TP .
462 .Ss \&R
463 Text is rendered in roman (the default font).
464 .Pp
465 See also
466 .Sx \&I
467 and
468 .Sx \&B .
469 .Ss \&RB
470 Text is rendered alternately in roman (the default font) and bold face.
471 Whitespace between arguments is omitted in output.
472 .Pp
473 See
474 .Sx \&BI
475 for an equivalent example.
476 .Pp
477 See also
478 .Sx \&BI ,
479 .Sx \&IB ,
480 .Sx \&BR ,
481 .Sx \&RI ,
482 and
483 .Sx \&IR .
484 .Ss \&RE
485 Explicitly close out the scope of a prior
486 .Sx \&RS .
487 The default left margin is restored to the state of the original
488 .Sx \&RS
489 invocation.
490 .Ss \&RI
491 Text is rendered alternately in roman (the default font) and italics.
492 Whitespace between arguments is omitted in output.
493 .Pp
494 See
495 .Sx \&BI
496 for an equivalent example.
497 .Pp
498 See also
499 .Sx \&BI ,
500 .Sx \&IB ,
501 .Sx \&BR ,
502 .Sx \&RB ,
503 and
504 .Sx \&IR .
505 .Ss \&RS
506 Temporarily reset the default left margin.
507 This has the following syntax:
508 .Bd -filled -offset indent
509 .Pf \. Sx \&RS
510 .Op Cm width
511 .Ed
512 .Pp
513 The
514 .Cm width
515 argument must conform to
516 .Sx Scaling Widths .
517 If not specified, the saved or default width is used.
518 .Pp
519 See also
520 .Sx \&RE .
521 .Ss \&SB
522 Text is rendered in small size (one point smaller than the default font)
523 bold face.
524 .Ss \&SH
525 Begin a section.
526 The scope of a section is only closed by another section or the end of
527 file.
528 The paragraph left-margin width is reset to the default.
529 .Ss \&SM
530 Text is rendered in small size (one point smaller than the default
531 font).
532 .Ss \&SS
533 Begin a sub-section.
534 The scope of a sub-section is closed by a subsequent sub-section,
535 section, or end of file.
536 The paragraph left-margin width is reset to the default.
537 .Ss \&TH
538 Sets the title of the manual page with the following syntax:
539 .Bd -filled -offset indent
540 .Pf \. Sx \&TH
541 .Ar title section date
542 .Op Ar source Op Ar volume
543 .Ed
544 .Pp
545 Conventionally, the document
546 .Ar title
547 is given in all caps.
548 The recommended
549 .Ar date
550 format is
551 .Sy YYYY-MM-DD
552 as specified in the ISO-8601 standard;
553 if the argument does not conform, it is printed verbatim.
554 If the
555 .Ar date
556 is empty or not specified, the current date is used.
557 The optional
558 .Ar source
559 string specifies the organisation providing the utility.
560 The
561 .Ar volume
562 string replaces the default rendered volume, which is dictated by the
563 manual section.
564 .Pp
565 Examples:
566 .Pp
567 .Dl \&.TH CVS 5 "1992-02-12" GNU
568 .Ss \&TP
569 Begin a paragraph where the head, if exceeding the indentation width, is
570 followed by a newline; if not, the body follows on the same line after a
571 buffer to the indentation width.
572 Subsequent output lines are indented.
573 The syntax is as follows:
574 .Bd -filled -offset indent
575 .Pf \. Sx \&TP
576 .Op Cm width
577 .Ed
578 .Pp
579 The
580 .Cm width
581 argument must conform to
582 .Sx Scaling Widths .
583 If specified, it's saved for later paragraph left-margins; if
584 unspecified, the saved or default width is used.
585 .Pp
586 See also
587 .Sx \&HP ,
588 .Sx \&IP ,
589 .Sx \&LP ,
590 .Sx \&P ,
591 and
592 .Sx \&PP .
593 .Ss \&UC
594 Sets the volume for the footer for compatibility with man pages from
595 BSD releases.
596 The optional first argument specifies which release it is from.
597 .Ss \&br
598 Breaks the current line.
599 Consecutive invocations have no further effect.
600 .Pp
601 See also
602 .Sx \&sp .
603 .Ss \&fi
604 End literal mode begun by
605 .Sx \&nf .
606 .Ss \&ft
607 Change the current font mode.
608 See
609 .Sx Text Decoration
610 for a listing of available font modes.
611 .Ss \&in
612 Indent relative to the current indentation:
613 .Pp
614 .D1 Pf \. Sx \&in Op Cm width
615 .Pp
616 If
617 .Cm width
618 is signed, the new offset is relative.
619 Otherwise, it is absolute.
620 This value is reset upon the next paragraph, section, or sub-section.
621 .Ss \&na
622 Don't align to the right margin.
623 .Ss \&nf
624 Begin literal mode: all subsequent free-form lines have their end of
625 line boundaries preserved.
626 May be ended by
627 .Sx \&fi .
628 Literal mode is implicitly ended by
629 .Sx \&SH
630 or
631 .Sx \&SS .
632 .Ss \&sp
633 Insert vertical spaces into output with the following syntax:
634 .Bd -filled -offset indent
635 .Pf \. Sx \&sp
636 .Op Cm height
637 .Ed
638 .Pp
639 Insert
640 .Cm height
641 spaces, which must conform to
642 .Sx Scaling Widths .
643 If 0, this is equivalent to the
644 .Sx \&br
645 macro.
646 Defaults to 1, if unspecified.
647 .Pp
648 See also
649 .Sx \&br .
650 .Sh MACRO SYNTAX
651 The
652 .Nm
653 macros are classified by scope: line scope or block scope.
654 Line macros are only scoped to the current line (and, in some
655 situations, the subsequent line).
656 Block macros are scoped to the current line and subsequent lines until
657 closed by another block macro.
658 .Ss Line Macros
659 Line macros are generally scoped to the current line, with the body
660 consisting of zero or more arguments.
661 If a macro is scoped to the next line and the line arguments are empty,
662 the next line, which must be text, is used instead.
663 Thus:
664 .Bd -literal -offset indent
665 \&.I
666 foo
667 .Ed
668 .Pp
669 is equivalent to
670 .Sq \&.I foo .
671 If next-line macros are invoked consecutively, only the last is used.
672 If a next-line macro is followed by a non-next-line macro, an error is
673 raised, except for
674 .Sx \&br ,
675 .Sx \&sp ,
676 and
677 .Sx \&na .
678 .Pp
679 The syntax is as follows:
680 .Bd -literal -offset indent
681 \&.YO \(lBbody...\(rB
682 \(lBbody...\(rB
683 .Ed
684 .Bl -column "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX" -offset indent
685 .It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes
686 .It Sx \&AT Ta <=1 Ta current Ta \&
687 .It Sx \&B Ta n Ta next-line Ta \&
688 .It Sx \&BI Ta n Ta current Ta \&
689 .It Sx \&BR Ta n Ta current Ta \&
690 .It Sx \&DT Ta 0 Ta current Ta \&
691 .It Sx \&I Ta n Ta next-line Ta \&
692 .It Sx \&IB Ta n Ta current Ta \&
693 .It Sx \&IR Ta n Ta current Ta \&
694 .It Sx \&R Ta n Ta next-line Ta \&
695 .It Sx \&RB Ta n Ta current Ta \&
696 .It Sx \&RI Ta n Ta current Ta \&
697 .It Sx \&SB Ta n Ta next-line Ta \&
698 .It Sx \&SM Ta n Ta next-line Ta \&
699 .It Sx \&TH Ta >1, <6 Ta current Ta \&
700 .It Sx \&UC Ta <=1 Ta current Ta \&
701 .It Sx \&br Ta 0 Ta current Ta compat
702 .It Sx \&fi Ta 0 Ta current Ta compat
703 .It Sx \&ft Ta 1 Ta current Ta compat
704 .It Sx \&in Ta 1 Ta current Ta compat
705 .It Sx \&na Ta 0 Ta current Ta compat
706 .It Sx \&nf Ta 0 Ta current Ta compat
707 .It Sx \&sp Ta 1 Ta current Ta compat
708 .El
709 .Pp
710 Macros marked as
711 .Qq compat
712 are included for compatibility with the significant corpus of existing
713 manuals that mix dialects of roff.
714 These macros should not be used for portable
715 .Nm
716 manuals.
717 .Ss Block Macros
718 Block macros comprise a head and body.
719 As with in-line macros, the head is scoped to the current line and, in
720 one circumstance, the next line (the next-line stipulations as in
721 .Sx Line Macros
722 apply here as well).
723 .Pp
724 The syntax is as follows:
725 .Bd -literal -offset indent
726 \&.YO \(lBhead...\(rB
727 \(lBhead...\(rB
728 \(lBbody...\(rB
729 .Ed
730 .Pp
731 The closure of body scope may be to the section, where a macro is closed
732 by
733 .Sx \&SH ;
734 sub-section, closed by a section or
735 .Sx \&SS ;
736 part, closed by a section, sub-section, or
737 .Sx \&RE ;
738 or paragraph, closed by a section, sub-section, part,
739 .Sx \&HP ,
740 .Sx \&IP ,
741 .Sx \&LP ,
742 .Sx \&P ,
743 .Sx \&PP ,
744 or
745 .Sx \&TP .
746 No closure refers to an explicit block closing macro.
747 .Pp
748 As a rule, block macros may not be nested; thus, calling a block macro
749 while another block macro scope is open, and the open scope is not
750 implicitly closed, is syntactically incorrect.
751 .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX" -offset indent
752 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes
753 .It Sx \&HP Ta <2 Ta current Ta paragraph Ta \&
754 .It Sx \&IP Ta <3 Ta current Ta paragraph Ta \&
755 .It Sx \&LP Ta 0 Ta current Ta paragraph Ta \&
756 .It Sx \&P Ta 0 Ta current Ta paragraph Ta \&
757 .It Sx \&PP Ta 0 Ta current Ta paragraph Ta \&
758 .It Sx \&RE Ta 0 Ta current Ta none Ta compat
759 .It Sx \&RS Ta 1 Ta current Ta part Ta compat
760 .It Sx \&SH Ta >0 Ta next-line Ta section Ta \&
761 .It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \&
762 .It Sx \&TP Ta n Ta next-line Ta paragraph Ta \&
763 .El
764 .Pp
765 Macros marked
766 .Qq compat
767 are as mentioned in
768 .Sx Line Macros .
769 .Pp
770 If a block macro is next-line scoped, it may only be followed by in-line
771 macros for decorating text.
772 .Ss Font handling
773 In
774 .Nm
775 documents, both
776 .Sx Physical markup
777 macros and
778 .Xr roff 7
779 .Ql \ef
780 font escape sequences can be used to choose fonts.
781 In text lines, the effect of manual font selection by escape sequences
782 only lasts until the next macro invocation; in macro lines, it only lasts
783 until the end of the macro scope.
784 Note that macros like
785 .Sx \&BR
786 open and close a font scope for each argument.
787 .Sh COMPATIBILITY
788 This section documents areas of questionable portability between
789 implementations of the
790 .Nm
791 language.
792 .Pp
793 .Bl -dash -compact
794 .It
795 Do not depend on
796 .Sx \&SH
797 or
798 .Sx \&SS
799 to close out a literal context opened with
800 .Sx \&nf .
801 This behaviour may not be portable.
802 .It
803 In quoted literals, GNU troff allowed pair-wise double-quotes to produce
804 a standalone double-quote in formatted output.
805 It is not known whether this behaviour is exhibited by other formatters.
806 .It
807 troff suppresses a newline before
808 .Sq \(aq
809 macro output; in mandoc, it is an alias for the standard
810 .Sq \&.
811 control character.
812 .It
813 The
814 .Sq \eh
815 .Pq horizontal position ,
816 .Sq \ev
817 .Pq vertical position ,
818 .Sq \em
819 .Pq text colour ,
820 .Sq \eM
821 .Pq text filling colour ,
822 .Sq \ez
823 .Pq zero-length character ,
824 .Sq \ew
825 .Pq string length ,
826 .Sq \ek
827 .Pq horizontal position marker ,
828 .Sq \eo
829 .Pq text overstrike ,
830 and
831 .Sq \es
832 .Pq text size
833 escape sequences are all discarded in mandoc.
834 .It
835 The
836 .Sq \ef
837 scaling unit is accepted by mandoc, but rendered as the default unit.
838 .It
839 The
840 .Sx \&sp
841 macro does not accept negative values in mandoc.
842 In GNU troff, this would result in strange behaviour.
843 .It
844 In page header lines, GNU troff versions up to and including 1.21
845 only print
846 .Ar volume
847 names explicitly specified in the
848 .Sx \&TH
849 macro; mandoc and newer groff print the default volume name
850 corresponding to the
851 .Ar section
852 number when no
853 .Ar volume
854 is given, like in
855 .Xr mdoc 7 .
856 .El
857 .Sh SEE ALSO
858 .Xr man 1 ,
859 .Xr mandoc 1 ,
860 .Xr eqn 7 ,
861 .Xr mandoc_char 7 ,
862 .Xr mdoc 7 ,
863 .Xr roff 7 ,
864 .Xr tbl 7
865 .Sh HISTORY
866 The
867 .Nm
868 language first appeared as a macro package for the roff typesetting
869 system in
870 .At v7 .
871 It was later rewritten by James Clark as a macro package for groff.
872 The stand-alone implementation that is part of the
873 .Xr mandoc 1
874 utility written by Kristaps Dzonsons appeared in
875 .Ox 4.6 .
876 .Sh AUTHORS
877 This
878 .Nm
879 reference was written by
880 .An Kristaps Dzonsons ,
881 .Mt kristaps@bsd.lv .
882 .Sh CAVEATS
883 Do not use this language.
884 Use
885 .Xr mdoc 7 ,
886 instead.