[BACK]Return to man.7 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/man.7, Revision 1.107

1.107   ! kristaps    1: .\"    $Id: man.7,v 1.106 2011/08/19 13:07:22 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.107   ! kristaps   17: .Dd $Mdocdate: August 19 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.107   ! kristaps  504: .Bl -column -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX"
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.107   ! kristaps  571: .Bl -column -offset indent "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX"
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.22      kristaps  592: .Sh REFERENCE
                    593: This section is a canonical reference to all macros, arranged
1.68      kristaps  594: alphabetically.
                    595: For the scoping of individual macros, see
1.32      kristaps  596: .Sx MACRO SYNTAX .
1.72      joerg     597: .Ss \&AT
                    598: Sets the volume for the footer for compatibility with man pages from
                    599: .Tn AT&T UNIX
                    600: releases.
                    601: The optional arguments specify which release it is from.
1.39      kristaps  602: .Ss \&B
1.22      kristaps  603: Text is rendered in bold face.
1.44      kristaps  604: .Pp
                    605: See also
1.92      kristaps  606: .Sx \&I
1.44      kristaps  607: and
1.92      kristaps  608: .Sx \&R .
1.39      kristaps  609: .Ss \&BI
1.68      kristaps  610: Text is rendered alternately in bold face and italic.
                    611: Thus,
1.32      kristaps  612: .Sq .BI this word and that
1.22      kristaps  613: causes
1.32      kristaps  614: .Sq this
1.22      kristaps  615: and
1.32      kristaps  616: .Sq and
1.55      kristaps  617: to render in bold face, while
1.32      kristaps  618: .Sq word
1.22      kristaps  619: and
1.32      kristaps  620: .Sq that
1.68      kristaps  621: render in italics.
                    622: Whitespace between arguments is omitted in output.
1.44      kristaps  623: .Pp
                    624: Examples:
1.46      kristaps  625: .Pp
1.93      kristaps  626: .Dl \&.BI bold italic bold italic
1.44      kristaps  627: .Pp
                    628: The output of this example will be emboldened
                    629: .Dq bold
                    630: and italicised
                    631: .Dq italic ,
                    632: with spaces stripped between arguments.
                    633: .Pp
                    634: See also
                    635: .Sx \&IB ,
                    636: .Sx \&BR ,
                    637: .Sx \&RB ,
                    638: .Sx \&RI ,
                    639: and
                    640: .Sx \&IR .
1.39      kristaps  641: .Ss \&BR
1.22      kristaps  642: Text is rendered alternately in bold face and roman (the default font).
                    643: Whitespace between arguments is omitted in output.
1.44      kristaps  644: .Pp
                    645: See
                    646: .Sx \&BI
                    647: for an equivalent example.
                    648: .Pp
                    649: See also
                    650: .Sx \&BI ,
                    651: .Sx \&IB ,
                    652: .Sx \&RB ,
                    653: .Sx \&RI ,
                    654: and
                    655: .Sx \&IR .
1.39      kristaps  656: .Ss \&DT
1.68      kristaps  657: Has no effect.
                    658: Included for compatibility.
1.39      kristaps  659: .Ss \&HP
1.23      kristaps  660: Begin a paragraph whose initial output line is left-justified, but
1.27      kristaps  661: subsequent output lines are indented, with the following syntax:
1.44      kristaps  662: .Bd -filled -offset indent
                    663: .Pf \. Sx \&HP
                    664: .Op Cm width
1.32      kristaps  665: .Ed
1.44      kristaps  666: .Pp
                    667: The
                    668: .Cm width
                    669: argument must conform to
                    670: .Sx Scaling Widths .
                    671: If specified, it's saved for later paragraph left-margins; if unspecified, the
                    672: saved or default width is used.
                    673: .Pp
                    674: See also
1.45      kristaps  675: .Sx \&IP ,
                    676: .Sx \&LP ,
                    677: .Sx \&P ,
                    678: .Sx \&PP ,
