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
21       release, 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.   All  of  the arguments will be printed next to each
93       other without intervening spaces, so that the .BR command can  be  used
94       to  specify  a word in bold followed by a mark of punctuation in Roman.
95       If no arguments are given, the command is applied to the following line
96       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
105       indent  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] Terminate the link text of the  preceding  .UR  macro,
154              with  the optional trailer (if present, usually a closing paren‐
155              thesis and/or end-of-sentence punctuation)  immediately  follow‐
156              ing.   For  non-HTML output devices (e.g., man -Tutf8), the link
157              text is followed by the URL in angle brackets; if  there  is  no
158              link  text,  the URL is printed as its own link text, surrounded
159              by angle brackets.  (Angle brackets may not be available on  all
160              output  devices.)   For the HTML output device, the link text is
161              hyperlinked to the URL; if there is no link  text,  the  URL  is
162              printed 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
209       sequences 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
236       information.    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
242       beginning 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), mdoc.samples(7)
282

COLOPHON

284       This page is part of release 4.15 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                             2017-09-15                            MAN(7)
Impressum