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