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

Annotation of mandoc/man.7, Revision 1.103

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

CVSweb