1.44      kristaps  679: and
1.45      kristaps  680: .Sx \&TP .
1.39      kristaps  681: .Ss \&I
1.22      kristaps  682: Text is rendered in italics.
1.44      kristaps  683: .Pp
                    684: See also
1.92      kristaps  685: .Sx \&B
1.44      kristaps  686: and
1.92      kristaps  687: .Sx \&R .
1.39      kristaps  688: .Ss \&IB
1.80      kristaps  689: Text is rendered alternately in italics and bold face.
                    690: Whitespace between arguments is omitted in output.
1.44      kristaps  691: .Pp
                    692: See
                    693: .Sx \&BI
                    694: for an equivalent example.
                    695: .Pp
                    696: See also
                    697: .Sx \&BI ,
                    698: .Sx \&BR ,
                    699: .Sx \&RB ,
                    700: .Sx \&RI ,
                    701: and
                    702: .Sx \&IR .
1.39      kristaps  703: .Ss \&IP
1.44      kristaps  704: Begin an indented paragraph with the following syntax:
                    705: .Bd -filled -offset indent
                    706: .Pf \. Sx \&IP
                    707: .Op Cm head Op Cm width
1.32      kristaps  708: .Ed
1.44      kristaps  709: .Pp
                    710: The
                    711: .Cm width
                    712: argument defines the width of the left margin and is defined by
1.80      kristaps  713: .Sx Scaling Widths .
1.44      kristaps  714: It's saved for later paragraph left-margins; if unspecified, the saved or
                    715: default width is used.
                    716: .Pp
                    717: The
                    718: .Cm head
1.68      kristaps  719: argument is used as a leading term, flushed to the left margin.
                    720: This is useful for bulleted paragraphs and so on.
1.44      kristaps  721: .Pp
                    722: See also
1.45      kristaps  723: .Sx \&HP ,
                    724: .Sx \&LP ,
                    725: .Sx \&P ,
                    726: .Sx \&PP ,
1.44      kristaps  727: and
1.45      kristaps  728: .Sx \&TP .
1.39      kristaps  729: .Ss \&IR
1.22      kristaps  730: Text is rendered alternately in italics and roman (the default font).
                    731: Whitespace between arguments is omitted in output.
1.44      kristaps  732: .Pp
                    733: See
                    734: .Sx \&BI
                    735: for an equivalent example.
                    736: .Pp
                    737: See also
                    738: .Sx \&BI ,
                    739: .Sx \&IB ,
                    740: .Sx \&BR ,
                    741: .Sx \&RB ,
                    742: and
                    743: .Sx \&RI .
1.39      kristaps  744: .Ss \&LP
1.68      kristaps  745: Begin an undecorated paragraph.
                    746: The scope of a paragraph is closed by a subsequent paragraph,
                    747: sub-section, section, or end of file.
1.78      schwarze  748: The saved paragraph left-margin width is reset to the default.
1.44      kristaps  749: .Pp
                    750: See also
1.45      kristaps  751: .Sx \&HP ,
                    752: .Sx \&IP ,
                    753: .Sx \&P ,
                    754: .Sx \&PP ,
1.44      kristaps  755: and
1.45      kristaps  756: .Sx \&TP .
1.39      kristaps  757: .Ss \&P
                    758: Synonym for
                    759: .Sx \&LP .
1.44      kristaps  760: .Pp
                    761: See also
1.45      kristaps  762: .Sx \&HP ,
                    763: .Sx \&IP ,
                    764: .Sx \&LP ,
                    765: .Sx \&PP ,
1.44      kristaps  766: and
1.45      kristaps  767: .Sx \&TP .
1.39      kristaps  768: .Ss \&PP
                    769: Synonym for
                    770: .Sx \&LP .
1.44      kristaps  771: .Pp
                    772: See also
