1 .\" $Id: man.7,v 1.22 2009/08/13 11:45:29 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: August 13 2009 $
23 .Nd man language reference
28 language was historically used to format
30 manuals. This reference document describes its syntax, structure, and
36 to write your manuals.
45 document follows simple rules: lines beginning with the control
48 are parsed for macros. Other lines are interpreted within the scope of
50 .Bd -literal -offset indent
51 \&.SH Macro lines change control state.
52 Other lines are interpreted within the current state.
57 documents may contain only graphable 7-bit ASCII characters, the
58 space character, and the tabs character. All manuals must have
62 Blank lines are acceptable; where found, the output will assert a
67 escape is common in historical
69 documents; if encountered at the end of a word, it ensures that the
70 subsequent word isn't off-set by whitespace.
75 whether in a macro or free-form text line, is ignored to the end of
76 line. A macro line with only a control character and comment escape,
78 is also ignored. Macro lines with only a control charater and
79 optionally whitespace are stripped from input.
81 .Ss Special Characters
82 Special characters may occur in both macro and free-form lines.
83 Sequences begin with the escape character
85 followed by either an open-parenthesis
87 for two-character sequences; an open-bracket
89 for n-character sequences (terminated at a close-bracket
91 or a single one-character sequence. See
93 for a complete list. Examples include
99 .\" SUB-SECTION----------------------
101 Terms may be text-decorated using the
103 escape followed by an indicator: B (bold), I, (italic), or P and R
105 .\" SUB-SECTION----------------------
107 Unless specifically escaped, consecutive blocks of whitespace are pruned
108 from input. These are later re-added, if applicable, by a front-end
115 document must contain contains at least the
117 macro describing the document's section and title. It may occur
118 anywhere in the document, although conventionally, it appears as the
123 at least one macro or text node must appear in the document. Documents
124 are generally structured as follows:
125 .Bd -literal -offset indent
126 \&.TH FOO 1 "13 Aug 2009"
129 foo \e- a description goes here
132 \efBfoo\efR [\efB\e-options\efR] arguments...
135 The \efBfoo\efR utility does...
137 \&.\e\*q .SH RETURN VALUES
138 \&.\e\*q .SH ENVIRONMENT
140 \&.\e\*q .SH EXAMPLES
141 \&.\e\*q .SH DIAGNOSTICS
143 \&.\e\*q .SH SEE ALSO
144 \&.\e\*q \efBbar\efR(1)
145 \&.\e\*q .SH STANDARDS
153 Macros are one to three three characters in length and begin with a
156 at the beginning of the line. An arbitrary amount of whitespace may
157 sit between the control character and the macro name. Thus,
165 macros are classified by scope: line scope or block scope. Line-scoped
166 macros are only scoped to the current line (and, in some situations,
167 the subsequent line). Block macros are scoped to the current line and
168 subsequent lines until closed by another block macro.
171 Line-macros are scoped to the current line, with the body consisting of
172 zero or more arguments. If a macro is next-line scoped and the line
173 arguments are empty, the next line is used instead. Thus:
174 .Bd -literal -offset indent
183 Consecutive next-line invocations are disallowed.
184 .Bd -literal -offset indent
185 \&.YO \(lBbody...\(rB
190 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX"
191 .It Em Macro Ta Em Arguments Ta Em Scope
192 .It \&B Ta n Ta next-line
193 .It \&BI Ta n Ta current
194 .It \&BR Ta n Ta current
195 .It \&I Ta n Ta next-line
196 .It \&IB Ta n Ta current
197 .It \&IR Ta n Ta current
198 .It \&R Ta n Ta next-line
199 .It \&RB Ta n Ta current
200 .It \&RI Ta n Ta current
201 .It \&SB Ta n Ta next-line
202 .It \&SM Ta n Ta next-line
203 .It \&TH Ta >1, <6 Ta current
204 .It \&br Ta 0 Ta current
205 .It \&fi Ta 0 Ta current
206 .It \&i Ta n Ta current
207 .It \&na Ta 0 Ta current
208 .It \&nf Ta 0 Ta current
209 .It \&r Ta 0 Ta current
210 .It \&sp Ta 1 Ta current
223 macros aren't historically part of
225 and should not be used. They're included for compatibility.
228 Block macros are comprised of a head and body. The head is scoped to
229 the current line and, in one circumstance, the next line; the body is
230 scoped to subsequent lines and is closed out by a subsequent block macro
232 .Bd -literal -offset indent
233 \&.YO \(lBhead...\(rB
239 If a block macro is next-line scoped, it may only be followed by in-line
249 .Bl -column "MacroX" "Arguments" "ScopeXXXX" -compact -offset indent
250 .It Em Macro Ta Em Arguments Ta Em Scope
251 .It \&HP Ta <2 Ta current
252 .It \&IP Ta <3 Ta current
253 .It \&LP Ta 0 Ta current
254 .It \&P Ta 0 Ta current
255 .It \&PP Ta 0 Ta current
256 .It \&SH Ta >0 Ta current
257 .It \&SS Ta >0 Ta current
258 .It \&TP Ta n Ta next-line
262 This section is a canonical reference to all macros, arranged
263 alphabetically. For the scoping of individual macros, see
265 .Bl -tag -width Ds -offset indent
267 Text is rendered in bold face.
269 Text is rendered alternately in bold face and italic. Thus,
270 .Sq \&.BI this word and that
275 to render in bold face, while
279 render in italics. Whitespace between arguments is omitted in output.
281 Text is rendered alternately in bold face and roman (the default font).
282 Whitespace between arguments is omitted in output.
286 Text is rendered in italics.
288 Text is rendered alternately in italics and bold face. Whitespace
289 between arguments is omitted in output.
293 Text is rendered alternately in italics and roman (the default font).
294 Whitespace between arguments is omitted in output.
296 Begin an undecorated paragraph. The scope of a paragraph is closed by a
297 subsequent paragraph, sub-section, section, or end of file.
299 Text is rendered in roman (the default font).
301 Text is rendered alternately in roman (the default font) and bold face.
302 Whitespace between arguments is omitted in output.
304 Text is rendered alternately in roman (the default font) and italics.
305 Whitespace between arguments is omitted in output.
307 Text is rendered in small size (one point smaller than the default font)
310 Begin a section. The scope of a section is only closed by another
311 section or the end of file.
313 Text is rendered in small size (one point smaller than the default
316 Begin a sub-section. The scope of a sub-section is closed by a
317 subsequent sub-section, section, or end of file.
319 Sets the title of the manual page with the following syntax:
320 .Bd -literal -offset indent
321 \&.TH title section date source volume
328 arguments must be provided. The
330 argument should be formatted as
336 string specifies the organisation providing the utility. The
338 replaces the default rendered volume as dictated by the manual section.
342 Breaks the current line. Consecutive invocations have no further effect.
345 End literal mode begun by
348 Italicise arguments. If no arguments are specified, all subsequent text
351 No alignment to the right margin.
353 Begin literal mode: all subsequent free-form lines have their end of
354 line boundaries preserved. May be ended by
357 Fonts and styles (bold face, italics) reset to roman (default font).
359 Insert n spaces, where n is the macro's positive numeric argument. If
360 0, this is equivalent to the
368 for groff compatibility notes.
377 utility was written by
378 .An Kristaps Dzonsons Aq kristaps@kth.se .
381 Do not use this language. Use