1 .\" $Id: man.7,v 1.47 2009/11/05 08:40:16 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 5 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 character 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), R (Roman), or P
113 (revert to previous mode). A numerical representation 3, 2, or 1
114 (bold, italic, and Roman, respectively) may be used instead.
118 Unless specifically escaped, consecutive blocks of whitespace are pruned
119 from input. These are later re-added, if applicable, by a front-end
129 macro that requires a date. The form for this date is the ISO-8601
135 Many macros support scaled widths for their arguments, such as
136 stipulating a two-inch paragraph indentation with the following:
137 .Bd -literal -offset indent
142 The syntax for scaled widths is
143 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:]? ,
144 where a decimal must be preceded or proceeded by at least one digit.
145 Negative numbers, while accepted, are truncated to zero. The following
146 scaling units are accepted:
149 .Bl -tag -width Ds -offset indent -compact
162 default vertical span
174 default horizontal span
179 Using anything other than
185 is necessarily non-portable across output media.
188 If a scaling unit is not provided, the numerical value is interpreted
189 under the default rules of
191 for vertical spaces and
197 which, if a unit is not provided, will instead interpret the string as
204 document must contain contains at least the
206 macro describing the document's section and title. It may occur
207 anywhere in the document, although conventionally, it appears as the
213 at least one macro or text node must appear in the document. Documents
214 are generally structured as follows:
215 .Bd -literal -offset indent
216 \&.TH FOO 1 2009-10-10
219 \efBfoo\efR \e(en a description goes here
220 \&.\e\*q The next is for sections 2 & 3 only.
224 \efBfoo\efR [\efB\e-options\efR] arguments...
227 The \efBfoo\efR utility processes files...
229 \&.\e\*q .SH IMPLEMENTATION NOTES
230 \&.\e\*q The next is for sections 1 & 8 only.
231 \&.\e\*q .SH EXIT STATUS
232 \&.\e\*q The next is for sections 2, 3, & 9 only.
233 \&.\e\*q .SH RETURN VALUES
234 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
235 \&.\e\*q .SH ENVIRONMENT
237 \&.\e\*q .SH EXAMPLES
238 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
239 \&.\e\*q .SH DIAGNOSTICS
240 \&.\e\*q The next is for sections 2, 3, & 9 only.
242 \&.\e\*q .SH SEE ALSO
243 \&.\e\*q .BR foo ( 1 )
244 \&.\e\*q .SH STANDARDS
249 \&.\e\*q .SH SECURITY CONSIDERATIONS
254 document are conventionally ordered as they appear above. Sections
255 should be composed as follows:
256 .Bl -ohang -offset indent
258 The name(s) and a short description of the documented material. The
259 syntax for this is generally as follows:
261 .D1 \efBname\efR \e(en description
263 The name of the library containing the documented material, which is
264 assumed to be a function in a section 2 or 3 manual. For functions in
265 the C library, this may be as follows:
267 .D1 Standard C Library (libc, -lc)
269 Documents the utility invocation syntax, function call syntax, or device
272 For the first, utilities (sections 1, 6, and 8), this is
273 generally structured as follows:
275 .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
277 For the second, function calls (sections 2, 3, 9):
279 .D1 \&.B char *name(char *\efIarg\efR);
281 And for the third, configurations (section 4):
283 .D1 \&.B name* at cardbus ? function ?
285 Manuals not in these sections generally don't need a
288 This expands upon the brief, one-line description in
290 It usually contains a break-down of the options (if documenting a
292 .It Em IMPLEMENTATION NOTES
293 Implementation-specific notes should be kept here. This is useful when
294 implementing standard functions that may have side effects or notable
295 algorithmic implications.
297 Command exit status for section 1, 6, and 8 manuals. This section is
300 which is used for functions. Historically, this information was
303 a practise that is now discouraged.
306 This section is the dual of
308 which is used for commands. It documents the return values of functions
309 in sections 2, 3, and 9.
312 Documents any usages of environment variables, e.g.,
316 Documents files used. It's helpful to document both the file and a
317 short description of how the file is used (created, modified, etc.).
320 Example usages. This often contains snippets of well-formed,
321 well-tested invocations. Make doubly sure that your examples work
325 Documents error conditions. This is most useful in section 4 manuals.
326 Historically, this section was used in place of
328 for manuals in sections 1, 6, and 8; however, this practise is
332 Documents error handling in sections 2, 3, and 9.
335 References other manuals with related topics. This section should exist
338 .D1 \&.BR bar \&( 1 \&),
340 Cross-references should conventionally be ordered
341 first by section, then alphabetically.
344 References any standards implemented or used, such as
346 .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
348 If not adhering to any standards, the
350 section should be used.
353 The history of any manual without a
355 section should be described in this section.
358 Credits to authors, if applicable, should appear in this section.
359 Authors should generally be noted by both name and an e-mail address.
362 Explanations of common misuses and misunderstandings should be explained
366 Extant bugs should be described in this section.
368 .It Em SECURITY CONSIDERATIONS
369 Documents any security precautions that operators should consider.
375 Macros are one to three three characters in length and begin with a
378 at the beginning of the line. An arbitrary amount of whitespace may
379 sit between the control character and the macro name. Thus, the
380 following are equivalent:
381 .Bd -literal -offset indent
389 macros are classified by scope: line scope or block scope. Line
390 macros are only scoped to the current line (and, in some situations,
391 the subsequent line). Block macros are scoped to the current line and
392 subsequent lines until closed by another block macro.
396 Line macros are generally scoped to the current line, with the body
397 consisting of zero or more arguments. If a macro is scoped to the next
398 line and the line arguments are empty, the next line is used instead,
399 else the general syntax is used. Thus:
400 .Bd -literal -offset indent
408 If next-line macros are invoked consecutively, only the last is used; in
409 other words, if a next-line macro is preceded by a block macro, it is
411 .Bd -literal -offset indent
412 \&.YO \(lBbody...\(rB
417 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX"
418 .It Em Macro Ta Em Arguments Ta Em Scope
419 .It Sx \&B Ta n Ta next-line
420 .It Sx \&BI Ta n Ta current
421 .It Sx \&BR Ta n Ta current
422 .It Sx \&DT Ta 0 Ta current
423 .It Sx \&I Ta n Ta next-line
424 .It Sx \&IB Ta n Ta current
425 .It Sx \&IR Ta n Ta current
426 .It Sx \&PD Ta n Ta current
427 .It Sx \&R Ta n Ta next-line
428 .It Sx \&RB Ta n Ta current
429 .It Sx \&RI Ta n Ta current
430 .It Sx \&SB Ta n Ta next-line
431 .It Sx \&SM Ta n Ta next-line
432 .It Sx \&TH Ta >1, <6 Ta current
433 .It Sx \&UC Ta n Ta current
434 .It Sx \&br Ta 0 Ta current
435 .It Sx \&fi Ta 0 Ta current
436 .It Sx \&i Ta n Ta current
437 .It Sx \&na Ta 0 Ta current
438 .It Sx \&nf Ta 0 Ta current
439 .It Sx \&r Ta 0 Ta current
440 .It Sx \&sp Ta 1 Ta current
457 macros should not be used. They're included for compatibility.
461 Block macros are comprised of a head and body. Like for in-line macros,
462 the head is scoped to the current line and, in one circumstance, the
463 next line; the body is scoped to subsequent lines and is closed out by a
464 subsequent block macro invocation.
465 .Bd -literal -offset indent
466 \&.YO \(lBhead...\(rB
472 The closure of body scope may be to the section, where a macro is closed
475 sub-section, closed by a section or
477 part, closed by a section, sub-section, or
479 or paragraph, closed by a section, sub-section, part,
487 No closure refers to an explicit block closing macro.
490 .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" -compact -offset indent
491 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope
492 .It Sx \&HP Ta <2 Ta current Ta paragraph
493 .It Sx \&IP Ta <3 Ta current Ta paragraph
494 .It Sx \&LP Ta 0 Ta current Ta paragraph
495 .It Sx \&P Ta 0 Ta current Ta paragraph
496 .It Sx \&PP Ta 0 Ta current Ta paragraph
497 .It Sx \&RE Ta 0 Ta current Ta none
498 .It Sx \&RS Ta 1 Ta current Ta part
499 .It Sx \&SH Ta >0 Ta next-line Ta section
500 .It Sx \&SS Ta >0 Ta next-line Ta sub-section
501 .It Sx \&TP Ta n Ta next-line Ta paragraph
505 If a block macro is next-line scoped, it may only be followed by in-line
520 This section is a canonical reference to all macros, arranged
521 alphabetically. For the scoping of individual macros, see
526 Text is rendered in bold face.
538 Text is rendered alternately in bold face and italic. Thus,
539 .Sq .BI this word and that
544 to render in bold face, while
548 render in italics. Whitespace between arguments is omitted in output.
552 .D1 \&.BI bold italic bold italic
554 The output of this example will be emboldened
558 with spaces stripped between arguments.
570 Text is rendered alternately in bold face and roman (the default font).
571 Whitespace between arguments is omitted in output.
575 for an equivalent example.
587 Has no effect. Included for compatibility.
591 Begin a paragraph whose initial output line is left-justified, but
592 subsequent output lines are indented, with the following syntax:
593 .Bd -filled -offset indent
600 argument must conform to
602 If specified, it's saved for later paragraph left-margins; if unspecified, the
603 saved or default width is used.
615 Text is rendered in italics.
627 Text is rendered alternately in italics and bold face. Whitespace
628 between arguments is omitted in output.
632 for an equivalent example.
644 Begin an indented paragraph with the following syntax:
645 .Bd -filled -offset indent
647 .Op Cm head Op Cm width
652 argument defines the width of the left margin and is defined by
654 It's saved for later paragraph left-margins; if unspecified, the saved or
655 default width is used.
659 argument is used as a leading term, flushed to the left margin. This is
660 useful for bulleted paragraphs and so on.
672 Text is rendered alternately in italics and roman (the default font).
673 Whitespace between arguments is omitted in output.
677 for an equivalent example.
689 Begin an undecorated paragraph. The scope of a paragraph is closed by a
690 subsequent paragraph, sub-section, section, or end of file. The saved
691 paragraph left-margin width is re-set to the default.
729 Text is rendered in roman (the default font).
741 Text is rendered alternately in roman (the default font) and bold face.
742 Whitespace between arguments is omitted in output.
746 for an equivalent example.
758 Explicitly close out the scope of a prior
763 Text is rendered alternately in roman (the default font) and italics.
764 Whitespace between arguments is omitted in output.
768 for an equivalent example.
780 Begin a part setting the left margin. The left margin controls the
781 offset, following an initial indentation, to un-indented text such as
784 This has the following syntax:
785 .Bd -filled -offset indent
792 argument must conform to
794 If not specified, the saved or default width is used.
798 Text is rendered in small size (one point smaller than the default font)
803 Begin a section. The scope of a section is only closed by another
804 section or the end of file. The paragraph left-margin width is re-set
809 Text is rendered in small size (one point smaller than the default
814 Begin a sub-section. The scope of a sub-section is closed by a
815 subsequent sub-section, section, or end of file. The paragraph
816 left-margin width is re-set to the default.
820 Sets the title of the manual page with the following syntax:
821 .Bd -filled -offset indent
824 .Op Cm date Op Cm source Op Cm volume
827 At least the upper-case document title
829 and numeric manual section
831 arguments must be provided. The
833 argument should be formatted as described in
835 if it does not conform, the current date is used instead. The
837 string specifies the organisation providing the utility. The
839 string replaces the default rendered volume, which is dictated by the
844 .D1 \&.TH CVS 5 "1992-02-12" GNU
848 Begin a paragraph where the head, if exceeding the indentation width, is
849 followed by a newline; if not, the body follows on the same line after a
850 buffer to the indentation width. Subsequent output lines are indented.
851 The syntax is as follows:
852 .Bd -filled -offset indent
859 argument must conform to
861 If specified, it's saved for later paragraph left-margins; if
862 unspecified, the saved or default width is used.
874 Has no effect. Included for compatibility.
878 Has no effect. Included for compatibility.
882 Breaks the current line. Consecutive invocations have no further effect.
889 End literal mode begun by
894 Italicise arguments. If no arguments are specified, all subsequent text
907 Don't align to the right margin.
911 Begin literal mode: all subsequent free-form lines have their end of
912 line boundaries preserved. May be ended by
917 Fonts and styles (bold face, italics) reset to roman (default font).
929 Insert vertical spaces into output with the following syntax:
930 .Bd -filled -offset indent
937 spaces, which must conform to
939 If 0, this is equivalent to the
941 macro. Defaults to 1, if unspecified.
948 This section documents compatibility with other roff implementations, at
953 In quoted literals, groff allowed pair-wise double-quotes to produce a
954 standalone double-quote in formatted output. This idiosyncratic
955 behaviour is no longer applicable.
959 macro does not accept negative numbers.
961 Blocks of whitespace are stripped from both macro and free-form text
962 lines (except when in literal mode), while groff would retain whitespace
963 in free-form text lines.
975 reference was written by
976 .An Kristaps Dzonsons Aq kristaps@kth.se .
980 Do not use this language. Use