Name
groff_man - compose manual pages with GNU roff
Synopsis
groff -man |
[option ...] [file ...] man [option ...] [file ...] DescriptionThe GNU implementation of the man macro package is part of the groff document formatting system. It is used to produce manual pages (“man pages”) like the one you are reading. This document presents the macros thematically; for those needing only a quick reference, the following table lists them alphabetically, with cross references to appropriate subsections below. Man page authors and maintainers who are not already experienced groff users should consult groff_man_style(7), an expanded version of this document, for additional explanations and advice. It covers only those concepts required for man page document maintenance, and not the full breadth of the groff typesetting system. We discuss other macros (.AT, .DT, .HP, .OP, .PD, and .UC) in subsection “Deprecated features” below. Throughout Unix documentation, a manual entry is referred to simply as a “man page”, regardless of its length, without gendered implication, and irrespective of the macro package selected for its composition. Macro
reference preliminaries An empty macro argument can be specified with a pair of double-quotes (""), but the man package is designed such that this should seldom be necessary. Most macro arguments will be formatted as text in the output; exceptions are noted. Document
structure macros Determine the contents of the page header and footer. The subject of the man page is topic and the section of the manual to which it belongs is section. See man(1) or intro(1) for the manual sectioning applicable to your system. topic and section are positioned together at the left and right in the header (with section in parentheses immediately appended to topic). footer-middle is centered in the footer. The arrangement of the rest of the footer depends on whether double-sided layout is enabled with the option -rD1. When disabled (the default), footer-inside is positioned at the bottom left. Otherwise, footer-inside appears at the bottom left on recto (odd-numbered) pages, and at the bottom right on verso (even-numbered) pages. The outside footer is the page number, except in the continuous-rendering mode enabled by the option -rcR=1, in which case it is the topic and section, as in the header. header-middle is centered in the header. If section is an integer between 1 and 9 (inclusive), there is no need to specify header-middle; an.tmac will supply text for it. The macro package may also abbreviate topic and footer-inside with ellipses if they would overrun the space available in the header and footer, respectively. For HTML output, headers and footers are suppressed. Additionally, this macro breaks the page, resetting the number to 1 (unless the -rC1 option is given). This feature is intended only for formatting multiple man documents in sequence. A valid man document calls .TH once, early in the file, prior to any other macro calls. .SH [heading-text] Set heading-text as a section heading. If no argument is given, a one-line input trap is planted; text on the next line becomes heading-text. The left margin is reset to zero to set the heading text in bold (or the font specified by the string HF), and, on typesetting devices, slightly larger than the base type size. If the heading font \*[HF] is bold, use of an italic style in heading-text is mapped to the bold-italic style if available in the font family. The inset level is reset to 1, setting the left margin to the value of the IN register. Text after heading-text is set as an ordinary paragraph (.P). The content of heading-text and ordering of sections follows a set of common practices, as has much of the layout of material within sections. For example, a section called “Name” or “NAME” must exist, must be the first section after the .TH call, and must contain only text of the form topic[, another-topic]... \- summary-description for a man page to be properly indexed. See groff_man_style(7) for suggestions and man(7) for the conventions prevailing on your system. .SS [subheading-text] Set subheading-text as a subsection heading indented between a section heading and an ordinary paragraph (.P). If no argument is given, a one-line input trap is planted; text on the next line becomes subheading-text. The left margin is reset to the value of the SN register to set the heading text in bold (or the font specified by the string HF). If the heading font \*[HF] is bold, use of an italic style in subheading-text is mapped to the bold-italic style if available in the font family. The inset level is reset to 1, setting the left margin to the value of the IN register. Text after subheading-text is set as an ordinary paragraph (.P).
These macros are extensions introduced in Ninth Edition Research Unix. Systems running that troff, or those from Documenter’s Workbench, Heirloom Doctools, or Plan 9 troff support them. To be certain your page will be portable to systems that do not, copy their definitions from the an-ext.tmac file of a groff installation. .RS [inset-amount] Start a new relative inset level. The position of the left margin is saved, then moved right by inset-amount, if specified, and by the amount of the IN register otherwise. Calls to .RS can be nested; each increments by 1 the inset level used by .RE. The level prior to any .RS calls is 1. .RE [level] End a relative inset. The left margin corresponding to inset level level is restored. If no argument is given, the inset level is reduced by 1. Paragraphing
macros
.TP [indentation] Set a paragraph with a leading tag, and the remainder of the paragraph indented. A one-line input trap is planted; text on the next line, which can be formatted with a macro, becomes the tag, which is placed at the current left margin. The tag can be extended with the \c escape sequence. Subsequent text is indented by indentation, if specified, and by the amount of the IN register otherwise. If the tag is not as wide as the indentation, the paragraph starts on the same line as the tag, at the applicable indentation, and continues on the following lines. Otherwise, the descriptive part of the paragraph begins on the line following the tag.
This macro is a GNU extension not defined on systems running AT&T, Plan 9, or Solaris troff; see an-ext.tmac in section “Files” below. .IP [tag] [indentation] Set an indented paragraph with an optional tag. The tag and indentation arguments, if present, are handled as with .TP, with the exception that the tag argument to .IP cannot include a macro call. Command
synopsis macros These macros
are GNU extensions not defined on systems running AT&T,
Plan 9, or Solaris troff; see an-ext.tmac
in section “Files” below. Begin synopsis. A new paragraph begins at the left margin unless .SY has already been called without a corresponding .YS, in which case only a break is performed. Adjustment and automatic hyphenation are disabled. command is set in bold. If a break is required, lines after the first are indented by the width of command plus a space.
Hyperlink
macros .MT, .ME, .UR, and .UE are GNU extensions not defined on systems running AT&T, Plan 9, or Solaris troff; see an-ext.tmac in section “Files” below. Plan 9 from User Space’s troff implements .MR. The arguments
to .MR, .MT, and .UR should be prepared
for typesetting since they can appear in the output. Use
special character escape sequences to encode Unicode basic
Latin characters where necessary, particularly the
hyphen-minus. The formatter removes \: escape
sequences from hyperlinks when supplying device control
commands to output drivers. (since groff 1.23) Set a man page cross reference as “topic(manual-section)”. If trailing-text (typically punctuation) is specified, it follows the closing parenthesis without intervening space. Hyphenation is disabled while the cross reference is set. topic is set in the font specified by the MF string. The cross reference hyperlinks to a URI of the form “man:topic(manual-section)”. .MT address
Identify address as an RFC 6068 addr-spec for a “mailto:” URI with the text between the two macro calls as the link text. An argument to .ME is placed after the link text without intervening space. address may not be visible in the rendered document if hyperlinks are enabled and supported by the output driver. If they are not, address is set in angle brackets after the link text and before trailing-text. If hyperlinking is enabled but there is no link text, address is formatted and hyperlinked without angle brackets. .UR uri Identify uri as an RFC 3986 URI hyperlink with the text between the two macro calls as the link text. An argument to .UE is placed after the link text without intervening space. uri may not be visible in the rendered document if hyperlinks are enabled and supported by the output driver. If they are not, uri is set in angle brackets after the link text and before trailing-text. If hyperlinking is enabled but there is no link text, uri is formatted and hyperlinked without angle brackets. The hyperlinking of .TP paragraph tags with .UR/.UE and .MT/.ME is not yet supported; if attempted, the hyperlink will be typeset at the beginning of the indented paragraph even on hyperlink-supporting devices. Font style
macros The default
type size and family for typesetting devices is 10-point
Times, except on the X75-12 and X100-12
devices where the type size is 12 points. The default style
is roman. Set text in bold. If no argument is given, a one-line input trap is planted; text on the next line, which can be further formatted with a macro, is set in bold. .I [text] Set text in an italic or oblique face. If no argument is given, a one-line input trap is planted; text on the next line, which can be further formatted with a macro, is set in an italic or oblique face. .SM [text] Set text one point smaller than the default type size on typesetting devices. If no argument is given, a one-line input trap is planted; text on the next line, which can be further formatted with a macro, is set smaller. .SB [text] Set text in bold and (on typesetting devices) one point smaller than the default type size. If no argument is given, a one-line input trap is planted; text on the next line, which can be further formatted with a macro, is set smaller and in bold. This macro is an extension introduced in SunOS 4.0. Unlike the
above font style macros, the font style alternation macros
below set no input traps; they must be given arguments to
have effect. Italic corrections are applied as appropriate.
Set each argument in bold and italics, alternately. .BR bold-text roman-text ... Set each argument in bold and roman, alternately. .IB italic-text bold-text ... Set each argument in italics and bold, alternately. .IR italic-text roman-text ... Set each argument in italics and roman, alternately. .RB roman-text bold-text ... Set each argument in roman and bold, alternately. .RI roman-text italic-text ... Set each argument in roman and italics, alternately. Horizontal
and vertical spacing The left margin used by ordinary paragraphs set with .P (and its synonyms) not within an .RS/.RE relative inset is 7.2n for typesetting devices and 7n for terminal devices (but see the -rIN option). Headers, footers (both set with .TH), and section headings (.SH) are set at the page offset (see groff(7)) and subsection headings (.SS) indented from it by 3n (but see the -rSN option). Several macros insert vertical space: .SH, .SS, .TP, .P (and its synonyms), .IP, and the deprecated .HP. The default inter-section and inter-paragraph spacing is is 1v for terminal devices and 0.4v for typesetting devices. (The deprecated macro .PD can change this vertical spacing, but its use is discouraged.) Between .EX and .EE calls, the inter-paragraph spacing is 1v regardless of output device. Registers
Strings
Hooks
To remove a page header or footer entirely, define the appropriate macro as empty rather than deleting it. Deprecated
features Alter the footer for use with legacy AT&T man pages, overriding any definition of the footer-inside argument to .TH. This macro exists only to render man pages from historical systems. system can be any of the following.
The optional release argument specifies the release number, as in “System V Release 3”.
Use of this presentation-oriented macro is deprecated. It translates poorly to HTML, under which exact space control and tabulation are not readily available. Thus, information or distinctions that you use tab stops to express are likely to be lost. If you feel tempted to change the tab stops such that calling this macro later is desirable to restore them, you should probably be composing a table using tbl(1) instead. .HP [indentation] Set up a paragraph with a hanging left indentation. The indentation argument, if present, is handled as with .TP. Use of this presentation-oriented macro is deprecated. A hanging indentation cannot be expressed naturally under HTML, and non-roff-based man page interpreters may treat .HP as an ordinary paragraph. Thus, information or distinctions you mean to express with indentation may be lost. .OP option-name [option-argument] Indicate an optional command parameter called option-name, which is set in bold. If the option takes an argument, specify option-argument using a noun, abbreviation, or hyphenated noun phrase. If present, option-argument is preceded by a space and set in italics. Square brackets in roman surround both arguments. Use of this quasi-semantic macro, an extension originating in Documenter’s Workbench troff, is deprecated. It cannot easily be used to annotate options that take optional arguments or options whose arguments have internal structure (such as a mixture of literal and variable components). One could work around these limitations with font selection escape sequences, but it is preferable to use font style alternation macros, which afford greater flexibility. .PD [vertical-space] Define the vertical space between paragraphs or (sub)sections. The optional argument vertical-space specifies the amount; the default scaling unit is “v”. Without an argument, the spacing is reset to its default value; see subsection “Horizontal and vertical spacing” above. Use of this presentation-oriented macro is deprecated. It translates poorly to HTML, under which exact control of inter-paragraph spacing is not readily available. Thus, information or distinctions that you use .PD to express are likely to be lost. .UC [version] Alter the footer for use with legacy BSD man pages, overriding any definition of the footer-inside argument to .TH. This macro exists only to render man pages from historical systems. version can be any of the following.
History
.UC appeared in 3BSD (1980). Unix System III (1980) introduced .P and exposed the registers IN and LL, which had been internal to Seventh Edition Unix man. PWB/UNIX 2.0 (1980) added the Tm string. 4BSD (1980) added lq and rq strings. SunOS 2.0 (1985) recognized C, D, P, and X registers. 4.3BSD (1986) added .AT and .P. Ninth Edition Research Unix (1986) introduced .EX and .EE. SunOS 4.0 (1988) added .SB. The foregoing features were what James Clark implemented in early versions of groff. Later, groff 1.20 (2009) originated .SY/.YS, .TQ, .MT/.ME, and .UR/.UE. Plan 9 from User Space’s troff introduced .MR in 2020. OptionsThe following
groff options set registers (with -r) and
strings (with -d) recognized and used by the
man macro package. To ensure rendering consistent
with output device capabilities and reader preferences, man
pages should never manipulate them. Set line adjustment to adjustment-mode, which is typically “b” for adjustment to both margins (the default), or “l” for left alignment (ragged right margin). Any valid argument to groff’s “.ad” request may be used. See groff(7) for less-common choices.
-rFT=footer-distance Set distance of the footer relative to the bottom of the page to footer-distance; this amount is always negative. At one half-inch above this location, the page text is broken before writing the footer. Ignored if continuous rendering is enabled. The default is -0.5i. -dHF=heading-font Set the font used for section and subsection headings; the default is “B” (bold style of the default family). Any valid argument to groff’s “.ft” request may be used. See groff(7).
-rIN=standard-indentation Set the amount of indentation used for ordinary paragraphs (.P and its synonyms) and the default indentation amount used by .IP, .RS, .TP, and the deprecated .HP. See subsection “Horizontal and vertical spacing” above for the default. For terminal devices, standard-indentation should always be an integer multiple of unit “n” to get consistent indentation. -rLL=line-length Set line length; the default is 78n for terminal devices and 6.5i for typesetting devices. -rLT=title-length Set the line length for titles. By default, it is set to the line length (see -rLL above). -dMF=man-page-topic-font Set the font used for man page topics named in .TH and .MR calls; the default is “I” (italic style of the default family). Any valid argument to groff’s “.ft” request may be used. If the MF string ends in “I”, it is assumed to be an oblique typeface, and italic corrections are applied before and after man page topics.
-rStype-size Use type-size for the document’s body text; acceptable values are 10, 11, or 12 points. See subsection “Font style macros” above for the default. -rSN=subsection-indentation Set indentation of subsection headings to subsection-indentation. See subsection “Horizontal and vertical spacing” above for the default.
Files/usr/share/groff/1.23.0/tmac/an.tmac Most man macros are defined in this file. It also loads extensions from an-ext.tmac (see below). /usr/share/groff/1.23.0/tmac/andoc.tmac This brief groff program detects whether the man or mdoc macro package is being used by a document and loads the correct macro definitions, taking advantage of the fact that pages using them must call .TH or .Dd, respectively, before any other macros. A man program or user typing, for example, “groff -mandoc page.1”, need not know which package the file page.1 uses. Multiple man pages, in either format, can be handled; andoc reloads each macro package as necessary. /usr/share/groff/1.23.0/tmac/an-ext.tmac Except for .SB, definitions of macros described above as extensions are contained in this file; in some cases, they are simpler versions of definitions appearing in an.tmac, and are ignored if the formatter is GNU troff. They are written to be compatible with AT&T troff and permissively licensed—not copylefted. To reduce the risk of name space collisions, string and register names begin only with “m”. We encourage man page authors who are concerned about portability to legacy Unix systems to copy these definitions into their pages, and maintainers of troff implementations or work-alike systems that format man pages to re-use them. The definitions for these macros are read after a page calls .TH, so they will replace any macros of the same names preceding it in your file. If you use your own implementations of these macros, they must be defined after .TH is called to have any effect. Furthermore, it is wise to define such page-local macros (if at all) after the “Name” section to accommodate timid makewhatis or mandb implementations that may give up their scan for indexing material early. /usr/share/groff/1.23.0/tmac/man.tmac This is a wrapper that loads an.tmac. /usr/share/groff/1.23.0/tmac/mandoc.tmac This is a wrapper that loads andoc.tmac. /usr/share/groff/site-tmac/man.local Put site-local changes and customizations into this file. AuthorsThe initial GNU implementation of the man macro package was written by James Clark. Later, wl [AT] gnu.org">Werner Lemberg supplied the S, LT, and cR registers, the last a 4.3BSD-Reno mdoc(7) feature. kollar [AT] alltel.net">Larry Kollar added the FT, HY, and SN registers; the HF string; and the PT and BT macros. g.branden.robinson [AT] gmail.com">G. Branden Robinson implemented the AD and MF strings; CS, CT, and U registers; and the MR macro. Except for .SB, the extension macros were written by Lemberg, esr [AT] thyrsus.com">Eric S. Raymond, and Robinson. This document was originally written for the Debian GNU/Linux system by sgk [AT] debian.org">Susan G. Kleinmann. It was corrected and updated by Lemberg and Robinson. The extension macros were documented by Raymond and Robinson. See alsotbl(1), eqn(1), and refer(1) are preprocessors used with man pages. man(1) describes the man page librarian on your system. groff_mdoc(7) details the groff version of the BSD-originated alternative macro package for man pages. |