1 .\" $Id: man.7,v 1.89 2010/09/26 19:46:48 schwarze Exp $
3 .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
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: September 26 2010 $
22 .Nd man language reference
26 language was historically used to format
29 This reference document describes its syntax, structure, and usage.
34 to write your manuals.
42 document follows simple rules: lines beginning with the control
45 are parsed for macros.
46 Other lines are interpreted within the scope of
48 .Bd -literal -offset indent
49 \&.SH Macro lines change control state.
50 Other lines are interpreted within the current state.
54 documents may contain only graphable 7-bit ASCII characters, the
55 space character, and the tab character.
60 Blank lines are acceptable; where found, the output will assert a
65 whether in a macro or free-form text line, is ignored to the end of
67 A macro line with only a control character and comment escape,
70 Macro lines with only a control character and optionally whitespace are
72 .Ss Special Characters
73 Special characters may occur in both macro and free-form lines.
74 Sequences begin with the escape character
76 followed by either an open-parenthesis
78 for two-character sequences; an open-bracket
80 for n-character sequences (terminated at a close-bracket
82 or a single one-character sequence.
93 Terms may be text-decorated using the
95 escape followed by an indicator: B (bold), I (italic), R (Roman), or P
96 (revert to previous mode):
98 .D1 \efBbold\efR \efIitalic\efP
100 A numerical representation 3, 2, or 1 (bold, italic, and Roman,
101 respectively) may be used instead.
102 A text decoration is only valid, if specified in free-form text, until
103 the next macro invocation; if specified within a macro, it's only valid
104 until the macro closes scope.
105 Note that macros like
107 open and close a font scope with each argument.
111 attribute is forgotten when entering or exiting a macro block.
113 Whitespace consists of the space character.
114 In free-form lines, whitespace is preserved within a line; unescaped
115 trailing spaces are stripped from input (unless in a literal context).
116 Blank free-form lines, which may include spaces, are permitted and
117 rendered as an empty line.
119 In macro lines, whitespace delimits arguments and is discarded.
120 If arguments are quoted, whitespace within the quotes is retained.
126 macro that requires a date.
127 The form for this date is the ISO-8601
131 Many macros support scaled widths for their arguments, such as
132 stipulating a two-inch paragraph indentation with the following:
133 .Bd -literal -offset indent
137 The syntax for scaled widths is
138 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:]? ,
139 where a decimal must be preceded or proceeded by at least one digit.
140 Negative numbers, while accepted, are truncated to zero.
141 The following scaling units are accepted:
143 .Bl -tag -width Ds -offset indent -compact
156 default vertical span
168 default horizontal span
173 Using anything other than
179 is necessarily non-portable across output media.
181 If a scaling unit is not provided, the numerical value is interpreted
182 under the default rules of
184 for vertical spaces and
190 which, if a unit is not provided, will instead interpret the string as
193 When composing a manual, make sure that sentences end at the end of
195 By doing so, front-ends will be able to apply the proper amount of
196 spacing after the end of sentence (unescaped) period, exclamation mark,
197 or question mark followed by zero or more non-sentence closing
208 document must contain the
210 macro describing the document's section and title.
211 It may occur anywhere in the document, although conventionally it
212 appears as the first macro.
216 at least one macro or text node must appear in the document.
217 Documents are generally structured as follows:
218 .Bd -literal -offset indent
219 \&.TH FOO 1 2009-10-10
221 \efBfoo\efR \e(en a description goes here
223 \&.\e\*q For sections 2 & 3 only.
224 \&.\e\*q Not used in OpenBSD.
226 \efBfoo\efR [\efB\e-options\efR] arguments...
228 The \efBfoo\efR utility processes files...
229 \&.\e\*q .SH IMPLEMENTATION NOTES
230 \&.\e\*q Not used in OpenBSD.
231 \&.\e\*q .SH RETURN VALUES
232 \&.\e\*q For sections 2, 3, & 9 only.
233 \&.\e\*q .SH ENVIRONMENT
234 \&.\e\*q For sections 1, 6, 7, & 8 only.
236 \&.\e\*q .SH EXIT STATUS
237 \&.\e\*q For sections 1, 6, & 8 only.
238 \&.\e\*q .SH EXAMPLES
239 \&.\e\*q .SH DIAGNOSTICS
240 \&.\e\*q For sections 1, 4, 6, 7, & 8 only.
242 \&.\e\*q For sections 2, 3, & 9 only.
243 \&.\e\*q .SH SEE ALSO
244 \&.\e\*q .BR foo ( 1 )
245 \&.\e\*q .SH STANDARDS
250 \&.\e\*q .SH SECURITY CONSIDERATIONS
251 \&.\e\*q Not used in OpenBSD.
256 document are conventionally ordered as they appear above.
257 Sections should be composed as follows:
258 .Bl -ohang -offset indent
260 The name(s) and a short description of the documented material.
261 The syntax for this is generally as follows:
263 .D1 \efBname\efR \e(en description
265 The name of the library containing the documented material, which is
266 assumed to be a function in a section 2 or 3 manual.
267 For functions in the C library, this may be as follows:
269 .D1 Standard C Library (libc, -lc)
271 Documents the utility invocation syntax, function call syntax, or device
274 For the first, utilities (sections 1, 6, and 8), this is
275 generally structured as follows:
277 .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
279 For the second, function calls (sections 2, 3, 9):
281 .D1 \&.B char *name(char *\efIarg\efR);
283 And for the third, configurations (section 4):
285 .D1 \&.B name* at cardbus ? function ?
287 Manuals not in these sections generally don't need a
290 This expands upon the brief, one-line description in
292 It usually contains a break-down of the options (if documenting a
294 .It Em IMPLEMENTATION NOTES
295 Implementation-specific notes should be kept here.
296 This is useful when implementing standard functions that may have side
297 effects or notable algorithmic implications.
299 This section documents the return values of functions in sections 2, 3, and 9.
301 Documents any usages of environment variables, e.g.,
304 Documents files used.
305 It's helpful to document both the file name and a short description of how
306 the file is used (created, modified, etc.).
308 This section documents the command exit status for
309 section 1, 6, and 8 utilities.
310 Historically, this information was described in
312 a practise that is now discouraged.
315 This often contains snippets of well-formed,
316 well-tested invocations.
317 Make sure that examples work properly!
319 Documents error conditions.
320 This is most useful in section 4 manuals.
321 Historically, this section was used in place of
323 for manuals in sections 1, 6, and 8; however, this practise is
326 Documents error handling in sections 2, 3, and 9.
328 References other manuals with related topics.
329 This section should exist for most manuals.
331 .D1 \&.BR bar \&( 1 \&),
333 Cross-references should conventionally be ordered
334 first by section, then alphabetically.
336 References any standards implemented or used, such as
338 .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
340 If not adhering to any standards, the
342 section should be used.
344 A brief history of the subject, including where support first appeared.
346 Credits to the person or persons who wrote the code and/or documentation.
347 Authors should generally be noted by both name and email address.
349 Common misuses and misunderstandings should be explained
352 Known bugs, limitations, and work-arounds should be described
354 .It Em SECURITY CONSIDERATIONS
355 Documents any security precautions that operators should consider.
358 Macros are one to three characters in length and begin with a
361 at the beginning of the line.
364 macro control character is also accepted.
365 An arbitrary amount of whitespace (spaces or tabs) may sit between the
366 control character and the macro name.
367 Thus, the following are equivalent:
368 .Bd -literal -offset indent
375 macros are classified by scope: line scope or block scope.
376 Line macros are only scoped to the current line (and, in some
377 situations, the subsequent line).
378 Block macros are scoped to the current line and subsequent lines until
379 closed by another block macro.
381 Line macros are generally scoped to the current line, with the body
382 consisting of zero or more arguments.
383 If a macro is scoped to the next line and the line arguments are empty,
384 the next line, which must be text, is used instead.
386 .Bd -literal -offset indent
393 If next-line macros are invoked consecutively, only the last is used.
394 If a next-line macro is followed by a non-next-line macro, an error is
401 The syntax is as follows:
402 .Bd -literal -offset indent
403 \&.YO \(lBbody...\(rB
407 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX"
408 .It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes
409 .It Sx \&AT Ta <=1 Ta current Ta \&
410 .It Sx \&B Ta n Ta next-line Ta \&
411 .It Sx \&BI Ta n Ta current Ta \&
412 .It Sx \&BR Ta n Ta current Ta \&
413 .It Sx \&DT Ta 0 Ta current Ta \&
414 .It Sx \&I Ta n Ta next-line Ta \&
415 .It Sx \&IB Ta n Ta current Ta \&
416 .It Sx \&IR Ta n Ta current Ta \&
417 .\" .It Sx \&PD Ta n Ta current Ta compat
418 .It Sx \&R Ta n Ta next-line Ta \&
419 .It Sx \&RB Ta n Ta current Ta \&
420 .It Sx \&RI Ta n Ta current Ta \&
421 .It Sx \&SB Ta n Ta next-line Ta \&
422 .It Sx \&SM Ta n Ta next-line Ta \&
423 .It Sx \&TH Ta >1, <6 Ta current Ta \&
424 .It Sx \&UC Ta <=1 Ta current Ta \&
425 .It Sx \&br Ta 0 Ta current Ta compat
426 .It Sx \&fi Ta 0 Ta current Ta compat
427 .It Sx \&i Ta n Ta current Ta compat
428 .It Sx \&in Ta 1 Ta current Ta compat
429 .It Sx \&na Ta 0 Ta current Ta compat
430 .It Sx \&nf Ta 0 Ta current Ta compat
431 .It Sx \&r Ta 0 Ta current Ta compat
432 .It Sx \&sp Ta 1 Ta current Ta compat
433 .\" .It Sx \&Sp Ta <1 Ta current Ta compat
434 .\" .It Sx \&Vb Ta <1 Ta current Ta compat
435 .\" .It Sx \&Ve Ta 0 Ta current Ta compat
440 are included for compatibility with the significant corpus of existing
441 manuals that mix dialects of roff.
442 These macros should not be used for portable
446 Block macros comprise a head and body.
447 As with in-line macros, the head is scoped to the current line and, in
448 one circumstance, the next line (the next-line stipulations as in
452 The syntax is as follows:
453 .Bd -literal -offset indent
454 \&.YO \(lBhead...\(rB
459 The closure of body scope may be to the section, where a macro is closed
462 sub-section, closed by a section or
464 part, closed by a section, sub-section, or
466 or paragraph, closed by a section, sub-section, part,
474 No closure refers to an explicit block closing macro.
476 As a rule, block macros may not be nested; thus, calling a block macro
477 while another block macro scope is open, and the open scope is not
478 implicitly closed, is syntactically incorrect.
480 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX"
481 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes
482 .It Sx \&HP Ta <2 Ta current Ta paragraph Ta \&
483 .It Sx \&IP Ta <3 Ta current Ta paragraph Ta \&
484 .It Sx \&LP Ta 0 Ta current Ta paragraph Ta \&
485 .It Sx \&P Ta 0 Ta current Ta paragraph Ta \&
486 .It Sx \&PP Ta 0 Ta current Ta paragraph Ta \&
487 .It Sx \&RE Ta 0 Ta current Ta none Ta compat
488 .It Sx \&RS Ta 1 Ta current Ta part Ta compat
489 .It Sx \&SH Ta >0 Ta next-line Ta section Ta \&
490 .It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \&
491 .It Sx \&TP Ta n Ta next-line Ta paragraph Ta \&
499 If a block macro is next-line scoped, it may only be followed by in-line
500 macros for decorating text.
502 This section is a canonical reference to all macros, arranged
504 For the scoping of individual macros, see
507 Sets the volume for the footer for compatibility with man pages from
510 The optional arguments specify which release it is from.
512 Text is rendered in bold face.
522 Text is rendered alternately in bold face and italic.
524 .Sq .BI this word and that
529 to render in bold face, while
534 Whitespace between arguments is omitted in output.
538 .D1 \&.BI bold italic bold italic
540 The output of this example will be emboldened
544 with spaces stripped between arguments.
554 Text is rendered alternately in bold face and roman (the default font).
555 Whitespace between arguments is omitted in output.
559 for an equivalent example.
570 Included for compatibility.
572 Begin a paragraph whose initial output line is left-justified, but
573 subsequent output lines are indented, with the following syntax:
574 .Bd -filled -offset indent
581 argument must conform to
583 If specified, it's saved for later paragraph left-margins; if unspecified, the
584 saved or default width is used.
594 Text is rendered in italics.
604 Text is rendered alternately in italics and bold face.
605 Whitespace between arguments is omitted in output.
609 for an equivalent example.
619 Begin an indented paragraph with the following syntax:
620 .Bd -filled -offset indent
622 .Op Cm head Op Cm width
627 argument defines the width of the left margin and is defined by
629 It's saved for later paragraph left-margins; if unspecified, the saved or
630 default width is used.
634 argument is used as a leading term, flushed to the left margin.
635 This is useful for bulleted paragraphs and so on.
645 Text is rendered alternately in italics and roman (the default font).
646 Whitespace between arguments is omitted in output.
650 for an equivalent example.
660 Begin an undecorated paragraph.
661 The scope of a paragraph is closed by a subsequent paragraph,
662 sub-section, section, or end of file.
663 The saved paragraph left-margin width is reset to the default.
695 Text is rendered in roman (the default font).
705 Text is rendered alternately in roman (the default font) and bold face.
706 Whitespace between arguments is omitted in output.
710 for an equivalent example.
720 Explicitly close out the scope of a prior
723 Text is rendered alternately in roman (the default font) and italics.
724 Whitespace between arguments is omitted in output.
728 for an equivalent example.
738 Begin a part setting the left margin.
739 The left margin controls the offset, following an initial indentation,
740 to un-indented text such as that of
742 This has the following syntax:
743 .Bd -filled -offset indent
750 argument must conform to
752 If not specified, the saved or default width is used.
754 Text is rendered in small size (one point smaller than the default font)
758 The scope of a section is only closed by another section or the end of
760 The paragraph left-margin width is reset to the default.
762 Text is rendered in small size (one point smaller than the default
766 The scope of a sub-section is closed by a subsequent sub-section,
767 section, or end of file.
768 The paragraph left-margin width is reset to the default.
770 Sets the title of the manual page with the following syntax:
771 .Bd -filled -offset indent
774 .Op Cm date Op Cm source Op Cm volume
777 At least the upper-case document
781 arguments must be provided.
784 argument should be formatted as described in
786 but will be printed verbatim if it is not.
787 If the date is not specified, the current date is used.
790 string specifies the organisation providing the utility.
793 string replaces the default rendered volume, which is dictated by the
798 .D1 \&.TH CVS 5 "1992-02-12" GNU
800 Begin a paragraph where the head, if exceeding the indentation width, is
801 followed by a newline; if not, the body follows on the same line after a
802 buffer to the indentation width.
803 Subsequent output lines are indented.
804 The syntax is as follows:
805 .Bd -filled -offset indent
812 argument must conform to
814 If specified, it's saved for later paragraph left-margins; if
815 unspecified, the saved or default width is used.
827 .\" Has no effect. Included for compatibility.
831 Sets the volume for the footer for compatibility with man pages from
833 The optional first argument specifies which release it is from.
835 Breaks the current line.
836 Consecutive invocations have no further effect.
841 End literal mode begun by
856 Indent relative to the current indentation:
858 .D1 Pf \. Sx \&in Op Cm width
862 is signed, the new offset is relative.
863 Otherwise, it is absolute.
864 This value is reset upon the next paragraph, section, or sub-section.
866 Don't align to the right margin.
868 Begin literal mode: all subsequent free-form lines have their end of
869 line boundaries preserved.
873 Fonts and styles (bold face, italics) reset to roman (default font).
883 Insert vertical spaces into output with the following syntax:
884 .Bd -filled -offset indent
891 spaces, which must conform to
893 If 0, this is equivalent to the
896 Defaults to 1, if unspecified.
908 .\" Accepts an argument (the height of the formatted space) which is
916 This section documents areas of questionable portability between
917 implementations of the
923 In quoted literals, GNU troff allowed pair-wise double-quotes to produce
924 a standalone double-quote in formatted output.
925 It is not known whether this behaviour is exhibited by other formatters.
927 troff suppresses a newline before
929 macro output; in mandoc, it is an alias for the standard
935 .Pq horizontal position ,
937 .Pq vertical position ,
941 .Pq text filling colour ,
943 .Pq zero-length character ,
947 .Pq horizontal position marker ,
949 .Pq text overstrike ,
953 escape sequences are all discarded in mandoc.
957 scaling unit is accepted by mandoc, but rendered as the default unit.
961 macro does not accept negative values in mandoc.
962 In GNU troff, this would result in strange behaviour.
972 language first appeared as a macro package for the roff typesetting
975 It was later rewritten by James Clark as a macro package for groff.
976 The stand-alone implementation that is part of the
978 utility written by Kristaps Dzonsons appeared in
983 reference was written by
984 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
986 Do not use this language.