1 .\" $Id: man.7,v 1.123 2014/02/14 17:35:05 schwarze Exp $
3 .\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
5 .\" Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
7 .\" Permission to use, copy, modify, and distribute this software for any
8 .\" purpose with or without fee is hereby granted, provided that the above
9 .\" copyright notice and this permission notice appear in all copies.
11 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 .Dd $Mdocdate: February 14 2014 $
24 .Nd legacy formatting language for manual pages
28 language has been used to write
33 It supports limited control of presentational details like fonts,
34 indentation and spacing.
35 This reference document describes the structure of manual pages
36 and the syntax and usage of the man language.
41 to write your manuals:
43 It lacks support for semantic markup.
50 document, lines beginning with the control character
54 The first word is the macro name.
55 It usually consists of two capital letters.
56 For a list of available macros, see
58 The words following the macro name are arguments to the macro.
60 Lines not beginning with the control character are called
62 They provide free-form text to be printed; the formatting of the text
63 depends on the respective processing context:
64 .Bd -literal -offset indent
65 \&.SH Macro lines change control state.
66 Text lines are interpreted within the current state.
69 Many aspects of the basic syntax of the
71 language are based on the
79 manual for details, in particular regarding
80 comments, escape sequences, whitespace, and quoting.
84 document must contain the
86 macro describing the document's section and title.
87 It may occur anywhere in the document, although conventionally it
88 appears as the first macro.
92 at least one macro or text line must appear in the document.
94 The following is a well-formed skeleton
98 .Bd -literal -offset indent
99 \&.TH PROGNAME 1 2009-10-10
101 \efBprogname\efR \e(en a description goes here
102 \&.\e\(dq .SH LIBRARY
103 \&.\e\(dq For sections 2 & 3 only.
104 \&.\e\(dq Not used in OpenBSD.
106 \efBprogname\efR [\efB\e-options\efR] arguments...
108 The \efBfoo\efR utility processes files...
109 \&.\e\(dq .SH IMPLEMENTATION NOTES
110 \&.\e\(dq Not used in OpenBSD.
111 \&.\e\(dq .SH RETURN VALUES
112 \&.\e\(dq For sections 2, 3, & 9 only.
113 \&.\e\(dq .SH ENVIRONMENT
114 \&.\e\(dq For sections 1, 6, 7, & 8 only.
116 \&.\e\(dq .SH EXIT STATUS
117 \&.\e\(dq For sections 1, 6, & 8 only.
118 \&.\e\(dq .SH EXAMPLES
119 \&.\e\(dq .SH DIAGNOSTICS
120 \&.\e\(dq For sections 1, 4, 6, 7, & 8 only.
122 \&.\e\(dq For sections 2, 3, & 9 only.
123 \&.\e\(dq .SH SEE ALSO
124 \&.\e\(dq .BR foo ( 1 )
125 \&.\e\(dq .SH STANDARDS
126 \&.\e\(dq .SH HISTORY
127 \&.\e\(dq .SH AUTHORS
128 \&.\e\(dq .SH CAVEATS
130 \&.\e\(dq .SH SECURITY CONSIDERATIONS
131 \&.\e\(dq Not used in OpenBSD.
136 document are conventionally ordered as they appear above.
137 Sections should be composed as follows:
138 .Bl -ohang -offset indent
140 The name(s) and a short description of the documented material.
141 The syntax for this is generally as follows:
143 .D1 \efBname\efR \e(en description
145 The name of the library containing the documented material, which is
146 assumed to be a function in a section 2 or 3 manual.
147 For functions in the C library, this may be as follows:
149 .D1 Standard C Library (libc, -lc)
151 Documents the utility invocation syntax, function call syntax, or device
154 For the first, utilities (sections 1, 6, and 8), this is
155 generally structured as follows:
157 .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
159 For the second, function calls (sections 2, 3, 9):
161 .D1 \&.B char *name(char *\efIarg\efR);
163 And for the third, configurations (section 4):
165 .D1 \&.B name* at cardbus ? function ?
167 Manuals not in these sections generally don't need a
170 This expands upon the brief, one-line description in
172 It usually contains a break-down of the options (if documenting a
174 .It Em IMPLEMENTATION NOTES
175 Implementation-specific notes should be kept here.
176 This is useful when implementing standard functions that may have side
177 effects or notable algorithmic implications.
179 This section documents the return values of functions in sections 2, 3, and 9.
181 Documents any usages of environment variables, e.g.,
184 Documents files used.
185 It's helpful to document both the file name and a short description of how
186 the file is used (created, modified, etc.).
188 This section documents the command exit status for
189 section 1, 6, and 8 utilities.
190 Historically, this information was described in
192 a practise that is now discouraged.
195 This often contains snippets of well-formed,
196 well-tested invocations.
197 Make sure that examples work properly!
199 Documents error conditions.
200 This is most useful in section 4 manuals.
201 Historically, this section was used in place of
203 for manuals in sections 1, 6, and 8; however, this practise is
206 Documents error handling in sections 2, 3, and 9.
208 References other manuals with related topics.
209 This section should exist for most manuals.
211 .D1 \&.BR bar \&( 1 \&),
213 Cross-references should conventionally be ordered
214 first by section, then alphabetically.
216 References any standards implemented or used, such as
218 .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
220 If not adhering to any standards, the
222 section should be used.
224 A brief history of the subject, including where support first appeared.
226 Credits to the person or persons who wrote the code and/or documentation.
227 Authors should generally be noted by both name and email address.
229 Common misuses and misunderstandings should be explained
232 Known bugs, limitations, and work-arounds should be described
234 .It Em SECURITY CONSIDERATIONS
235 Documents any security precautions that operators should consider.
238 This overview is sorted such that macros of similar purpose are listed
239 together, to help find the best macro for any given purpose.
240 Deprecated macros are not included in the overview, but can be found
241 in the alphabetical reference below.
242 .Ss Page header and footer meta-data
243 .Bl -column "PP, LP, P" description
244 .It Sx TH Ta set the title: Ar title section date Op Ar source Op Ar volume
245 .It Sx AT Ta display AT&T UNIX version in the page footer (<= 1 argument)
246 .It Sx UC Ta display BSD version in the page footer (<= 1 argument)
248 .Ss Sections and paragraphs
249 .Bl -column "PP, LP, P" description
250 .It Sx SH Ta section header (one line)
251 .It Sx SS Ta subsection header (one line)
252 .It Sx PP , LP , P Ta start an undecorated paragraph (no arguments)
253 .It Sx RS , RE Ta reset the left margin: Op Ar width
254 .It Sx IP Ta indented paragraph: Op Ar head Op Ar width
255 .It Sx TP Ta tagged paragraph: Op Ar width
256 .It Sx HP Ta hanged paragraph: Op Ar width
257 .It Sx PD Ta set vertical paragraph distance: Op Ar height
258 .It Sx \&br Ta force output line break in text mode (no arguments)
259 .It Sx \&sp Ta force vertical space: Op Ar height
260 .It Sx fi , nf Ta fill mode and no-fill mode (no arguments)
261 .It Sx in Ta additional indent: Op Ar width
264 .Bl -column "PP, LP, P" description
265 .It Sx B Ta boldface font
266 .It Sx I Ta italic font
267 .It Sx R Ta roman (default) font
268 .It Sx SB Ta small boldface font
269 .It Sx SM Ta small roman font
270 .It Sx BI Ta alternate between boldface and italic fonts
271 .It Sx BR Ta alternate between boldface and roman fonts
272 .It Sx IB Ta alternate between italic and boldface fonts
273 .It Sx IR Ta alternate between italic and roman fonts
274 .It Sx RB Ta alternate between roman and boldface fonts
275 .It Sx RI Ta alternate between roman and italic fonts
278 This section is a canonical reference to all macros, arranged
280 For the scoping of individual macros, see
283 Sets the volume for the footer for compatibility with man pages from
286 The optional arguments specify which release it is from.
288 Text is rendered in bold face.
295 Text is rendered alternately in bold face and italic.
297 .Sq .BI this word and that
302 to render in bold face, while
307 Whitespace between arguments is omitted in output.
311 .Dl \&.BI bold italic bold italic
313 The output of this example will be emboldened
317 with spaces stripped between arguments.
327 Text is rendered alternately in bold face and roman (the default font).
328 Whitespace between arguments is omitted in output.
332 for an equivalent example.
343 Included for compatibility.
345 This is a non-standard GNU extension, included only for compatibility.
351 This is a non-standard GNU extension, included only for compatibility.
357 Begin a paragraph whose initial output line is left-justified, but
358 subsequent output lines are indented, with the following syntax:
359 .Bd -filled -offset indent
369 If specified, it's saved for later paragraph left-margins; if unspecified, the
370 saved or default width is used.
380 Text is rendered in italics.
387 Text is rendered alternately in italics and bold face.
388 Whitespace between arguments is omitted in output.
392 for an equivalent example.
402 Begin an indented paragraph with the following syntax:
403 .Bd -filled -offset indent
405 .Op Cm head Op Cm width
412 scaling width defining the left margin.
413 It's saved for later paragraph left-margins; if unspecified, the saved or
414 default width is used.
418 argument is used as a leading term, flushed to the left margin.
419 This is useful for bulleted paragraphs and so on.
429 Text is rendered alternately in italics and roman (the default font).
430 Whitespace between arguments is omitted in output.
434 for an equivalent example.
444 Begin an undecorated paragraph.
445 The scope of a paragraph is closed by a subsequent paragraph,
446 sub-section, section, or end of file.
447 The saved paragraph left-margin width is reset to the default.
457 Optional command-line argument.
458 This is a non-standard GNU extension, included only for compatibility.
459 It has the following syntax:
460 .Bd -filled -offset indent
467 is usually a command-line flag and
482 Specify the vertical space to be inserted before each new paragraph.
484 The syntax is as follows:
485 .Bd -filled -offset indent
497 If the unit is omitted,
501 This macro affects the spacing before any subsequent instances of
523 Text is rendered in roman (the default font).
530 Text is rendered alternately in roman (the default font) and bold face.
531 Whitespace between arguments is omitted in output.
535 for an equivalent example.
545 Explicitly close out the scope of a prior
547 The default left margin is restored to the state of the original
551 Text is rendered alternately in roman (the default font) and italics.
552 Whitespace between arguments is omitted in output.
556 for an equivalent example.
566 Temporarily reset the default left margin.
567 This has the following syntax:
568 .Bd -filled -offset indent
578 If not specified, the saved or default width is used.
583 Text is rendered in small size (one point smaller than the default font)
587 The scope of a section is only closed by another section or the end of
589 The paragraph left-margin width is reset to the default.
591 Text is rendered in small size (one point smaller than the default
595 The scope of a sub-section is closed by a subsequent sub-section,
596 section, or end of file.
597 The paragraph left-margin width is reset to the default.
599 Sets the title of the manual page with the following syntax:
600 .Bd -filled -offset indent
602 .Ar title section date
603 .Op Ar source Op Ar volume
606 Conventionally, the document
608 is given in all caps.
613 as specified in the ISO-8601 standard;
614 if the argument does not conform, it is printed verbatim.
617 is empty or not specified, the current date is used.
620 string specifies the organisation providing the utility.
623 string replaces the default rendered volume, which is dictated by the
628 .Dl \&.TH CVS 5 "1992-02-12" GNU
630 Begin a paragraph where the head, if exceeding the indentation width, is
631 followed by a newline; if not, the body follows on the same line after a
632 buffer to the indentation width.
633 Subsequent output lines are indented.
634 The syntax is as follows:
635 .Bd -filled -offset indent
645 If specified, it's saved for later paragraph left-margins; if
646 unspecified, the saved or default width is used.
656 Sets the volume for the footer for compatibility with man pages from
659 The optional first argument specifies which release it is from.
661 End a uniform resource identifier block.
662 This is a non-standard GNU extension, included only for compatibility.
666 Begin a uniform resource identifier block.
667 This is a non-standard GNU extension, included only for compatibility.
668 It has the following syntax:
669 .Bd -literal -offset indent
670 .Pf \. Sx \&UR Ar uri
671 link description to be shown
675 Breaks the current line.
676 Consecutive invocations have no further effect.
681 End literal mode begun by
684 Change the current font mode.
687 for a listing of available font modes.
689 Indent relative to the current indentation:
691 .D1 Pf \. Sx \&in Op Cm width
695 is signed, the new offset is relative.
696 Otherwise, it is absolute.
697 This value is reset upon the next paragraph, section, or sub-section.
699 Don't align to the right margin.
701 Begin literal mode: all subsequent free-form lines have their end of
702 line boundaries preserved.
705 Literal mode is implicitly ended by
710 Insert vertical spaces into output with the following syntax:
711 .Bd -filled -offset indent
718 argument is a scaling width as described in
720 If 0, this is equivalent to the
723 Defaults to 1, if unspecified.
730 macros are classified by scope: line scope or block scope.
731 Line macros are only scoped to the current line (and, in some
732 situations, the subsequent line).
733 Block macros are scoped to the current line and subsequent lines until
734 closed by another block macro.
736 Line macros are generally scoped to the current line, with the body
737 consisting of zero or more arguments.
738 If a macro is scoped to the next line and the line arguments are empty,
739 the next line, which must be text, is used instead.
741 .Bd -literal -offset indent
748 If next-line macros are invoked consecutively, only the last is used.
749 If a next-line macro is followed by a non-next-line macro, an error is
756 The syntax is as follows:
757 .Bd -literal -offset indent
758 \&.YO \(lBbody...\(rB
761 .Bl -column "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX" -offset indent
762 .It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes
763 .It Sx \&AT Ta <=1 Ta current Ta \&
764 .It Sx \&B Ta n Ta next-line Ta \&
765 .It Sx \&BI Ta n Ta current Ta \&
766 .It Sx \&BR Ta n Ta current Ta \&
767 .It Sx \&DT Ta 0 Ta current Ta \&
768 .It Sx \&EE Ta 0 Ta current Ta compat
769 .It Sx \&EX Ta 0 Ta current Ta compat
770 .It Sx \&I Ta n Ta next-line Ta \&
771 .It Sx \&IB Ta n Ta current Ta \&
772 .It Sx \&IR Ta n Ta current Ta \&
773 .It Sx \&OP Ta 0, 1 Ta current Ta compat
774 .It Sx \&PD Ta 1 Ta current Ta \&
775 .It Sx \&R Ta n Ta next-line Ta \&
776 .It Sx \&RB Ta n Ta current Ta \&
777 .It Sx \&RI Ta n Ta current Ta \&
778 .It Sx \&SB Ta n Ta next-line Ta \&
779 .It Sx \&SM Ta n Ta next-line Ta \&
780 .It Sx \&TH Ta >1, <6 Ta current Ta \&
781 .It Sx \&UC Ta <=1 Ta current Ta \&
782 .It Sx \&br Ta 0 Ta current Ta compat
783 .It Sx \&fi Ta 0 Ta current Ta compat
784 .It Sx \&ft Ta 1 Ta current Ta compat
785 .It Sx \&in Ta 1 Ta current Ta compat
786 .It Sx \&na Ta 0 Ta current Ta compat
787 .It Sx \&nf Ta 0 Ta current Ta compat
788 .It Sx \&sp Ta 1 Ta current Ta compat
793 are included for compatibility with the significant corpus of existing
794 manuals that mix dialects of roff.
795 These macros should not be used for portable
799 Block macros comprise a head and body.
800 As with in-line macros, the head is scoped to the current line and, in
801 one circumstance, the next line (the next-line stipulations as in
805 The syntax is as follows:
806 .Bd -literal -offset indent
807 \&.YO \(lBhead...\(rB
812 The closure of body scope may be to the section, where a macro is closed
815 sub-section, closed by a section or
817 part, closed by a section, sub-section, or
819 or paragraph, closed by a section, sub-section, part,
827 No closure refers to an explicit block closing macro.
829 As a rule, block macros may not be nested; thus, calling a block macro
830 while another block macro scope is open, and the open scope is not
831 implicitly closed, is syntactically incorrect.
832 .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX" -offset indent
833 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes
834 .It Sx \&HP Ta <2 Ta current Ta paragraph Ta \&
835 .It Sx \&IP Ta <3 Ta current Ta paragraph Ta \&
836 .It Sx \&LP Ta 0 Ta current Ta paragraph Ta \&
837 .It Sx \&P Ta 0 Ta current Ta paragraph Ta \&
838 .It Sx \&PP Ta 0 Ta current Ta paragraph Ta \&
839 .It Sx \&RE Ta 0 Ta current Ta none Ta compat
840 .It Sx \&RS Ta 1 Ta current Ta part Ta compat
841 .It Sx \&SH Ta >0 Ta next-line Ta section Ta \&
842 .It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \&
843 .It Sx \&TP Ta n Ta next-line Ta paragraph Ta \&
844 .It Sx \&UE Ta 0 Ta current Ta none Ta compat
845 .It Sx \&UR Ta 1 Ta current Ta part Ta compat
853 If a block macro is next-line scoped, it may only be followed by in-line
854 macros for decorating text.
863 font escape sequences can be used to choose fonts.
864 In text lines, the effect of manual font selection by escape sequences
865 only lasts until the next macro invocation; in macro lines, it only lasts
866 until the end of the macro scope.
867 Note that macros like
869 open and close a font scope for each argument.
871 This section documents areas of questionable portability between
872 implementations of the
882 to close out a literal context opened with
884 This behaviour may not be portable.
886 In quoted literals, GNU troff allowed pair-wise double-quotes to produce
887 a standalone double-quote in formatted output.
888 It is not known whether this behaviour is exhibited by other formatters.
890 troff suppresses a newline before
892 macro output; in mandoc, it is an alias for the standard
898 .Pq horizontal position ,
900 .Pq vertical position ,
904 .Pq text filling colour ,
906 .Pq zero-length character ,
910 .Pq horizontal position marker ,
912 .Pq text overstrike ,
916 escape sequences are all discarded in mandoc.
920 scaling unit is accepted by mandoc, but rendered as the default unit.
924 macro does not accept negative values in mandoc.
925 In GNU troff, this would result in strange behaviour.
927 In page header lines, GNU troff versions up to and including 1.21
930 names explicitly specified in the
932 macro; mandoc and newer groff print the default volume name
943 macro is part of the extended
945 macro set, and may not be portable to non-GNU troff implementations.
957 language first appeared as a macro package for the roff typesetting
960 It was later rewritten by James Clark as a macro package for groff.
961 Eric S. Raymond wrote the extended
963 macros for groff in 2007.
964 The stand-alone implementation that is part of the
966 utility written by Kristaps Dzonsons appeared in
971 reference was written by
972 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
974 Do not use this language.