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