1.45      kristaps  773: .Sx \&HP ,
                    774: .Sx \&IP ,
                    775: .Sx \&LP ,
                    776: .Sx \&P ,
1.44      kristaps  777: and
1.45      kristaps  778: .Sx \&TP .
1.39      kristaps  779: .Ss \&R
1.22      kristaps  780: Text is rendered in roman (the default font).
1.44      kristaps  781: .Pp
                    782: See also
1.92      kristaps  783: .Sx \&I
1.44      kristaps  784: and
1.92      kristaps  785: .Sx \&B .
1.39      kristaps  786: .Ss \&RB
1.22      kristaps  787: Text is rendered alternately in roman (the default font) and bold face.
                    788: Whitespace between arguments is omitted in output.
1.44      kristaps  789: .Pp
                    790: See
                    791: .Sx \&BI
                    792: for an equivalent example.
                    793: .Pp
                    794: See also
                    795: .Sx \&BI ,
                    796: .Sx \&IB ,
                    797: .Sx \&BR ,
                    798: .Sx \&RI ,
                    799: and
                    800: .Sx \&IR .
1.39      kristaps  801: .Ss \&RE
1.30      kristaps  802: Explicitly close out the scope of a prior
1.39      kristaps  803: .Sx \&RS .
1.102     kristaps  804: The default left margin is restored to the state of the original
                    805: .Sx \&RS
                    806: invocation.
1.39      kristaps  807: .Ss \&RI
1.22      kristaps  808: Text is rendered alternately in roman (the default font) and italics.
                    809: Whitespace between arguments is omitted in output.
1.44      kristaps  810: .Pp
                    811: See
                    812: .Sx \&BI
                    813: for an equivalent example.
                    814: .Pp
                    815: See also
                    816: .Sx \&BI ,
                    817: .Sx \&IB ,
                    818: .Sx \&BR ,
                    819: .Sx \&RB ,
                    820: and
                    821: .Sx \&IR .
1.39      kristaps  822: .Ss \&RS
1.102     kristaps  823: Temporarily reset the default left margin.
1.44      kristaps  824: This has the following syntax:
                    825: .Bd -filled -offset indent
1.102     kristaps  826: .Pf \. Sx \&RS
1.44      kristaps  827: .Op Cm width
1.32      kristaps  828: .Ed
1.44      kristaps  829: .Pp
                    830: The
                    831: .Cm width
                    832: argument must conform to
                    833: .Sx Scaling Widths .
1.55      kristaps  834: If not specified, the saved or default width is used.
1.102     kristaps  835: .Pp
                    836: See also
                    837: .Sx \&RE .
1.39      kristaps  838: .Ss \&SB
1.22      kristaps  839: Text is rendered in small size (one point smaller than the default font)
                    840: bold face.
1.39      kristaps  841: .Ss \&SH
1.68      kristaps  842: Begin a section.
                    843: The scope of a section is only closed by another section or the end of
                    844: file.
1.78      schwarze  845: The paragraph left-margin width is reset to the default.
1.39      kristaps  846: .Ss \&SM
1.22      kristaps  847: Text is rendered in small size (one point smaller than the default
                    848: font).
1.39      kristaps  849: .Ss \&SS
1.68      kristaps  850: Begin a sub-section.
                    851: The scope of a sub-section is closed by a subsequent sub-section,
                    852: section, or end of file.
1.78      schwarze  853: The paragraph left-margin width is reset to the default.
1.39      kristaps  854: .Ss \&TH
1.22      kristaps  855: Sets the title of the manual page with the following syntax:
1.44      kristaps  856: .Bd -filled -offset indent
                    857: .Pf \. Sx \&TH
1.99      schwarze  858: .Ar title section date
                    859: .Op Ar source Op Ar volume
