Annotation of mandoc/man.7, Revision 1.106
1.106 ! kristaps 1: .\" $Id: man.7,v 1.105 2011/08/18 08:58:43 kristaps Exp $
1.1 kristaps 2: .\"
1.78 schwarze 3: .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
1.1 kristaps 4: .\"
5: .\" Permission to use, copy, modify, and distribute this software for any
1.10 kristaps 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.
1.1 kristaps 16: .\"
1.106 ! kristaps 17: .Dd $Mdocdate: August 18 2011 $
1.9 kristaps 18: .Dt MAN 7
1.1 kristaps 19: .Os
20: .Sh NAME
1.32 kristaps 21: .Nm man
22: .Nd man language reference
1.1 kristaps 23: .Sh DESCRIPTION
24: The
1.32 kristaps 25: .Nm man
1.20 kristaps 26: language was historically used to format
1.32 kristaps 27: .Ux
1.68 kristaps 28: manuals.
29: This reference document describes its syntax, structure, and usage.
1.32 kristaps 30: .Pp
31: .Bf -emphasis
1.20 kristaps 32: Do not use
1.32 kristaps 33: .Nm
1.20 kristaps 34: to write your manuals.
1.32 kristaps 35: .Ef
1.19 kristaps 36: Use the
1.32 kristaps 37: .Xr mdoc 7
1.1 kristaps 38: language, instead.
1.32 kristaps 39: .Pp
1.78 schwarze 40: A
1.32 kristaps 41: .Nm
1.106 ! kristaps 42: document follows simple rules: lines beginning with the control
1.20 kristaps 43: character
1.32 kristaps 44: .Sq \&.
1.68 kristaps 45: are parsed for macros.
1.106 ! kristaps 46: Lines not beginning with the control character are
! 47: interpreted within the scope of prior macros:
1.32 kristaps 48: .Bd -literal -offset indent
1.1 kristaps 49: \&.SH Macro lines change control state.
1.106 ! kristaps 50: Text lines are interpreted within the current state.
1.32 kristaps 51: .Ed
1.103 kristaps 52: .Sh LANGUAGE SYNTAX
1.32 kristaps 53: .Nm
1.14 kristaps 54: documents may contain only graphable 7-bit ASCII characters, the
1.78 schwarze 55: space character, and the tab character.
1.103 kristaps 56: The back-space character
57: .Sq \e
58: indicates the start of an escape sequence for
59: .Sx Comments ,
60: .Sx Predefined Strings ,
61: and
62: .Sx Special Characters .
1.32 kristaps 63: .Ss Comments
1.103 kristaps 64: Text following an escaped double-quote
1.106 ! kristaps 65: .Sq \e\(dq ,
1.103 kristaps 66: whether in a macro or text line, is ignored to the end of
1.68 kristaps 67: line.
1.103 kristaps 68: A macro line beginning with a control character and comment escape
1.106 ! kristaps 69: .Sq \&.\e\(dq
1.68 kristaps 70: is also ignored.
1.103 kristaps 71: Furthermore,
72: macro lines with only a control character and optional trailing
73: whitespace are
1.68 kristaps 74: stripped from input.
1.104 kristaps 75: .Pp
76: Examples:
77: .Bd -literal -offset indent -compact
1.106 ! kristaps 78: \&.\e\(dq This is a comment line.
! 79: \&.\e\(dq The next line is ignored:
1.104 kristaps 80: \&.
1.106 ! kristaps 81: \&.Em Emphasis \e\(dq This is also a comment.
1.104 kristaps 82: .Ed
1.32 kristaps 83: .Ss Special Characters
1.103 kristaps 84: Special characters are used to encode special glyphs and are rendered
85: differently across output media.
86: They may occur in both macro and text lines.
1.21 kristaps 87: Sequences begin with the escape character
1.32 kristaps 88: .Sq \e
1.20 kristaps 89: followed by either an open-parenthesis
1.32 kristaps 90: .Sq \&(
1.1 kristaps 91: for two-character sequences; an open-bracket
1.32 kristaps 92: .Sq \&[
1.1 kristaps 93: for n-character sequences (terminated at a close-bracket
1.32 kristaps 94: .Sq \&] ) ;
1.103 kristaps 95: or a single one character sequence.
96: .Pp
97: Examples:
98: .Bl -tag -width Ds -offset indent -compact
1.106 ! kristaps 99: .It Li \e(em
! 100: Two-letter em dash escape.
! 101: .It Li \ee
! 102: One-letter backslash escape.
1.103 kristaps 103: .El
104: .Pp
1.68 kristaps 105: See
1.32 kristaps 106: .Xr mandoc_char 7
1.68 kristaps 107: for a complete list.
1.32 kristaps 108: .Ss Text Decoration
1.21 kristaps 109: Terms may be text-decorated using the
1.32 kristaps 110: .Sq \ef
1.103 kristaps 111: escape followed by an indicator: B (bold), I (italic), R (regular), or P
1.106 ! kristaps 112: (revert to previous mode).
1.103 kristaps 113: A numerical representation 3, 2, or 1 (bold, italic, and regular,
1.68 kristaps 114: respectively) may be used instead.
115: A text decoration is only valid, if specified in free-form text, until
116: the next macro invocation; if specified within a macro, it's only valid
117: until the macro closes scope.
1.54 kristaps 118: Note that macros like
119: .Sx \&BR
120: open and close a font scope with each argument.
1.48 kristaps 121: .Pp
1.76 kristaps 122: The
1.49 kristaps 123: .Sq \ef
1.76 kristaps 124: attribute is forgotten when entering or exiting a macro block.
1.103 kristaps 125: .Pp
126: Examples:
127: .Bl -tag -width Ds -offset indent -compact
1.106 ! kristaps 128: .It Li \efBbold\efR
! 129: Write in bold, then switch to regular font mode.
! 130: .It Li \efIitalic\efP
! 131: Write in italic, then return to previous font mode.
1.103 kristaps 132: .El
133: .Ss Predefined Strings
134: Predefined strings, like
135: .Sx Special Characters ,
136: mark special output glyphs.
137: Predefined strings are escaped with the slash-asterisk,
138: .Sq \e* :
139: single-character
140: .Sq \e*X ,
141: two-character
142: .Sq \e*(XX ,
143: and N-character
144: .Sq \e*[N] .
145: .Pp
146: Examples:
147: .Bl -tag -width Ds -offset indent -compact
1.106 ! kristaps 148: .It Li \e*(Am
! 149: Two-letter ampersand predefined string.
! 150: .It Li \e*q
! 151: One-letter double-quote predefined string.
1.103 kristaps 152: .El
153: .Pp
154: These strings are set using
155: .Xr roff 7 ,
156: although
157: .Nm
158: consists of several pre-set escapes listed in
159: .Xr mandoc_char 7 .
1.32 kristaps 160: .Ss Whitespace
1.66 kristaps 161: Whitespace consists of the space character.
1.103 kristaps 162: In text lines, whitespace is preserved within a line.
163: In macro lines, whitespace delimits arguments and is discarded.
1.64 kristaps 164: .Pp
1.103 kristaps 165: Unescaped trailing spaces are stripped from text line input unless in a
166: literal context.
167: In general, trailing whitespace on any input line is discouraged for
168: reasons of portability.
169: In the rare case that a blank character is needed at the end of an
170: input line, it may be forced by
171: .Sq \e\ \e& .
172: .Pp
1.106 ! kristaps 173: In general, space characters can be rendered as literal
! 174: characters by using non-breaking space escapes or
! 175: .Sx Quotation .
1.103 kristaps 176: If the first character of a text line is a space, that line is printed
177: with a leading newline.
178: .Ss Quotation
1.106 ! kristaps 179: Macro arguments may be quoted with double-quotes to so that the
! 180: enclosed text is one literal term.
! 181: Quoted text, even if whitespace or if it would cause a macro invocation
! 182: when unquoted, is considered literal text.
1.103 kristaps 183: .Pp
184: A quoted argument begins with a double-quote preceded by whitespace.
185: The next double-quote not pairwise adjacent to another double-quote
186: terminates the literal, regardless of surrounding whitespace.
187: .Pp
1.106 ! kristaps 188: Examples:
! 189: .Bl -tag -width Ds -offset indent -compact
! 190: .It Li .BR a \(dqb c\(dq d
! 191: Group arguments
! 192: .Qq b c
! 193: into one un-bolded argument.
! 194: If unspecified,
! 195: .Qq a
! 196: and
! 197: .Qq c
! 198: will be in bold,
! 199: .Qq b
! 200: and
! 201: .Qq d
! 202: in regular font mode.
! 203: Furthermore, will be preserved between
! 204: .Qq b
! 205: and
! 206: .Qq c .
! 207: .El
1.38 kristaps 208: .Ss Scaling Widths
1.103 kristaps 209: Many macros support scaled widths for their arguments.
210: The syntax for a scaled width is
211: .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
1.38 kristaps 212: where a decimal must be preceded or proceeded by at least one digit.
1.68 kristaps 213: Negative numbers, while accepted, are truncated to zero.
1.103 kristaps 214: .Pp
1.68 kristaps 215: The following scaling units are accepted:
1.38 kristaps 216: .Pp
217: .Bl -tag -width Ds -offset indent -compact
218: .It c
219: centimetre
220: .It i
221: inch
222: .It P
223: pica (~1/6 inch)
224: .It p
225: point (~1/72 inch)
226: .It f
227: synonym for
228: .Sq u
229: .It v
230: default vertical span
231: .It m
232: width of rendered
233: .Sq m
234: .Pq em
235: character
236: .It n
237: width of rendered
238: .Sq n
239: .Pq en
240: character
241: .It u
242: default horizontal span
243: .It M
244: mini-em (~1/100 em)
245: .El
246: .Pp
247: Using anything other than
248: .Sq m ,
249: .Sq n ,
250: .Sq u ,
251: or
252: .Sq v
1.44 kristaps 253: is necessarily non-portable across output media.
1.103 kristaps 254: See
255: .Sx COMPATIBILITY .
1.38 kristaps 256: .Pp
257: If a scaling unit is not provided, the numerical value is interpreted
258: under the default rules of
259: .Sq v
260: for vertical spaces and
261: .Sq u
262: for horizontal ones.
1.103 kristaps 263: .Pp
264: Examples:
265: .Bl -tag -width Ds -offset indent -compact
266: .It \&.HP 2i
267: two-inch tagged list indentation
268: .Pq see Sx \&HP
269: .It \&.sp 2v
270: two vertical spaces
271: .Pq see Sx \&sp
272: .El
1.69 kristaps 273: .Ss Sentence Spacing
1.103 kristaps 274: Sentences should terminate at the end of an input line.
275: By doing this, a formatter will be able to apply the proper amount of
1.71 kristaps 276: spacing after the end of sentence (unescaped) period, exclamation mark,
277: or question mark followed by zero or more non-sentence closing
1.80 kristaps 278: delimiters
279: .Po
280: .Sq \&) ,
1.71 kristaps 281: .Sq \&] ,
282: .Sq \&' ,
1.80 kristaps 283: .Sq \&"
284: .Pc .
1.103 kristaps 285: .Pp
286: Examples:
287: .Bd -literal -offset indent -compact
288: Do not end sentences mid-line like this. Instead,
289: end a sentence like this.
290: A new sentence gets a new line.
291: .Ed
1.22 kristaps 292: .Sh MANUAL STRUCTURE
1.16 kristaps 293: Each
1.32 kristaps 294: .Nm
1.80 kristaps 295: document must contain the
1.39 kristaps 296: .Sx \&TH
1.68 kristaps 297: macro describing the document's section and title.
1.80 kristaps 298: It may occur anywhere in the document, although conventionally it
1.68 kristaps 299: appears as the first macro.
1.32 kristaps 300: .Pp
1.22 kristaps 301: Beyond
1.39 kristaps 302: .Sx \&TH ,
1.68 kristaps 303: at least one macro or text node must appear in the document.
1.100 kristaps 304: .Pp
305: The following is a well-formed skeleton
306: .Nm
307: file for a utility
308: .Qq progname :
1.32 kristaps 309: .Bd -literal -offset indent
1.100 kristaps 310: \&.TH PROGNAME 1 2009-10-10
1.22 kristaps 311: \&.SH NAME
1.100 kristaps 312: \efBprogname\efR \e(en a description goes here
1.106 ! kristaps 313: \&.\e\(dq .SH LIBRARY
! 314: \&.\e\(dq For sections 2 & 3 only.
! 315: \&.\e\(dq Not used in OpenBSD.
1.22 kristaps 316: \&.SH SYNOPSIS
1.100 kristaps 317: \efBprogname\efR [\efB\e-options\efR] arguments...
1.22 kristaps 318: \&.SH DESCRIPTION
1.33 kristaps 319: The \efBfoo\efR utility processes files...
1.106 ! kristaps 320: \&.\e\(dq .SH IMPLEMENTATION NOTES
! 321: \&.\e\(dq Not used in OpenBSD.
! 322: \&.\e\(dq .SH RETURN VALUES
! 323: \&.\e\(dq For sections 2, 3, & 9 only.
! 324: \&.\e\(dq .SH ENVIRONMENT
! 325: \&.\e\(dq For sections 1, 6, 7, & 8 only.
! 326: \&.\e\(dq .SH FILES
! 327: \&.\e\(dq .SH EXIT STATUS
! 328: \&.\e\(dq For sections 1, 6, & 8 only.
! 329: \&.\e\(dq .SH EXAMPLES
! 330: \&.\e\(dq .SH DIAGNOSTICS
! 331: \&.\e\(dq For sections 1, 4, 6, 7, & 8 only.
! 332: \&.\e\(dq .SH ERRORS
! 333: \&.\e\(dq For sections 2, 3, & 9 only.
! 334: \&.\e\(dq .SH SEE ALSO
! 335: \&.\e\(dq .BR foo ( 1 )
! 336: \&.\e\(dq .SH STANDARDS
! 337: \&.\e\(dq .SH HISTORY
! 338: \&.\e\(dq .SH AUTHORS
! 339: \&.\e\(dq .SH CAVEATS
! 340: \&.\e\(dq .SH BUGS
! 341: \&.\e\(dq .SH SECURITY CONSIDERATIONS
! 342: \&.\e\(dq Not used in OpenBSD.
1.32 kristaps 343: .Ed
1.41 kristaps 344: .Pp
345: The sections in a
346: .Nm
1.68 kristaps 347: document are conventionally ordered as they appear above.
348: Sections should be composed as follows:
1.42 kristaps 349: .Bl -ohang -offset indent
350: .It Em NAME
1.68 kristaps 351: The name(s) and a short description of the documented material.
352: The syntax for this is generally as follows:
1.41 kristaps 353: .Pp
354: .D1 \efBname\efR \e(en description
1.42 kristaps 355: .It Em LIBRARY
1.41 kristaps 356: The name of the library containing the documented material, which is
1.68 kristaps 357: assumed to be a function in a section 2 or 3 manual.
358: For functions in the C library, this may be as follows:
1.41 kristaps 359: .Pp
360: .D1 Standard C Library (libc, -lc)
1.42 kristaps 361: .It Em SYNOPSIS
1.41 kristaps 362: Documents the utility invocation syntax, function call syntax, or device
1.55 kristaps 363: configuration.
1.41 kristaps 364: .Pp
365: For the first, utilities (sections 1, 6, and 8), this is
366: generally structured as follows:
367: .Pp
368: .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
369: .Pp
370: For the second, function calls (sections 2, 3, 9):
371: .Pp
1.44 kristaps 372: .D1 \&.B char *name(char *\efIarg\efR);
1.41 kristaps 373: .Pp
374: And for the third, configurations (section 4):
375: .Pp
1.44 kristaps 376: .D1 \&.B name* at cardbus ? function ?
1.41 kristaps 377: .Pp
1.55 kristaps 378: Manuals not in these sections generally don't need a
1.42 kristaps 379: .Em SYNOPSIS .
380: .It Em DESCRIPTION
1.55 kristaps 381: This expands upon the brief, one-line description in
1.42 kristaps 382: .Em NAME .
383: It usually contains a break-down of the options (if documenting a
384: command).
385: .It Em IMPLEMENTATION NOTES
1.68 kristaps 386: Implementation-specific notes should be kept here.
387: This is useful when implementing standard functions that may have side
388: effects or notable algorithmic implications.
1.42 kristaps 389: .It Em RETURN VALUES
1.80 kristaps 390: This section documents the return values of functions in sections 2, 3, and 9.
1.42 kristaps 391: .It Em ENVIRONMENT
392: Documents any usages of environment variables, e.g.,
393: .Xr environ 7 .
394: .It Em FILES
1.68 kristaps 395: Documents files used.
1.78 schwarze 396: It's helpful to document both the file name and a short description of how
1.68 kristaps 397: the file is used (created, modified, etc.).
1.67 kristaps 398: .It Em EXIT STATUS
1.80 kristaps 399: This section documents the command exit status for
400: section 1, 6, and 8 utilities.
1.68 kristaps 401: Historically, this information was described in
1.67 kristaps 402: .Em DIAGNOSTICS ,
403: a practise that is now discouraged.
1.42 kristaps 404: .It Em EXAMPLES
1.68 kristaps 405: Example usages.
406: This often contains snippets of well-formed,
407: well-tested invocations.
1.80 kristaps 408: Make sure that examples work properly!
1.42 kristaps 409: .It Em DIAGNOSTICS
1.68 kristaps 410: Documents error conditions.
411: This is most useful in section 4 manuals.
1.42 kristaps 412: Historically, this section was used in place of
413: .Em EXIT STATUS
414: for manuals in sections 1, 6, and 8; however, this practise is
415: discouraged.
416: .It Em ERRORS
417: Documents error handling in sections 2, 3, and 9.
418: .It Em SEE ALSO
1.68 kristaps 419: References other manuals with related topics.
420: This section should exist for most manuals.
1.44 kristaps 421: .Pp
422: .D1 \&.BR bar \&( 1 \&),
423: .Pp
424: Cross-references should conventionally be ordered
1.42 kristaps 425: first by section, then alphabetically.
426: .It Em STANDARDS
427: References any standards implemented or used, such as
428: .Pp
429: .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
430: .Pp
431: If not adhering to any standards, the
432: .Em HISTORY
433: section should be used.
434: .It Em HISTORY
1.81 schwarze 435: A brief history of the subject, including where support first appeared.
1.42 kristaps 436: .It Em AUTHORS
1.81 schwarze 437: Credits to the person or persons who wrote the code and/or documentation.
1.78 schwarze 438: Authors should generally be noted by both name and email address.
1.42 kristaps 439: .It Em CAVEATS
1.78 schwarze 440: Common misuses and misunderstandings should be explained
1.42 kristaps 441: in this section.
442: .It Em BUGS
1.80 kristaps 443: Known bugs, limitations, and work-arounds should be described
1.78 schwarze 444: in this section.
1.42 kristaps 445: .It Em SECURITY CONSIDERATIONS
446: Documents any security precautions that operators should consider.
1.41 kristaps 447: .El
1.22 kristaps 448: .Sh MACRO SYNTAX
1.80 kristaps 449: Macros are one to three characters in length and begin with a
1.78 schwarze 450: control character,
1.32 kristaps 451: .Sq \&. ,
1.68 kristaps 452: at the beginning of the line.
453: The
1.59 kristaps 454: .Sq \(aq
1.68 kristaps 455: macro control character is also accepted.
456: An arbitrary amount of whitespace (spaces or tabs) may sit between the
457: control character and the macro name.
458: Thus, the following are equivalent:
1.39 kristaps 459: .Bd -literal -offset indent
460: \&.PP
461: \&.\ \ \ PP
462: .Ed
1.96 schwarze 463: .Pp
464: To include space characters in macro arguments, arguments may be quoted;
465: see the
466: .Sq MACRO SYNTAX
467: section in the
468: .Xr roff 7
469: manual for details.
1.32 kristaps 470: .Pp
1.1 kristaps 471: The
1.32 kristaps 472: .Nm
1.68 kristaps 473: macros are classified by scope: line scope or block scope.
474: Line macros are only scoped to the current line (and, in some
475: situations, the subsequent line).
476: Block macros are scoped to the current line and subsequent lines until
477: closed by another block macro.
1.32 kristaps 478: .Ss Line Macros
1.30 kristaps 479: Line macros are generally scoped to the current line, with the body
1.68 kristaps 480: consisting of zero or more arguments.
481: If a macro is scoped to the next line and the line arguments are empty,
482: the next line, which must be text, is used instead.
483: Thus:
1.32 kristaps 484: .Bd -literal -offset indent
1.30 kristaps 485: \&.I
1.4 kristaps 486: foo
1.32 kristaps 487: .Ed
488: .Pp
1.20 kristaps 489: is equivalent to
1.32 kristaps 490: .Sq \&.I foo .
1.56 kristaps 491: If next-line macros are invoked consecutively, only the last is used.
492: If a next-line macro is followed by a non-next-line macro, an error is
1.78 schwarze 493: raised, except for
1.56 kristaps 494: .Sx \&br ,
495: .Sx \&sp ,
1.78 schwarze 496: and
497: .Sx \&na .
1.56 kristaps 498: .Pp
499: The syntax is as follows:
1.32 kristaps 500: .Bd -literal -offset indent
1.22 kristaps 501: \&.YO \(lBbody...\(rB
502: \(lBbody...\(rB
1.32 kristaps 503: .Ed
504: .Pp
1.57 kristaps 505: .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX"
506: .It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes
1.73 kristaps 507: .It Sx \&AT Ta <=1 Ta current Ta \&
1.57 kristaps 508: .It Sx \&B Ta n Ta next-line Ta \&
509: .It Sx \&BI Ta n Ta current Ta \&
510: .It Sx \&BR Ta n Ta current Ta \&
511: .It Sx \&DT Ta 0 Ta current Ta \&
512: .It Sx \&I Ta n Ta next-line Ta \&
513: .It Sx \&IB Ta n Ta current Ta \&
514: .It Sx \&IR Ta n Ta current Ta \&
515: .It Sx \&R Ta n Ta next-line Ta \&
516: .It Sx \&RB Ta n Ta current Ta \&
517: .It Sx \&RI Ta n Ta current Ta \&
518: .It Sx \&SB Ta n Ta next-line Ta \&
519: .It Sx \&SM Ta n Ta next-line Ta \&
520: .It Sx \&TH Ta >1, <6 Ta current Ta \&
1.73 kristaps 521: .It Sx \&UC Ta <=1 Ta current Ta \&
1.57 kristaps 522: .It Sx \&br Ta 0 Ta current Ta compat
523: .It Sx \&fi Ta 0 Ta current Ta compat
1.91 kristaps 524: .It Sx \&ft Ta 1 Ta current Ta compat
1.79 kristaps 525: .It Sx \&in Ta 1 Ta current Ta compat
1.57 kristaps 526: .It Sx \&na Ta 0 Ta current Ta compat
527: .It Sx \&nf Ta 0 Ta current Ta compat
528: .It Sx \&sp Ta 1 Ta current Ta compat
1.32 kristaps 529: .El
530: .Pp
1.57 kristaps 531: Macros marked as
532: .Qq compat
533: are included for compatibility with the significant corpus of existing
1.68 kristaps 534: manuals that mix dialects of roff.
535: These macros should not be used for portable
1.58 kristaps 536: .Nm
537: manuals.
1.32 kristaps 538: .Ss Block Macros
1.80 kristaps 539: Block macros comprise a head and body.
540: As with in-line macros, the head is scoped to the current line and, in
1.68 kristaps 541: one circumstance, the next line (the next-line stipulations as in
1.57 kristaps 542: .Sx Line Macros
543: apply here as well).
1.56 kristaps 544: .Pp
545: The syntax is as follows:
1.32 kristaps 546: .Bd -literal -offset indent
1.22 kristaps 547: \&.YO \(lBhead...\(rB
548: \(lBhead...\(rB
549: \(lBbody...\(rB
1.32 kristaps 550: .Ed
551: .Pp
1.30 kristaps 552: The closure of body scope may be to the section, where a macro is closed
553: by
1.39 kristaps 554: .Sx \&SH ;
1.30 kristaps 555: sub-section, closed by a section or
1.39 kristaps 556: .Sx \&SS ;
1.30 kristaps 557: part, closed by a section, sub-section, or
1.39 kristaps 558: .Sx \&RE ;
1.55 kristaps 559: or paragraph, closed by a section, sub-section, part,
1.39 kristaps 560: .Sx \&HP ,
561: .Sx \&IP ,
562: .Sx \&LP ,
563: .Sx \&P ,
564: .Sx \&PP ,
1.30 kristaps 565: or
1.39 kristaps 566: .Sx \&TP .
1.30 kristaps 567: No closure refers to an explicit block closing macro.
1.32 kristaps 568: .Pp
1.58 kristaps 569: As a rule, block macros may not be nested; thus, calling a block macro
570: while another block macro scope is open, and the open scope is not
571: implicitly closed, is syntactically incorrect.
572: .Pp
1.57 kristaps 573: .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX"
574: .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes
575: .It Sx \&HP Ta <2 Ta current Ta paragraph Ta \&
576: .It Sx \&IP Ta <3 Ta current Ta paragraph Ta \&
577: .It Sx \&LP Ta 0 Ta current Ta paragraph Ta \&
578: .It Sx \&P Ta 0 Ta current Ta paragraph Ta \&
579: .It Sx \&PP Ta 0 Ta current Ta paragraph Ta \&
580: .It Sx \&RE Ta 0 Ta current Ta none Ta compat
581: .It Sx \&RS Ta 1 Ta current Ta part Ta compat
582: .It Sx \&SH Ta >0 Ta next-line Ta section Ta \&
583: .It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \&
584: .It Sx \&TP Ta n Ta next-line Ta paragraph Ta \&
1.32 kristaps 585: .El
1.57 kristaps 586: .Pp
587: Macros marked
588: .Qq compat
589: are as mentioned in
590: .Sx Line Macros .
1.32 kristaps 591: .Pp
1.22 kristaps 592: If a block macro is next-line scoped, it may only be followed by in-line
1.57 kristaps 593: macros for decorating text.
1.22 kristaps 594: .Sh REFERENCE
595: This section is a canonical reference to all macros, arranged
1.68 kristaps 596: alphabetically.
597: For the scoping of individual macros, see
1.32 kristaps 598: .Sx MACRO SYNTAX .
1.72 joerg 599: .Ss \&AT
600: Sets the volume for the footer for compatibility with man pages from
601: .Tn AT&T UNIX
602: releases.
603: The optional arguments specify which release it is from.
1.39 kristaps 604: .Ss \&B
1.22 kristaps 605: Text is rendered in bold face.
1.44 kristaps 606: .Pp
607: See also
1.92 kristaps 608: .Sx \&I
1.44 kristaps 609: and
1.92 kristaps 610: .Sx \&R .
1.39 kristaps 611: .Ss \&BI
1.68 kristaps 612: Text is rendered alternately in bold face and italic.
613: Thus,
1.32 kristaps 614: .Sq .BI this word and that
1.22 kristaps 615: causes
1.32 kristaps 616: .Sq this
1.22 kristaps 617: and
1.32 kristaps 618: .Sq and
1.55 kristaps 619: to render in bold face, while
1.32 kristaps 620: .Sq word
1.22 kristaps 621: and
1.32 kristaps 622: .Sq that
1.68 kristaps 623: render in italics.
624: Whitespace between arguments is omitted in output.
1.44 kristaps 625: .Pp
626: Examples:
1.46 kristaps 627: .Pp
1.93 kristaps 628: .Dl \&.BI bold italic bold italic
1.44 kristaps 629: .Pp
630: The output of this example will be emboldened
631: .Dq bold
632: and italicised
633: .Dq italic ,
634: with spaces stripped between arguments.
635: .Pp
636: See also
637: .Sx \&IB ,
638: .Sx \&BR ,
639: .Sx \&RB ,
640: .Sx \&RI ,
641: and
642: .Sx \&IR .
1.39 kristaps 643: .Ss \&BR
1.22 kristaps 644: Text is rendered alternately in bold face and roman (the default font).
645: Whitespace between arguments is omitted in output.
1.44 kristaps 646: .Pp
647: See
648: .Sx \&BI
649: for an equivalent example.
650: .Pp
651: See also
652: .Sx \&BI ,
653: .Sx \&IB ,
654: .Sx \&RB ,
655: .Sx \&RI ,
656: and
657: .Sx \&IR .
1.39 kristaps 658: .Ss \&DT
1.68 kristaps 659: Has no effect.
660: Included for compatibility.
1.39 kristaps 661: .Ss \&HP
1.23 kristaps 662: Begin a paragraph whose initial output line is left-justified, but
1.27 kristaps 663: subsequent output lines are indented, with the following syntax:
1.44 kristaps 664: .Bd -filled -offset indent
665: .Pf \. Sx \&HP
666: .Op Cm width
1.32 kristaps 667: .Ed
1.44 kristaps 668: .Pp
669: The
670: .Cm width
671: argument must conform to
672: .Sx Scaling Widths .
673: If specified, it's saved for later paragraph left-margins; if unspecified, the
674: saved or default width is used.
675: .Pp
676: See also
1.45 kristaps 677: .Sx \&IP ,
678: .Sx \&LP ,
679: .Sx \&P ,
680: .Sx \&PP ,
1.44 kristaps 681: and
1.45 kristaps 682: .Sx \&TP .
1.39 kristaps 683: .Ss \&I
1.22 kristaps 684: Text is rendered in italics.
1.44 kristaps 685: .Pp
686: See also
1.92 kristaps 687: .Sx \&B
1.44 kristaps 688: and
1.92 kristaps 689: .Sx \&R .
1.39 kristaps 690: .Ss \&IB
1.80 kristaps 691: Text is rendered alternately in italics and bold face.
692: Whitespace between arguments is omitted in output.
1.44 kristaps 693: .Pp
694: See
695: .Sx \&BI
696: for an equivalent example.
697: .Pp
698: See also
699: .Sx \&BI ,
700: .Sx \&BR ,
701: .Sx \&RB ,
702: .Sx \&RI ,
703: and
704: .Sx \&IR .
1.39 kristaps 705: .Ss \&IP
1.44 kristaps 706: Begin an indented paragraph with the following syntax:
707: .Bd -filled -offset indent
708: .Pf \. Sx \&IP
709: .Op Cm head Op Cm width
1.32 kristaps 710: .Ed
1.44 kristaps 711: .Pp
712: The
713: .Cm width
714: argument defines the width of the left margin and is defined by
1.80 kristaps 715: .Sx Scaling Widths .
1.44 kristaps 716: It's saved for later paragraph left-margins; if unspecified, the saved or
717: default width is used.
718: .Pp
719: The
720: .Cm head
1.68 kristaps 721: argument is used as a leading term, flushed to the left margin.
722: This is useful for bulleted paragraphs and so on.
1.44 kristaps 723: .Pp
724: See also
1.45 kristaps 725: .Sx \&HP ,
726: .Sx \&LP ,
727: .Sx \&P ,
728: .Sx \&PP ,
1.44 kristaps 729: and
1.45 kristaps 730: .Sx \&TP .
1.39 kristaps 731: .Ss \&IR
1.22 kristaps 732: Text is rendered alternately in italics and roman (the default font).
733: Whitespace between arguments is omitted in output.
1.44 kristaps 734: .Pp
735: See
736: .Sx \&BI
737: for an equivalent example.
738: .Pp
739: See also
740: .Sx \&BI ,
741: .Sx \&IB ,
742: .Sx \&BR ,
743: .Sx \&RB ,
744: and
745: .Sx \&RI .
1.39 kristaps 746: .Ss \&LP
1.68 kristaps 747: Begin an undecorated paragraph.
748: The scope of a paragraph is closed by a subsequent paragraph,
749: sub-section, section, or end of file.
1.78 schwarze 750: The saved paragraph left-margin width is reset to the default.
1.44 kristaps 751: .Pp
752: See also
1.45 kristaps 753: .Sx \&HP ,
754: .Sx \&IP ,
755: .Sx \&P ,
756: .Sx \&PP ,
1.44 kristaps 757: and
1.45 kristaps 758: .Sx \&TP .
1.39 kristaps 759: .Ss \&P
760: Synonym for
761: .Sx \&LP .
1.44 kristaps 762: .Pp
763: See also
1.45 kristaps 764: .Sx \&HP ,
765: .Sx \&IP ,
766: .Sx \&LP ,
767: .Sx \&PP ,
1.44 kristaps 768: and
1.45 kristaps 769: .Sx \&TP .
1.39 kristaps 770: .Ss \&PP
771: Synonym for
772: .Sx \&LP .
1.44 kristaps 773: .Pp
774: See also
1.45 kristaps 775: .Sx \&HP ,
776: .Sx \&IP ,
777: .Sx \&LP ,
778: .Sx \&P ,
1.44 kristaps 779: and
1.45 kristaps 780: .Sx \&TP .
1.39 kristaps 781: .Ss \&R
1.22 kristaps 782: Text is rendered in roman (the default font).
1.44 kristaps 783: .Pp
784: See also
1.92 kristaps 785: .Sx \&I
1.44 kristaps 786: and
1.92 kristaps 787: .Sx \&B .
1.39 kristaps 788: .Ss \&RB
1.22 kristaps 789: Text is rendered alternately in roman (the default font) and bold face.
790: Whitespace between arguments is omitted in output.
1.44 kristaps 791: .Pp
792: See
793: .Sx \&BI
794: for an equivalent example.
795: .Pp
796: See also
797: .Sx \&BI ,
798: .Sx \&IB ,
799: .Sx \&BR ,
800: .Sx \&RI ,
801: and
802: .Sx \&IR .
1.39 kristaps 803: .Ss \&RE
1.30 kristaps 804: Explicitly close out the scope of a prior
1.39 kristaps 805: .Sx \&RS .
1.102 kristaps 806: The default left margin is restored to the state of the original
807: .Sx \&RS
808: invocation.
1.39 kristaps 809: .Ss \&RI
1.22 kristaps 810: Text is rendered alternately in roman (the default font) and italics.
811: Whitespace between arguments is omitted in output.
1.44 kristaps 812: .Pp
813: See
814: .Sx \&BI
815: for an equivalent example.
816: .Pp
817: See also
818: .Sx \&BI ,
819: .Sx \&IB ,
820: .Sx \&BR ,
821: .Sx \&RB ,
822: and
823: .Sx \&IR .
1.39 kristaps 824: .Ss \&RS
1.102 kristaps 825: Temporarily reset the default left margin.
1.44 kristaps 826: This has the following syntax:
827: .Bd -filled -offset indent
1.102 kristaps 828: .Pf \. Sx \&RS
1.44 kristaps 829: .Op Cm width
1.32 kristaps 830: .Ed
1.44 kristaps 831: .Pp
832: The
833: .Cm width
834: argument must conform to
835: .Sx Scaling Widths .
1.55 kristaps 836: If not specified, the saved or default width is used.
1.102 kristaps 837: .Pp
838: See also
839: .Sx \&RE .
1.39 kristaps 840: .Ss \&SB
1.22 kristaps 841: Text is rendered in small size (one point smaller than the default font)
842: bold face.
1.39 kristaps 843: .Ss \&SH
1.68 kristaps 844: Begin a section.
845: The scope of a section is only closed by another section or the end of
846: file.
1.78 schwarze 847: The paragraph left-margin width is reset to the default.
1.39 kristaps 848: .Ss \&SM
1.22 kristaps 849: Text is rendered in small size (one point smaller than the default
850: font).
1.39 kristaps 851: .Ss \&SS
1.68 kristaps 852: Begin a sub-section.
853: The scope of a sub-section is closed by a subsequent sub-section,
854: section, or end of file.
1.78 schwarze 855: The paragraph left-margin width is reset to the default.
1.39 kristaps 856: .Ss \&TH
1.22 kristaps 857: Sets the title of the manual page with the following syntax:
1.44 kristaps 858: .Bd -filled -offset indent
859: .Pf \. Sx \&TH
1.99 schwarze 860: .Ar title section date
861: .Op Ar source Op Ar volume
1.44 kristaps 862: .Ed
1.43 kristaps 863: .Pp
1.99 schwarze 864: Conventionally, the document
865: .Ar title
866: is given in all caps.
867: The recommended
868: .Ar date
869: format is
870: .Sy YYYY-MM-DD
871: as specified in the ISO-8601 standard;
872: if the argument does not conform, it is printed verbatim.
873: If the
874: .Ar date
875: is empty or not specified, the current date is used.
876: The optional
877: .Ar source
1.68 kristaps 878: string specifies the organisation providing the utility.
879: The
1.99 schwarze 880: .Ar volume
1.43 kristaps 881: string replaces the default rendered volume, which is dictated by the
882: manual section.
883: .Pp
884: Examples:
1.46 kristaps 885: .Pp
1.93 kristaps 886: .Dl \&.TH CVS 5 "1992-02-12" GNU
1.39 kristaps 887: .Ss \&TP
1.25 kristaps 888: Begin a paragraph where the head, if exceeding the indentation width, is
1.24 kristaps 889: followed by a newline; if not, the body follows on the same line after a
1.68 kristaps 890: buffer to the indentation width.
891: Subsequent output lines are indented.
1.44 kristaps 892: The syntax is as follows:
893: .Bd -filled -offset indent
894: .Pf \. Sx \&TP
895: .Op Cm width
1.32 kristaps 896: .Ed
897: .Pp
1.44 kristaps 898: The
899: .Cm width
900: argument must conform to
901: .Sx Scaling Widths .
902: If specified, it's saved for later paragraph left-margins; if
1.27 kristaps 903: unspecified, the saved or default width is used.
1.44 kristaps 904: .Pp
905: See also
1.45 kristaps 906: .Sx \&HP ,
907: .Sx \&IP ,
908: .Sx \&LP ,
909: .Sx \&P ,
1.44 kristaps 910: and
1.45 kristaps 911: .Sx \&PP .
1.72 joerg 912: .Ss \&UC
913: Sets the volume for the footer for compatibility with man pages from
914: BSD releases.
915: The optional first argument specifies which release it is from.
1.39 kristaps 916: .Ss \&br
1.68 kristaps 917: Breaks the current line.
918: Consecutive invocations have no further effect.
1.44 kristaps 919: .Pp
920: See also
921: .Sx \&sp .
1.39 kristaps 922: .Ss \&fi
1.22 kristaps 923: End literal mode begun by
1.39 kristaps 924: .Sx \&nf .
1.91 kristaps 925: .Ss \&ft
926: Change the current font mode.
927: See
928: .Sx Text Decoration
929: for a listing of available font modes.
1.79 kristaps 930: .Ss \&in
931: Indent relative to the current indentation:
932: .Pp
933: .D1 Pf \. Sx \&in Op Cm width
934: .Pp
935: If
936: .Cm width
937: is signed, the new offset is relative.
938: Otherwise, it is absolute.
939: This value is reset upon the next paragraph, section, or sub-section.
1.39 kristaps 940: .Ss \&na
1.36 kristaps 941: Don't align to the right margin.
1.39 kristaps 942: .Ss \&nf
1.22 kristaps 943: Begin literal mode: all subsequent free-form lines have their end of
1.68 kristaps 944: line boundaries preserved.
945: May be ended by
1.39 kristaps 946: .Sx \&fi .
1.101 kristaps 947: Literal mode is implicitly ended by
948: .Sx \&SH
949: or
950: .Sx \&SS .
1.39 kristaps 951: .Ss \&sp
1.44 kristaps 952: Insert vertical spaces into output with the following syntax:
953: .Bd -filled -offset indent
954: .Pf \. Sx \&sp
955: .Op Cm height
956: .Ed
957: .Pp
1.55 kristaps 958: Insert
1.44 kristaps 959: .Cm height
960: spaces, which must conform to
961: .Sx Scaling Widths .
962: If 0, this is equivalent to the
1.39 kristaps 963: .Sx \&br
1.68 kristaps 964: macro.
965: Defaults to 1, if unspecified.
1.44 kristaps 966: .Pp
967: See also
968: .Sx \&br .
1.18 kristaps 969: .Sh COMPATIBILITY
1.58 kristaps 970: This section documents areas of questionable portability between
971: implementations of the
972: .Nm
973: language.
1.51 kristaps 974: .Pp
975: .Bl -dash -compact
1.77 kristaps 976: .It
1.58 kristaps 977: In quoted literals, GNU troff allowed pair-wise double-quotes to produce
1.68 kristaps 978: a standalone double-quote in formatted output.
979: It is not known whether this behaviour is exhibited by other formatters.
1.32 kristaps 980: .It
1.82 kristaps 981: troff suppresses a newline before
982: .Sq \(aq
983: macro output; in mandoc, it is an alias for the standard
984: .Sq \&.
985: control character.
986: .It
987: The
988: .Sq \eh
989: .Pq horizontal position ,
990: .Sq \ev
991: .Pq vertical position ,
992: .Sq \em
993: .Pq text colour ,
994: .Sq \eM
995: .Pq text filling colour ,
1.83 kristaps 996: .Sq \ez
997: .Pq zero-length character ,
1.84 kristaps 998: .Sq \ew
999: .Pq string length ,
1.85 kristaps 1000: .Sq \ek
1001: .Pq horizontal position marker ,
1.87 kristaps 1002: .Sq \eo
1003: .Pq text overstrike ,
1.82 kristaps 1004: and
1005: .Sq \es
1006: .Pq text size
1.84 kristaps 1007: escape sequences are all discarded in mandoc.
1.82 kristaps 1008: .It
1009: The
1010: .Sq \ef
1011: scaling unit is accepted by mandoc, but rendered as the default unit.
1012: .It
1.23 kristaps 1013: The
1.51 kristaps 1014: .Sx \&sp
1.68 kristaps 1015: macro does not accept negative values in mandoc.
1016: In GNU troff, this would result in strange behaviour.
1.32 kristaps 1017: .El
1.1 kristaps 1018: .Sh SEE ALSO
1.89 schwarze 1019: .Xr man 1 ,
1.32 kristaps 1020: .Xr mandoc 1 ,
1.98 kristaps 1021: .Xr eqn 7 ,
1.89 schwarze 1022: .Xr mandoc_char 7 ,
1.94 kristaps 1023: .Xr mdoc 7 ,
1024: .Xr roff 7 ,
1025: .Xr tbl 7
1.78 schwarze 1026: .Sh HISTORY
1027: The
1028: .Nm
1029: language first appeared as a macro package for the roff typesetting
1030: system in
1031: .At v7 .
1032: It was later rewritten by James Clark as a macro package for groff.
1033: The stand-alone implementation that is part of the
1034: .Xr mandoc 1
1035: utility written by Kristaps Dzonsons appeared in
1.80 kristaps 1036: .Ox 4.6 .
1.1 kristaps 1037: .Sh AUTHORS
1.78 schwarze 1038: This
1.32 kristaps 1039: .Nm
1.23 kristaps 1040: reference was written by
1.105 kristaps 1041: .An Kristaps Dzonsons ,
1042: .Mt kristaps@bsd.lv .
1.1 kristaps 1043: .Sh CAVEATS
1.68 kristaps 1044: Do not use this language.
1045: Use
1.32 kristaps 1046: .Xr mdoc 7 ,
1.1 kristaps 1047: instead.
CVSweb