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