1.44      kristaps  860: .Ed
1.43      kristaps  861: .Pp
1.99      schwarze  862: Conventionally, the document
                    863: .Ar title
                    864: is given in all caps.
                    865: The recommended
                    866: .Ar date
                    867: format is
                    868: .Sy YYYY-MM-DD
                    869: as specified in the ISO-8601 standard;
                    870: if the argument does not conform, it is printed verbatim.
                    871: If the
                    872: .Ar date
                    873: is empty or not specified, the current date is used.
                    874: The optional
                    875: .Ar source
1.68      kristaps  876: string specifies the organisation providing the utility.
                    877: The
1.99      schwarze  878: .Ar volume
1.43      kristaps  879: string replaces the default rendered volume, which is dictated by the
                    880: manual section.
                    881: .Pp
                    882: Examples:
1.46      kristaps  883: .Pp
1.93      kristaps  884: .Dl \&.TH CVS 5 "1992-02-12" GNU
1.39      kristaps  885: .Ss \&TP
1.25      kristaps  886: Begin a paragraph where the head, if exceeding the indentation width, is
1.24      kristaps  887: followed by a newline; if not, the body follows on the same line after a
1.68      kristaps  888: buffer to the indentation width.
                    889: Subsequent output lines are indented.
1.44      kristaps  890: The syntax is as follows:
                    891: .Bd -filled -offset indent
                    892: .Pf \. Sx \&TP
                    893: .Op Cm width
1.32      kristaps  894: .Ed
                    895: .Pp
1.44      kristaps  896: The
                    897: .Cm width
                    898: argument must conform to
                    899: .Sx Scaling Widths .
                    900: If specified, it's saved for later paragraph left-margins; if
1.27      kristaps  901: unspecified, the saved or default width is used.
1.44      kristaps  902: .Pp
                    903: See also
1.45      kristaps  904: .Sx \&HP ,
                    905: .Sx \&IP ,
                    906: .Sx \&LP ,
                    907: .Sx \&P ,
1.44      kristaps  908: and
1.45      kristaps  909: .Sx \&PP .
1.72      joerg     910: .Ss \&UC
                    911: Sets the volume for the footer for compatibility with man pages from
                    912: BSD releases.
                    913: The optional first argument specifies which release it is from.
1.39      kristaps  914: .Ss \&br
1.68      kristaps  915: Breaks the current line.
                    916: Consecutive invocations have no further effect.
1.44      kristaps  917: .Pp
                    918: See also
                    919: .Sx \&sp .
1.39      kristaps  920: .Ss \&fi
1.22      kristaps  921: End literal mode begun by
1.39      kristaps  922: .Sx \&nf .
1.91      kristaps  923: .Ss \&ft
                    924: Change the current font mode.
                    925: See
                    926: .Sx Text Decoration
                    927: for a listing of available font modes.
1.79      kristaps  928: .Ss \&in
                    929: Indent relative to the current indentation:
                    930: .Pp
                    931: .D1 Pf \. Sx \&in Op Cm width
                    932: .Pp
                    933: If
                    934: .Cm width
                    935: is signed, the new offset is relative.
                    936: Otherwise, it is absolute.
                    937: This value is reset upon the next paragraph, section, or sub-section.
1.39      kristaps  938: .Ss \&na
1.36      kristaps  939: Don't align to the right margin.
1.39      kristaps  940: .Ss \&nf
1.22      kristaps  941: Begin literal mode: all subsequent free-form lines have their end of
1.68      kristaps  942: line boundaries preserved.
                    943: May be ended by
1.39      kristaps  944: .Sx \&fi .
1.101     kristaps  945: Literal mode is implicitly ended by
                    946: .Sx \&SH
                    947: or
                    948: .Sx \&SS .
1.39      kristaps  949: .Ss \&sp
1.44      kristaps  950: Insert vertical spaces into output with the following syntax:
                    951: .Bd -filled -offset indent
                    952: .Pf \. Sx \&sp
                    953: .Op Cm height
                    954: .Ed
                    955: .Pp
