1 .\" This module is believed to contain source code proprietary to AT&T.
2 .\" Use and redistribution is subject to the Berkeley Software License
3 .\" Agreement and your Software Agreement with AT&T (Western Electric).
5 .\" @(#)tt08 8.1 (Berkeley) 6/8/93
6 .\" Copyright (C) Caldera International Inc. 2001-2002. All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions are
12 .\" Redistributions of source code and documentation must retain the above
13 .\" copyright notice, this list of conditions and the following
16 .\" Redistributions in binary form must reproduce the above copyright
17 .\" notice, this list of conditions and the following disclaimer in the
18 .\" documentation and/or other materials provided with the distribution.
20 .\" All advertising materials mentioning features or use of this software
21 .\" must display the following acknowledgement:
23 .\" This product includes software developed or owned by Caldera
24 .\" International, Inc. Neither the name of Caldera International, Inc.
25 .\" nor the names of other contributors may be used to endorse or promote
26 .\" products derived from this software without specific prior written
29 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
30 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
31 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 .\" DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
34 .\" FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39 .\" OR OTHERWISE) RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
40 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 Introduction to Macros
47 Before we can go much further in
49 we need to learn a bit about the
52 In its simplest form, a macro is just a shorthand notation
53 quite similar to a string.
54 Suppose we want every paragraph to start
55 in exactly the same way _
56 with a space and a temporary indent of two ems:
61 Then to save typing, we would like to collapse these into
69 that would be treated by
96 The first line names the macro
100 and upper case so it wouldn't conflict with
107 marks the end of the definition.
108 In between is the text,
109 which is simply inserted whenever
117 can contain any mixture of text and formatting commands.
121 has to precede its first use;
122 undefined macros are simply ignored.
123 Names are restricted to one or two characters.
125 Using macros for commonly occurring sequences of commands
126 is critically important.
127 Not only does it save typing,
128 but it makes later changes much easier.
129 Suppose we decide that the paragraph indent is too small,
130 the vertical space is much too big,
131 and roman font should be forced.
132 Instead of changing the whole document,
133 we need only change the definition of
138 ^de PP \e" paragraph macro
145 effect everywhere we used
151 command that causes the rest of the line to be ignored.
152 We use it here to add comments to the macro
154 (a wise idea once definitions get complicated).
156 As another example of macros,
157 consider these two which start and end a block of offset,
158 unfilled text, like most of the examples in this paper:
160 ^de BS \e" start indented block
165 ^de BE \e" end indented block
171 Now we can surround text like
182 and it will come out as it did above.
183 Notice that we indented by
187 This way we can nest our uses of
191 to get blocks within blocks.
193 If later on we decide that the indent
194 should be 0.5i, then it is only necessary to
195 change the definitions of