| NAME | .Nm name0 , .Nm name1 , .Nm name2 .Nd a one line description Multiple ‘Nm’ names should be separated by commas. The Nm macro(s) must precede the Nd macro. See Nm and Nd. |
| LIBRARY | .Lb libarm See Lb. |
| SYNOPSIS | For the first, utilities (sections 1, 6, and 8), this is generally structured as follows: .Nm bar .Op Fl v .Op Fl o Ar file .Op Ar .Nm foo .Op Fl v .Op Fl o Ar file .Op Ar Commands should be ordered alphabetically. For the second, function calls (sections 2, 3, 9): .In header.h .Vt extern const char *global; .Ft "char *" .Fn foo "const char *src" .Ft "char *" .Fn bar "const char *src" Ordering of In, Vt, Fn, and Fo macros should follow C header-file conventions. And for the third, configurations (section 4): .Cd "it* at isa? port 0x2e" .Cd "it* at isa? port 0x4e" Manuals not in these sections generally don't need a SYNOPSIS. Some macros are displayed differently in the SYNOPSIS section, particularly Nm, Cd, Fd, Fn, Fo, In, Vt, and Ft. All of these macros are output on their own line. If two such dissimilar macros are pairwise invoked (except for Ft before Fo or Fn), they are separated by a vertical space, unless in the case of Fo, Fn, and Ft, which are always separated by vertical space. When text and macros following an Nm macro starting an input line span multiple output lines, all output lines but the first will be indented to align with the text immediately following the Nm macro, up to the next Nm, Sh, or Ss macro or the end of an enclosing block, whichever comes first. |
| DESCRIPTION | The .Nm utility does this, that, and the other. It usually follows with a breakdown of the options (if documenting a command), such as: The options are as follows: .Bl -tag -width Ds .It Fl v Print verbose information. .El List the options in alphabetical order, uppercase before lowercase for each letter and with no regard to whether an option takes an argument. Put digits in ascending order before all letter options. Manuals not documenting a command won't include the above fragment. Since the DESCRIPTION section usually contains most of the text of a manual, longer manuals often use the Ss macro to form subsections. In very long manuals, the DESCRIPTION may be split into multiple sections, each started by an Sh macro followed by a non-standard section name, and each having several subsections, like in the present mdoc manual. |
| CONTEXT | This section lists the contexts in which functions can be called in section 9. The contexts are autoconf, process, or interrupt. |
| IMPLEMENTATION NOTES | Implementation-specific notes should be kept here. This is useful when implementing standard functions that may have side effects or notable algorithmic implications. |
| RETURN VALUES | See Rv. |
| ENVIRONMENT | See Ev. |
| FILES | See Pa. |
| EXIT STATUS | See Ex. |
| EXAMPLES | Example usages. This often contains snippets of well-formed, well-tested invocations. Make sure that examples work properly! |
| DIAGNOSTICS | Historically, this section was used in place of EXIT STATUS for manuals in sections 1, 6, and 8; however, this practise is discouraged. See Bl-diag. |
| ERRORS | See Er. |
| SEE ALSO | References to other documentation concerning the topic of the manual page, for example authoritative books or journal articles, may also be provided in this section. See Rs and Xr. |
| STANDARDS | See St. |
| HISTORY | A brief history of the subject, including where it was first implemented, and when it was ported to or reimplemented for the operating system at hand. |
| AUTHORS | See An. |
| CAVEATS | Common misuses and misunderstandings should be explained in this section. |
| BUGS | Known bugs, limitations, and work-arounds should be described in this section. |
| SECURITY CONSIDERATIONS | Documents any security precautions that operators should consider. |
| %Afirst_name ... last_name | Author name of an Rs block. Multiple authors should each be accorded their own %A line. Author names should be ordered with full or abbreviated forename(s) first, then full surname. |
| %Btitle | Book title of an Rs block. This macro may also be used in a non-bibliographic context when referring to book titles. |
| %Clocation | Publication city or location of an Rs block. |
| %D [month day,] year | Publication date of an Rs block. Provide the full English name of the month and all four digits of the year. |
| %Iname | Publisher or issuer name of an Rs block. |
| %Jname | Journal name of an Rs block. |
| %Nnumber | Issue number (usually for journals) of an Rs block. |
| %Oline | Optional information of an Rs block. |
| %Pnumber | Book or journal page number of an Rs block. Conventionally, the argument starts with ‘p.’ for a single page or ‘pp.’ for a range of pages, for example: .%P pp. 42\(en47 |
| %Qname | Institutional author (school, government, etc.) of an Rs block. Multiple institutional authors should each be accorded their own %Q line. |
| %Rname | Technical report name of an Rs block. |
| %Ttitle | Article title of an Rs block. This macro may also be used in a non-bibliographical context when referring to article titles. |
| %Uprotocol://path | URI of reference document. |
| %Vnumber | Volume number of an Rs block. |
| Ac | Close an Ao block. Does not have any tail arguments. |
| Adaddress | Examples: |
| -nosplit | -split Start a new output line before each subsequent invocation of An. -nosplit The opposite of -split. The default is -nosplit. The effect of selecting either of the -split modes ends at the beginning of the AUTHORS section. In the AUTHORS section, the default is -nosplit for the first author listing and -split for all other author listings. Examples: |
| Aoblock | Begin a block enclosed by angle brackets. Does not have any head arguments. This macro is almost never useful. See Aq for more details. |
| Ap | Examples: |
| Aqline | Occasionally, it is used for names of characters and keys, for example: Press the .Aq escape key to ... For URIs, use Lk instead, and In for “#include” directives. Never wrap Ar in Aq. Since Aq usually renders with non-ASCII characters in non-ASCII output modes, do not use it where the ASCII characters ‘<’ and ‘>’ are required as syntax elements. Instead, use these characters directly in such cases, combining them with the macros Pf, Ns, or Eo as needed. See also Ao. |
| Ar [placeholder ...] | Examples: The arguments to the Ar macro are names and placeholders for command arguments; for fixed strings to be passed verbatim as arguments, use Fl or Cm. |
| At [version] | v[1-7] | 32v A version of AT&T UNIX. III AT&T System III UNIX. V | V.[1-4] A version of AT&T System V UNIX. Note that these arguments do not begin with a hyphen. Examples: See also Bsx, Bx, Dx, Fx, Nx, and Ox. |
| Bc | Close a Bo block. Does not have any tail arguments. |
| Bd-type [-offsetwidth] [-compact] | The type must be one of the following: -centered Produce one output line from each input line, and center-justify each line. Using this display type is not recommended; many mdoc implementations render it poorly. -filled Change the positions of line breaks to fill each line, and left- and right-justify the resulting block. -literal Produce one output line from each input line, and do not justify the block at all. Preserve white space as it appears in the input. Always use a constant-width font. Use this for displaying source code. -ragged Change the positions of line breaks to fill each line, and left-justify the resulting block. -unfilled The same as -literal, but using the same font as for normal text, which is a variable width font if supported by the output device. The type must be provided first. Additional arguments may follow: -offsetwidth One of the pre-defined strings indent , the width of a standard indentation (six constant width characters); indent-two , twice indent ; left , which has no effect; right , which justifies to the right margin; or center , which aligns around an imagined center axis. A macro invocation, which selects a predefined width associated with that macro. The most popular is the imaginary macro Ds , which resolves to 6n . A scaling width as described in roff(7) . An arbitrary string, which indents by the length of this string. When the argument is missing, -offset is ignored. -compact Do not assert vertical space before the display. Examples: .Bd -literal -offset indent -compact Hello world. .Ed See also D1 and Dl. |
| -literal-symbolic | See also Li, Ef, Em, and Sy. |
| Bk-words | The -words argument is required; additional arguments are ignored. The following example will not break within each Op macro line: .Bk -words .Op Fl f Ar flags .Op Fl o Ar output .Ek Be careful in using over-long lines within a keep block! Doing so will clobber the right margin. |
| Bl-type [-widthval] [-offsetval] [-compact] [col ...] | The list type is mandatory and must be specified first. The -width and -offset arguments accept macro names as described for Bd-offset, scaling widths as described in roff(7), or use the length of the given string. The -offset is a global indentation for the whole list, affecting both item heads and bodies. For those list types supporting it, the -width argument requests an additional indentation of item bodies, to be added to the -offset. Unless the -compact argument is specified, list entries are separated by vertical space. A list must specify one of the following list types: -bullet No item heads can be specified, but a bullet will be printed at the head of each item. Item bodies start on the same output line as the bullet and are indented according to the -width argument. -column A columnated list. The -width argument has no effect; instead, the string length of each argument specifies the width of one column. If the first line of the body of a -column list is not an It macro line, It contexts spanning one input line each are implied until an It macro line is encountered, at which point items start being interpreted as described in the It documentation. -dash Like -bullet, except that dashes are used in place of bullets. -diag Like -inset, except that item heads are not parsed for macro invocations. Most often used in the DIAGNOSTICS section with error constants in the item heads. -enum A numbered list. No item heads can be specified. Formatted like -bullet, except that cardinal numbers are used in place of bullets, starting at 1. -hang Like -tag, except that the first lines of item bodies are not indented, but follow the item heads like in -inset lists. -hyphen Synonym for -dash. -inset Item bodies follow items heads on the same line, using normal inter-word spacing. Bodies are not indented, and the -width argument is ignored. -item No item heads can be specified, and none are printed. Bodies are not indented, and the -width argument is ignored. -ohang Item bodies start on the line following item heads and are not indented. The -width argument is ignored. -tag Item bodies are indented according to the -width argument. When an item head fits inside the indentation, the item body follows this head on the same output line. Otherwise, the body starts on the output line following the head. Lists may be nested within lists and displays. Nesting of -column and -enum lists may not be portable. See also El and It. |
| Boblock | Examples: .Bo 1 , .Dv BUFSIZ Bc See also Bq. |
| Bqline | Examples: Remarks: this macro is sometimes abused to emulate optional arguments for commands; the correct macros to use for this purpose are Op, Oo, and Oc. See also Bo. |
| Brc | Close a Bro block. Does not have any tail arguments. |
| Broblock | Examples: .Bro 1 , ... , .Va n Brc See also Brq. |
| Brqline | Examples: See also Bro. |
| Bsx [version] | Examples: See also At, Bx, Dx, Fx, Nx, and Ox. |
| Bt | Supported only for compatibility, do not use this in new manuals. Prints “is currently in beta test.” |
| Bx [version [variant]] | Examples: See also At, Bsx, Dx, Fx, Nx, and Ox. |
| Cdline | Examples: Remarks: this macro is commonly abused by using quoted literals to retain whitespace and align consecutive Cd declarations. This practise is discouraged. |
| Cmkeyword ... | Examples: |
| D1line | Examples: See also Bd and Dl. |
| Db | This macro is obsolete. No replacement is needed. It is ignored by mandoc(1) and groff including its arguments. It was formerly used to toggle a debugging mode. |
| Dc | Close a Do block. Does not have any tail arguments. |
| Dd$Mdocdate$ | month day, year | The month is the full English month name, the day is an integer number, and the year is the full four-digit year. Other arguments are not portable; the mandoc(1) utility handles them as follows: To have the date automatically filled in by the OpenBSD version of cvs(1) , the special string “$Mdocdate$” can be given as an argument. The traditional, purely numeric man(7) format year – month – day is accepted, too. If a date string cannot be parsed, it is used verbatim. If no date string is given, the current date is used. Examples: See also Dt and Os. |
| Dlline | Examples: See also Ql, Bd-literal, and D1. |
| Doblock | Examples: .Do April is the cruellest month .Dc \(em T.S. Eliot See also Dq. |
| Dqline | Examples: .Dq April is the cruellest month \(em T.S. Eliot See also Qq, Sq, and Do. |
| DtTITLE section [arch] | Its arguments are as follows: TITLE The document's title (name), defaulting to “UNTITLED” if unspecified. To achieve a uniform appearance of page header lines, it should by convention be all caps. section The manual section. This may be one of 1 (General Commands), 2 (System Calls), 3 (Library Functions), 3p (Perl Library), 4 (Device Drivers), 5 (File Formats), 6 (Games), 7 (Miscellaneous Information), 8 (System Manager's Manual), or 9 (Kernel Developer's Manual). It should correspond to the manual's filename suffix and defaults to the empty string if unspecified. arch This specifies the machine architecture a manual page applies to, where relevant, for example alpha, amd64, i386, or sparc64. The list of valid architectures varies by operating system. Examples: See also Dd and Os. |
| Dvidentifier ... | Examples: See also Er and Ev for special-purpose constants, Va for variable symbols, and Fd for listing preprocessor variable definitions in the SYNOPSIS. |
| Dx [version] | Examples: See also At, Bsx, Bx, Fx, Nx, and Ox. |
| Ec [closing_delimiter] | The closing_delimiter argument is used as the enclosure tail, for example, specifying \(rq will emulate Dc. |
| Ed | End a display context started by Bd. |
| Ef | End a font mode context started by Bf. |
| Ek | End a keep context started by Bk. |
| El | End a list context started by Bl. See also It. |
| Emword ... | This is most often used for stress emphasis (not to be confused with importance, see Sy). In the rare cases where none of the semantic markup macros fit, it can also be used for technical terms and placeholders, except that for syntax elements, Sy and Ar are preferred, respectively. Examples: Selected lines are those .Em not matching any of the specified patterns. Some of the functions use a .Em hold space to save the pattern space for subsequent retrieval. See also No, Ql, and Sy. |
| Enword ... | It encloses its argument in the delimiters specified by the last Es macro. |
| Eo [opening_delimiter] | An arbitrary enclosure. The opening_delimiter argument is used as the enclosure head, for example, specifying \(lq will emulate Do. |
| Eridentifier ... | Examples: See also Dv for general constants. |
| Esopening_delimiter closing_delimiter | It takes two arguments, defining the delimiters to be used by subsequent En macros. |
| Evidentifier ... | Examples: See also Dv for general constants. |
| Ex-std [utility ...] | If utility is not specified, the document's name set by Nm is used. Multiple utility arguments are treated as separate utilities. See also Rv. |
| Faargument ... | This macro is also used to specify the field name of a structure. Most often, the Fa macro is used in the SYNOPSIS within Fo blocks when documenting multi-line function prototypes. If invoked with multiple arguments, the arguments are separated by a comma. Furthermore, if the following macro is another Fa, the last argument will also have a trailing comma. Examples: See also Fo. |
| Fc | End a function context started by Fo. |
| Fd #directive [argument ...] | Examples: See also MANUAL STRUCTURE, In, and Dv. |
| Fl [word ...] | Examples: For GNU-sytle long options, escaping the additional hyphen-minus is not strictly required, but may be safer with future versions of GNU troff; see mandoc_char(7) for details. See also Cm. |
| Fnfuncname [argument ...] | Function arguments are surrounded in parenthesis and are delimited by commas. If no arguments are specified, blank parenthesis are output. In the SYNOPSIS section, this macro starts a new output line, and a blank line is automatically inserted between function definitions. Examples: .Ft functype .Fn funcname When referring to a function documented in another manual page, use Xr instead. See also MANUAL STRUCTURE, Fo, and Ft. |
| Fofuncname | Invocations usually occur in the following context: A Fo scope is closed by Fc. See also MANUAL STRUCTURE, Fa, Fc, and Ft. |
| Frnumber | It was used to show numerical function return values in an italic font. |
| Ftfunctype | In the SYNOPSIS section, a new output line is started after this macro. Examples: .Ft functype .Fn funcname See also MANUAL STRUCTURE, Fn, and Fo. |
| Fx [version] | Examples: See also At, Bsx, Bx, Dx, Nx, and Ox. |
| Hffilename | This macro is not implemented in mandoc(1). It was used to include the contents of a (header) file literally. |
| Ickeyword ... | Examples: Note that using Ql, Dl, or Bd-literal is preferred for displaying code samples; the Ic macro is used when referring to an individual command name. |
| Infilename | When invoked as the first macro on an input line in the SYNOPSIS section, the argument is displayed in angle brackets and preceded by "#include", and a blank line is inserted in front if there is a preceding function declaration. In other sections, it only encloses its argument in angle brackets and causes no line break. Examples: See also MANUAL STRUCTURE. |
| It [head] | Lists of type -hang, -ohang, -inset, and -diag have the following syntax: Lists of type -bullet, -dash, -enum, -hyphen and -item have the following syntax: with subsequent lines interpreted within the scope of the It until either a closing El or another It. The -tag list has the following syntax: Subsequent lines are interpreted as with -bullet and family. The line arguments correspond to the list's left-hand side; body arguments correspond to the list's contents. The -column list is the most complicated. Its syntax is as follows: The arguments consist of one or more lines of text and macros representing a complete table line. Cells within the line are delimited by the special Ta block macro or by literal tab characters. Using literal tabs is strongly discouraged because they are very hard to use correctly and mdoc code using them is very hard to read. In particular, a blank character is syntactically significant before and after the literal tab character. If a word precedes or follows the tab without an intervening blank, that word is never interpreted as a macro call, but always output literally. The tab cell delimiter may only be used within the It line itself; on following lines, only the Ta macro can be used to delimit cells, and portability requires that Ta is called by other macros: some parsers do not recognize it when it appears as the first macro on a line. Note that quoted strings may span tab-delimited cells on an It line. For example, will preserve the whitespace before both commas, but not the whitespace before the semicolon. See also Bl. |
| Lblibname | The name parameter may be a system library, such as z or pam, in which case a small library description is printed next to the linker invocation; or a custom library, in which case the library name is printed in quotes. This is most commonly used in the SYNOPSIS section as described in MANUAL STRUCTURE. Examples: |
| Liword ... | Request a typewriter (literal) font. Deprecated because on terminal output devices, this is usually indistinguishable from normal text. For literal displays, use Ql (in-line), Dl (single line), or Bd-literal (multi-line) instead. |
| Lkuri [display_name] | Examples: See also Mt. |
| Lp | Deprecated synonym for Pp. |
| Msname | Examples: |
| Mtlocalpart@domain | Examples: |
| Ndline | Examples: The Nd macro technically accepts child macros and terminates with a subsequent Sh invocation. Do not assume this behaviour: some whatis(1) database generators are not smart enough to parse more than the line arguments and will display macros verbatim. See also Nm. |
| Nm [name] | Examples: .Sh SYNOPSIS .Nm cat .Op Fl benstuv .Op Ar In the SYNOPSIS of section 2, 3 and 9 manual pages, use the Fn macro rather than Nm to mark up the name of the manual page. |
| Noword ... | Examples: .Sm off .Cm :C No / Ar pattern No / Ar replacement No / .Sm on See also Em, Ql, and Sy. |
| Ns | This has no effect when invoked at the start of a macro line. Examples: See also No and Sm. |
| Nx [version] | Examples: See also At, Bsx, Bx, Dx, Fx, and Ox. |
| Oc | Close multi-line Oo context. |
| Ooblock | Examples: .Oo .Op Fl flag Ns Ar value .Oc |
| Opline | Examples: See also Oo. |
| Os [system [version]] | The optional system parameter specifies the relevant operating system or environment. It is suggested to leave it unspecified, in which case mandoc(1) uses its -Ios argument or, if that isn't specified either, sysname and release as returned by uname(3). Examples: See also Dd and Dt. |
| Otfunctype | Historical mdoc packages described it as “old function type (FORTRAN)”. |
| Ox [version] | Examples: See also At, Bsx, Bx, Dx, Fx, and Nx. |
| Paname ... | Examples: See also Lk. |
| Pc | Close parenthesised context opened by Po. |
| Pfprefix macro [argument ...] | The prefix argument is not parsed for macro names or delimiters, but used verbatim as if it were escaped. Examples: See also Ns and Sm. |
| Poblock | Multi-line version of Pq. |
| Pp | Paragraph breaks are not needed before or after Sh or Ss macros or before displays (Bdline) or lists (Bl) unless the -compact flag is given. |
| Pqline | See also Po. |
| Qc | Close quoted context opened by Qo. |
| Qlline | See also Dl and Bd-literal. |
| Qoblock | Multi-line version of Qq. |
| Qqline | See also Dq, Sq, and Qo. |
| Re | Close an Rs block. Does not have any tail arguments. |
| Rs | Examples: .Rs .%A J. E. Hopcroft .%A J. D. Ullman .%B Introduction to Automata Theory, Languages, and Computation .%I Addison-Wesley .%C Reading, Massachusetts .%D 1979 .Re If an Rs block is used within a SEE ALSO section, a vertical space is asserted before the rendered output, else the block continues on the current line. |
| Rv-std [function ...] | If function is not specified, the document's name set by Nm is used. Multiple function arguments are treated as separate functions. See also Ex. |
| Sc | Close single-quoted context opened by So. |
| ShTITLE LINE | Section names should be unique so that they may be keyed by Sx. Although this macro is parsed, it should not consist of child node or it may not be linked with Sx. See also Pp, Ss, and Sx. |
| Sm [on | off] | By default, spacing is on. When switched off, no white space is inserted between macro arguments and between the output generated from adjacent macros, but text lines still get normal spacing between words and sentences. When called without an argument, the Sm macro toggles the spacing mode. Using this is not recommended because it makes the code harder to read. |
| Soblock | Multi-line version of Sq. |
| Sqline | See also Dq, Qq, and So. |
| SsTitle line | Sub-section names should be unique so that they may be keyed by Sx. Although this macro is parsed, it should not consist of child node or it may not be linked with Sx. See also Pp, Sh, and Sx. |
| St-abbreviation | C language standards -ansiC ANSI X3.159-1989 (“ANSI C89”) -ansiC-89 ANSI X3.159-1989 (“ANSI C89”) -isoC ISO/IEC 9899:1990 (“ISO C90”) -isoC-90 ISO/IEC 9899:1990 (“ISO C90”) The original C standard. -isoC-amd1 ISO/IEC 9899/AMD1:1995 (“ISO C90, Amendment 1”) -isoC-tcor1 ISO/IEC 9899/TCOR1:1994 (“ISO C90, Technical Corrigendum 1”) -isoC-tcor2 ISO/IEC 9899/TCOR2:1995 (“ISO C90, Technical Corrigendum 2”) -isoC-99 ISO/IEC 9899:1999 (“ISO C99”) The second major version of the C language standard. -isoC-2011 ISO/IEC 9899:2011 (“ISO C11”) The third major version of the C language standard. POSIX.1 before the Single UNIX Specification -p1003.1-88 IEEE Std 1003.1-1988 (“POSIX.1”) -p1003.1 IEEE Std 1003.1 (“POSIX.1”) The original POSIX standard, based on ANSI C. -p1003.1-90 IEEE Std 1003.1-1990 (“POSIX.1”) -iso9945-1-90 ISO/IEC 9945-1:1990 (“POSIX.1”) The first update of POSIX.1. -p1003.1b-93 IEEE Std 1003.1b-1993 (“POSIX.1b”) -p1003.1b IEEE Std 1003.1b (“POSIX.1b”) Real-time extensions. -p1003.1c-95 IEEE Std 1003.1c-1995 (“POSIX.1c”) POSIX thread interfaces. -p1003.1i-95 IEEE Std 1003.1i-1995 (“POSIX.1i”) Technical Corrigendum. -p1003.1-96 ISO/IEC 9945-1:1996 (“POSIX.1”) -iso9945-1-96 ISO/IEC 9945-1:1996 (“POSIX.1”) Includes POSIX.1-1990, 1b, 1c, and 1i. X/Open Portability Guide version 4 and related standards -xpg3 X/Open Portability Guide Issue 3 (“XPG3”) An XPG4 precursor, published in 1989. -p1003.2 IEEE Std 1003.2 (“POSIX.2”) -p1003.2-92 IEEE Std 1003.2-1992 (“POSIX.2”) -iso9945-2-93 ISO/IEC 9945-2:1993 (“POSIX.2”) An XCU4 precursor. -p1003.2a-92 IEEE Std 1003.2a-1992 (“POSIX.2”) Updates to POSIX.2. -xpg4 X/Open Portability Guide Issue 4 (“XPG4”) Based on POSIX.1 and POSIX.2, published in 1992. Single UNIX Specification version 1 and related standards -susv1 Version 1 of the Single UNIX Specification (“SUSv1”) -xpg4.2 X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”) This standard was published in 1994. It was used as the basis for UNIX 95 certification. The following three refer to parts of it. -xsh4.2 X/Open System Interfaces and Headers Issue 4, Version 2 (“XSH4.2”) -xcurses4.2 X/Open Curses Issue 4, Version 2 (“XCURSES4.2”) -p1003.1g-2000 IEEE Std 1003.1g-2000 (“POSIX.1g”) Networking APIs, including sockets. -svid4 System V Interface Definition, Fourth Edition (“SVID4”), Published in 1995. Single UNIX Specification version 2 and related standards -susv2 Version 2 of the Single UNIX Specification (“SUSv2”) This Standard was published in 1997 and is also called X/Open Portability Guide version 5. It was used as the basis for UNIX 98 certification. The following refer to parts of it. -xbd5 X/Open Base Definitions Issue 5 (“XBD5”) -xsh5 X/Open System Interfaces and Headers Issue 5 (“XSH5”) -xcu5 X/Open Commands and Utilities Issue 5 (“XCU5”) -xns5 X/Open Networking Services Issue 5 (“XNS5”) -xns5.2 X/Open Networking Services Issue 5.2 (“XNS5.2”) Single UNIX Specification version 3 -p1003.1-2001 IEEE Std 1003.1-2001 (“POSIX.1”) -susv3 Version 3 of the Single UNIX Specification (“SUSv3”) This standard is based on C99, SUSv2, POSIX.1-1996, 1d, and 1j. It is also called X/Open Portability Guide version 6. It is used as the basis for UNIX 03 certification. -p1003.1-2004 IEEE Std 1003.1-2004 (“POSIX.1”) The second and last Technical Corrigendum. Single UNIX Specification version 4 -p1003.1-2008 IEEE Std 1003.1-2008 (“POSIX.1”) -susv4 Version 4 of the Single UNIX Specification (“SUSv4”) This standard is also called X/Open Portability Guide version 7. Other standards -ieee754 IEEE Std 754-1985 Floating-point arithmetic. -iso8601 ISO 8601 Representation of dates and times, published in 1988. -iso8802-3 ISO 8802-3: 1989 Ethernet local area networks. -ieee1275-94 IEEE Std 1275-1994 (“Open Firmware”) |
| SxTitle line | Examples: See also Sh and Ss. |
| Syword ... | This is most often used to indicate importance or seriousness (not to be confused with stress emphasis, see Em). When none of the semantic macros fit, it is also adequate for syntax elements that have to be given or that appear verbatim. Examples: .Sy Warning : If .Sy s appears in the owner permissions, set-user-ID mode is set. This utility replaces the former .Sy dumpdir program. See also Em, No, and Ql. |
| Ta | Table cell separator in Bl-column lists; can only be used below It. |
| Tg [term] | When viewing terminal output with less(1), the interactive :t command can be used to go to the definition of the term as described for the MANPAGER variable in man(1); when producing HTML output, a fragment identifier (idattribute) is generated, to be used for deep linking to this place of the document. In most cases, adding a Tg macro would be redundant because mandoc(1) is able to automatically tag most definitions. This macro is intended for cases where automatic tagging of a term is unsatisfactory, for example if a definition is not tagged automatically (false negative) or if places are tagged that do not define the term (false positives). When there is at least one Tg macro for a term, no other places are automatically marked as definitions of that term. |
| Tnword ... | Supported only for compatibility, do not use this in new manuals. Even though the macro name (“tradename”) suggests a semantic function, historic usage is inconsistent, mostly using it as a presentation-level macro to request a small caps font. |
| Ud | Supported only for compatibility, do not use this in new manuals. Prints out “currently under development.” |
| Ux | Supported only for compatibility, do not use this in new manuals. Prints out “UNIX”. |
| Va [type] identifier ... | Examples: For function arguments and parameters, use Fa instead. For declarations of global variables in the SYNOPSIS section, use Vt. |
| Vttype [identifier] | This is also used for indicating global variables in the SYNOPSIS section, in which case a variable name is also specified. Note that it accepts Block partial-implicit syntax when invoked as the first macro on an input line in the SYNOPSIS section, else it accepts ordinary In-line syntax. In the former case, this macro starts a new output line, and a blank line is inserted in front if there is a preceding function definition or include directive. Examples: For parameters in function prototypes, use Fa instead, for function return types Ft, and for variable names outside the SYNOPSIS section Va, even when including a type with the name. See also MANUAL STRUCTURE. |
| Xc | Close a scope opened by Xo. |
| Xoblock | Extend the header of an It macro or the body of a partial-implicit block macro beyond the end of the input line. This macro originally existed to work around the 9-argument limit of historic roff(7). |
| Xrname section | Cross reference the name and section number of another man page. Examples: |
| ( | left parenthesis |
| [ | left bracket |
| . | period |
| , | comma |
| : | colon |
| ; | semicolon |
| ) | right parenthesis |
| ] | right bracket |
| ? | question mark |
| ! | exclamation mark |
| | | vertical bar |
NAME
mdoc — semantic
markup language for formatting manual pages
DESCRIPTION
The mdoc language supports authoring of
manual pages for the man(1) utility by allowing semantic
annotations of words, phrases, page sections and complete manual pages. Such
annotations are used by formatting tools to achieve a uniform presentation
across all manuals written in mdoc, and to support
hyperlinking if supported by the output medium.
This reference document describes the structure of manual pages
and the syntax and usage of the mdoc language. The
reference implementation of a parsing and formatting tool is
mandoc(1); the
COMPATIBILITY section describes
compatibility with other implementations.
In an mdoc document, lines beginning with
the control character ‘.’ are called “macro
lines”. The first word is the macro name. It consists of two or three
letters. Most macro names begin with a capital letter. For a list of
available macros, see MACRO
OVERVIEW. The words following the macro name are arguments to the macro,
optionally including the names of other, callable macros; see
MACRO SYNTAX for details.
Lines not beginning with the control character are called “text lines”. They provide free-form text to be printed; the formatting of the text depends on the respective processing context:
.Sh Macro lines change control state.
Text lines are interpreted within the current state.Many aspects of the basic syntax of the
mdoc language are based on the
roff(7) language; see the
LANGUAGE SYNTAX
and MACRO
SYNTAX sections in the roff(7) manual for details,
in particular regarding comments, escape sequences, whitespace, and quoting.
However, using roff(7) requests in
mdoc documents is discouraged;
mandoc(1) supports some of them merely for backward
compatibility.
MANUAL STRUCTURE
A well-formed mdoc document consists of a
document prologue followed by one or more sections.
The prologue, which consists of the Dd,
Dt, and Os macros in that
order, is required for every document.
The first section (sections are denoted by
Sh) must be the NAME section, consisting of at least
one Nm followed by Nd.
Following that, convention dictates specifying at least the SYNOPSIS and DESCRIPTION sections, although this varies between manual sections.
The following is a well-formed skeleton
mdoc file for a utility "progname":
.Dd $Mdocdate$
.Dt PROGNAME section
.Os
.Sh NAME
.Nm progname
.Nd one line about what it does
.\" .Sh LIBRARY
.\" For sections 2, 3, and 9 only.
.\" Not used in OpenBSD.
.Sh SYNOPSIS
.Nm progname
.Op Fl options
.Ar
.Sh DESCRIPTION
The
.Nm
utility processes files ...
.\" .Sh CONTEXT
.\" For section 9 functions only.
.\" .Sh IMPLEMENTATION NOTES
.\" Not used in OpenBSD.
.\" .Sh RETURN VALUES
.\" For sections 2, 3, and 9 function return values only.
.\" .Sh ENVIRONMENT
.\" For sections 1, 6, 7, and 8 only.
.\" .Sh FILES
.\" .Sh EXIT STATUS
.\" For sections 1, 6, and 8 only.
.\" .Sh EXAMPLES
.\" .Sh DIAGNOSTICS
.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
.\" .Sh ERRORS
.\" For sections 2, 3, 4, and 9 errno settings only.
.\" .Sh SEE ALSO
.\" .Xr foobar 1
.\" .Sh STANDARDS
.\" .Sh HISTORY
.\" .Sh AUTHORS
.\" .Sh CAVEATS
.\" .Sh BUGS
.\" .Sh SECURITY CONSIDERATIONS
.\" Not used in OpenBSD.The sections in an mdoc document are
conventionally ordered as they appear above. Sections should be composed as
follows:
- NAME
- bash
.Nm name0 , .Nm name1 , .Nm name2 .Nd a one line descriptionMultiple ‘Nm’ names should be separated by commas.
The
Nmmacro(s) must precede theNdmacro.See
NmandNd. - LIBRARY
- bash
.Lb libarmSee
Lb. - SYNOPSIS
For the first, utilities (sections 1, 6, and 8), this is generally structured as follows:
bash.Nm bar .Op Fl v .Op Fl o Ar file .Op Ar .Nm foo .Op Fl v .Op Fl o Ar file .Op ArCommands should be ordered alphabetically.
For the second, function calls (sections 2, 3, 9):
bash.In header.h .Vt extern const char *global; .Ft "char *" .Fn foo "const char *src" .Ft "char *" .Fn bar "const char *src"Ordering of
In,Vt,Fn, andFomacros should follow C header-file conventions.And for the third, configurations (section 4):
bash.Cd "it* at isa? port 0x2e" .Cd "it* at isa? port 0x4e"Manuals not in these sections generally don't need a SYNOPSIS.
Some macros are displayed differently in the SYNOPSIS section, particularly
Nm,Cd,Fd,Fn,Fo,In,Vt, andFt. All of these macros are output on their own line. If two such dissimilar macros are pairwise invoked (except forFtbeforeFoorFn), they are separated by a vertical space, unless in the case ofFo,Fn, andFt, which are always separated by vertical space.When text and macros following an
Nmmacro starting an input line span multiple output lines, all output lines but the first will be indented to align with the text immediately following theNmmacro, up to the nextNm,Sh, orSsmacro or the end of an enclosing block, whichever comes first.- DESCRIPTION
- bash
The .Nm utility does this, that, and the other.It usually follows with a breakdown of the options (if documenting a command), such as:
bashThe options are as follows: .Bl -tag -width Ds .It Fl v Print verbose information. .ElList the options in alphabetical order, uppercase before lowercase for each letter and with no regard to whether an option takes an argument. Put digits in ascending order before all letter options.
Manuals not documenting a command won't include the above fragment.
Since the DESCRIPTION section usually contains most of the text of a manual, longer manuals often use the
Ssmacro to form subsections. In very long manuals, the DESCRIPTION may be split into multiple sections, each started by anShmacro followed by a non-standard section name, and each having several subsections, like in the presentmdocmanual. - CONTEXT
This section lists the contexts in which functions can be called in section 9. The contexts are autoconf, process, or interrupt.
- IMPLEMENTATION NOTES
Implementation-specific notes should be kept here. This is useful when implementing standard functions that may have side effects or notable algorithmic implications.
- RETURN VALUES
See
Rv.- ENVIRONMENT
See
Ev.- FILES
See
Pa.- EXIT STATUS
See
Ex.- EXAMPLES
Example usages. This often contains snippets of well-formed, well-tested invocations. Make sure that examples work properly!
- DIAGNOSTICS
Historically, this section was used in place of EXIT STATUS for manuals in sections 1, 6, and 8; however, this practise is discouraged.
See
Bl-diag.- ERRORS
See
Er.- SEE ALSO
References to other documentation concerning the topic of the manual page, for example authoritative books or journal articles, may also be provided in this section.
See
RsandXr.- STANDARDS
See
St.- HISTORY
A brief history of the subject, including where it was first implemented, and when it was ported to or reimplemented for the operating system at hand.
- AUTHORS
See
An.- CAVEATS
Common misuses and misunderstandings should be explained in this section.
- BUGS
Known bugs, limitations, and work-arounds should be described in this section.
- SECURITY CONSIDERATIONS
Documents any security precautions that operators should consider.
MACRO OVERVIEW
This overview is sorted such that macros of similar purpose are listed together, to help find the best macro for any given purpose. Deprecated macros are not included in the overview, but can be found below in the alphabetical MACRO REFERENCE.
Document preamble and NAME section macros
| Dd | document date: $Mdocdate$ | month day , year |
| Dt | document title: TITLE section [ arch ] |
| Os | operating system version: [ system [ version ]] |
| Nm | document name (one argument) |
| Nd | document description (one line) |
Sections and cross references
| Sh | section header (one line) |
| Ss | subsection header (one line) |
| Sx | internal cross reference to a section or subsection |
| Xr | cross reference to another manual page: name section |
| Tg | tag the definition of a term (<= 1 arguments) |
| Pp | start a text paragraph (no arguments) |
Displays and lists
| Bd , Ed | display block: - type [ -offset width ] [ -compact ] |
| D1 | indented display (one line) |
| Dl | indented literal display (one line) |
| Ql | in-line literal display: ‘ text ’ |
| Bl , El | list block: - type [ -width val ] [ -offset val ] [ -compact ] |
| It | list item (syntax depends on - type ) |
| Ta | table cell separator in Bl -column lists |
| Rs , %* , Re | bibliographic block (references) |
Spacing control
| Pf | prefix, no following horizontal space (one argument) |
| Ns | roman font, no preceding horizontal space (no arguments) |
| Ap | apostrophe without surrounding whitespace (no arguments) |
| Sm | switch horizontal spacing mode: [ on | off ] |
| Bk , Ek | keep block: -words |
Semantic markup for command line utilities
| Nm | start a SYNOPSIS block with the name of a utility |
| Fl | command line options (flags) (>=0 arguments) |
| Cm | command modifier (>0 arguments) |
| Ar | command arguments (>=0 arguments) |
| Op , Oo , Oc | optional syntax elements (enclosure) |
| Ic | internal or interactive command (>0 arguments) |
| Ev | environmental variable (>0 arguments) |
| Pa | file system path (>=0 arguments) |
Semantic markup for function libraries
| Lb | function library (one argument) |
| In | include file (one argument) |
| Fd | other preprocessor directive (>0 arguments) |
| Ft | function type (>0 arguments) |
| Fo , Fc | function block: funcname |
| Fn | function name: funcname [ argument ... ] |
| Fa | function argument (>0 arguments) |
| Vt | variable type (>0 arguments) |
| Va | variable name (>0 arguments) |
| Dv | defined variable or preprocessor constant (>0 arguments) |
| Er | error constant (>0 arguments) |
| Ev | environmental variable (>0 arguments) |
Various semantic markup
| An | author name (>0 arguments) |
| Lk | hyperlink: uri [ display_name ] |
| Mt | “mailto” hyperlink: localpart @ domain |
| Cd | kernel configuration declaration (>0 arguments) |
| Ad | memory address (>0 arguments) |
| Ms | mathematical symbol (>0 arguments) |
Physical markup
| Em | italic font or underline (emphasis) (>0 arguments) |
| Sy | boldface font (symbolic) (>0 arguments) |
| No | return to roman font (normal) (>0 arguments) |
| Bf , Ef | font block: - type | Em | Li | Sy |
Physical enclosures
| Dq , Do , Dc | enclose in typographic double quotes: “text” |
| Qq , Qo , Qc | enclose in typewriter double quotes: "text" |
| Sq , So , Sc | enclose in single quotes: ‘text’ |
| Pq , Po , Pc | enclose in parentheses: (text) |
| Bq , Bo , Bc | enclose in square brackets: [text] |
| Brq , Bro , Brc | enclose in curly braces: {text} |
| Aq , Ao , Ac | enclose in angle brackets: ⟨text⟩ |
| Eo , Ec | generic enclosure |
Text production
| Ex -std | standard command exit values: [ utility ... ] |
| Rv -std | standard function return values: [ function ... ] |
| St | reference to a standards document (one argument) |
| At | AT&T UNIX |
| Bx | BSD |
| Bsx | BSD/OS |
| Nx | NetBSD |
| Fx | FreeBSD |
| Ox | OpenBSD |
| Dx | DragonFly |
MACRO REFERENCE
This section is a canonical reference of all macros, arranged alphabetically. For the scoping of individual macros, see MACRO SYNTAX.
%Afirst_name ... last_nameAuthor name of an
Rsblock. Multiple authors should each be accorded their own%Aline. Author names should be ordered with full or abbreviated forename(s) first, then full surname.%BtitleBook title of an
Rsblock. This macro may also be used in a non-bibliographic context when referring to book titles.%ClocationPublication city or location of an
Rsblock.%D[month day,] yearPublication date of an
Rsblock. Provide the full English name of the month and all four digits of the year.%InamePublisher or issuer name of an
Rsblock.%JnameJournal name of an
Rsblock.%NnumberIssue number (usually for journals) of an
Rsblock.%OlineOptional information of an
Rsblock.%PnumberBook or journal page number of an
Rsblock. Conventionally, the argument starts with ‘p.’ for a single page or ‘pp.’ for a range of pages, for example:.%P pp. 42\(en47%QnameInstitutional author (school, government, etc.) of an
Rsblock. Multiple institutional authors should each be accorded their own%Qline.%RnameTechnical report name of an
Rsblock.%TtitleArticle title of an
Rsblock. This macro may also be used in a non-bibliographical context when referring to article titles.%Uprotocol://pathURI of reference document.
%VnumberVolume number of an
Rsblock.AcClose an
Aoblock. Does not have any tail arguments.AdaddressExamples:
An-split|-nosplit| first_name ... last_name-splitStart a new output line before each subsequent invocation of
An.-nosplitThe opposite of
-split.
The default is
-nosplit. The effect of selecting either of the-splitmodes ends at the beginning of the AUTHORS section. In the AUTHORS section, the default is-nosplitfor the first author listing and-splitfor all other author listings.Examples:
AoblockBegin a block enclosed by angle brackets. Does not have any head arguments. This macro is almost never useful. See
Aqfor more details.ApExamples:
AqlineOccasionally, it is used for names of characters and keys, for example:
bashPress the .Aq escape key to ...For URIs, use
Lkinstead, andInfor “#include” directives. Never wrapArinAq.Since
Aqusually renders with non-ASCII characters in non-ASCII output modes, do not use it where the ASCII characters ‘<’ and ‘>’ are required as syntax elements. Instead, use these characters directly in such cases, combining them with the macrosPf,Ns, orEoas needed.See also
Ao.Ar[placeholder ...]Examples:
The arguments to the
Armacro are names and placeholders for command arguments; for fixed strings to be passed verbatim as arguments, useFlorCm.At[version]v[1-7]|32vA version of AT&T UNIX.
IIIAT&T System III UNIX.
V|V.[1-4]A version of AT&T System V UNIX.
Note that these arguments do not begin with a hyphen.
Examples:
See also
Bsx,Bx,Dx,Fx,Nx, andOx.BcClose a
Boblock. Does not have any tail arguments.Bd-type [-offsetwidth] [-compact]The type must be one of the following:
-centeredProduce one output line from each input line, and center-justify each line. Using this display type is not recommended; many
mdocimplementations render it poorly.-filledChange the positions of line breaks to fill each line, and left- and right-justify the resulting block.
-literalProduce one output line from each input line, and do not justify the block at all. Preserve white space as it appears in the input. Always use a constant-width font. Use this for displaying source code.
-raggedChange the positions of line breaks to fill each line, and left-justify the resulting block.
-unfilledThe same as
-literal, but using the same font as for normal text, which is a variable width font if supported by the output device.
The type must be provided first. Additional arguments may follow:
-offsetwidthOne of the pre-defined strings indent , the width of a standard indentation (six constant width characters); indent-two , twice indent ; left , which has no effect; right , which justifies to the right margin; or center , which aligns around an imagined center axis.
A macro invocation, which selects a predefined width associated with that macro. The most popular is the imaginary macro Ds , which resolves to 6n .
A scaling width as described in roff(7) .
An arbitrary string, which indents by the length of this string.
When the argument is missing,
-offsetis ignored.-compactDo not assert vertical space before the display.
Examples:
bash.Bd -literal -offset indent -compact Hello world. .EdSee also
D1andDl.Bf-emphasis|-literal|-symbolic|Em|Li|SySee also
Li,Ef,Em, andSy.Bk-wordsThe
-wordsargument is required; additional arguments are ignored.The following example will not break within each
Opmacro line:bash.Bk -words .Op Fl f Ar flags .Op Fl o Ar output .EkBe careful in using over-long lines within a keep block! Doing so will clobber the right margin.
Bl-type [-widthval] [-offsetval] [-compact] [col ...]The list type is mandatory and must be specified first. The
-widthand-offsetarguments accept macro names as described forBd-offset, scaling widths as described in roff(7), or use the length of the given string. The-offsetis a global indentation for the whole list, affecting both item heads and bodies. For those list types supporting it, the-widthargument requests an additional indentation of item bodies, to be added to the-offset. Unless the-compactargument is specified, list entries are separated by vertical space.A list must specify one of the following list types:
-bulletNo item heads can be specified, but a bullet will be printed at the head of each item. Item bodies start on the same output line as the bullet and are indented according to the
-widthargument.-columnA columnated list. The
-widthargument has no effect; instead, the string length of each argument specifies the width of one column. If the first line of the body of a-columnlist is not anItmacro line,Itcontexts spanning one input line each are implied until anItmacro line is encountered, at which point items start being interpreted as described in theItdocumentation.-dashLike
-bullet, except that dashes are used in place of bullets.-diagLike
-inset, except that item heads are not parsed for macro invocations. Most often used in the DIAGNOSTICS section with error constants in the item heads.-enumA numbered list. No item heads can be specified. Formatted like
-bullet, except that cardinal numbers are used in place of bullets, starting at 1.-hangLike
-tag, except that the first lines of item bodies are not indented, but follow the item heads like in-insetlists.-hyphenSynonym for
-dash.-insetItem bodies follow items heads on the same line, using normal inter-word spacing. Bodies are not indented, and the
-widthargument is ignored.-itemNo item heads can be specified, and none are printed. Bodies are not indented, and the
-widthargument is ignored.-ohangItem bodies start on the line following item heads and are not indented. The
-widthargument is ignored.-tagItem bodies are indented according to the
-widthargument. When an item head fits inside the indentation, the item body follows this head on the same output line. Otherwise, the body starts on the output line following the head.
Lists may be nested within lists and displays. Nesting of
-columnand-enumlists may not be portable.See also
ElandIt.BoblockExamples:
bash.Bo 1 , .Dv BUFSIZ BcSee also
Bq.BqlineExamples:
Remarks: this macro is sometimes abused to emulate optional arguments for commands; the correct macros to use for this purpose are
Op,Oo, andOc.See also
Bo.BrcClose a
Broblock. Does not have any tail arguments.BroblockExamples:
bash.Bro 1 , ... , .Va n BrcSee also
Brq.BrqlineExamples:
See also
Bro.Bsx[version]Examples:
See also
At,Bx,Dx,Fx,Nx, andOx.BtSupported only for compatibility, do not use this in new manuals. Prints “is currently in beta test.”
Bx[version [variant]]Examples:
See also
At,Bsx,Dx,Fx,Nx, andOx.CdlineExamples:
Remarks: this macro is commonly abused by using quoted literals to retain whitespace and align consecutive
Cddeclarations. This practise is discouraged.Cmkeyword ...Examples:
D1lineExamples:
See also
BdandDl.DbThis macro is obsolete. No replacement is needed. It is ignored by mandoc(1) and groff including its arguments. It was formerly used to toggle a debugging mode.
DcClose a
Doblock. Does not have any tail arguments.Dd$Mdocdate$| month day, yearThe month is the full English month name, the day is an integer number, and the year is the full four-digit year.
Other arguments are not portable; the mandoc(1) utility handles them as follows:
To have the date automatically filled in by the OpenBSD version of cvs(1) , the special string “$Mdocdate$” can be given as an argument.
The traditional, purely numeric man(7) format year – month – day is accepted, too.
If a date string cannot be parsed, it is used verbatim.
If no date string is given, the current date is used.
Examples:
See also
DtandOs.DllineExamples:
See also
Ql,Bd-literal, andD1.DoblockExamples:
bash.Do April is the cruellest month .Dc \(em T.S. EliotSee also
Dq.DqlineExamples:
bash.Dq April is the cruellest month \(em T.S. EliotSee also
Qq,Sq, andDo.DtTITLE section [arch]Its arguments are as follows:
- TITLE
The document's title (name), defaulting to “UNTITLED” if unspecified. To achieve a uniform appearance of page header lines, it should by convention be all caps.
- section
The manual section. This may be one of
1(General Commands),2(System Calls),3(Library Functions),3p(Perl Library),4(Device Drivers),5(File Formats),6(Games),7(Miscellaneous Information),8(System Manager's Manual), or9(Kernel Developer's Manual). It should correspond to the manual's filename suffix and defaults to the empty string if unspecified.- arch
This specifies the machine architecture a manual page applies to, where relevant, for example
alpha,amd64,i386, orsparc64. The list of valid architectures varies by operating system.
Examples:
See also
DdandOs.Dvidentifier ...Examples:
See also
ErandEvfor special-purpose constants,Vafor variable symbols, andFdfor listing preprocessor variable definitions in the SYNOPSIS.Dx[version]Examples:
See also
At,Bsx,Bx,Fx,Nx, andOx.Ec[closing_delimiter]The closing_delimiter argument is used as the enclosure tail, for example, specifying \(rq will emulate
Dc.EdEnd a display context started by
Bd.EfEnd a font mode context started by
Bf.EkEnd a keep context started by
Bk.ElEnd a list context started by
Bl. See alsoIt.Emword ...This is most often used for stress emphasis (not to be confused with importance, see
Sy). In the rare cases where none of the semantic markup macros fit, it can also be used for technical terms and placeholders, except that for syntax elements,SyandArare preferred, respectively.Examples:
bashSelected lines are those .Em not matching any of the specified patterns. Some of the functions use a .Em hold space to save the pattern space for subsequent retrieval.See also
No,Ql, andSy.Enword ...It encloses its argument in the delimiters specified by the last
Esmacro.Eo[opening_delimiter]An arbitrary enclosure. The opening_delimiter argument is used as the enclosure head, for example, specifying \(lq will emulate
Do.Eridentifier ...Examples:
See also
Dvfor general constants.Esopening_delimiter closing_delimiterIt takes two arguments, defining the delimiters to be used by subsequent
Enmacros.Evidentifier ...Examples:
See also
Dvfor general constants.Ex-std[utility ...]If utility is not specified, the document's name set by
Nmis used. Multiple utility arguments are treated as separate utilities.See also
Rv.Faargument ...This macro is also used to specify the field name of a structure.
Most often, the
Famacro is used in the SYNOPSIS withinFoblocks when documenting multi-line function prototypes. If invoked with multiple arguments, the arguments are separated by a comma. Furthermore, if the following macro is anotherFa, the last argument will also have a trailing comma.Examples:
See also
Fo.FcEnd a function context started by
Fo.Fd#directive [argument ...]Examples:
See also MANUAL STRUCTURE,
In, andDv.Fl[word ...]Examples:
For GNU-sytle long options, escaping the additional hyphen-minus is not strictly required, but may be safer with future versions of GNU troff; see mandoc_char(7) for details.
See also
Cm.Fnfuncname [argument ...]Function arguments are surrounded in parenthesis and are delimited by commas. If no arguments are specified, blank parenthesis are output. In the SYNOPSIS section, this macro starts a new output line, and a blank line is automatically inserted between function definitions.
Examples:
bash.Ft functype .Fn funcnameWhen referring to a function documented in another manual page, use
Xrinstead. See also MANUAL STRUCTURE,Fo, andFt.FofuncnameInvocations usually occur in the following context:
A
Foscope is closed byFc.See also MANUAL STRUCTURE,
Fa,Fc, andFt.FrnumberIt was used to show numerical function return values in an italic font.
FtfunctypeIn the SYNOPSIS section, a new output line is started after this macro.
Examples:
bash.Ft functype .Fn funcnameSee also MANUAL STRUCTURE,
Fn, andFo.Fx[version]Examples:
See also
At,Bsx,Bx,Dx,Nx, andOx.HffilenameThis macro is not implemented in mandoc(1). It was used to include the contents of a (header) file literally.
Ickeyword ...Examples:
Note that using
Ql,Dl, orBd-literalis preferred for displaying code samples; theIcmacro is used when referring to an individual command name.InfilenameWhen invoked as the first macro on an input line in the SYNOPSIS section, the argument is displayed in angle brackets and preceded by "#include", and a blank line is inserted in front if there is a preceding function declaration. In other sections, it only encloses its argument in angle brackets and causes no line break.
Examples:
See also MANUAL STRUCTURE.
It[head]Lists of type
-hang,-ohang,-inset, and-diaghave the following syntax:Lists of type
-bullet,-dash,-enum,-hyphenand-itemhave the following syntax:with subsequent lines interpreted within the scope of the
Ituntil either a closingElor anotherIt.The
-taglist has the following syntax:Subsequent lines are interpreted as with
-bulletand family. The line arguments correspond to the list's left-hand side; body arguments correspond to the list's contents.The
-columnlist is the most complicated. Its syntax is as follows:The arguments consist of one or more lines of text and macros representing a complete table line. Cells within the line are delimited by the special
Tablock macro or by literal tab characters.Using literal tabs is strongly discouraged because they are very hard to use correctly and
mdoccode using them is very hard to read. In particular, a blank character is syntactically significant before and after the literal tab character. If a word precedes or follows the tab without an intervening blank, that word is never interpreted as a macro call, but always output literally.The tab cell delimiter may only be used within the
Itline itself; on following lines, only theTamacro can be used to delimit cells, and portability requires thatTais called by other macros: some parsers do not recognize it when it appears as the first macro on a line.Note that quoted strings may span tab-delimited cells on an
Itline. For example,will preserve the whitespace before both commas, but not the whitespace before the semicolon.
See also
Bl.LblibnameThe name parameter may be a system library, such as
zorpam, in which case a small library description is printed next to the linker invocation; or a custom library, in which case the library name is printed in quotes. This is most commonly used in the SYNOPSIS section as described in MANUAL STRUCTURE.Examples:
Liword ...Request a typewriter (literal) font. Deprecated because on terminal output devices, this is usually indistinguishable from normal text. For literal displays, use
Ql(in-line),Dl(single line), orBd-literal(multi-line) instead.Lkuri [display_name]Examples:
See also
Mt.LpDeprecated synonym for
Pp.MsnameExamples:
Mtlocalpart@domainExamples:
NdlineExamples:
The
Ndmacro technically accepts child macros and terminates with a subsequentShinvocation. Do not assume this behaviour: some whatis(1) database generators are not smart enough to parse more than the line arguments and will display macros verbatim.See also
Nm.Nm[name]Examples:
bash.Sh SYNOPSIS .Nm cat .Op Fl benstuv .Op ArIn the SYNOPSIS of section 2, 3 and 9 manual pages, use the
Fnmacro rather thanNmto mark up the name of the manual page.Noword ...Examples:
bash.Sm off .Cm :C No / Ar pattern No / Ar replacement No / .Sm onSee also
Em,Ql, andSy.NsThis has no effect when invoked at the start of a macro line.
Examples:
See also
NoandSm.Nx[version]Examples:
See also
At,Bsx,Bx,Dx,Fx, andOx.OcClose multi-line
Oocontext.OoblockExamples:
bash.Oo .Op Fl flag Ns Ar value .OcOplineExamples:
See also
Oo.Os[system [version]]The optional system parameter specifies the relevant operating system or environment. It is suggested to leave it unspecified, in which case mandoc(1) uses its
-Iosargument or, if that isn't specified either, sysname and release as returned by uname(3).Examples:
See also
DdandDt.OtfunctypeHistorical
mdocpackages described it as “old function type (FORTRAN)”.Ox[version]Examples:
See also
At,Bsx,Bx,Dx,Fx, andNx.Paname ...Examples:
See also
Lk.PcClose parenthesised context opened by
Po.Pfprefix macro [argument ...]The prefix argument is not parsed for macro names or delimiters, but used verbatim as if it were escaped.
Examples:
See also
NsandSm.PoblockMulti-line version of
Pq.PpParagraph breaks are not needed before or after
ShorSsmacros or before displays (Bdline) or lists (Bl) unless the-compactflag is given.PqlineSee also
Po.QcClose quoted context opened by
Qo.QllineSee also
DlandBd-literal.QoblockMulti-line version of
Qq.QqlineSee also
Dq,Sq, andQo.ReClose an
Rsblock. Does not have any tail arguments.RsExamples:
bash.Rs .%A J. E. Hopcroft .%A J. D. Ullman .%B Introduction to Automata Theory, Languages, and Computation .%I Addison-Wesley .%C Reading, Massachusetts .%D 1979 .ReIf an
Rsblock is used within a SEE ALSO section, a vertical space is asserted before the rendered output, else the block continues on the current line.Rv-std[function ...]If function is not specified, the document's name set by
Nmis used. Multiple function arguments are treated as separate functions.See also
Ex.ScClose single-quoted context opened by
So.ShTITLE LINESection names should be unique so that they may be keyed by
Sx. Although this macro is parsed, it should not consist of child node or it may not be linked withSx.See also
Pp,Ss, andSx.Sm[on|off]By default, spacing is
on. When switchedoff, no white space is inserted between macro arguments and between the output generated from adjacent macros, but text lines still get normal spacing between words and sentences.When called without an argument, the
Smmacro toggles the spacing mode. Using this is not recommended because it makes the code harder to read.SoblockMulti-line version of
Sq.SqlineSee also
Dq,Qq, andSo.SsTitle lineSub-section names should be unique so that they may be keyed by
Sx. Although this macro is parsed, it should not consist of child node or it may not be linked withSx.See also
Pp,Sh, andSx.St-abbreviation- C language standards
- -ansiC
ANSI X3.159-1989 (“ANSI C89”)
- -ansiC-89
ANSI X3.159-1989 (“ANSI C89”)
- -isoC
ISO/IEC 9899:1990 (“ISO C90”)
- -isoC-90
ISO/IEC 9899:1990 (“ISO C90”) The original C standard.
- -isoC-amd1
ISO/IEC 9899/AMD1:1995 (“ISO C90, Amendment 1”)
- -isoC-tcor1
ISO/IEC 9899/TCOR1:1994 (“ISO C90, Technical Corrigendum 1”)
- -isoC-tcor2
ISO/IEC 9899/TCOR2:1995 (“ISO C90, Technical Corrigendum 2”)
- -isoC-99
ISO/IEC 9899:1999 (“ISO C99”) The second major version of the C language standard.
- -isoC-2011
ISO/IEC 9899:2011 (“ISO C11”) The third major version of the C language standard.
- POSIX.1 before the Single UNIX Specification
- -p1003.1-88
IEEE Std 1003.1-1988 (“POSIX.1”)
- -p1003.1
IEEE Std 1003.1 (“POSIX.1”) The original POSIX standard, based on ANSI C.
- -p1003.1-90
IEEE Std 1003.1-1990 (“POSIX.1”)
- -iso9945-1-90
ISO/IEC 9945-1:1990 (“POSIX.1”) The first update of POSIX.1.
- -p1003.1b-93
IEEE Std 1003.1b-1993 (“POSIX.1b”)
- -p1003.1b
IEEE Std 1003.1b (“POSIX.1b”) Real-time extensions.
- -p1003.1c-95
IEEE Std 1003.1c-1995 (“POSIX.1c”) POSIX thread interfaces.
- -p1003.1i-95
IEEE Std 1003.1i-1995 (“POSIX.1i”) Technical Corrigendum.
- -p1003.1-96
ISO/IEC 9945-1:1996 (“POSIX.1”)
- -iso9945-1-96
ISO/IEC 9945-1:1996 (“POSIX.1”) Includes POSIX.1-1990, 1b, 1c, and 1i.
- -xpg3
X/Open Portability Guide Issue 3 (“XPG3”) An XPG4 precursor, published in 1989.
- -p1003.2
IEEE Std 1003.2 (“POSIX.2”)
- -p1003.2-92
IEEE Std 1003.2-1992 (“POSIX.2”)
- -iso9945-2-93
ISO/IEC 9945-2:1993 (“POSIX.2”) An XCU4 precursor.
- -p1003.2a-92
IEEE Std 1003.2a-1992 (“POSIX.2”) Updates to POSIX.2.
- -xpg4
X/Open Portability Guide Issue 4 (“XPG4”) Based on POSIX.1 and POSIX.2, published in 1992.
- -susv1
Version 1 of the Single UNIX Specification (“SUSv1”)
- -xpg4.2
X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”) This standard was published in 1994. It was used as the basis for UNIX 95 certification. The following three refer to parts of it.
- -xsh4.2
X/Open System Interfaces and Headers Issue 4, Version 2 (“XSH4.2”)
- -xcurses4.2
X/Open Curses Issue 4, Version 2 (“XCURSES4.2”)
- -p1003.1g-2000
IEEE Std 1003.1g-2000 (“POSIX.1g”) Networking APIs, including sockets.
- -svid4
System V Interface Definition, Fourth Edition (“SVID4”), Published in 1995.
- -susv2
Version 2 of the Single UNIX Specification (“SUSv2”) This Standard was published in 1997 and is also called X/Open Portability Guide version 5. It was used as the basis for UNIX 98 certification. The following refer to parts of it.
- -xbd5
X/Open Base Definitions Issue 5 (“XBD5”)
- -xsh5
X/Open System Interfaces and Headers Issue 5 (“XSH5”)
- -xcu5
X/Open Commands and Utilities Issue 5 (“XCU5”)
- -xns5
X/Open Networking Services Issue 5 (“XNS5”)
- -xns5.2
X/Open Networking Services Issue 5.2 (“XNS5.2”)
- Single UNIX Specification version 3
- -p1003.1-2001
IEEE Std 1003.1-2001 (“POSIX.1”)
- -susv3
Version 3 of the Single UNIX Specification (“SUSv3”) This standard is based on C99, SUSv2, POSIX.1-1996, 1d, and 1j. It is also called X/Open Portability Guide version 6. It is used as the basis for UNIX 03 certification.
- -p1003.1-2004
IEEE Std 1003.1-2004 (“POSIX.1”) The second and last Technical Corrigendum.
- Single UNIX Specification version 4
- -p1003.1-2008
IEEE Std 1003.1-2008 (“POSIX.1”)
- -susv4
Version 4 of the Single UNIX Specification (“SUSv4”) This standard is also called X/Open Portability Guide version 7.
- Other standards
- -ieee754
IEEE Std 754-1985 Floating-point arithmetic.
- -iso8601
ISO 8601 Representation of dates and times, published in 1988.
- -iso8802-3
ISO 8802-3: 1989 Ethernet local area networks.
- -ieee1275-94
IEEE Std 1275-1994 (“Open Firmware”)
SxTitle lineExamples:
See also
ShandSs.Syword ...This is most often used to indicate importance or seriousness (not to be confused with stress emphasis, see
Em). When none of the semantic macros fit, it is also adequate for syntax elements that have to be given or that appear verbatim.Examples:
bash.Sy Warning : If .Sy s appears in the owner permissions, set-user-ID mode is set. This utility replaces the former .Sy dumpdir program.See also
Em,No, andQl.TaTable cell separator in
Bl-columnlists; can only be used belowIt.Tg[term]When viewing terminal output with less(1), the interactive
:tcommand can be used to go to the definition of the term as described for theMANPAGERvariable in man(1); when producing HTML output, a fragment identifier (idattribute) is generated, to be used for deep linking to this place of the document.In most cases, adding a
Tgmacro would be redundant because mandoc(1) is able to automatically tag most definitions. This macro is intended for cases where automatic tagging of a term is unsatisfactory, for example if a definition is not tagged automatically (false negative) or if places are tagged that do not define the term (false positives). When there is at least oneTgmacro for a term, no other places are automatically marked as definitions of that term.Tnword ...Supported only for compatibility, do not use this in new manuals. Even though the macro name (“tradename”) suggests a semantic function, historic usage is inconsistent, mostly using it as a presentation-level macro to request a small caps font.
UdSupported only for compatibility, do not use this in new manuals. Prints out “currently under development.”
UxSupported only for compatibility, do not use this in new manuals. Prints out “UNIX”.
Va[type] identifier ...Examples:
For function arguments and parameters, use
Fainstead. For declarations of global variables in the SYNOPSIS section, useVt.Vttype [identifier]This is also used for indicating global variables in the SYNOPSIS section, in which case a variable name is also specified. Note that it accepts Block partial-implicit syntax when invoked as the first macro on an input line in the SYNOPSIS section, else it accepts ordinary In-line syntax. In the former case, this macro starts a new output line, and a blank line is inserted in front if there is a preceding function definition or include directive.
Examples:
For parameters in function prototypes, use
Fainstead, for function return typesFt, and for variable names outside the SYNOPSIS sectionVa, even when including a type with the name. See also MANUAL STRUCTURE.XcClose a scope opened by
Xo.XoblockExtend the header of an
Itmacro or the body of a partial-implicit block macro beyond the end of the input line. This macro originally existed to work around the 9-argument limit of historic roff(7).Xrname sectionCross reference the name and section number of another man page.
Examples:
MACRO SYNTAX
The syntax of a macro depends on its classification. In this section, ‘-arg’ refers to macro arguments, which may be followed by zero or more ‘parm’ parameters; ‘Yo’ opens the scope of a macro; and if specified, ‘Yc’ closes it out.
The Callable column indicates that the macro may
also be called by passing its name as an argument to another macro. For
example, ‘.Op Fl O Ar file’ produces
‘[-Ofile]’. To
prevent a macro call and render the macro name literally, escape it by
prepending a zero-width space, ‘\&’. For example,
‘Op \&Fl O’ produces ‘[Fl O]’. If a macro is
not callable but its name appears as an argument to another macro, it is
interpreted as opaque text. For example, ‘.Fl Sh’ produces
‘-Sh’.
The Parsed column indicates whether the macro may call other macros by receiving their names as arguments. If a macro is not parsed but the name of another macro appears as an argument, it is interpreted as opaque text.
The Scope column, if applicable, describes closure rules.
Block full-explicit
Multi-line scope closed by an explicit closing macro. All macros
contains bodies; only Bf and (optionally)
Bl contain a head.
.Yo [-arg [parm...]] [head...]
[body...]
.Yc| Macro | Callable | Parsed | Scope |
| Bd | No | No | closed by Ed |
| Bf | No | No | closed by Ef |
| Bk | No | No | closed by Ek |
| Bl | No | No | closed by El |
| Ed | No | No | opened by Bd |
| Ef | No | No | opened by Bf |
| Ek | No | No | opened by Bk |
| El | No | No | opened by Bl |
Block full-implicit
Multi-line scope closed by end-of-file or implicitly by another
macro. All macros have bodies; some (It-bullet, -hyphen,
-dash, -enum,
-item) don't have heads; only one
(It in Bl-column) has multiple heads.
.Yo [-arg [parm...]] [head... [Ta head...]]
[body...]| Macro | Callable | Parsed | Scope |
| It | No | Yes | closed by It , El |
| Nd | No | No | closed by Sh |
| Nm | No | Yes | closed by Nm , Sh , Ss |
| Sh | No | Yes | closed by Sh |
| Ss | No | Yes | closed by Sh , Ss |
Note that the Nm macro is a
Block full-implicit macro only
when invoked as the first macro in a SYNOPSIS section
line, else it is In-line.
Block partial-explicit
Like block full-explicit, but also with single-line scope. Each
has at least a body and, in limited circumstances, a head
(Fo, Eo) and/or tail
(Ec).
.Yo [-arg [parm...]] [head...]
[body...]
.Yc [tail...]
.Yo [-arg [parm...]] [head...] [body...] Yc [tail...]| Macro | Callable | Parsed | Scope |
| Ac | Yes | Yes | opened by Ao |
| Ao | Yes | Yes | closed by Ac |
| Bc | Yes | Yes | closed by Bo |
| Bo | Yes | Yes | opened by Bc |
| Brc | Yes | Yes | opened by Bro |
| Bro | Yes | Yes | closed by Brc |
| Dc | Yes | Yes | opened by Do |
| Do | Yes | Yes | closed by Dc |
| Ec | Yes | Yes | opened by Eo |
| Eo | Yes | Yes | closed by Ec |
| Fc | Yes | Yes | opened by Fo |
| Fo | No | No | closed by Fc |
| Oc | Yes | Yes | closed by Oo |
| Oo | Yes | Yes | opened by Oc |
| Pc | Yes | Yes | closed by Po |
| Po | Yes | Yes | opened by Pc |
| Qc | Yes | Yes | opened by Oo |
| Qo | Yes | Yes | closed by Oc |
| Re | No | No | opened by Rs |
| Rs | No | No | closed by Re |
| Sc | Yes | Yes | opened by So |
| So | Yes | Yes | closed by Sc |
| Xc | Yes | Yes | opened by Xo |
| Xo | Yes | Yes | closed by Xc |
Block partial-implicit
Like block full-implicit, but with single-line scope closed by the end of the line.
.Yo [-arg [val...]] [body...] [res...]| Macro | Callable | Parsed |
| Aq | Yes | Yes |
| Bq | Yes | Yes |
| Brq | Yes | Yes |
| D1 | No | Yes |
| Dl | No | Yes |
| Dq | Yes | Yes |
| En | Yes | Yes |
| Op | Yes | Yes |
| Pq | Yes | Yes |
| Ql | Yes | Yes |
| Yes | Yes | |
| Sq | Yes | Yes |
| Vt | Yes | Yes |
Note that the Vt macro is a
Block partial-implicit only
when invoked as the first macro in a SYNOPSIS section
line, else it is In-line.
Special block macro
The Ta macro can only be used below
It in Bl-column lists. It delimits blocks representing table
cells; these blocks have bodies, but no heads.
| Macro | Callable | Parsed | Scope |
| Ta | Yes | Yes | closed by Ta , It |
In-line
Closed by the end of the line, fixed argument lengths, and/or subsequent macros. In-line macros have only text children. If a number (or inequality) of arguments is (n), then the macro accepts an arbitrary number of arguments.
.Yo [-arg [val...]] [args...] [res...]
.Yo [-arg [val...]] [args...] Yc...
.Yo [-arg [val...]] arg0 arg1 argN| Macro | Callable | Parsed | Arguments |
| %A | No | No | >0 |
| %B | No | No | >0 |
| %C | No | No | >0 |
| %D | No | No | >0 |
| %I | No | No | >0 |
| %J | No | No | >0 |
| %N | No | No | >0 |
| %O | No | No | >0 |
| %P | No | No | >0 |
| %Q | No | No | >0 |
| %R | No | No | >0 |
| %T | No | No | >0 |
| %U | No | No | >0 |
| %V | No | No | >0 |
| Ad | Yes | Yes | >0 |
| An | Yes | Yes | >0 |
| Ap | Yes | Yes | 0 |
| Ar | Yes | Yes | n |
| At | Yes | Yes | 1 |
| Bsx | Yes | Yes | n |
| Bt | No | No | 0 |
| Bx | Yes | Yes | n |
| Cd | Yes | Yes | >0 |
| Cm | Yes | Yes | >0 |
| Db | No | No | 1 |
| Dd | No | No | n |
| Dt | No | No | n |
| Dv | Yes | Yes | >0 |
| Dx | Yes | Yes | n |
| Em | Yes | Yes | >0 |
| Er | Yes | Yes | >0 |
| Es | Yes | Yes | 2 |
| Ev | Yes | Yes | >0 |
| Ex | No | No | n |
| Fa | Yes | Yes | >0 |
| Fd | No | No | >0 |
| Fl | Yes | Yes | n |
| Fn | Yes | Yes | >0 |
| Fr | Yes | Yes | >0 |
| Ft | Yes | Yes | >0 |
| Fx | Yes | Yes | n |
| Hf | No | No | n |
| Ic | Yes | Yes | >0 |
| In | No | No | 1 |
| Lb | No | No | 1 |
| Li | Yes | Yes | >0 |
| Lk | Yes | Yes | >0 |
| Lp | No | No | 0 |
| Ms | Yes | Yes | >0 |
| Mt | Yes | Yes | >0 |
| Nm | Yes | Yes | n |
| No | Yes | Yes | >0 |
| Ns | Yes | Yes | 0 |
| Nx | Yes | Yes | n |
| Os | No | No | n |
| Ot | Yes | Yes | >0 |
| Ox | Yes | Yes | n |
| Pa | Yes | Yes | n |
| Pf | Yes | Yes | 1 |
| Pp | No | No | 0 |
| Rv | No | No | n |
| Sm | No | No | <2 |
| St | No | Yes | 1 |
| Sx | Yes | Yes | >0 |
| Sy | Yes | Yes | >0 |
| Tg | No | No | <2 |
| Tn | Yes | Yes | >0 |
| Ud | No | No | 0 |
| Ux | Yes | Yes | n |
| Va | Yes | Yes | n |
| Vt | Yes | Yes | >0 |
| Xr | Yes | Yes | 2 |
Delimiters
When a macro argument consists of one single input character considered as a delimiter, the argument gets special handling. This does not apply when delimiters appear in arguments containing more than one character. Consequently, to prevent special handling and just handle it like any other argument, a delimiter can be escaped by prepending a zero-width space (‘\&’). In text lines, delimiters never need escaping, but may be used as normal punctuation.
For many macros, when the leading arguments are opening delimiters, these delimiters are put before the macro scope, and when the trailing arguments are closing delimiters, these delimiters are put after the macro scope. Spacing is suppressed after opening delimiters and before closing delimiters. For example,
renders as:
Opening delimiters are:
- (
left parenthesis
- [
left bracket
Closing delimiters are:
- .
period
- ,
comma
- :
colon
- ;
semicolon
- )
right parenthesis
- ]
right bracket
- ?
question mark
- !
exclamation mark
Note that even a period preceded by a backslash (‘\.’) gets this special handling; use ‘\&.’ to prevent that.
Many in-line macros interrupt their scope when they encounter delimiters, and resume their scope when more arguments follow that are not delimiters. For example,
renders as:
This applies to both opening and closing delimiters, and also to the middle delimiter, which does not suppress spacing:
- |
vertical bar
As a special case, the predefined string \*(Ba is handled and rendered in the same way as a plain ‘|’ character. Using this predefined string is not recommended in new manuals.
Appending a zero-width space (‘\&’) to the end of an input line is also useful to prevent the interpretation of a trailing period, exclamation or question mark as the end of a sentence, for example when an abbreviation happens to occur at the end of a text or macro input line.
Font handling
In mdoc documents, usage of semantic
markup is recommended in order to have proper fonts automatically selected;
only when no fitting semantic markup is available, consider falling back to
Physical markup macros. Whenever
any mdoc macro switches the
roff(7) font mode, it will automatically restore the
previous font when exiting its scope. Manually switching the font using the
roff(7) ‘\f’ font
escape sequences is never required.
COMPATIBILITY
This section provides an incomplete list of compatibility issues between mandoc and GNU troff ("groff").
The following problematic behaviour is found in groff:
Pa does not format its arguments when used in the FILES section under certain list types.
Ta can only be called by other macros, but not at the beginning of a line.
‘\f’ (font face) and ‘\F’ (font family face) Text Decoration escapes behave irregularly when specified within line-macro scopes.
Negative scaling units return to prior lines. Instead, mandoc truncates them to zero.
The following features are unimplemented in mandoc:
Bd -file file is unsupported for security reasons.
Bd -filled does not adjust the right margin, but is an alias for Bd -ragged .
Bd -literal does not use a literal font, but is an alias for Bd -unfilled .
Bd -offset center and -offset right don't work. Groff does not implement centered and flush-right rendering either, but produces large indentations.
SEE ALSO
man(1), mandoc(1), eqn(7), man(7), mandoc_char(7), roff(7), tbl(7)
The web page extended documentation for the mdoc language (opens in new tab) provides a few tutorial-style pages for beginners, an extensive style guide for advanced authors, and an alphabetic index helping to choose the best macros for various kinds of content.
The manual page groff_mdoc(7) (opens in new tab) contained in the “groff” package documents exactly the same language in a somewhat different style.
HISTORY
The mdoc language first appeared as a
troff macro package in 4.4BSD. It was later
significantly updated by Werner Lemberg and Ruslan Ermilov in groff-1.17.
The standalone implementation that is part of the
mandoc(1) utility written by Kristaps Dzonsons appeared in
OpenBSD 4.6.
AUTHORS
The mdoc reference was written by
Kristaps Dzonsons
<[email protected]>.