|groff_man(7)||Standards, Environments, and Macros||groff_man(7)|
groff_man - compose manual pages with GNU roff
||[option ...] [file ...]|
||[option ...] [file ...]|
The 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.
|.B||Bold||Font style macros|
|.BI||Bold, italic alternating||Font style macros|
|.BR||Bold, roman alternating||Font style macros|
|.EE||Example end||Document structure macros|
|.EX||Example begin||Document structure macros|
|.I||Italic||Font style macros|
|.IB||Italic, bold alternating||Font style macros|
|.IP||Indented paragraph||Paragraphing macros|
|.IR||Italic, roman alternating||Font style macros|
|.LP||Begin paragraph||Paragraphing macros|
|.ME||Mail-to end||Hyperlink macros|
|.MR||Man page cross reference||Hyperlink macros|
|.MT||Mail-to start||Hyperlink macros|
|.P||Begin paragraph||Paragraphing macros|
|.PP||Begin paragraph||Paragraphing macros|
|.RB||Roman, bold alternating||Font style macros|
|.RE||Relative inset end||Document structure macros|
|.RI||Roman, italic alternating||Font style macros|
|.RS||Relative inset start||Document structure macros|
|.SB||Small bold||Font style macros|
|.SH||Section heading||Document structure macros|
|.SM||Small||Font style macros|
|.SS||Subsection heading||Document structure macros|
|.SY||Synopsis start||Command synopsis macros|
|.TH||Title heading||Document structure macros|
|.TP||Tagged paragraph||Paragraphing macros|
|.TQ||Supplemental paragraph tag||Paragraphing macros|
|.UE||URI end||Hyperlink macros|
|.UR||URI start||Hyperlink macros|
|.YS||Synopsis end||Command synopsis macros|
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
A tagged paragraph describes each macro. We present coupled pairs
together, as with .EX and .EE.
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 organize a man page's content. All of them break the output line. .TH (title heading) identifies the document as a man page and configures the page headers and footers. Section headings (.SH), one of which is mandatory and many of which are conventionally expected, facilitate location of material by the reader and aid the man page writer to discuss all essential aspects of the topic. Subsection headings (.SS) are optional and permit sections that grow long to develop in a controlled way. Many technical discussions benefit from examples; lengthy ones, especially those reflecting multiple lines of input to or output from the system, are usefully bracketed by .EX and .EE. When none of the foregoing meets a structural demand, use .RS/.RE to inset a region within a (sub)section.
An ordinary paragraph (.P) is set without a first-line
indentation at the current left margin. In man pages and other technical
literature, definition lists are frequently encountered; these can be set as
“tagged paragraphs”, which have one (.TP) or more
(.TQ) leading tags followed by a paragraph that has an additional
indentation. The indented paragraph (.IP) macro is useful to continue
the indented content of a narrative started with .TP, or to present
an itemized or ordered list. All of these macros break the output line. If
another paragraph macro has occurred since the previous .SH or
.SS, they (except for .TQ) follow the break with a default
amount of vertical space, which can be changed by the deprecated .PD
macro; see subsection “Horizontal and vertical spacing” below.
They also reset the type size and font style to defaults (.TQ again
excepted); see subsection “Font style macros” below.
.SY and .YS aid you to construct a command synopsis that has the classical Unix appearance. They break the output line.
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.
Man page cross references are best presented with .MR. Text may be hyperlinked to email addresses with .MT/.ME or other URIs with .UR/.UE. Hyperlinked text is supported on HTML and terminal output devices; terminals and pager programs must support ECMA-48 OSC 8 escape sequences (see grotty(1)). When device support is unavailable or disabled with the U register (see section “Options” below), .MT and .UR URIs are rendered between angle brackets after the linked text.
.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.
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.
The man macro package is limited in its font styling
options, offering only bold (.B),
italic (.I), and roman. Italic text is usually set
underscored instead on terminal devices. The .SM and .SB
macros set text in roman or bold, respectively, at a smaller type size;
these differ visually from regular-sized roman or bold text only on
typesetting devices. It is often necessary to set text in different styles
without intervening space. The macros .BI, .BR, .IB,
.IR, .RB, and .RI, where “B”,
“I”, and “R” indicate bold, italic, and roman,
respectively, set their odd- and even-numbered arguments in alternating
styles, with no space separating them.
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.
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.
The indentation argument accepted by .IP, .TP, and the deprecated .HP is a number plus an optional scaling unit, as is .RS's inset-amount. If no scaling unit is given, the man package assumes “n”. An indentation specified in a call to .IP, .TP, or the deprecated .HP persists until (1) another of these macros is called with an indentation argument, or (2) .SH, .SS, or .P or its synonyms is called; these clear the indentation entirely.
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 are described in section “Options” below. They can be set not only on the command line but in the site man.local file as well; see section “Files” below.
The following strings are defined for use in man pages. None of these is necessary in a contemporary man page; see groff_man_style(7). Others are supported for configuration of rendering parameters; see section “Options” below.
Two macros, both GNU extensions, are called internally by the groff man package to format page headers and footers and can be redefined by the administrator in a site's man.local file (see section “Files” below). The presentation of .TH above describes the default headers and footers. Because these macros are hooks for groff man internals, man pages have no reason to call them. Such hook definitions will likely consist of “.sp” and “.tl” requests. They must also increase the page length with “.pl” requests in continuous rendering mode; .PT furthermore has the responsibility of emitting a PDF bookmark after writing the first page header in a document. Consult the existing implementations in an.tmac when drafting replacements.
To remove a page header or footer entirely, define the appropriate macro as empty rather than deleting it.
Use of the following in man pages for public distribution is discouraged.
M. Douglas McIlroy designed, implemented, and documented the AT&T man macros for Unix Version 7 (1979) and employed them to edit the first volume of its Programmer's Manual, a compilation of all man pages supplied by the system. That man supported the macros listed in this page not described as extensions, except .P and the deprecated .AT and .UC. The only strings defined were R and S; no registers were documented.
.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.
The 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.
The initial GNU implementation of the man macro package was
written by James Clark. Later, Werner
Lemberg supplied the S, LT, and cR registers, the
last a 4.3BSD-Reno mdoc(7) feature.
Larry Kollar added the
FT, HY, and SN registers; the HF string; and the
PT and BT macros.
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,
Eric S. Raymond, and
This document was originally written for the Debian GNU/Linux system by Susan G. Kleinmann. It was corrected and updated by Lemberg and Robinson. The extension macros were documented by Raymond and Robinson.
gtbl(1), geqn(1), and grefer(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.
groff_man_style(7), groff(7), groff_char(7), man(7)
|1 November 2023||groff 1.23.0|