Annotation of mandoc/man.7, Revision 1.110
1.110 ! schwarze 1: .\" $Id: man.7,v 1.109 2011/09/06 17:56:00 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.110 ! schwarze 17: .Dd $Mdocdate: September 6 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
1.108 kristaps 504: .Bl -column "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX" -offset indent
1.57 kristaps 505: .It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes
1.73 kristaps 506: .It Sx \&AT Ta <=1 Ta current Ta \&
1.57 kristaps 507: .It Sx \&B Ta n Ta next-line Ta \&
508: .It Sx \&BI Ta n Ta current Ta \&
509: .It Sx \&BR Ta n Ta current Ta \&
510: .It Sx \&DT Ta 0 Ta current Ta \&
511: .It Sx \&I Ta n Ta next-line Ta \&
512: .It Sx \&IB Ta n Ta current Ta \&
513: .It Sx \&IR Ta n Ta current Ta \&
514: .It Sx \&R Ta n Ta next-line Ta \&
515: .It Sx \&RB Ta n Ta current Ta \&
516: .It Sx \&RI Ta n Ta current Ta \&
517: .It Sx \&SB Ta n Ta next-line Ta \&
518: .It Sx \&SM Ta n Ta next-line Ta \&
519: .It Sx \&TH Ta >1, <6 Ta current Ta \&
1.73 kristaps 520: .It Sx \&UC Ta <=1 Ta current Ta \&
1.57 kristaps 521: .It Sx \&br Ta 0 Ta current Ta compat
522: .It Sx \&fi Ta 0 Ta current Ta compat
1.91 kristaps 523: .It Sx \&ft Ta 1 Ta current Ta compat
1.79 kristaps 524: .It Sx \&in Ta 1 Ta current Ta compat
1.57 kristaps 525: .It Sx \&na Ta 0 Ta current Ta compat
526: .It Sx \&nf Ta 0 Ta current Ta compat
527: .It Sx \&sp Ta 1 Ta current Ta compat
1.32 kristaps 528: .El
529: .Pp
1.57 kristaps 530: Macros marked as
531: .Qq compat
532: are included for compatibility with the significant corpus of existing
1.68 kristaps 533: manuals that mix dialects of roff.
534: These macros should not be used for portable
1.58 kristaps 535: .Nm
536: manuals.
1.32 kristaps 537: .Ss Block Macros
1.80 kristaps 538: Block macros comprise a head and body.
539: As with in-line macros, the head is scoped to the current line and, in
1.68 kristaps 540: one circumstance, the next line (the next-line stipulations as in
1.57 kristaps 541: .Sx Line Macros
542: apply here as well).
1.56 kristaps 543: .Pp
544: The syntax is as follows:
1.32 kristaps 545: .Bd -literal -offset indent
1.22 kristaps 546: \&.YO \(lBhead...\(rB
547: \(lBhead...\(rB
548: \(lBbody...\(rB
1.32 kristaps 549: .Ed
550: .Pp
1.30 kristaps 551: The closure of body scope may be to the section, where a macro is closed
552: by
1.39 kristaps 553: .Sx \&SH ;
1.30 kristaps 554: sub-section, closed by a section or
1.39 kristaps 555: .Sx \&SS ;
1.30 kristaps 556: part, closed by a section, sub-section, or
1.39 kristaps 557: .Sx \&RE ;
1.55 kristaps 558: or paragraph, closed by a section, sub-section, part,
1.39 kristaps 559: .Sx \&HP ,
560: .Sx \&IP ,
561: .Sx \&LP ,
562: .Sx \&P ,
563: .Sx \&PP ,
1.30 kristaps 564: or
1.39 kristaps 565: .Sx \&TP .
1.30 kristaps 566: No closure refers to an explicit block closing macro.
1.32 kristaps 567: .Pp
1.58 kristaps 568: As a rule, block macros may not be nested; thus, calling a block macro
569: while another block macro scope is open, and the open scope is not
570: implicitly closed, is syntactically incorrect.
1.108 kristaps 571: .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX" -offset indent
1.57 kristaps 572: .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes
573: .It Sx \&HP Ta <2 Ta current Ta paragraph Ta \&
574: .It Sx \&IP Ta <3 Ta current Ta paragraph Ta \&
575: .It Sx \&LP Ta 0 Ta current Ta paragraph Ta \&
576: .It Sx \&P Ta 0 Ta current Ta paragraph Ta \&
577: .It Sx \&PP Ta 0 Ta current Ta paragraph Ta \&
578: .It Sx \&RE Ta 0 Ta current Ta none Ta compat
579: .It Sx \&RS Ta 1 Ta current Ta part Ta compat
580: .It Sx \&SH Ta >0 Ta next-line Ta section Ta \&
581: .It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \&
582: .It Sx \&TP Ta n Ta next-line Ta paragraph Ta \&
1.32 kristaps 583: .El
1.57 kristaps 584: .Pp
585: Macros marked
586: .Qq compat
587: are as mentioned in
588: .Sx Line Macros .
1.32 kristaps 589: .Pp
1.22 kristaps 590: If a block macro is next-line scoped, it may only be followed by in-line
1.57 kristaps 591: macros for decorating text.
1.110 ! schwarze 592: .Sh MACRO OVERVIEW
! 593: This overview is sorted such that macros of similar purpose are listed
! 594: together, to help find the best macro for any given purpose.
! 595: Deprecated macros are not included in the overview, but can be found
! 596: in the alphabetical reference below.
! 597: .Ss Page header and footer meta-data
! 598: .Bl -column "PP, LP, P" description
! 599: .It Sx TH Ta set the title: Ar title section date Op Ar source Op Ar volume
! 600: .It Sx AT Ta display AT&T UNIX version in the page footer (<= 1 argument)
! 601: .It Sx UC Ta display BSD version in the page footer (<= 1 argument)
! 602: .El
! 603: .Ss Sections and paragraphs
! 604: .Bl -column "PP, LP, P" description
! 605: .It Sx SH Ta section header (one line)
! 606: .It Sx SS Ta subsection header (one line)
! 607: .It Sx PP , LP , P Ta start an undecorated paragraph (no arguments)
! 608: .It Sx RS , RE Ta reset the left margin: Op Ar width
! 609: .It Sx IP Ta indented paragraph: Op Ar head Op Ar width
! 610: .It Sx TP Ta tagged paragraph: Op Ar width
! 611: .It Sx HP Ta hanged paragraph: Op Ar width
! 612: .It Sx \&br Ta force output line break in text mode (no arguments)
! 613: .It Sx \&sp Ta force vertical space: Op Ar height
! 614: .It Sx fi , nf Ta fill mode and no-fill mode (no arguments)
! 615: .It Sx in Ta additional indent: Op Ar width
! 616: .El
! 617: .Ss Physical markup
! 618: .Bl -column "PP, LP, P" description
! 619: .It Sx B Ta boldface font
! 620: .It Sx I Ta italic font
! 621: .It Sx R Ta roman (default) font
! 622: .It Sx SB Ta small boldface font
! 623: .It Sx SM Ta small roman font
! 624: .It Sx BI Ta alternate between boldface and italic fonts
! 625: .It Sx BR Ta alternate between boldface and roman fonts
! 626: .It Sx IB Ta alternate between italic and boldface fonts
! 627: .It Sx IR Ta alternate between italic and roman fonts
! 628: .It Sx RB Ta alternate between roman and boldface fonts
! 629: .It Sx RI Ta alternate between roman and italic fonts
! 630: .El
1.22 kristaps 631: .Sh REFERENCE
632: This section is a canonical reference to all macros, arranged
1.68 kristaps 633: alphabetically.
634: For the scoping of individual macros, see
1.32 kristaps 635: .Sx MACRO SYNTAX .
1.72 joerg 636: .Ss \&AT
637: Sets the volume for the footer for compatibility with man pages from
638: .Tn AT&T UNIX
639: releases.
640: The optional arguments specify which release it is from.
1.39 kristaps 641: .Ss \&B
1.22 kristaps 642: Text is rendered in bold face.
1.44 kristaps 643: .Pp
644: See also
1.92 kristaps 645: .Sx \&I
1.44 kristaps 646: and
1.92 kristaps 647: .Sx \&R .
1.39 kristaps 648: .Ss \&BI
1.68 kristaps 649: Text is rendered alternately in bold face and italic.
650: Thus,
1.32 kristaps 651: .Sq .BI this word and that
1.22 kristaps 652: causes
1.32 kristaps 653: .Sq this
1.22 kristaps 654: and
1.32 kristaps 655: .Sq and
1.55 kristaps 656: to render in bold face, while
1.32 kristaps 657: .Sq word
1.22 kristaps 658: and
1.32 kristaps 659: .Sq that
1.68 kristaps 660: render in italics.
661: Whitespace between arguments is omitted in output.
1.44 kristaps 662: .Pp
663: Examples:
1.46 kristaps 664: .Pp
1.93 kristaps 665: .Dl \&.BI bold italic bold italic
1.44 kristaps 666: .Pp
667: The output of this example will be emboldened
668: .Dq bold
669: and italicised
670: .Dq italic ,
671: with spaces stripped between arguments.
672: .Pp
673: See also
674: .Sx \&IB ,
675: .Sx \&BR ,
676: .Sx \&RB ,
677: .Sx \&RI ,
678: and
679: .Sx \&IR .
1.39 kristaps 680: .Ss \&BR
1.22 kristaps 681: Text is rendered alternately in bold face and roman (the default font).
682: Whitespace between arguments is omitted in output.
1.44 kristaps 683: .Pp
684: See
685: .Sx \&BI
686: for an equivalent example.
687: .Pp
688: See also
689: .Sx \&BI ,
690: .Sx \&IB ,
691: .Sx \&RB ,
692: .Sx \&RI ,
693: and
694: .Sx \&IR .
1.39 kristaps 695: .Ss \&DT
1.68 kristaps 696: Has no effect.
697: Included for compatibility.
1.39 kristaps 698: .Ss \&HP
1.23 kristaps 699: Begin a paragraph whose initial output line is left-justified, but
1.27 kristaps 700: subsequent output lines are indented, with the following syntax:
1.44 kristaps 701: .Bd -filled -offset indent
702: .Pf \. Sx \&HP
703: .Op Cm width
1.32 kristaps 704: .Ed
1.44 kristaps 705: .Pp
706: The
707: .Cm width
708: argument must conform to
709: .Sx Scaling Widths .
710: If specified, it's saved for later paragraph left-margins; if unspecified, the
711: saved or default width is used.
712: .Pp
713: See also
1.45 kristaps 714: .Sx \&IP ,
715: .Sx \&LP ,
716: .Sx \&P ,
717: .Sx \&PP ,
1.44 kristaps 718: and
1.45 kristaps 719: .Sx \&TP .
1.39 kristaps 720: .Ss \&I
1.22 kristaps 721: Text is rendered in italics.
1.44 kristaps 722: .Pp
723: See also
1.92 kristaps 724: .Sx \&B
1.44 kristaps 725: and
1.92 kristaps 726: .Sx \&R .
1.39 kristaps 727: .Ss \&IB
1.80 kristaps 728: Text is rendered alternately in italics and bold face.
729: Whitespace between arguments is omitted in output.
1.44 kristaps 730: .Pp
731: See
732: .Sx \&BI
733: for an equivalent example.
734: .Pp
735: See also
736: .Sx \&BI ,
737: .Sx \&BR ,
738: .Sx \&RB ,
739: .Sx \&RI ,
740: and
741: .Sx \&IR .
1.39 kristaps 742: .Ss \&IP
1.44 kristaps 743: Begin an indented paragraph with the following syntax:
744: .Bd -filled -offset indent
745: .Pf \. Sx \&IP
746: .Op Cm head Op Cm width
1.32 kristaps 747: .Ed
1.44 kristaps 748: .Pp
749: The
750: .Cm width
751: argument defines the width of the left margin and is defined by
1.80 kristaps 752: .Sx Scaling Widths .
1.44 kristaps 753: It's saved for later paragraph left-margins; if unspecified, the saved or
754: default width is used.
755: .Pp
756: The
757: .Cm head
1.68 kristaps 758: argument is used as a leading term, flushed to the left margin.
759: This is useful for bulleted paragraphs and so on.
1.44 kristaps 760: .Pp
761: See also
1.45 kristaps 762: .Sx \&HP ,
763: .Sx \&LP ,
764: .Sx \&P ,
765: .Sx \&PP ,
1.44 kristaps 766: and
1.45 kristaps 767: .Sx \&TP .
1.39 kristaps 768: .Ss \&IR
1.22 kristaps 769: Text is rendered alternately in italics and roman (the default font).
770: Whitespace between arguments is omitted in output.
1.44 kristaps 771: .Pp
772: See
773: .Sx \&BI
774: for an equivalent example.
775: .Pp
776: See also
777: .Sx \&BI ,
778: .Sx \&IB ,
779: .Sx \&BR ,
780: .Sx \&RB ,
781: and
782: .Sx \&RI .
1.39 kristaps 783: .Ss \&LP
1.68 kristaps 784: Begin an undecorated paragraph.
785: The scope of a paragraph is closed by a subsequent paragraph,
786: sub-section, section, or end of file.
1.78 schwarze 787: The saved paragraph left-margin width is reset to the default.
1.44 kristaps 788: .Pp
789: See also
1.45 kristaps 790: .Sx \&HP ,
791: .Sx \&IP ,
792: .Sx \&P ,
793: .Sx \&PP ,
1.44 kristaps 794: and
1.45 kristaps 795: .Sx \&TP .
1.39 kristaps 796: .Ss \&P
797: Synonym for
798: .Sx \&LP .
1.44 kristaps 799: .Pp
800: See also
1.45 kristaps 801: .Sx \&HP ,
802: .Sx \&IP ,
803: .Sx \&LP ,
804: .Sx \&PP ,
1.44 kristaps 805: and
1.45 kristaps 806: .Sx \&TP .
1.39 kristaps 807: .Ss \&PP
808: Synonym for
809: .Sx \&LP .
1.44 kristaps 810: .Pp
811: See also
1.45 kristaps 812: .Sx \&HP ,
813: .Sx \&IP ,
814: .Sx \&LP ,
815: .Sx \&P ,
1.44 kristaps 816: and
1.45 kristaps 817: .Sx \&TP .
1.39 kristaps 818: .Ss \&R
1.22 kristaps 819: Text is rendered in roman (the default font).
1.44 kristaps 820: .Pp
821: See also
1.92 kristaps 822: .Sx \&I
1.44 kristaps 823: and
1.92 kristaps 824: .Sx \&B .
1.39 kristaps 825: .Ss \&RB
1.22 kristaps 826: Text is rendered alternately in roman (the default font) and bold face.
827: Whitespace between arguments is omitted in output.
1.44 kristaps 828: .Pp
829: See
830: .Sx \&BI
831: for an equivalent example.
832: .Pp
833: See also
834: .Sx \&BI ,
835: .Sx \&IB ,
836: .Sx \&BR ,
837: .Sx \&RI ,
838: and
839: .Sx \&IR .
1.39 kristaps 840: .Ss \&RE
1.30 kristaps 841: Explicitly close out the scope of a prior
1.39 kristaps 842: .Sx \&RS .
1.102 kristaps 843: The default left margin is restored to the state of the original
844: .Sx \&RS
845: invocation.
1.39 kristaps 846: .Ss \&RI
1.22 kristaps 847: Text is rendered alternately in roman (the default font) and italics.
848: Whitespace between arguments is omitted in output.
1.44 kristaps 849: .Pp
850: See
851: .Sx \&BI
852: for an equivalent example.
853: .Pp
854: See also
855: .Sx \&BI ,
856: .Sx \&IB ,
857: .Sx \&BR ,
858: .Sx \&RB ,
859: and
860: .Sx \&IR .
1.39 kristaps 861: .Ss \&RS
1.102 kristaps 862: Temporarily reset the default left margin.
1.44 kristaps 863: This has the following syntax:
864: .Bd -filled -offset indent
1.102 kristaps 865: .Pf \. Sx \&RS
1.44 kristaps 866: .Op Cm width
1.32 kristaps 867: .Ed
1.44 kristaps 868: .Pp
869: The
870: .Cm width
871: argument must conform to
872: .Sx Scaling Widths .
1.55 kristaps 873: If not specified, the saved or default width is used.
1.102 kristaps 874: .Pp
875: See also
876: .Sx \&RE .
1.39 kristaps 877: .Ss \&SB
1.22 kristaps 878: Text is rendered in small size (one point smaller than the default font)
879: bold face.
1.39 kristaps 880: .Ss \&SH
1.68 kristaps 881: Begin a section.
882: The scope of a section is only closed by another section or the end of
883: file.
1.78 schwarze 884: The paragraph left-margin width is reset to the default.
1.39 kristaps 885: .Ss \&SM
1.22 kristaps 886: Text is rendered in small size (one point smaller than the default
887: font).
1.39 kristaps 888: .Ss \&SS
1.68 kristaps 889: Begin a sub-section.
890: The scope of a sub-section is closed by a subsequent sub-section,
891: section, or end of file.
1.78 schwarze 892: The paragraph left-margin width is reset to the default.
1.39 kristaps 893: .Ss \&TH
1.22 kristaps 894: Sets the title of the manual page with the following syntax:
1.44 kristaps 895: .Bd -filled -offset indent
896: .Pf \. Sx \&TH
1.99 schwarze 897: .Ar title section date
898: .Op Ar source Op Ar volume
1.44 kristaps 899: .Ed
1.43 kristaps 900: .Pp
1.99 schwarze 901: Conventionally, the document
902: .Ar title
903: is given in all caps.
904: The recommended
905: .Ar date
906: format is
907: .Sy YYYY-MM-DD
908: as specified in the ISO-8601 standard;
909: if the argument does not conform, it is printed verbatim.
910: If the
911: .Ar date
912: is empty or not specified, the current date is used.
913: The optional
914: .Ar source
1.68 kristaps 915: string specifies the organisation providing the utility.
916: The
1.99 schwarze 917: .Ar volume
1.43 kristaps 918: string replaces the default rendered volume, which is dictated by the
919: manual section.
920: .Pp
921: Examples:
1.46 kristaps 922: .Pp
1.93 kristaps 923: .Dl \&.TH CVS 5 "1992-02-12" GNU
1.39 kristaps 924: .Ss \&TP
1.25 kristaps 925: Begin a paragraph where the head, if exceeding the indentation width, is
1.24 kristaps 926: followed by a newline; if not, the body follows on the same line after a
1.68 kristaps 927: buffer to the indentation width.
928: Subsequent output lines are indented.
1.44 kristaps 929: The syntax is as follows:
930: .Bd -filled -offset indent
931: .Pf \. Sx \&TP
932: .Op Cm width
1.32 kristaps 933: .Ed
934: .Pp
1.44 kristaps 935: The
936: .Cm width
937: argument must conform to
938: .Sx Scaling Widths .
939: If specified, it's saved for later paragraph left-margins; if
1.27 kristaps 940: unspecified, the saved or default width is used.
1.44 kristaps 941: .Pp
942: See also
1.45 kristaps 943: .Sx \&HP ,
944: .Sx \&IP ,
945: .Sx \&LP ,
946: .Sx \&P ,
1.44 kristaps 947: and
1.45 kristaps 948: .Sx \&PP .
1.72 joerg 949: .Ss \&UC
950: Sets the volume for the footer for compatibility with man pages from
951: BSD releases.
952: The optional first argument specifies which release it is from.
1.39 kristaps 953: .Ss \&br
1.68 kristaps 954: Breaks the current line.
955: Consecutive invocations have no further effect.
1.44 kristaps 956: .Pp
957: See also
958: .Sx \&sp .
1.39 kristaps 959: .Ss \&fi
1.22 kristaps 960: End literal mode begun by
1.39 kristaps 961: .Sx \&nf .
1.91 kristaps 962: .Ss \&ft
963: Change the current font mode.
964: See
965: .Sx Text Decoration
966: for a listing of available font modes.
1.79 kristaps 967: .Ss \&in
968: Indent relative to the current indentation:
969: .Pp
970: .D1 Pf \. Sx \&in Op Cm width
971: .Pp
972: If
973: .Cm width
974: is signed, the new offset is relative.
975: Otherwise, it is absolute.
976: This value is reset upon the next paragraph, section, or sub-section.
1.39 kristaps 977: .Ss \&na
1.36 kristaps 978: Don't align to the right margin.
1.39 kristaps 979: .Ss \&nf
1.22 kristaps 980: Begin literal mode: all subsequent free-form lines have their end of
1.68 kristaps 981: line boundaries preserved.
982: May be ended by
1.39 kristaps 983: .Sx \&fi .
1.101 kristaps 984: Literal mode is implicitly ended by
985: .Sx \&SH
986: or
987: .Sx \&SS .
1.39 kristaps 988: .Ss \&sp
1.44 kristaps 989: Insert vertical spaces into output with the following syntax:
990: .Bd -filled -offset indent
991: .Pf \. Sx \&sp
992: .Op Cm height
993: .Ed
994: .Pp
1.55 kristaps 995: Insert
1.44 kristaps 996: .Cm height
997: spaces, which must conform to
998: .Sx Scaling Widths .
999: If 0, this is equivalent to the
1.39 kristaps 1000: .Sx \&br
1.68 kristaps 1001: macro.
1002: Defaults to 1, if unspecified.
1.44 kristaps 1003: .Pp
1004: See also
1005: .Sx \&br .
1.18 kristaps 1006: .Sh COMPATIBILITY
1.58 kristaps 1007: This section documents areas of questionable portability between
1008: implementations of the
1009: .Nm
1010: language.
1.51 kristaps 1011: .Pp
1012: .Bl -dash -compact
1.109 kristaps 1013: .It
1014: Do not depend on
1015: .Sx \&SH
1016: or
1017: .Sx \&SS
1018: to close out a literal context opened with
1019: .Sx \&nf .
1020: This behaviour may not be portable.
1.77 kristaps 1021: .It
1.58 kristaps 1022: In quoted literals, GNU troff allowed pair-wise double-quotes to produce
1.68 kristaps 1023: a standalone double-quote in formatted output.
1024: It is not known whether this behaviour is exhibited by other formatters.
1.32 kristaps 1025: .It
1.82 kristaps 1026: troff suppresses a newline before
1027: .Sq \(aq
1028: macro output; in mandoc, it is an alias for the standard
1029: .Sq \&.
1030: control character.
1031: .It
1032: The
1033: .Sq \eh
1034: .Pq horizontal position ,
1035: .Sq \ev
1036: .Pq vertical position ,
1037: .Sq \em
1038: .Pq text colour ,
1039: .Sq \eM
1040: .Pq text filling colour ,
1.83 kristaps 1041: .Sq \ez
1042: .Pq zero-length character ,
1.84 kristaps 1043: .Sq \ew
1044: .Pq string length ,
1.85 kristaps 1045: .Sq \ek
1046: .Pq horizontal position marker ,
1.87 kristaps 1047: .Sq \eo
1048: .Pq text overstrike ,
1.82 kristaps 1049: and
1050: .Sq \es
1051: .Pq text size
1.84 kristaps 1052: escape sequences are all discarded in mandoc.
1.82 kristaps 1053: .It
1054: The
1055: .Sq \ef
1056: scaling unit is accepted by mandoc, but rendered as the default unit.
1057: .It
1.23 kristaps 1058: The
1.51 kristaps 1059: .Sx \&sp
1.68 kristaps 1060: macro does not accept negative values in mandoc.
1061: In GNU troff, this would result in strange behaviour.
1.32 kristaps 1062: .El
1.1 kristaps 1063: .Sh SEE ALSO
1.89 schwarze 1064: .Xr man 1 ,
1.32 kristaps 1065: .Xr mandoc 1 ,
1.98 kristaps 1066: .Xr eqn 7 ,
1.89 schwarze 1067: .Xr mandoc_char 7 ,
1.94 kristaps 1068: .Xr mdoc 7 ,
1069: .Xr roff 7 ,
1070: .Xr tbl 7
1.78 schwarze 1071: .Sh HISTORY
1072: The
1073: .Nm
1074: language first appeared as a macro package for the roff typesetting
1075: system in
1076: .At v7 .
1077: It was later rewritten by James Clark as a macro package for groff.
1078: The stand-alone implementation that is part of the
1079: .Xr mandoc 1
1080: utility written by Kristaps Dzonsons appeared in
1.80 kristaps 1081: .Ox 4.6 .
1.1 kristaps 1082: .Sh AUTHORS
1.78 schwarze 1083: This
1.32 kristaps 1084: .Nm
1.23 kristaps 1085: reference was written by
1.105 kristaps 1086: .An Kristaps Dzonsons ,
1087: .Mt kristaps@bsd.lv .
1.1 kristaps 1088: .Sh CAVEATS
1.68 kristaps 1089: Do not use this language.
1090: Use
1.32 kristaps 1091: .Xr mdoc 7 ,
1.1 kristaps 1092: instead.
CVSweb