1 .\" $Id: man.7,v 1.39 2009/10/19 07:44:30 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: October 19 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
123 Many macros support scaled widths for their arguments, such as
124 stipulating a two-inch paragraph indentation with the following:
125 .Bd -literal -offset indent
130 The syntax for scaled widths is
131 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:]? ,
132 where a decimal must be preceded or proceeded by at least one digit.
133 Negative numbers, while accepted, are truncated to zero. The following
134 scaling units are accepted:
137 .Bl -tag -width Ds -offset indent -compact
150 default vertical span
162 default horizontal span
167 Using anything other than
173 is necessarily non-portable across output media. See
177 If a scaling unit is not provided, the numerical value is interpreted
178 under the default rules of
180 for vertical spaces and
186 which, if a unit is not provided, will instead interpret the string as
193 document must contain contains at least the
195 macro describing the document's section and title. It may occur
196 anywhere in the document, although conventionally, it appears as the
202 at least one macro or text node must appear in the document. Documents
203 are generally structured as follows:
204 .Bd -literal -offset indent
205 \&.TH FOO 1 "13 Aug 2009"
208 \efBfoo\efR \e(en a description goes here
209 \&.\e\*q The next is for sections 2 & 3 only.
213 \efBfoo\efR [\efB\e-options\efR] arguments...
216 The \efBfoo\efR utility processes files...
218 \&.\e\*q .SH IMPLEMENTATION NOTES
219 \&.\e\*q The next is for sections 1 & 8 only.
220 \&.\e\*q .SH EXIT STATUS
221 \&.\e\*q The next is for sections 2, 3, & 9 only.
222 \&.\e\*q .SH RETURN VALUES
223 \&.\e\*q The next is for sections 1, 6, 7, & 8 only.
224 \&.\e\*q .SH ENVIRONMENT
226 \&.\e\*q .SH EXAMPLES
227 \&.\e\*q The next is for sections 1, 4, 6, 7, & 8 only.
228 \&.\e\*q .SH DIAGNOSTICS
229 \&.\e\*q The next is for sections 2, 3, & 9 only.
231 \&.\e\*q .SH SEE ALSO
232 \&.\e\*q \efBbar\efR(1)
233 \&.\e\*q .SH STANDARDS
238 \&.\e\*q .SH SECURITY CONSIDERATIONS
243 Macros are one to three three characters in length and begin with a
246 at the beginning of the line. An arbitrary amount of whitespace may
247 sit between the control character and the macro name. Thus, the
248 following are equivalent:
249 .Bd -literal -offset indent
257 macros are classified by scope: line scope or block scope. Line
258 macros are only scoped to the current line (and, in some situations,
259 the subsequent line). Block macros are scoped to the current line and
260 subsequent lines until closed by another block macro.
264 Line macros are generally scoped to the current line, with the body
265 consisting of zero or more arguments. If a macro is scoped to the next
266 line and the line arguments are empty, the next line is used instead,
267 else the general syntax is used. Thus:
268 .Bd -literal -offset indent
276 If next-line macros are invoked consecutively, only the last is used.
277 If a next-line macro is proceded by a block macro, it is ignored.
278 .Bd -literal -offset indent
279 \&.YO \(lBbody...\(rB
284 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX"
285 .It Em Macro Ta Em Arguments Ta Em Scope
286 .It Sx \&B Ta n Ta next-line
287 .It Sx \&BI Ta n Ta current
288 .It Sx \&BR Ta n Ta current
289 .It Sx \&DT Ta 0 Ta current
290 .It Sx \&I Ta n Ta next-line
291 .It Sx \&IB Ta n Ta current
292 .It Sx \&IR Ta n Ta current
293 .It Sx \&R Ta n Ta next-line
294 .It Sx \&RB Ta n Ta current
295 .It Sx \&RI Ta n Ta current
296 .It Sx \&SB Ta n Ta next-line
297 .It Sx \&SM Ta n Ta next-line
298 .It Sx \&TH Ta >1, <6 Ta current
299 .It Sx \&UC Ta n Ta current
300 .It Sx \&br Ta 0 Ta current
301 .It Sx \&fi Ta 0 Ta current
302 .It Sx \&i Ta n Ta current
303 .It Sx \&na Ta 0 Ta current
304 .It Sx \&nf Ta 0 Ta current
305 .It Sx \&r Ta 0 Ta current
306 .It Sx \&sp Ta 1 Ta current
322 macros should not be used. They're included for compatibility.
326 Block macros are comprised of a head and body. Like for in-line macros,
327 the head is scoped to the current line and, in one circumstance, the
328 next line; the body is scoped to subsequent lines and is closed out by a
329 subsequent block macro invocation.
330 .Bd -literal -offset indent
331 \&.YO \(lBhead...\(rB
337 The closure of body scope may be to the section, where a macro is closed
340 sub-section, closed by a section or
342 part, closed by a section, sub-section, or
344 or paragraph, closed by a section, sub-section, part,
352 No closure refers to an explicit block closing macro.
355 .Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" -compact -offset indent
356 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope
357 .It Sx \&HP Ta <2 Ta current Ta paragraph
358 .It Sx \&IP Ta <3 Ta current Ta paragraph
359 .It Sx \&LP Ta 0 Ta current Ta paragraph
360 .It Sx \&P Ta 0 Ta current Ta paragraph
361 .It Sx \&PP Ta 0 Ta current Ta paragraph
362 .It Sx \&RE Ta 0 Ta current Ta none
363 .It Sx \&RS Ta 1 Ta current Ta part
364 .It Sx \&SH Ta >0 Ta next-line Ta section
365 .It Sx \&SS Ta >0 Ta next-line Ta sub-section
366 .It Sx \&TP Ta n Ta next-line Ta paragraph
370 If a block macro is next-line scoped, it may only be followed by in-line
384 This section is a canonical reference to all macros, arranged
385 alphabetically. For the scoping of individual macros, see
389 Text is rendered in bold face.
391 Text is rendered alternately in bold face and italic. Thus,
392 .Sq .BI this word and that
397 to render in bold face, while
401 render in italics. Whitespace between arguments is omitted in output.
403 Text is rendered alternately in bold face and roman (the default font).
404 Whitespace between arguments is omitted in output.
406 Has no effect. Included for compatibility.
408 Begin a paragraph whose initial output line is left-justified, but
409 subsequent output lines are indented, with the following syntax:
410 .Bd -literal -offset indent
417 is specified, it's saved for later paragraph left-margins; if
418 unspecified, the saved or default width is used.
420 Text is rendered in italics.
422 Text is rendered alternately in italics and bold face. Whitespace
423 between arguments is omitted in output.
425 Begin a paragraph with the following syntax:
426 .Bd -literal -offset indent
431 This follows the behaviour of the
433 except for the macro syntax (all arguments on the line, instead of
434 having next-line scope). If
436 is specified, it's saved for later paragraph left-margins; if
437 unspecified, the saved or default width is used.
439 Text is rendered alternately in italics and roman (the default font).
440 Whitespace between arguments is omitted in output.
442 Begin an undecorated paragraph. The scope of a paragraph is closed by a
443 subsequent paragraph, sub-section, section, or end of file. The saved
444 paragraph left-margin width is re-set to the default.
452 Text is rendered in roman (the default font).
454 Text is rendered alternately in roman (the default font) and bold face.
455 Whitespace between arguments is omitted in output.
457 Explicitly close out the scope of a prior
460 Text is rendered alternately in roman (the default font) and italics.
461 Whitespace between arguments is omitted in output.
463 Begin a part setting the left margin. The left margin controls the
464 offset, following an initial indentation, to un-indented text such as
467 A scaling width may be specified as following:
468 .Bd -literal -offset indent
475 is not specified, the saved or default width is used.
477 Text is rendered in small size (one point smaller than the default font)
480 Begin a section. The scope of a section is only closed by another
481 section or the end of file. The paragraph left-margin width is re-set
484 Text is rendered in small size (one point smaller than the default
487 Begin a sub-section. The scope of a sub-section is closed by a
488 subsequent sub-section, section, or end of file. The paragraph
489 left-margin width is re-set to the default.
491 Sets the title of the manual page with the following syntax:
492 .Bd -literal -offset indent
493 \&.TH title section [date [source [volume]]]
501 arguments must be provided. The
503 argument should be formatted as
509 string specifies the organisation providing the utility. The
511 replaces the default rendered volume as dictated by the manual section.
513 Begin a paragraph where the head, if exceeding the indentation width, is
514 followed by a newline; if not, the body follows on the same line after a
515 buffer to the indentation width. Subsequent output lines are indented.
518 The indentation scaling width may be set as follows:
519 .Bd -literal -offset indent
526 is specified, it's saved for later paragraph left-margins; if
527 unspecified, the saved or default width is used.
529 Has no effect. Included for compatibility.
531 Breaks the current line. Consecutive invocations have no further effect.
533 End literal mode begun by
536 Italicise arguments. If no arguments are specified, all subsequent text
539 Don't align to the right margin.
541 Begin literal mode: all subsequent free-form lines have their end of
542 line boundaries preserved. May be ended by
545 Fonts and styles (bold face, italics) reset to roman (default font).
547 Insert n spaces, where n is the macro's positive numeric argument. If
548 0, this is equivalent to the
554 This section documents compatibility with other roff implementations, at
559 In quoted literals, groff allowed pair-wise double-quotes to produce a
560 standalone double-quote in formatted output. This idiosyncratic
561 behaviour is no longer applicable.
565 macro does not accept negative numbers.
567 Blocks of whitespace are stripped from both macro and free-form text
568 lines (except when in literal mode), while groff would retain whitespace
569 in free-form text lines.
581 reference was written by
582 .An Kristaps Dzonsons Aq kristaps@kth.se .
586 Do not use this language. Use