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       groff -Tps -man file ...
11
12       man [section] title
13

DESCRIPTION

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

FILES

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

NOTES

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

BUGS

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

SEE ALSO

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

COLOPHON

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