]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/doc/usd/21.troff/m2
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / doc / usd / 21.troff / m2
1 .\" Copyright (C) Caldera International Inc. 2001-2002.  All rights reserved.
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions are
5 .\" met:
6 .\"
7 .\" Redistributions of source code and documentation must retain the above
8 .\" copyright notice, this list of conditions and the following
9 .\" disclaimer.
10 .\"
11 .\" Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\"
15 .\" All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\"
18 .\" This product includes software developed or owned by Caldera
19 .\" International, Inc.  Neither the name of Caldera International, Inc.
20 .\" nor the names of other contributors may be used to endorse or promote
21 .\" products derived from this software without specific prior written
22 .\" permission.
23 .\"
24 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
25 .\" INTERNATIONAL, INC.  AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
26 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 .\" DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34 .\" OR OTHERWISE) RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
35 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .\"
37 .\"     @(#)m2  8.1 (Berkeley) 8/14/93
38 .\"
39 .\" $FreeBSD$
40 .tr |
41 .rm mx
42 .br
43 .mh
44 Line Length and Indenting
45 .pg
46 The maximum line length for fill mode may be set with \fBll\fR.
47 The indent may be set with \fBin\fR;
48 an indent applicable to \fIonly\fR the \fInext\fR output line may be set with \fBti\fR.
49 The line length includes indent space but \fInot\fR
50 page offset space.
51 The line-length minus the indent is the basis for centering with \fBce\fR.
52 The effect of \fBll\fR, \fBin\fR, or \fBti\fR
53 is delayed, if a partially collected line exists,
54 until after that line is output.
55 In fill mode the length of text on an output line is less than or equal to
56 the line length minus the indent.
57 The current line length and indent are available in registers \fB.l\fR and \fB.i\fR respectively.
58 The length of \fIthree-part titles\fR produced by \fBtl\fR
59 (see \(sc14) is \fIindependently\fR set by \fBlt\fR.
60 .h1
61 .bt
62 \fB&ll\fI|\(+-N\fR      6.5\|in previous        E,\fBm\fR       Line length is set to \(+-\fIN\fR.
63 In \*(TR the maximum (line-length)+(page-offset) is about 7.54 inches.
64 .bt
65 \fB&in\fI|\(+-N\fR      \fIN\(eq\^\fR0  previous        B,E,\fBm\fR     Indent is set to \fI\(+-N\fR.
66 The indent is prepended to each output line.
67 .bt
68 \fB&ti\fI|\(+-N\fR      -       ignored B,E,\fBm\fR     Temporary indent.
69 The \fInext\fR output text line will be indented a distance \fI\(+-N\fR
70 with respect to the current indent.
71 The resulting total indent may not be negative.
72 The current indent is not changed.
73 .mh
74 Macros, Strings, Diversion, and Position Traps
75 .sc
76 Macros and strings.
77 A \fImacro\fR is a named set of arbitrary \fIlines\fR that may be invoked by name or
78 with a \fItrap\fR.
79 A \fIstring\fR is a named string of \fIcharacters\fR,
80 \fInot\fR including a newline character,
81 that may be interpolated by name at any point.
82 Request, macro, and string names share the \fIsame\fR name list.
83 Macro and string names
84 may be one or two characters long and may usurp previously defined
85 request, macro, or string names.
86 Any of these entities may be renamed with \fBrn\fR
87 or removed with \fBrm\fR.
88 Macros are created by \fBde\fR and \fBdi\fR, and appended to by \fBam\fR and \fBda\fR;
89 \fBdi\fR and \fBda\fR cause normal output to be stored in a macro.
90 Strings are created by \fBds\fR and appended to by \fBas\fR.
91 A macro is invoked in the same way as a request;
92 a control line beginning \fB.\fIxx\fR will interpolate the contents of macro \fIxx\fR.
93 The remainder of the line may contain up to nine \fIarguments\fR.
94 The strings \fIx\fR and \fIxx\fR are interpolated at any desired point with
95 \fB\e\(**\fIx\fR and \fB\e\(**(\fIxx\fR respectively.
96 String references and macro invocations may be nested.
97 .sc
98 Copy mode input interpretation.
99 During the definition and extension
100 of strings and macros (not by diversion)
101 the input is read in \fIcopy mode\fR.
102 The input is copied without interpretation
103 \fIexcept\fR that:
104 .x1
105 .ds + \v'-.1m'\s-4\(bu\s+4\v'+.1m'
106 \(bu The contents of number registers indicated by \fB\en\fR are interpolated.
107 \(bu Strings indicated by \fB\e\(**\fR are interpolated.
108 \(bu Arguments indicated by \fB\e$\fR are interpolated.
109 \(bu Concealed newlines indicated by \fB\e\fR(newline) are eliminated.
110 \(bu Comments indicated by \fB\e"\fR are eliminated.
111 \(bu \fB\et\fR and \fB\ea\fR are interpreted as \s-1ASCII\s+1 horizontal tab and \s-1SOH\s+1 respectively (\(sc9).
112 \(bu \fB\e\e\fR is interpreted as \fB\e\fR.
113 \(bu \fB\e.\fR is interpreted as "\fB.\fR".
114 .x2
115 These interpretations can be suppressed by
116 prepending
117 a \fB\e\fR.
118 For example, since \fB\e\e\fR maps into a \fB\e\fR, \fB\e\en\fR will copy as \fB\en\fR which
119 will be interpreted as a number register indicator when the
120 macro or string is reread.
121 .sc
122 Arguments.
123 When a macro is invoked by name, the remainder of the line is
124 taken to contain up to nine arguments.
125 The argument separator is the space character, and arguments
126 may be surrounded by double-quotes to permit imbedded space characters.
127 Pairs of double-quotes may be imbedded in double-quoted arguments to
128 represent a single double-quote.
129 If the desired arguments won't fit on a line,
130 a concealed newline may be used to continue on the next line.
131 .pg
132 When a macro is invoked the \fIinput level\fR is \fIpushed down\fR and
133 any arguments available at the previous level become unavailable
134 until the macro is completely read and the previous level is restored.
135 A macro's own arguments can be interpolated at \fIany\fR point
136 within the macro with \fB\e$\fIN\fR, which interpolates the \fIN\fR\^th
137 argument
138 (1\(<=\fIN\fR\^\(<=9).
139 If an invoked argument doesn't exist,
140 a null string results.
141 For example, the macro \fIxx\fR may be defined by
142 .x1
143 .ft B
144 .ta .75i
145 &de xx  \e"begin definition
146 Today is \e\e$1 the \e\e$2.
147 &.      \e"end definition
148 .ft R
149 .x2
150 and called by
151 .x1
152 .ft B
153 &xx Monday 14th
154 .ft R
155 .x2
156 to produce the text
157 .x1
158 .ft B
159 Today is Monday the 14th.
160 .ft R
161 .x2
162 Note that the \fB\e$\fR
163 was concealed in the definition with a prepended \fB\e\fR.
164 The number of currently available
165 arguments is in the \fB.$\fR register.
166 .pg
167 No arguments are available at the top (non-macro) level
168 in this implementation.
169 Because string referencing is implemented
170 as an input-level push down,
171 no arguments are available from \fIwithin\fR a string.
172 No arguments are available within a trap-invoked macro.
173 .pg
174 Arguments are copied in \fIcopy mode\fR onto a stack
175 where they are available for reference.
176 The mechanism does not allow an argument to contain
177 a direct reference to a \fIlong\fR string
178 (interpolated at copy time) and it is advisable to
179 conceal string references (with an extra \fB\e\fR\|)
180 to delay interpolation until argument reference time.
181 .sc
182 Diversions.
183 Processed output may be diverted into a macro for purposes
184 such as footnote processing (see Tutorial \(scT5)
185 or determining the horizontal and vertical size of some text for
186 conditional changing of pages or columns.
187 A single diversion trap may be set at a specified vertical position.
188 The number registers \fBdn\fR and \fBdl\fR respectively contain the
189 vertical and horizontal size of the most
190 recently ended diversion.
191 Processed text that is diverted into a macro
192 retains the vertical size of each of its lines when reread
193 in \fInofill\fR mode
194 regardless of the current \fIV\fR.
195 Constant-spaced (\fBcs\fR) or emboldened (\fBbd\fR) text that is diverted
196 can be reread correctly only if these modes are again or still in effect
197 at reread time.
198 One way to do this is to imbed in the diversion the appropriate
199 \fBcs\fR or \fBbd\fR requests with the \fItransparent\fR
200 mechanism described in \(sc10.6.
201 .pg
202 Diversions may be nested
203 and certain parameters and registers
204 are associated
205 with the current diversion level
206 (the top non-diversion level may be thought of as the
207 0th diversion level).
208 These are the diversion trap and associated macro,
209 no-space mode,
210 the internally-saved marked place (see \fBmk\fR and \fBrt\fR),
211 the current vertical place (\fB.d\fR register),
212 the current high-water text base-line (\fB.h\fR register),
213 and the current diversion name (\fB.z\fR register).
214 .sc
215 Traps.
216 Three types of trap mechanisms are available\(empage traps, a diversion trap, and
217 an input-line-count trap.
218 Macro-invocation traps may be planted using \fBwh\fR at any page position including the top.
219 This trap position may be changed using \fBch\fR.
220 Trap positions at or below the bottom of the page
221 have no effect unless or until
222 moved to within the page or rendered effective by an increase in page length.
223 Two traps may be planted at the \fIsame\fR position only by first planting them at different
224 positions and then moving one of the traps;
225 the first planted trap will conceal the second unless and until the first one is moved
226 (see Tutorial Examples \(scT5).
227 If the first one is moved back, it again conceals the second trap.
228 The macro associated with a page trap is automatically
229 invoked when a line of text is output whose vertical size \fIreaches\fR
230 or \fIsweeps past\fR the trap position.
231 Reaching the bottom of a page springs the top-of-page trap, if any,
232 provided there is a next page.
233 The distance to the next trap position is available in the \fB.t\fR register;
234 if there are no traps between the current position and the bottom of the page,
235 the distance returned is the distance to the page bottom.
236 .pg
237 A macro-invocation trap effective in the current diversion may be planted using \fBdt\fR.
238 The \fB.t\fR register works in a diversion; if there is no subsequent trap a \fIlarge\fR
239 distance is returned.
240 For a description of input-line-count traps, see the \fBit\fR request below.
241 .h1
242 .bt
243 \fB&de\fI|xx|yy\fR      -       \fI.yy=\fB..\fR -       Define or redefine the macro \fIxx\fR.
244 The contents of the macro begin on the next input line.
245 Input lines are copied in \fIcopy mode\fR until the definition is terminated by a
246 line beginning with \fB.\fIyy\fR,
247 whereupon the macro \fIyy\fR is called.
248 In the absence of \fIyy\fR, the definition
249 is terminated by a
250 line beginning with "\fB..\fR".
251 A macro may contain \fBde\fR requests
252 provided the terminating macros differ
253 or the contained definition terminator is concealed.
254 \&"\fB..\fR" can be concealed as
255 \fB\e\e..\fR which will copy as \fB\e..\fR and be reread as "\fB..\fR".
256 .bt
257 \fB&am\fI|xx|yy\fR      -       \fI.yy=\fB..\fR -       Append to macro (append version of \fBde\fR).
258 .bt
259 \fB&ds\fI|xx|string\fR  -       ignored -       Define a string
260 \fIxx\fR containing \fIstring\fR.
261 Any initial double-quote in \fIstring\fR is stripped off to permit
262 initial blanks.
263 .bt
264 \fB&as\fI|xx|string\fR  -       ignored -       Append
265 \fIstring\fR to string \fIxx\fR
266 (append version of \fBds\fR).
267 .bt
268 \fB&rm\fI|xx\fR -       ignored -       Remove
269 request, macro, or string.
270 The name \fIxx\fR is removed from the name list and
271 any related storage space is freed.
272 Subsequent references will have no effect.
273 .bt
274 \fB&rn\fI|xx|yy\fR      -       ignored -       Rename request, macro, or string
275 \fIxx\fR to \fIyy\fR.
276 If \fIyy\fR exists, it is first removed.
277 .bt
278 \fB&di|\fIxx\fR -       end     D       Divert output to macro \fIxx\fR.
279 Normal text processing occurs during diversion
280 except that page offsetting is not done.
281 The diversion ends when the request \fBdi\fR or \fBda\fR is encountered without an argument;
282 extraneous
283 requests of this type should not appear when nested diversions are being used.
284 .bt
285 \fB&da|\fIxx\fR -       end     D       Divert, appending to \fIxx\fR
286 (append version of \fBdi\fR).
287 .bt
288 \fB&wh\fI|N|xx\fR       -       -       \fBv\fR Install
289 a trap to invoke \fIxx\fR at page position \fIN;\fR
290 a \fInegative N\fR will be interpreted with respect to the
291 page \fIbottom\fR.
292 Any macro previously planted at \fIN\fR is replaced by \fIxx\fR.
293 A zero \fIN\fR refers to the \fItop\fR of a page.
294 In the absence of \fIxx\fR, the first found trap at \fIN\fR, if any, is removed.
295 .bt
296 \fB&ch\fI|xx|N\fR       -       -       \fBv\fR Change
297 the trap position for macro \fIxx\fR to be \fIN\fR.
298 In the absence of \fIN\fR, the trap, if any, is removed.
299 .bt
300 \fB&dt\fI|N|xx\fR       -       off     D,\fBv\fR       Install a diversion trap
301 at position \fIN\fR in the \fIcurrent\fR diversion to invoke
302 macro \fIxx\fR.
303 Another \fBdt\fR will redefine the diversion trap.
304 If no arguments are given, the diversion trap is removed.
305 .bt
306 \fB&it\fI|N|xx\fR       -       off     E       Set an input-line-count trap
307 to invoke the macro \fIxx\fR after \fIN\fR lines of \fItext\fR input
308 have been read
309 (control or request lines don't count).
310 The text may be in-line text or
311 text interpolated by inline or trap-invoked macros.
312 .bt
313 \fB&em\fI|xx\fR none    none    -       The
314 macro \fIxx\fR will be invoked
315 when all input has ended.
316 The effect is the same as if the contents of \fIxx\fR had been at the end
317 of the last file processed.
318 .mh
319 Number Registers
320 .pg
321 A variety of parameters are available to the user as
322 predefined, named \fInumber registers\fR (see Summary and Index, page 7).
323 In addition, the user may define his own named registers.
324 Register names are one or two characters long and \fIdo not\fR conflict
325 with request, macro, or string names.
326 Except for certain predefined read-only registers,
327 a number register can be read, written, automatically
328 incremented or decremented, and interpolated
329 into the input in a variety of formats.
330 One common use of user-defined registers is to
331 automatically number sections, paragraphs, lines, etc.
332 A number register may be used any time numerical input is expected or desired
333 and may be used in numerical \fIexpressions\fR (\(sc1.4).
334 .pg
335 Number registers are created and modified using \fBnr\fR, which
336 specifies the name, numerical value, and the auto-increment size.
337 Registers are also modified, if accessed
338 with an auto-incrementing sequence.
339 If the registers \fIx\fR and \fIxx\fR both contain
340 \fIN\fR and have the auto-increment size \fIM\fR,
341 the following access sequences have the effect shown:
342 .TS
343 center box;
344 c2|c2|c
345 c2|c2|c
346 l2|c2|c
347 l2|c2|c
348 l2|l2|c.
349         Effect on       Value
350 Sequence        Register        Interpolated
351 _
352 \fB\en\fIx\fR   none    \fIN\fR
353 \fB\en(\fIxx\fR none    \fIN\fR
354 \fB\en+\fIx\fR  \fIx\fR incremented by \fIM\fR  \fIN+M\fR
355 \fB\en\-\fIx\fR \fIx\fR decremented by \fIM\fR  \fIN\-M\fR
356 \fB\en+(\fIxx\fR        \fIxx\fR incremented by \fIM\fR \fIN+M\fR
357 \fB\en\-(\fIxx\fR       \fIxx\fR decremented by \fIM\fR \fIN\-M\fR
358 .TE
359 When interpolated, a number register is converted to
360 decimal (default),
361 decimal with leading zeros,
362 lower-case Roman,
363 upper-case Roman,
364 lower-case sequential alphabetic,
365 or
366 upper-case sequential alphabetic
367 according to the format specified by \fBaf\fR.
368 .h1
369 .bt
370 \fB&nr\fI|R|\(+-N|M\fR  -       -       \fBu\fR \
371 The number register \fIR\fR is assigned the value \fI\(+-N\fR
372 with respect to the previous value, if any.
373 The increment for auto-incrementing is set to \fIM\fR.
374 .bt
375 \fB&af\fI|R|c\fR        arabic  -       -       Assign format \fIc\fR to register \fIR\fR.
376 The available formats are:
377 .TS
378 center box;
379 c2|c
380 c2|c
381 c2|l.
382         Numbering
383 Format  Sequence
384 _
385 \fB1\fR 0,1,2,3,4,5,...
386 \fB001\fR       000,001,002,003,004,005,...
387 \fBi\fR 0,i,ii,iii,iv,v,...
388 \fBI\fR 0,I,II,III,IV,V,...
389 \fBa\fR 0,a,b,c,...,z,aa,ab,...,zz,aaa,...
390 \fBA\fR 0,A,B,C,...,Z,AA,AB,...,ZZ,AAA,...
391 .TE
392 An arabic format having \fIN\fR digits
393 specifies a field width of \fIN\fR digits (example 2 above).
394 The read-only registers and the \fIwidth\fR function (\(sc11.2)
395 are always arabic.
396 .bt
397 \fB&rr\fI|R\fR  -       ignored -       Remove register \fIR\fR.
398 If many registers are being created dynamically, it
399 may become necessary to remove no longer used registers
400 to recapture internal storage space for newer registers.