1 .\" $Id: roff.7,v 1.9 2010/06/10 21:42:02 kristaps Exp $
3 .\" Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
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: June 10 2010 $
22 .Nd roff language reference
26 language is a general-purpose text-formatting language. The purpose of
27 this document is to consistently describe those language constructs
30 utility. It is a work in progress.
34 document follows simple rules: lines beginning with the control
39 are parsed for macros. Other lines are interpreted within the scope of
41 .Bd -literal -offset indent
42 \&.xx Macro lines change control state.
43 Other lines are interpreted within the current state.
47 documents may contain only graphable 7-bit ASCII characters, the space
48 character, and, in certain circumstances, the tab character. All
53 Macros are arbitrary in length and begin with a control character ,
57 at the beginning of the line.
58 An arbitrary amount of whitespace may sit between the control character
60 Thus, the following are equivalent:
61 .Bd -literal -offset indent
66 This section is a canonical reference of all macros, arranged
69 The syntax of this macro is the same as that of
71 except that a leading argument must be specified.
72 It is ignored, as are its children.
74 The syntax of this macro is the same as that of
76 except that a leading argument must be specified.
77 It is ignored, as are its children.
79 The syntax of this macro is the same as that of
81 except that a leading argument must be specified.
82 It is ignored, as are its children.
84 The syntax of this macro is the same as that of
86 except that a leading argument must be specified.
87 It is ignored, as are its children.
89 The syntax of this macro is the same as that of
91 except that a leading argument must be specified.
92 It is ignored, as are its children.
95 This macro is intended to have two arguments,
96 the name of the string to define and its content.
97 Currently, it is ignored including its arguments,
98 and the number of arguments is not checked.
100 The syntax of this macro is the same as that of
102 except that a leading argument must be specified.
103 It is ignored, as are its children.
107 half of an if/else conditional.
108 Pops a result off the stack of conditional evaluations pushed by
110 and uses it as its conditional.
111 If no stack entries are present (e.g., due to no prior
114 then false is assumed.
115 The syntax of this macro is similar to
117 except that the conditional is missing.
121 half of an if/else conditional.
122 The result of the conditional is pushed into a stack used by subsequent
125 which may be separated by any intervening input (or not exist at all).
126 Its syntax is equivalent to
129 Begins a conditional.
130 Right now, the conditional evaluates to true
131 if and only if it starts with the letter
133 indicating processing in
138 If a conditional is false, its children are not processed, but are
139 syntactically interpreted to preserve the integrity of the input
147 which may lead to interesting results, but
149 .D1 \&.if t \e .if t \e{\e
151 will continue to syntactically interpret to the block close of the final
153 Sub-conditionals, in this case, obviously inherit the truth value of
155 This macro has the following syntax:
157 .Bd -literal -offset indent -compact
162 .Bd -literal -offset indent -compact
166 .Bd -literal -offset indent -compact
171 .Bd -literal -offset indent -compact
176 COND is a conditional statement.
177 roff allows for complicated conditionals; mandoc is much simpler.
178 At this time, mandoc supports only
187 All other invocations are read up to the next end of line or space and
190 If the BODY section is begun by an escaped brace
192 scope continues until a closing-brace macro
194 If the BODY is not enclosed in braces, scope continues until the next
196 If the COND is followed by a BODY on the same line, whether after a
197 brace or not, then macros
199 begin with a control character.
200 It is generally more intuitive, in this case, to write
201 .Bd -literal -offset indent
208 than having the macro follow as
210 .D1 \&.if COND \e{ .foo
212 The scope of a conditional is always parsed, but only executed if the
213 conditional evaluates to true.
215 Note that text subsequent a
218 Furthermore, if an explicit closing sequence
220 is specified in a free-form line, the entire line is accepted within the
221 scope of the prior macro, not only the text preceding the close, with the
223 collapsing into a zero-width space.
226 Accepts the following syntax:
228 .Bd -literal -offset indent -compact
233 .Bd -literal -offset indent -compact
239 In the first case, input is ignored until a
241 macro is encountered on its own line.
242 In the second case, input is ignored until a
251 Do not use the escape
253 anywhere in the definition of END.
254 It causes very strange behaviour.
255 Furthermore, if you redefine a
261 the subsequent invocation of
263 will first signify the end of comment, then be invoked as a macro.
264 This behaviour really shouldn't be counted upon.
266 Remove a request, macro or string.
267 This macro is intended to have one argument,
268 the name of the request, macro or string to be undefined.
269 Currently, it is ignored including its arguments,
270 and the number of arguments is not checked.
272 Output character translation.
273 This macro is intended to have one argument,
274 consisting of an even number of characters.
275 Currently, it is ignored including its arguments,
276 and the number of arguments is not checked.
278 This section documents compatibility between mandoc and other other
279 troff implementations, at this time limited to GNU troff
283 refers to groff versions before the
286 .Pq somewhere between 1.15 and 1.19 .
290 Historic groff did not accept white-space buffering the custom END tag
297 and family would print funny white-spaces with historic groff when
298 depending on next-line syntax.
303 reference was written by
304 .An Kristaps Dzonsons Aq kristaps@bsd.lv .