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