1 .\" $Id: man.7,v 1.43 2009/11/02 06:22:45 kristaps Exp $
3 .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: November 2 2009 $
24 .Nd man language reference
30 language was historically used to format
32 manuals. This reference document describes its syntax, structure, and
39 to write your manuals.
48 document follows simple rules: lines beginning with the control
51 are parsed for macros. Other lines are interpreted within the scope of
53 .Bd -literal -offset indent
54 \&.SH Macro lines change control state.
55 Other lines are interpreted within the current state.
61 documents may contain only graphable 7-bit ASCII characters, the
62 space character, and the tabs character. All manuals must have
67 Blank lines are acceptable; where found, the output will assert a
73 escape is common in historical
75 documents; if encountered at the end of a word, it ensures that the
76 subsequent word isn't off-set by whitespace.
82 whether in a macro or free-form text line, is ignored to the end of
83 line. A macro line with only a control character and comment escape,
85 is also ignored. Macro lines with only a control charater and
86 optionally whitespace are stripped from input.
89 .Ss Special Characters
90 Special characters may occur in both macro and free-form lines.
91 Sequences begin with the escape character
93 followed by either an open-parenthesis
95 for two-character sequences; an open-bracket
97 for n-character sequences (terminated at a close-bracket
99 or a single one-character sequence. See
101 for a complete list. Examples include
110 Terms may be text-decorated using the
112 escape followed by an indicator: B (bold), I, (italic), or P and R
117 Unless specifically escaped, consecutive blocks of whitespace are pruned
118 from input. These are later re-added, if applicable, by a front-end
127 macro that requires a date. The form for this date is the ISO-8601
132 Many macros support scaled widths for their arguments, such as
133 stipulating a two-inch list indentation with the following:
134 .Bd -literal -offset indent
140 Many macros support scaled widths for their arguments, such as
141 stipulating a two-inch paragraph indentation with the following:
142 .Bd -literal -offset indent
147 The syntax for scaled widths is
148 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:]? ,
149 where a decimal must be preceded or proceeded by at least one digit.
150 Negative numbers, while accepted, are truncated to zero. The following
151 scaling units are accepted:
154 .Bl -tag -width Ds -offset indent -compact
167 default vertical span
179 default horizontal span
184 Using anything other than
190 is necessarily non-portable across output media. See
194 If a scaling unit is not provided, the numerical value is interpreted
195 under the default rules of
197 for vertical spaces and
203 which, if a unit is not provided, will instead interpret the string as
210 document must contain contains at least the
212 macro describing the document's section and title. It may occur
213 anywhere in the document, although conventionally, it appears as the
219 at least one macro or text node must appear in the document. Documents
220 are generally structured as follows:
221 .Bd -literal -offset indent
222 \&.TH FOO 1 2009-10-10
225 \efBfoo\efR \e(en a description goes here
226 \&.\e\*q The next is for sections 2 & 3 only.
230 \efBfoo\efR [\efB\e-options\efR] arguments...
233 The \efBfoo\efR utility processes files...
235 \&.\e\*q .SH IMPLEMENTATION NOTES
236 \&.\e\*q The next is for sections 1 & 8 only.
237 \&.\e\*q .SH EXIT STATUS
238 \&.\e\*q The next is for sections 2, 3, & 9 only.
239 \&.\e\*q .SH RETURN VALUES
240 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
241 \&.\e\*q .SH ENVIRONMENT
243 \&.\e\*q .SH EXAMPLES
244 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
245 \&.\e\*q .SH DIAGNOSTICS
246 \&.\e\*q The next is for sections 2, 3, & 9 only.
248 \&.\e\*q .SH SEE ALSO
249 \&.\e\*q .BR foo ( 1 )
250 \&.\e\*q .SH STANDARDS
255 \&.\e\*q .SH SECURITY CONSIDERATIONS
260 document are conventionally ordered as they appear above. Sections
261 should be composed as follows:
262 .Bl -ohang -offset indent
264 The name(s) and a short description of the documented material. The
265 syntax for this is generally as follows:
267 .D1 \efBname\efR \e(en description
269 The name of the library containing the documented material, which is
270 assumed to be a function in a section 2 or 3 manual. For functions in
271 the C library, this may be as follows:
273 .D1 Standard C Library (libc, -lc)
275 Documents the utility invocation syntax, function call syntax, or device
278 For the first, utilities (sections 1, 6, and 8), this is
279 generally structured as follows:
281 .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
283 For the second, function calls (sections 2, 3, 9):
285 .D1 \. Ns Sx \&B No char *name(char *\efIarg\efR);
287 And for the third, configurations (section 4):
289 .D1 \. Ns Sx \&B No name* at cardbus ? function ?
291 Manuals not in these sections generally don't need a
294 This expands upon the brief, one-line description in
296 It usually contains a break-down of the options (if documenting a
298 .It Em IMPLEMENTATION NOTES
299 Implementation-specific notes should be kept here. This is useful when
300 implementing standard functions that may have side effects or notable
301 algorithmic implications.
303 Command exit status for section 1, 6, and 8 manuals. This section is
306 which is used for functions. Historically, this information was
309 a practise that is now discouraged.
312 This section is the dual of
314 which is used for commands. It documents the return values of functions
315 in sections 2, 3, and 9.
318 Documents any usages of environment variables, e.g.,
322 Documents files used. It's helpful to document both the file and a
323 short description of how the file is used (created, modified, etc.).
326 Example usages. This often contains snippets of well-formed,
327 well-tested invocations. Make doubly sure that your examples work
328 properly! Assume that users will skip to this section and use your
332 Documents error conditions. This is most useful in section 4 manuals.
333 Historically, this section was used in place of
335 for manuals in sections 1, 6, and 8; however, this practise is
339 Documents error handling in sections 2, 3, and 9.
342 References other manuals with related topics. This section should exist
343 for most manuals. Cross-references should conventionally be ordered
344 first by section, then alphabetically.
346 .D1 \. Ns Sx \&BR No bar \&( 1 \&),
347 .D1 \. Ns Sx \&BR No foo \&( 1 \&),
348 .D1 \. Ns Sx \&BR No baz \&( 2 \&).
351 References any standards implemented or used, such as
353 .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
355 If not adhering to any standards, the
357 section should be used.
360 The history of any manual without a
362 section should be described in this section.
365 Credits to authors, if applicable, should appear in this section.
366 Authors should generally be noted by both name and an e-mail address.
369 Explanations of common misuses and misunderstandings should be explained
373 Extant bugs should be described in this section.
375 .It Em SECURITY CONSIDERATIONS
376 Documents any security precautions that operators should consider.
382 Macros are one to three three characters in length and begin with a
385 at the beginning of the line. An arbitrary amount of whitespace may
386 sit between the control character and the macro name. Thus, the
387 following are equivalent:
388 .Bd -literal -offset indent
396 macros are classified by scope: line scope or block scope. Line
397 macros are only scoped to the current line (and, in some situations,
398 the subsequent line). Block macros are scoped to the current line and
399 subsequent lines until closed by another block macro.
403 Line macros are generally scoped to the current line, with the body
404 consisting of zero or more arguments. If a macro is scoped to the next
405 line and the line arguments are empty, the next line is used instead,
406 else the general syntax is used. Thus:
407 .Bd -literal -offset indent
415 If next-line macros are invoked consecutively, only the last is used.
416 If a next-line macro is proceded by a block macro, it is ignored.
417 .Bd -literal -offset indent
418 \&.YO \(lBbody...\(rB
423 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX"
424 .It Em Macro Ta Em Arguments Ta Em Scope
425 .It Sx \&B Ta n Ta next-line
426 .It Sx \&BI Ta n Ta current
427 .It Sx \&BR Ta n Ta current
428 .It Sx \&DT Ta 0 Ta current
429 .It Sx \&I Ta n Ta next-line
430 .It Sx \&IB Ta n Ta current
431 .It Sx \&IR Ta n Ta current
432 .It Sx \&PD Ta n Ta current
433 .It Sx \&R Ta n Ta next-line
434 .It Sx \&RB Ta n Ta current
435 .It Sx \&RI Ta n Ta current
436 .It Sx \&SB Ta n Ta next-line
437 .It Sx \&SM Ta n Ta next-line
438 .It Sx \&TH Ta >1, <6 Ta current
439 .It Sx \&UC Ta n Ta current
440 .It Sx \&br Ta 0 Ta current
441 .It Sx \&fi Ta 0 Ta current
442 .It Sx \&i Ta n Ta current
443 .It Sx \&na Ta 0 Ta current
444 .It Sx \&nf Ta 0 Ta current
445 .It Sx \&r Ta 0 Ta current
446 .It Sx \&sp Ta 1 Ta current
463 macros should not be used. They're included for compatibility.
467 Block macros are comprised of a head and body. Like for in-line macros,
468 the head is scoped to the current line and, in one circumstance, the
469 next line; the body is scoped to subsequent lines and is closed out by a
470 subsequent block macro invocation.
471 .Bd -literal -offset indent
472 \&.YO \(lBhead...\(rB
478 The closure of body scope may be to the section, where a macro is closed
481 sub-section, closed by a section or
483 part, closed by a section, sub-section, or
485 or paragraph, closed by a section, sub-section, part,
493 No closure refers to an explicit block closing macro.
496 .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" -compact -offset indent
497 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope
498 .It Sx \&HP Ta <2 Ta current Ta paragraph
499 .It Sx \&IP Ta <3 Ta current Ta paragraph
500 .It Sx \&LP Ta 0 Ta current Ta paragraph
501 .It Sx \&P Ta 0 Ta current Ta paragraph
502 .It Sx \&PP Ta 0 Ta current Ta paragraph
503 .It Sx \&RE Ta 0 Ta current Ta none
504 .It Sx \&RS Ta 1 Ta current Ta part
505 .It Sx \&SH Ta >0 Ta next-line Ta section
506 .It Sx \&SS Ta >0 Ta next-line Ta sub-section
507 .It Sx \&TP Ta n Ta next-line Ta paragraph
511 If a block macro is next-line scoped, it may only be followed by in-line
526 This section is a canonical reference to all macros, arranged
527 alphabetically. For the scoping of individual macros, see
531 Text is rendered in bold face.
533 Text is rendered alternately in bold face and italic. Thus,
534 .Sq .BI this word and that
539 to render in bold face, while
543 render in italics. Whitespace between arguments is omitted in output.
545 Text is rendered alternately in bold face and roman (the default font).
546 Whitespace between arguments is omitted in output.
548 Has no effect. Included for compatibility.
550 Begin a paragraph whose initial output line is left-justified, but
551 subsequent output lines are indented, with the following syntax:
552 .Bd -literal -offset indent
559 is specified, it's saved for later paragraph left-margins; if
560 unspecified, the saved or default width is used.
562 Text is rendered in italics.
564 Text is rendered alternately in italics and bold face. Whitespace
565 between arguments is omitted in output.
567 Begin a paragraph with the following syntax:
568 .Bd -literal -offset indent
573 This follows the behaviour of the
575 except for the macro syntax (all arguments on the line, instead of
576 having next-line scope). If
578 is specified, it's saved for later paragraph left-margins; if
579 unspecified, the saved or default width is used.
581 Text is rendered alternately in italics and roman (the default font).
582 Whitespace between arguments is omitted in output.
584 Begin an undecorated paragraph. The scope of a paragraph is closed by a
585 subsequent paragraph, sub-section, section, or end of file. The saved
586 paragraph left-margin width is re-set to the default.
594 Text is rendered in roman (the default font).
596 Text is rendered alternately in roman (the default font) and bold face.
597 Whitespace between arguments is omitted in output.
599 Explicitly close out the scope of a prior
602 Text is rendered alternately in roman (the default font) and italics.
603 Whitespace between arguments is omitted in output.
605 Begin a part setting the left margin. The left margin controls the
606 offset, following an initial indentation, to un-indented text such as
609 A scaling width may be specified as following:
610 .Bd -literal -offset indent
617 is not specified, the saved or default width is used.
619 Text is rendered in small size (one point smaller than the default font)
622 Begin a section. The scope of a section is only closed by another
623 section or the end of file. The paragraph left-margin width is re-set
626 Text is rendered in small size (one point smaller than the default
629 Begin a sub-section. The scope of a sub-section is closed by a
630 subsequent sub-section, section, or end of file. The paragraph
631 left-margin width is re-set to the default.
633 Sets the title of the manual page with the following syntax:
635 .D1 \. Ns Sx \&TH No Cm title msec Op Cm date Op Cm src Op Cm vol
637 At least the upper-case document title
639 and numeric manual section
641 arguments must be provided. The
643 argument should be formatted as described in
645 if it does not conform, the current date is used instead. The
647 string specifies the organisation providing the utility. The
649 string replaces the default rendered volume, which is dictated by the
653 .Bd -literal -offset indent
654 \&.TH CVS 5 "1992-02-12" GNU
658 Begin a paragraph where the head, if exceeding the indentation width, is
659 followed by a newline; if not, the body follows on the same line after a
660 buffer to the indentation width. Subsequent output lines are indented.
663 The indentation scaling width may be set as follows:
664 .Bd -literal -offset indent
671 is specified, it's saved for later paragraph left-margins; if
672 unspecified, the saved or default width is used.
674 Has no effect. Included for compatibility.
676 Has no effect. Included for compatibility.
678 Breaks the current line. Consecutive invocations have no further effect.
680 End literal mode begun by
683 Italicise arguments. If no arguments are specified, all subsequent text
686 Don't align to the right margin.
688 Begin literal mode: all subsequent free-form lines have their end of
689 line boundaries preserved. May be ended by
692 Fonts and styles (bold face, italics) reset to roman (default font).
694 Insert n spaces, where n is the macro's positive numeric argument. If
695 0, this is equivalent to the
701 This section documents compatibility with other roff implementations, at
706 In quoted literals, groff allowed pair-wise double-quotes to produce a
707 standalone double-quote in formatted output. This idiosyncratic
708 behaviour is no longer applicable.
712 macro does not accept negative numbers.
714 Blocks of whitespace are stripped from both macro and free-form text
715 lines (except when in literal mode), while groff would retain whitespace
716 in free-form text lines.
728 reference was written by
729 .An Kristaps Dzonsons Aq kristaps@kth.se .
733 Do not use this language. Use