1 .\" $Id: man.7,v 1.37 2009/09/05 10:37:09 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: September 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 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
126 document must contain contains at least the
128 macro describing the document's section and title. It may occur
129 anywhere in the document, although conventionally, it appears as the
135 at least one macro or text node must appear in the document. Documents
136 are generally structured as follows:
137 .Bd -literal -offset indent
138 \&.TH FOO 1 "13 Aug 2009"
141 \efBfoo\efR \e(en a description goes here
142 \&.\e\*q The next is for sections 2 & 3 only.
146 \efBfoo\efR [\efB\e-options\efR] arguments...
149 The \efBfoo\efR utility processes files...
151 \&.\e\*q .SH IMPLEMENTATION NOTES
152 \&.\e\*q The next is for sections 1 & 8 only.
153 \&.\e\*q .SH EXIT STATUS
154 \&.\e\*q The next is for sections 2, 3, & 9 only.
155 \&.\e\*q .SH RETURN VALUES
156 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
157 \&.\e\*q .SH ENVIRONMENT
159 \&.\e\*q .SH EXAMPLES
160 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
161 \&.\e\*q .SH DIAGNOSTICS
162 \&.\e\*q The next is for sections 2, 3, & 9 only.
164 \&.\e\*q .SH SEE ALSO
165 \&.\e\*q \efBbar\efR(1)
166 \&.\e\*q .SH STANDARDS
171 \&.\e\*q .SH SECURITY CONSIDERATIONS
176 Macros are one to three three characters in length and begin with a
179 at the beginning of the line. An arbitrary amount of whitespace may
180 sit between the control character and the macro name. Thus,
189 macros are classified by scope: line scope or block scope. Line
190 macros are only scoped to the current line (and, in some situations,
191 the subsequent line). Block macros are scoped to the current line and
192 subsequent lines until closed by another block macro.
196 Line macros are generally scoped to the current line, with the body
197 consisting of zero or more arguments. If a macro is scoped to the next
198 line and the line arguments are empty, the next line is used instead,
199 else the general syntax is used. Thus:
200 .Bd -literal -offset indent
208 If next-line macros are invoked consecutively, only the last is used.
209 If a next-line macro is proceded by a block macro, it is ignored.
210 .Bd -literal -offset indent
211 \&.YO \(lBbody...\(rB
216 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX"
217 .It Em Macro Ta Em Arguments Ta Em Scope
218 .It B Ta n Ta next-line
219 .It BI Ta n Ta current
220 .It BR Ta n Ta current
221 .It DT Ta 0 Ta current
222 .It I Ta n Ta next-line
223 .It IB Ta n Ta current
224 .It IR Ta n Ta current
225 .It R Ta n Ta next-line
226 .It RB Ta n Ta current
227 .It RI Ta n Ta current
228 .It SB Ta n Ta next-line
229 .It SM Ta n Ta next-line
230 .It TH Ta >1, <6 Ta current
231 .It UC Ta n Ta current
232 .It br Ta 0 Ta current
233 .It fi Ta 0 Ta current
234 .It i Ta n Ta current
235 .It na Ta 0 Ta current
236 .It nf Ta 0 Ta current
237 .It r Ta 0 Ta current
238 .It sp Ta 1 Ta current
254 macros should not be used. They're included for compatibility.
258 Block macros are comprised of a head and body. Like for in-line macros,
259 the head is scoped to the current line and, in one circumstance, the
260 next line; the body is scoped to subsequent lines and is closed out by a
261 subsequent block macro invocation.
262 .Bd -literal -offset indent
263 \&.YO \(lBhead...\(rB
269 The closure of body scope may be to the section, where a macro is closed
272 sub-section, closed by a section or
274 part, closed by a section, sub-section, or
276 or paragraph, closed by a section, sub-section, part,
284 No closure refers to an explicit block closing macro.
287 .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" -compact -offset indent
288 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope
289 .It HP Ta <2 Ta current Ta paragraph
290 .It IP Ta <3 Ta current Ta paragraph
291 .It LP Ta 0 Ta current Ta paragraph
292 .It P Ta 0 Ta current Ta paragraph
293 .It PP Ta 0 Ta current Ta paragraph
294 .It RE Ta 0 Ta current Ta none
295 .It RS Ta 1 Ta current Ta part
296 .It SH Ta >0 Ta next-line Ta section
297 .It SS Ta >0 Ta next-line Ta sub-section
298 .It TP Ta n Ta next-line Ta paragraph
302 If a block macro is next-line scoped, it may only be followed by in-line
316 This section is a canonical reference to all macros, arranged
317 alphabetically. For the scoping of individual macros, see
322 In this reference, a numerical width may be either a standalone natural
323 number (such as 3, 4, 10, etc.) or a natural number followed by a width
326 corresponding to the width of the formatted letter n, or
328 corresponding to the width of the formatted letter m. The latter is the
329 default, if unspecified. Thus,
330 .Bd -literal -offset indent
335 indicates an offset of 12
344 Text is rendered in bold face.
346 Text is rendered alternately in bold face and italic. Thus,
347 .Sq .BI this word and that
352 to render in bold face, while
356 render in italics. Whitespace between arguments is omitted in output.
358 Text is rendered alternately in bold face and roman (the default font).
359 Whitespace between arguments is omitted in output.
361 Has no effect. Included for compatibility.
363 Begin a paragraph whose initial output line is left-justified, but
364 subsequent output lines are indented, with the following syntax:
365 .Bd -literal -offset indent
372 is specified, it's saved for later paragraph left-margins; if
373 unspecified, the saved or default width is used.
375 Text is rendered in italics.
377 Text is rendered alternately in italics and bold face. Whitespace
378 between arguments is omitted in output.
380 Begin a paragraph with the following syntax:
381 .Bd -literal -offset indent
386 This follows the behaviour of the
388 except for the macro syntax (all arguments on the line, instead of
389 having next-line scope). If
391 is specified, it's saved for later paragraph left-margins; if
392 unspecified, the saved or default width is used.
394 Text is rendered alternately in italics and roman (the default font).
395 Whitespace between arguments is omitted in output.
397 Begin an undecorated paragraph. The scope of a paragraph is closed by a
398 subsequent paragraph, sub-section, section, or end of file. The saved
399 paragraph left-margin width is re-set to the default.
401 Text is rendered in roman (the default font).
403 Text is rendered alternately in roman (the default font) and bold face.
404 Whitespace between arguments is omitted in output.
406 Explicitly close out the scope of a prior
409 Text is rendered alternately in roman (the default font) and italics.
410 Whitespace between arguments is omitted in output.
412 Begin a part setting the left margin. The left margin controls the
413 offset, following an initial indentation, to un-indented text such as
416 The width may be specified as following:
417 .Bd -literal -offset indent
424 is not specified, the saved or default width is used.
426 Text is rendered in small size (one point smaller than the default font)
429 Begin a section. The scope of a section is only closed by another
430 section or the end of file. The paragraph left-margin width is re-set
433 Text is rendered in small size (one point smaller than the default
436 Begin a sub-section. The scope of a sub-section is closed by a
437 subsequent sub-section, section, or end of file. The paragraph
438 left-margin width is re-set to the default.
440 Sets the title of the manual page with the following syntax:
441 .Bd -literal -offset indent
442 \&.TH title section [date [source [volume]]]
450 arguments must be provided. The
452 argument should be formatted as
458 string specifies the organisation providing the utility. The
460 replaces the default rendered volume as dictated by the manual section.
462 Begin a paragraph where the head, if exceeding the indentation width, is
463 followed by a newline; if not, the body follows on the same line after a
464 buffer to the indentation width. Subsequent output lines are indented.
467 The indentation width may be set as follows:
468 .Bd -literal -offset indent
475 must be a properly-formed numeric width. If
477 is specified, it's saved for later paragraph left-margins; if
478 unspecified, the saved or default width is used.
480 Has no effect. Included for compatibility.
482 Breaks the current line. Consecutive invocations have no further effect.
484 End literal mode begun by
487 Italicise arguments. If no arguments are specified, all subsequent text
490 Don't align to the right margin.
492 Begin literal mode: all subsequent free-form lines have their end of
493 line boundaries preserved. May be ended by
496 Fonts and styles (bold face, italics) reset to roman (default font).
498 Insert n spaces, where n is the macro's positive numeric argument. If
499 0, this is equivalent to the
506 This section documents compatibility with other roff implementations, at
511 In quoted literals, groff allowed pair-wise double-quotes to produce a
512 standalone double-quote in formatted output. This idiosyncratic
513 behaviour is no longer applicable.
517 macro does not accept negative numbers.
519 Blocks of whitespace are stripped from both macro and free-form text
520 lines (except when in literal mode), while groff would retain whitespace
521 in free-form text lines.
533 reference was written by
534 .An Kristaps Dzonsons Aq kristaps@kth.se .
538 Do not use this language. Use