1MAN(7)                     Linux Programmer's Manual                    MAN(7)
2
3
4

NAME

6       man - macros to format man pages
7

SYNOPSIS

9       groff -Tascii -man file ...
10
11       groff -Tps -man file ...
12
13       man [section] title
14

DESCRIPTION

16       This manual page explains the groff an.tmac macro package (often called
17       the man macro package).  This macro package should be used by  develop‐
18       ers when writing or porting man pages for Linux.  It is fairly compati‐
19       ble with other versions of this macro package,  so  porting  man  pages
20       should  not  be  a  major problem (exceptions include the NET-2 BSD re‐
21       lease, which uses a totally different macro package  called  mdoc;  see
22       mdoc(7)).
23
24       Note  that  NET-2  BSD  mdoc man pages can be used with groff simply by
25       specifying the -mdoc option instead of  the  -man  option.   Using  the
26       -mandoc  option is, however, recommended, since this will automatically
27       detect which macro package is in use.
28
29       For conventions that should be employed when writing man pages for  the
30       Linux man-pages package, see man-pages(7).
31
32   Title line
33       The  first  command  in a man page (after comment lines, that is, lines
34       that start with .\") should be
35
36              .TH title section date source manual
37
38       For details of the arguments that should be supplied to the TH command,
39       see man-pages(7).
40
41       Note  that  BSD mdoc-formatted pages begin with the Dd command, not the
42       TH command.
43
44   Sections
45       Sections are started with .SH followed by the heading name.
46
47       The only mandatory heading is NAME, which should be the  first  section
48       and  be followed on the next line by a one-line description of the pro‐
49       gram:
50
51              .SH NAME
52              item \- description
53
54       It is extremely important that this format is followed, and that  there
55       is  a  backslash  before  the  single dash which follows the item name.
56       This syntax is used by the mandb(8) program to  create  a  database  of
57       short  descriptions  for  the  whatis(1) and apropos(1) commands.  (See
58       lexgrog(1) for further details on the syntax of the NAME section.)
59
60       For a list of other sections that might appear in a  manual  page,  see
61       man-pages(7).
62
63   Fonts
64       The commands to select the type face are:
65
66       .B  Bold
67
68       .BI Bold alternating with italics (especially useful for function spec‐
69           ifications)
70
71       .BR Bold alternating with Roman (especially  useful  for  referring  to
72           other manual pages)
73
74       .I  Italics
75
76       .IB Italics alternating with bold
77
78       .IR Italics alternating with Roman
79
80       .RB Roman alternating with bold
81
82       .RI Roman alternating with italics
83
84       .SB Small alternating with bold
85
86       .SM Small (useful for acronyms)
87
88       Traditionally,  each  command can have up to six arguments, but the GNU
89       implementation removes this limitation (you might still want  to  limit
90       yourself  to 6 arguments for portability's sake).  Arguments are delim‐
91       ited by spaces.  Double quotes can be used to specify an argument which
92       contains  spaces.   For the macros that produce alternating type faces,
93       the arguments will be printed next to each  other  without  intervening
94       spaces,  so  that the .BR command can be used to specify a word in bold
95       followed by a mark of punctuation in Roman.  If no arguments are given,
96       the command is applied to the following line of text.
97
98   Other macros and strings
99       Below  are  other relevant macros and predefined strings.  Unless noted
100       otherwise, all macros cause a break (end the  current  line  of  text).
101       Many of these macros set or use the "prevailing indent."  The "prevail‐
102       ing indent" value is set by any  macro  with  the  parameter  i  below;
103       macros  may  omit i in which case the current prevailing indent will be
104       used.  As a result, successive indented paragraphs can use the same in‐
105       dent  without  respecifying  the  indent value.  A normal (nonindented)
106       paragraph resets the prevailing indent value to its default value  (0.5
107       inches).  By default, a given indent is measured in ens; try to use ens
108       or ems as units for indents, since these will automatically  adjust  to
109       font size changes.  The other key macro definitions are:
110
111   Normal paragraphs
112       .LP      Same as .PP (begin a new paragraph).
113
114       .P       Same as .PP (begin a new paragraph).
115
116       .PP      Begin a new paragraph and reset prevailing indent.
117
118   Relative margin indent
119       .RS i    Start  relative  margin indent: moves the left margin i to the
120                right (if i is omitted, the prevailing indent value is  used).
121                A  new  prevailing  indent is set to 0.5 inches.  As a result,
122                all following paragraph(s) will be indented until  the  corre‐
123                sponding .RE.
124
125       .RE      End  relative margin indent and restores the previous value of
126                the prevailing indent.
127
128   Indented paragraph macros
129       .HP i    Begin paragraph with a hanging indent (the first line  of  the
130                paragraph  is at the left margin of normal paragraphs, and the
131                rest of the paragraph's lines are indented).
132
133       .IP x i  Indented paragraph with optional hanging tag.  If the tag x is
134                omitted,  the entire following paragraph is indented by i.  If
135                the tag x is provided, it is hung at the  left  margin  before
136                the following indented paragraph (this is just like .TP except
137                the tag is included with the command instead of being  on  the
138                following  line).   If the tag is too long, the text after the
139                tag will be moved down to the next line (text will not be lost
140                or  garbled).   For  bulleted  lists, use this macro with \(bu
141                (bullet) or \(em (em dash) as the tag, and for numbered lists,
142                use the number or letter followed by a period as the tag; this
143                simplifies translation to other formats.
144
145       .TP i    Begin paragraph with hanging tag.  The tag  is  given  on  the
146                next line, but its results are like those of the .IP command.
147
148   Hypertext link macros
149       .UR url
150              Insert  a  hypertext link to the URI (URL) url, with all text up
151              to the following .UE macro as the link text.
152
153       .UE [trailer]
154              Terminate the link text of the preceding .UR macro, with the op‐
155              tional trailer (if present, usually a closing parenthesis and/or
156              end-of-sentence punctuation) immediately  following.   For  non-
157              HTML  output  devices  (e.g., man -Tutf8), the link text is fol‐
158              lowed by the URL in angle brackets; if there is  no  link  text,
159              the  URL  is  printed  as its own link text, surrounded by angle
160              brackets.  (Angle brackets may not be available  on  all  output
161              devices.)   For  the HTML output device, the link text is hyper‐
162              linked to the URL; if there is no link text, the URL is  printed
163              as its own link text.
164
165       These  macros have been supported since GNU Troff 1.20 (2009-01-05) and
166       Heirloom Doctools Troff since 160217 (2016-02-17).
167
168   Miscellaneous macros
169       .DT      Reset tabs to default tab values (every 0.5 inches); does  not
170                cause a break.
171
172       .PD d    Set  inter-paragraph  vertical  distance  to  d  (if  omitted,
173                d=0.4v); does not cause a break.
174
175       .SS t    Subheading t (like .SH, but used for  a  subsection  inside  a
176                section).
177
178   Predefined strings
179       The man package has the following predefined strings:
180
181       \*R    Registration Symbol: ®
182
183       \*S    Change to default font size
184
185       \*(Tm  Trademark Symbol: ™
186
187       \*(lq  Left angled double quote: “
188
189       \*(rq  Right angled double quote: ”
190
191   Safe subset
192       Although  technically  man is a troff macro package, in reality a large
193       number of other tools process man page files that don't  implement  all
194       of  troff's  abilities.   Thus, it's best to avoid some of troff's more
195       exotic abilities where possible to permit these  other  tools  to  work
196       correctly.   Avoid  using the various troff preprocessors (if you must,
197       go ahead and use tbl(1), but try to use the IP and TP commands  instead
198       for  two-column  tables).   Avoid  using computations; most other tools
199       can't process them.  Use simple commands that are easy to translate  to
200       other  formats.   The  following  troff  macros are believed to be safe
201       (though in many cases they will be ignored by translators): \", .,  ad,
202       bp, br, ce, de, ds, el, ie, if, fi, ft, hy, ig, in, na, ne, nf, nh, ps,
203       so, sp, ti, tr.
204
205       You may also use many troff escape sequences (those sequences beginning
206       with  \).   When  you need to include the backslash character as normal
207       text, use \e.  Other sequences you may use, where x or xx are any char‐
208       acters and N is any digit, include: \', \`, \-, \., \", \%, \*x, \*(xx,
209       \(xx, \$N, \nx, \n(xx, \fx, and \f(xx.   Avoid  using  the  escape  se‐
210       quences for drawing graphics.
211
212       Do  not use the optional parameter for bp (break page).  Use only posi‐
213       tive values for sp (vertical space).  Don't define a  macro  (de)  with
214       the  same name as a macro in this or the mdoc macro package with a dif‐
215       ferent meaning; it's likely that such redefinitions  will  be  ignored.
216       Every  positive  indent  (in) should be paired with a matching negative
217       indent (although you should be using the RS  and  RE  macros  instead).
218       The  condition  test  (if,ie) should only have 't' or 'n' as the condi‐
219       tion.  Only translations (tr) that can be ignored should be used.  Font
220       changes  (ft and the \f escape sequence) should only have the values 1,
221       2, 3, 4, R, I, B, P, or CW (the ft command may  also  have  no  parame‐
222       ters).
223
224       If  you  use  capabilities beyond these, check the results carefully on
225       several tools.  Once you've confirmed that the additional capability is
226       safe,  let  the maintainer of this document know about the safe command
227       or sequence that should be added to this list.
228

FILES

230       /usr/share/groff/[*/]tmac/an.tmac
231       /usr/man/whatis
232

NOTES

234       By all means include full URLs (or URIs) in the text itself; some tools
235       such  as  man2html(1) can automatically turn them into hypertext links.
236       You can also use the UR and UE macros to identify links to related  in‐
237       formation.    If   you   include   URLs,   use   the  full  URL  (e.g.,
238http://www.kernel.org⟩) to ensure that tools  can  automatically  find
239       the URLs.
240
241       Tools processing these files should open the file and examine the first
242       nonwhitespace character.  A period (.) or single quote (') at  the  be‐
243       ginning  of  a line indicates a troff-based file (such as man or mdoc).
244       A left angle bracket (<) indicates an SGML/XML-based file (such as HTML
245       or  Docbook).   Anything else suggests simple ASCII text (e.g., a "cat‐
246       man" result).
247
248       Many man pages begin with '\" followed by a space and a list of charac‐
249       ters, indicating how the page is to be preprocessed.  For portability's
250       sake to non-troff translators we recommend that you  avoid  using  any‐
251       thing other than tbl(1), and Linux can detect that automatically.  How‐
252       ever, you might want to include this information so your man  page  can
253       be  handled  by other (less capable) systems.  Here are the definitions
254       of the preprocessors invoked by these characters:
255
256       e  eqn(1)
257
258       g  grap(1)
259
260       p  pic(1)
261
262       r  refer(1)
263
264       t  tbl(1)
265
266       v  vgrind(1)
267

BUGS

269       Most of the macros describe formatting (e.g., font  type  and  spacing)
270       instead  of marking semantic content (e.g., this text is a reference to
271       another page), compared to formats like mdoc and DocBook (even HTML has
272       more  semantic  markings).   This situation makes it harder to vary the
273       man format for different media, to make the formatting consistent for a
274       given media, and to automatically insert cross-references.  By sticking
275       to the safe subset described above, it should  be  easier  to  automate
276       transitioning to a different reference page format in the future.
277
278       The Sun macro TX is not implemented.
279

SEE ALSO

281       apropos(1),   groff(1),  lexgrog(1),  man(1),  man2html(1),  whatis(1),
282       groff_man(7), groff_www(7), man-pages(7), mdoc(7)
283

COLOPHON

285       This page is part of release 5.10 of the Linux  man-pages  project.   A
286       description  of  the project, information about reporting bugs, and the
287       latest    version    of    this    page,    can     be     found     at
288       https://www.kernel.org/doc/man-pages/.
289
290
291
292Linux                             2020-11-01                            MAN(7)
Impressum