1.55      kristaps  956: Insert
1.44      kristaps  957: .Cm height
                    958: spaces, which must conform to
                    959: .Sx Scaling Widths .
                    960: If 0, this is equivalent to the
1.39      kristaps  961: .Sx \&br
1.68      kristaps  962: macro.
                    963: Defaults to 1, if unspecified.
1.44      kristaps  964: .Pp
                    965: See also
                    966: .Sx \&br .
1.18      kristaps  967: .Sh COMPATIBILITY
1.58      kristaps  968: This section documents areas of questionable portability between
                    969: implementations of the
                    970: .Nm
                    971: language.
1.51      kristaps  972: .Pp
                    973: .Bl -dash -compact
1.77      kristaps  974: .It
1.58      kristaps  975: In quoted literals, GNU troff allowed pair-wise double-quotes to produce
1.68      kristaps  976: a standalone double-quote in formatted output.
                    977: It is not known whether this behaviour is exhibited by other formatters.
1.32      kristaps  978: .It
1.82      kristaps  979: troff suppresses a newline before
                    980: .Sq \(aq
                    981: macro output; in mandoc, it is an alias for the standard
                    982: .Sq \&.
                    983: control character.
                    984: .It
                    985: The
                    986: .Sq \eh
                    987: .Pq horizontal position ,
                    988: .Sq \ev
                    989: .Pq vertical position ,
                    990: .Sq \em
                    991: .Pq text colour ,
                    992: .Sq \eM
                    993: .Pq text filling colour ,
1.83      kristaps  994: .Sq \ez
                    995: .Pq zero-length character ,
1.84      kristaps  996: .Sq \ew
                    997: .Pq string length ,
1.85      kristaps  998: .Sq \ek
                    999: .Pq horizontal position marker ,
1.87      kristaps 1000: .Sq \eo
                   1001: .Pq text overstrike ,
1.82      kristaps 1002: and
                   1003: .Sq \es
                   1004: .Pq text size
1.84      kristaps 1005: escape sequences are all discarded in mandoc.
1.82      kristaps 1006: .It
                   1007: The
                   1008: .Sq \ef
                   1009: scaling unit is accepted by mandoc, but rendered as the default unit.
                   1010: .It
1.23      kristaps 1011: The
1.51      kristaps 1012: .Sx \&sp
1.68      kristaps 1013: macro does not accept negative values in mandoc.
                   1014: In GNU troff, this would result in strange behaviour.
1.32      kristaps 1015: .El
1.1       kristaps 1016: .Sh SEE ALSO
1.89      schwarze 1017: .Xr man 1 ,
1.32      kristaps 1018: .Xr mandoc 1 ,
1.98      kristaps 1019: .Xr eqn 7 ,
1.89      schwarze 1020: .Xr mandoc_char 7 ,
1.94      kristaps 1021: .Xr mdoc 7 ,
                   1022: .Xr roff 7 ,
                   1023: .Xr tbl 7
1.78      schwarze 1024: .Sh HISTORY
                   1025: The
                   1026: .Nm
                   1027: language first appeared as a macro package for the roff typesetting
                   1028: system in
                   1029: .At v7 .
                   1030: It was later rewritten by James Clark as a macro package for groff.
                   1031: The stand-alone implementation that is part of the
                   1032: .Xr mandoc 1
                   1033: utility written by Kristaps Dzonsons appeared in
1.80      kristaps 1034: .Ox 4.6 .
1.1       kristaps 1035: .Sh AUTHORS
1.78      schwarze 1036: This
1.32      kristaps 1037: .Nm
1.23      kristaps 1038: reference was written by
1.105     kristaps 1039: .An Kristaps Dzonsons ,
                   1040: .Mt kristaps@bsd.lv .
1.1       kristaps 1041: .Sh CAVEATS
1.68      kristaps 1042: Do not use this language.
                   1043: Use
1.32      kristaps 1044: .Xr mdoc 7 ,
1.1       kristaps 1045: instead.

CVSweb