]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/man.7
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man7 / man.7
CommitLineData
fea681da
MK
1.\" (C) Copyright 1992-1999 Rickard E. Faith and David A. Wheeler
2.\" (faith@cs.unc.edu and dwheeler@ida.org)
3.\"
5fbde956 4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
5.\"
6.\" Modified Sun Jul 25 11:06:05 1993 by Rik Faith (faith@cs.unc.edu)
7.\" Modified Sat Jun 8 00:39:52 1996 by aeb
8.\" Modified Wed Jun 16 23:00:00 1999 by David A. Wheeler (dwheeler@ida.org)
9.\" Modified Thu Jul 15 12:43:28 1999 by aeb
fea681da
MK
10.\" Modified Sun Jan 6 18:26:25 2002 by Martin Schulze <joey@infodrom.org>
11.\" Modified Tue Jul 27 20:12:02 2004 by Colin Watson <cjwatson@debian.org>
a5e87f42 12.\" 2007-05-30, mtk: various rewrites and moved much text to new man-pages.7.
fea681da 13.\"
4c1c5274 14.TH man 7 (date) "Linux man-pages (unreleased)"
fea681da
MK
15.SH NAME
16man \- macros to format man pages
17.SH SYNOPSIS
18.B groff \-Tascii \-man
19.I file
20\&...
511bb71b 21.br
fea681da
MK
22.B groff \-Tps \-man
23.I file
24\&...
dd3568a1 25.PP
fea681da
MK
26.B man
27.RI [ section ]
28.I title
29.SH DESCRIPTION
30This manual page explains the
add00eab 31.B "groff an.tmac"
fea681da
MK
32macro package (often called the
33.B man
e7cbacd4 34macro package).
fea681da 35This macro package should be used by developers when
c13182ef
MK
36writing or porting man pages for Linux.
37It is fairly compatible with other
fea681da
MK
38versions of this macro package, so porting man pages should not be a major
39problem (exceptions include the NET-2 BSD release, which uses a totally
40different macro package called mdoc; see
41.BR mdoc (7)).
42.PP
43Note that NET-2 BSD mdoc man pages can be used with
44.B groff
45simply by specifying the
46.B \-mdoc
47option instead of the
48.B \-man
c13182ef
MK
49option.
50Using the
fea681da
MK
51.B \-mandoc
52option is, however, recommended, since this will automatically detect which
53macro package is in use.
e7cbacd4
MK
54.PP
55For conventions that should be employed when writing man pages
56for the Linux \fIman-pages\fP package, see
28a4c58c 57.BR man\-pages (7).
e7cbacd4 58.SS Title line
988db661 59The first command in a man page (after comment lines,
d1a71985 60that is, lines that start with \fB.\e"\fP) should be
6545cc56 61.PP
fea681da 62.RS
fea681da 63.B \&.TH
0daa9e92 64.I "title section date source manual"
fea681da 65.RE
6545cc56 66.PP
aeb9b6a6
MK
67For details of the arguments that should be supplied to the
68.B TH
e7cbacd4 69command, see
28a4c58c 70.BR man\-pages (7).
fea681da
MK
71.PP
72Note that BSD mdoc-formatted pages begin with the
73.B Dd
74command, not the
75.B TH
76command.
e6b9359d 77.SS Sections
fea681da
MK
78Sections are started with
79.B \&.SH
c13182ef 80followed by the heading name.
e6b9359d 81.\" The following doesn't seem to be required (see Debian bug 411303),
dc936104
MK
82.\" If the name contains spaces and appears
83.\" on the same line as
84.\" .BR \&.SH ,
85.\" then place the heading in double quotes.
5711c04f 86.PP
226ae424 87The only mandatory heading is NAME, which should be the first section and
a1712680 88be followed on the next line by a one-line description of the program:
6545cc56 89.PP
fea681da 90.RS
fea681da
MK
91\&.SH NAME
92.br
d1a71985 93item \e- description
fea681da 94.RE
6545cc56 95.PP
fea681da 96It is extremely important that this format is followed, and that there is a
a1712680 97backslash before the single dash which follows the item name.
c13182ef 98This syntax is used by the
a1712680
MK
99.BR mandb (8)
100program to create a database of short descriptions for the
fea681da
MK
101.BR whatis (1)
102and
103.BR apropos (1)
104commands.
a1712680
MK
105(See
106.BR lexgrog (1)
107for further details on the syntax of the NAME section.)
fea681da 108.PP
e7cbacd4 109For a list of other sections that might appear in a manual page, see
28a4c58c 110.BR man\-pages (7).
e6b9359d 111.SS Fonts
fea681da
MK
112The commands to select the type face are:
113.TP 4
114.B \&.B
115Bold
116.TP
117.B \&.BI
118Bold alternating with italics
119(especially useful for function specifications)
120.TP
121.B \&.BR
122Bold alternating with Roman
123(especially useful for referring to other
124manual pages)
125.TP
126.B \&.I
127Italics
128.TP
129.B \&.IB
130Italics alternating with bold
131.TP
132.B \&.IR
133Italics alternating with Roman
134.TP
135.B \&.RB
136Roman alternating with bold
137.TP
138.B \&.RI
139Roman alternating with italics
140.TP
141.B \&.SB
142Small alternating with bold
143.TP
144.B \&.SM
145Small (useful for acronyms)
dd3568a1 146.PP
fea681da
MK
147Traditionally, each command can have up to six arguments, but the GNU
148implementation removes this limitation (you might still want to limit
149yourself to 6 arguments for portability's sake).
c13182ef
MK
150Arguments are delimited by spaces.
151Double quotes can be used to specify an argument which contains spaces.
2f9b9e5a
MK
152For the macros that produce alternating type faces,
153the arguments will be printed next to each other without
fea681da
MK
154intervening spaces, so that the
155.B \&.BR
156command can be used to specify a word in bold followed by a mark of
157punctuation in Roman.
158If no arguments are given, the command is applied to the following line
159of text.
73d8cece 160.SS Other macros and strings
fea681da
MK
161Below are other relevant macros and predefined strings.
162Unless noted otherwise, all macros
163cause a break (end the current line of text).
2775c777 164Many of these macros set or use the "prevailing indent".
fea681da
MK
165The "prevailing indent" value is set by any macro with the parameter
166.I i
167below;
168macros may omit
169.I i
170in which case the current prevailing indent will be used.
171As a result, successive indented paragraphs can use the same indent without
3b777aff 172respecifying the indent value.
24b74457 173A normal (nonindented) paragraph resets the prevailing indent value
fea681da 174to its default value (0.5 inches).
f34cce68 175By default, a given indent is measured in ens;
75fa8557 176try to use ens or ems as units for
fea681da
MK
177indents, since these will automatically adjust to font size changes.
178The other key macro definitions are:
73d8cece 179.SS Normal paragraphs
fea681da
MK
180.TP 9m
181.B \&.LP
182Same as
183.B \&.PP
184(begin a new paragraph).
185.TP
186.B \&.P
187Same as
188.B \&.PP
189(begin a new paragraph).
190.TP
191.B \&.PP
192Begin a new paragraph and reset prevailing indent.
73d8cece 193.SS Relative margin indent
fea681da
MK
194.TP 9m
195.BI \&.RS " i"
4d9b6984 196Start relative margin indent: moves the left margin
fea681da
MK
197.I i
198to the right (if
199.I i
200is omitted, the prevailing indent value is used).
201A new prevailing indent is set to 0.5 inches.
202As a result, all following paragraph(s) will be
203indented until the corresponding
204.BR \&.RE .
205.TP
206.B \&.RE
207End relative margin indent and
208restores the previous value of the prevailing indent.
73d8cece 209.SS Indented paragraph macros
fea681da
MK
210.TP 9m
211.BI \&.HP " i"
212Begin paragraph with a hanging indent
213(the first line of the paragraph is at the left margin of
214normal paragraphs, and the rest of the paragraph's lines are indented).
215.TP
216.BI \&.IP " x i"
217Indented paragraph with optional hanging tag.
218If the tag
219.I x
220is omitted, the entire following paragraph is indented by
221.IR i .
222If the tag
223.I x
224is provided, it is hung at the left margin
225before the following indented paragraph
226(this is just like
0daa9e92 227.B \&.TP
fea681da
MK
228except the tag is included with the command instead of being on the
229following line).
230If the tag is too long, the text after the tag will be moved down to the
231next line (text will not be lost or garbled).
31a6818e 232For bulleted lists, use this macro with \e(bu (bullet) or \e(em (em dash)
fea681da
MK
233as the tag, and for numbered lists, use the number or letter followed by
234a period as the tag;
235this simplifies translation to other formats.
236.TP
237.BI \&.TP " i"
c13182ef
MK
238Begin paragraph with hanging tag.
239The tag is given on the next line, but
fea681da
MK
240its results are like those of the
241.B \&.IP
242command.
73d8cece 243.SS Hypertext link macros
fea681da 244.TP
e043552f
BR
245.BI \&.UR " url"
246Insert a hypertext link to the URI (URL)
247.IR url ,
248with all text up to the following
249.B \&.UE
250macro as the link text.
dd1b9170 251.TP
e043552f
BR
252.B \&.UE \c
253.RI [ trailer ]
254Terminate the link text of the preceding
255.B \&.UR
256macro, with the optional
257.I trailer
258(if present, usually a closing parenthesis and/or end-of-sentence
259punctuation) immediately following.
260For non-HTML output devices (e.g.,
fb6d2c09 261.BR "man \-Tutf8" ),
e043552f
BR
262the link text is followed by the URL in angle brackets; if there is no
263link text, the URL is printed as its own link text, surrounded by angle
264brackets.
265(Angle brackets may not be available on all output devices.)
266For the HTML output device, the link text is hyperlinked to the URL; if
267there is no link text, the URL is printed as its own link text.
fea681da 268.PP
e043552f
BR
269These macros have been supported since GNU Troff 1.20 (2009-01-05) and
270Heirloom Doctools Troff since 160217 (2016-02-17).
73d8cece 271.SS Miscellaneous macros
fea681da
MK
272.TP 9m
273.B \&.DT
274Reset tabs to default tab values (every 0.5 inches);
275does not cause a break.
276.TP
277.BI \&.PD " d"
278Set inter-paragraph vertical distance to d
279(if omitted, d=0.4v);
280does not cause a break.
281.TP
282.BI \&.SS " t"
283Subheading
284.I t
285(like
286.BR \&.SH ,
287but used for a subsection inside a section).
73d8cece 288.SS Predefined strings
fea681da
MK
289The
290.B man
291package has the following predefined strings:
4279e42d
AC
292.TP
293\e*R
fea681da 294Registration Symbol: \*R
4279e42d
AC
295.TP
296\e*S
fea681da 297Change to default font size
4279e42d
AC
298.TP
299\e*(Tm
fea681da 300Trademark Symbol: \*(Tm
4279e42d
AC
301.TP
302\e*(lq
eb1af896 303Left angled double quote: \*(lq
4279e42d
AC
304.TP
305\e*(rq
eb1af896 306Right angled double quote: \*(rq
73d8cece 307.SS Safe subset
fea681da
MK
308Although technically
309.B man
310is a troff macro package, in reality a large number of other tools
311process man page files that don't implement all of troff's abilities.
91749c0c
MK
312Thus, it's best to avoid some of troff's more exotic abilities
313where possible to permit these other tools to work correctly.
fea681da
MK
314Avoid using the various troff preprocessors
315(if you must, go ahead and use
316.BR tbl (1),
317but try to use the
318.B IP
c13182ef 319and
fea681da
MK
320.B TP
321commands instead for two-column tables).
322Avoid using computations; most other tools can't process them.
323Use simple commands that are easy to translate to other formats.
324The following troff macros are believed to be safe (though in many cases
325they will be ignored by translators):
31a6818e 326.BR \e" ,
fea681da
MK
327.BR . ,
328.BR ad ,
329.BR bp ,
330.BR br ,
331.BR ce ,
332.BR de ,
333.BR ds ,
334.BR el ,
335.BR ie ,
336.BR if ,
337.BR fi ,
338.BR ft ,
339.BR hy ,
340.BR ig ,
341.BR in ,
342.BR na ,
343.BR ne ,
344.BR nf ,
345.BR nh ,
346.BR ps ,
347.BR so ,
348.BR sp ,
349.BR ti ,
350.BR tr .
351.PP
352You may also use many troff escape sequences (those sequences beginning
31a6818e 353with \e).
fea681da 354When you need to include the backslash character as normal text,
31a6818e 355use \ee.
fea681da
MK
356Other sequences you may use, where x or xx are any characters and N
357is any digit, include:
6f25f547
JW
358.BR \e\(aq ,
359.BR \e\(ga ,
31a6818e
MK
360.BR \e- ,
361.BR \e. ,
362.BR \e" ,
363.BR \e% ,
364.BR \e*x ,
365.BR \e*(xx ,
366.BR \e(xx ,
367.BR \e$N ,
368.BR \enx ,
369.BR \en(xx ,
370.BR \efx ,
fea681da 371and
31a6818e 372.BR \ef(xx .
fea681da
MK
373Avoid using the escape sequences for drawing graphics.
374.PP
375Do not use the optional parameter for
376.B bp
377(break page).
378Use only positive values for
379.B sp
380(vertical space).
381Don't define a macro
382.RB ( de )
383with the same name as a macro in this or the
384mdoc macro package with a different meaning; it's likely that
385such redefinitions will be ignored.
386Every positive indent
387.RB ( in )
388should be paired with a matching negative indent
389(although you should be using the
390.B RS
391and
392.B RE
393macros instead).
394The condition test
395.RB ( if,ie )
9708eb37 396should only have \(aqt\(aq or \(aqn\(aq as the condition.
c13182ef 397Only translations
fea681da
MK
398.RB ( tr )
399that can be ignored should be used.
400Font changes
401.RB ( ft
31a6818e 402and the \fB\ef\fP escape sequence)
fea681da
MK
403should only have the values 1, 2, 3, 4, R, I, B, P, or CW
404(the ft command may also have no parameters).
405.PP
406If you use capabilities beyond these, check the
407results carefully on several tools.
408Once you've confirmed that the additional capability is safe,
409let the maintainer of this
410document know about the safe command or sequence
411that should be added to this list.
2b2581ee 412.SH FILES
add00eab 413.IR /usr/share/groff/ [*/] tmac/an.tmac
2b2581ee
MK
414.br
415.I /usr/man/whatis
fea681da 416.SH NOTES
fea681da
MK
417By all means include full URLs (or URIs) in the text itself;
418some tools such as
419.BR man2html (1)
420can automatically turn them into hypertext links.
e043552f
BR
421You can also use the
422.B UR
423and
424.B UE
425macros to identify links to related information.
fea681da 426If you include URLs, use the full URL
608bf950 427(e.g.,
6ade226b 428.UR http://www.kernel.org
608bf950
SK
429.UE )
430to ensure that tools can automatically find the URLs.
fea681da
MK
431.PP
432Tools processing these files should open the file and examine the first
24b74457 433nonwhitespace character.
6f25f547 434A period (.) or single quote (\(aq) at the beginning
91749c0c 435of a line indicates a troff-based file (such as man or mdoc).
fea681da 436A left angle bracket (<) indicates an SGML/XML-based
c13182ef
MK
437file (such as HTML or Docbook).
438Anything else suggests simple ASCII
fea681da
MK
439text (e.g., a "catman" result).
440.PP
6f25f547 441Many man pages begin with \fB\(aq\e"\fP followed by a
91749c0c 442space and a list of characters,
fea681da 443indicating how the page is to be preprocessed.
91749c0c
MK
444For portability's sake to non-troff translators we recommend
445that you avoid using anything other than
fea681da
MK
446.BR tbl (1),
447and Linux can detect that automatically.
448However, you might want to include this information so your man page
449can be handled by other (less capable) systems.
450Here are the definitions of the preprocessors invoked by these characters:
451.TP 3
452.B e
453eqn(1)
454.TP
455.B g
456grap(1)
457.TP
458.B p
459pic(1)
460.TP
461.B r
462refer(1)
463.TP
464.B t
465tbl(1)
466.TP
467.B v
468vgrind(1)
fea681da 469.SH BUGS
fea681da
MK
470Most of the macros describe formatting (e.g., font type and spacing) instead
471of marking semantic content (e.g., this text is a reference to another page),
472compared to formats like mdoc and DocBook (even HTML has more semantic
473markings).
474This situation makes it harder to vary the
475.B man
476format for different media,
477to make the formatting consistent for a given media, and to automatically
478insert cross-references.
479By sticking to the safe subset described above, it should be easier to
480automate transitioning to a different reference page format in the future.
dd3568a1 481.PP
fea681da
MK
482The Sun macro
483.B TX
484is not implemented.
fd7f0a7f
MK
485.\" .SH AUTHORS
486.\" .IP \(em 3m
487.\" James Clark (jjc@jclark.com) wrote the implementation of the macro package.
488.\" .IP \(em
489.\" Rickard E. Faith (faith@cs.unc.edu) wrote the initial version of
490.\" this manual page.
491.\" .IP \(em
492.\" Jens Schweikhardt (schweikh@noc.fdn.de) wrote the Linux Man-Page Mini-HOWTO
493.\" (which influenced this manual page).
494.\" .IP \(em
495.\" David A. Wheeler (dwheeler@ida.org) heavily modified this
496.\" manual page, such as adding detailed information on sections and macros.
47297adb 497.SH SEE ALSO
fea681da
MK
498.BR apropos (1),
499.BR groff (1),
a1712680 500.BR lexgrog (1),
fea681da
MK
501.BR man (1),
502.BR man2html (1),
e7cbacd4 503.BR whatis (1),
d81dc982 504.BR groff_man (7),
fea681da 505.BR groff_www (7),
28a4c58c 506.BR man\-pages (7),
5f3523f8 507.BR mdoc (7)