1 .\" $Id: roff.7,v 1.12 2010/07/04 22:04:04 schwarze Exp $
3 .\" Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 .Dd $Mdocdate: July 4 2010 $
23 .Nd roff language reference
27 language is a general-purpose text-formatting language. The purpose of
28 this document is to consistently describe those language constructs
31 utility. It is a work in progress.
35 document follows simple rules: lines beginning with the control
40 are parsed for macros. Other lines are interpreted within the scope of
42 .Bd -literal -offset indent
43 \&.xx Macro lines change control state.
44 Other lines are interpreted within the current state.
48 documents may contain only graphable 7-bit ASCII characters, the space
49 character, and, in certain circumstances, the tab character. All
54 Macros are arbitrary in length and begin with a control character ,
58 at the beginning of the line.
59 An arbitrary amount of whitespace may sit between the control character
61 Thus, the following are equivalent:
62 .Bd -literal -offset indent
67 This section is a canonical reference of all macros, arranged
70 The syntax of this macro is the same as that of
72 except that a leading argument must be specified.
73 It is ignored, as are its children.
75 The syntax of this macro is the same as that of
77 except that a leading argument must be specified.
78 It is ignored, as are its children.
80 The syntax of this macro is the same as that of
82 except that a leading argument must be specified.
83 It is ignored, as are its children.
85 The syntax of this macro is the same as that of
87 except that a leading argument must be specified.
88 It is ignored, as are its children.
90 The syntax of this macro is the same as that of
92 except that a leading argument must be specified.
93 It is ignored, as are its children.
96 This macro is intended to have two arguments,
97 the name of the string to define and its content.
98 Currently, it is ignored including its arguments,
99 and the number of arguments is not checked.
101 The syntax of this macro is the same as that of
103 except that a leading argument must be specified.
104 It is ignored, as are its children.
108 half of an if/else conditional.
109 Pops a result off the stack of conditional evaluations pushed by
111 and uses it as its conditional.
112 If no stack entries are present (e.g., due to no prior
115 then false is assumed.
116 The syntax of this macro is similar to
118 except that the conditional is missing.
122 half of an if/else conditional.
123 The result of the conditional is pushed into a stack used by subsequent
126 which may be separated by any intervening input (or not exist at all).
127 Its syntax is equivalent to
130 Begins a conditional.
131 Right now, the conditional evaluates to true
132 if and only if it starts with the letter
134 indicating processing in
139 If a conditional is false, its children are not processed, but are
140 syntactically interpreted to preserve the integrity of the input
148 which may lead to interesting results, but
150 .D1 \&.if t \e .if t \e{\e
152 will continue to syntactically interpret to the block close of the final
154 Sub-conditionals, in this case, obviously inherit the truth value of
156 This macro has the following syntax:
158 .Bd -literal -offset indent -compact
163 .Bd -literal -offset indent -compact
167 .Bd -literal -offset indent -compact
172 .Bd -literal -offset indent -compact
177 COND is a conditional statement.
178 roff allows for complicated conditionals; mandoc is much simpler.
179 At this time, mandoc supports only
188 All other invocations are read up to the next end of line or space and
191 If the BODY section is begun by an escaped brace
193 scope continues until a closing-brace macro
195 If the BODY is not enclosed in braces, scope continues until the next
197 If the COND is followed by a BODY on the same line, whether after a
198 brace or not, then macros
200 begin with a control character.
201 It is generally more intuitive, in this case, to write
202 .Bd -literal -offset indent
209 than having the macro follow as
211 .D1 \&.if COND \e{ .foo
213 The scope of a conditional is always parsed, but only executed if the
214 conditional evaluates to true.
216 Note that text subsequent a
219 Furthermore, if an explicit closing sequence
221 is specified in a free-form line, the entire line is accepted within the
222 scope of the prior macro, not only the text preceding the close, with the
224 collapsing into a zero-width space.
227 Accepts the following syntax:
229 .Bd -literal -offset indent -compact
234 .Bd -literal -offset indent -compact
240 In the first case, input is ignored until a
242 macro is encountered on its own line.
243 In the second case, input is ignored until a
252 Do not use the escape
254 anywhere in the definition of END.
255 It causes very strange behaviour.
256 Furthermore, if you redefine a
262 the subsequent invocation of
264 will first signify the end of comment, then be invoked as a macro.
265 This behaviour really shouldn't be counted upon.
267 Remove a request, macro or string.
268 This macro is intended to have one argument,
269 the name of the request, macro or string to be undefined.
270 Currently, it is ignored including its arguments,
271 and the number of arguments is not checked.
274 A register is an arbitrary string value that defines some sort of state,
275 which influences parsing and/or formatting.
276 Its syntax is as follows:
278 .D1 Pf \. Sx \&nr Cm name value
282 may, at the moment, only be an integer.
285 is defined up to the next whitespace.
286 The following register
288 requests are recognised:
291 If set to a positive integer value, certain
293 macros will behave as if they were defined in the
296 Otherwise, this behaviour is unset (even if called within the
299 Note that invoking a new
301 section will unset this value.
304 Output character translation.
305 This macro is intended to have one argument,
306 consisting of an even number of characters.
307 Currently, it is ignored including its arguments,
308 and the number of arguments is not checked.
310 This section documents compatibility between mandoc and other other
311 troff implementations, at this time limited to GNU troff
315 refers to groff versions before the
318 .Pq somewhere between 1.15 and 1.19 .
326 is only compatible with OpenBSD's groff.
328 Historic groff did not accept white-space buffering the custom END tag
335 and family would print funny white-spaces with historic groff when
336 depending on next-line syntax.
341 reference was written by
342 .An Kristaps Dzonsons Aq kristaps@bsd.lv .