]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/doc/usd/22.trofftut/tt06
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / share / doc / usd / 22.trofftut / tt06
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).
4 .\"
5 .\"     @(#)tt06        8.1 (Berkeley) 6/8/93
6 .\" Copyright (C) Caldera International Inc. 2001-2002.  All rights reserved.
7 .\" 
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions are
10 .\" met:
11 .\" 
12 .\" Redistributions of source code and documentation must retain the above
13 .\" copyright notice, this list of conditions and the following
14 .\" disclaimer.
15 .\" 
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.
19 .\" 
20 .\" All advertising materials mentioning features or use of this software
21 .\" must display the following acknowledgement:
22 .\" 
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
27 .\" permission.
28 .\" 
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.
41 .\" 
42 .\" $FreeBSD$
43 .\"
44 .NH
45 Local Motions: Drawing lines and characters
46 .PP
47 Remember `Area = \(*pr\u2\d' and the big `P'
48 in the Paternoster.
49 How are they done?
50 .UL troff
51 provides a host of commands for placing characters of any size
52 at any place.
53 You can use them to draw special characters 
54 or to tune your output for a particular appearance.
55 Most of these commands are straightforward, but messy to read
56 and tough to type correctly.
57 .PP
58 If you won't use 
59 .UL eqn ,
60 subscripts and superscripts are most easily done with
61 the half-line local motions
62 .BD \eu
63 and
64 .BD \ed .
65 To go back up the page half a point-size, insert a
66 .BD \eu
67 at the desired place;
68 to go down, insert a
69 .BD \ed .
70 .BD \eu \& (
71 and
72 .BD \ed
73 should always
74 be used in pairs, as explained below.)
75 Thus
76 .P1
77 Area = \e(*pr\eu2\ed
78 .P2
79 produces
80 .P1
81 Area = \(*pr\u2\d
82 .P2
83 To make the `2' smaller, bracket it with
84 .BD \es\-2...\es0 .
85 Since
86 .BD \eu
87 and
88 .BD \ed
89 refer to the current point size,
90 be sure to put them either both inside or both outside
91 the size changes,
92 or you will get an unbalanced vertical motion.
93 .PP
94 Sometimes the space given by
95 .BD \eu
96 and
97 .BD \ed
98 isn't the right amount.
99 The 
100 .BD \ev
101 command can be used to request an arbitrary amount of vertical motion.
102 The in-line command
103 .P1
104 \ev'(amount)'
105 .P2
106 causes motion up or down the page by the amount specified in
107 `(amount)'.
108 For example, to move the `P' down, we used
109 .P1 2
110 .ta 1i
111 ^in +0.6i       (move paragraph in)
112 ^ll \-0.3i      (shorten lines)
113 ^ti \-0.3i      (move P back)
114 \ev'2'\es36P\es0\ev'\-2'ater noster qui est
115 in caelis ...
116 .P2
117 A minus sign causes upward motion, while
118 no sign or a plus sign means down the page.
119 Thus
120 .BD \ev\(fm\-2\(fm
121 causes an upward vertical motion 
122 of two line spaces.
123 .PP
124 There are many other ways to specify the amount of motion _
125 .P1
126 \ev'0.1i'
127 \ev'3p'
128 \ev'\-0.5m'
129 .P2
130 and so on are all legal.
131 Notice that the scale specifier
132 .BD i
133 or
134 .BD p
135 or
136 .BD m
137 goes inside the quotes.
138 Any character can be used in place of the quotes;
139 this is also true of all other
140 .UL troff
141 commands described in this section.
142 .PP
143 Since
144 .UL troff
145 does not take within-the-line vertical motions into account
146 when figuring out where it is on the page,
147 output lines can have unexpected positions
148 if the left and right ends aren't at the same
149 vertical position.
150 Thus
151 .BD \ev ,
152 like
153 .BD \eu
154 and
155 .BD \ed ,
156 should always balance upward vertical motion in a line with
157 the same amount in the downward direction.
158 .PP
159 Arbitrary horizontal motions are also available _
160 .BD \eh
161 is quite analogous to
162 .BD \ev ,
163 except that the default scale factor is ems instead of line spaces.
164 As an example,
165 .P1
166 \eh'\-0.1i'
167 .P2
168 causes a backwards motion of a tenth of an inch.
169 As a practical matter, consider printing the mathematical symbol
170 `>>'.
171 The default spacing is too wide, so
172 .UL eqn
173 replaces this by
174 .P1
175 >\eh'\-0.3m'>
176 .P2
177 to produce >\h'-.3m'>.
178 .PP
179 Frequently
180 .BD \eh
181 is used with the `width function'
182 .BD \ew
183 to generate motions equal to the width
184 of some character string.
185 The construction
186 .P1
187 \ew'thing'
188 .P2
189 is a number equal to the width of `thing' in machine units
190 (1/432 inch).
191 All
192 .UL troff
193 computations are ultimately done in these units.
194 To move horizontally the width of an `x',
195 we can say
196 .P1
197 \eh'\ew'x'u'
198 .P2
199 As we mentioned above,
200 the default scale factor for
201 all horizontal dimensions is
202 .BD m ,
203 ems, so here we must have the
204 .BD u
205 for machine units,
206 or the motion produced will be far too large.
207 .UL troff
208 is quite happy with the nested quotes, by the way,
209 so long as you don't leave any out.
210 .PP
211 As a live example of this kind of construction,
212 all of the command names in the text, like
213 .BD .sp ,
214 were done by overstriking with a slight offset.
215 The commands for
216 .BD .sp
217 are
218 .P1
219 ^sp\eh'\-\ew'.sp'u'\eh'1u'.sp
220 .P2
221 That is, put out `.sp', move left by the width of `.sp',
222 move right 1 unit, and print
223 `.sp' again.
224 (Of course there is a way to avoid typing that much input
225 for each command name, which we will discuss in Section 11.)
226 .WS
227 .PP
228 There are also several special-purpose
229 .UL troff
230 commands for local motion.
231 We have already seen
232 .BD \e0 ,
233 which is an unpaddable white space
234 of the same width as a digit.
235 `Unpaddable' means that it will never be widened
236 or split across a line by line justification and filling.
237 There is also
238 .BD \e (blank),
239 .tr ^^
240 which is an unpaddable character the width of a space,
241 .BD \e| ,
242 which is half that width,
243 .BD \e^ ,
244 which is one quarter of the width of a space,
245 and
246 .BD \e& ,
247 which has zero width.
248 .tr ^.
249 (This last one is useful, for example, in entering
250 a text line which would otherwise begin with a `.'.)
251 .PP
252 The command
253 .BD \eo ,
254 used like
255 .P1
256 \eo'set of characters'
257 .P2
258 causes (up to 9)
259 characters to be overstruck,
260 centered on the widest.
261 This is nice for accents, as in
262 .P1 2
263 syst\eo"e\e(ga"me t\eo"e\e(aa"l\eo"e\e(aa"phonique
264 .P2
265 which makes
266 .P1
267 syst\o"e\(ga"me t\o"e\(aa"l\o"e\(aa"phonique
268 .P2
269 The accents are
270 .BD \e(ga
271 and
272 .BD \e(aa ,
273 or
274 .BD \e\` 
275 and
276 .BD \e\' ;
277 remember that each is just one character to
278 .UL troff .
279 .PP
280 You can make your own overstrikes with another special convention,
281 .BD \ez ,
282 the zero-motion command.
283 .BD \ezx
284 suppresses the normal horizontal motion
285 after printing the single character
286 .BD x ,
287 so another character can be laid on top of it.
288 Although sizes can be changed within
289 .BD \eo ,
290 it centers the characters on the widest,
291 and
292 there can be no horizontal or vertical motions,
293 so
294 .BD \ez
295 may be the only way to get what you want:
296 .P1
297 .sp 2
298 \s8\z\(sq\s14\z\(sq\s22\z\(sq\s36\(sq
299 .P2
300 is produced by
301 .P1
302 ^sp 2
303 \es8\ez\e(sq\es14\ez\e(sq\es22\ez\e(sq\es36\e(sq
304 .P2
305 The
306 .BD .sp
307 is needed to leave room for the result.
308 .PP
309 As another example, an extra-heavy semicolon
310 that looks like
311 .P1
312 \s+6\z,\v'-0.25m'.\v'0.25m'\s0  instead of  ;  or  \s+6;\s0
313 .P2
314 can be constructed with a big comma and a big period above it:
315 .P1
316 \es+6\ez,\ev'\(mi0.25m'.\ev'0.25m'\es0 
317 .P2
318 `0.25m' is an experimentally-derived constant.
319 .PP
320 A more ornate overstrike is given by the bracketing function
321 .BD \eb ,
322 which piles up characters vertically,
323 centered on the current baseline.
324 Thus we can get big brackets,
325 constructing them with piled-up smaller pieces:
326 .P1
327 .sp
328 .ne 3
329 \b'\(lt\(lk\(lb' \b'\(lc\(lf' x \b'\(rc\(rf' \b'\(rt\(rk\(rb'
330 .sp
331 .P2
332 by typing in only this:
333 .P1 0
334 \&^sp
335 \eb\(fm\e(lt\e(lk\e(lb\(fm \eb\(fm\e(lc\e(lf\(fm x \eb\(fm\e(rc\e(rf\(fm \eb\(fm\e(rt\e(rk\e(rb\(fm
336 .P2
337 .PP
338 .UL troff
339 also provides a convenient facility for drawing horizontal and vertical
340 lines of arbitrary length with arbitrary characters.
341 .BD \el\(fm1i\(fm
342 draws a line one inch long, like this:
343 \l'1i'\|.
344 The length can be followed by
345 the character to use if the \(ru isn't appropriate;
346 .BD \el\(fm0.5i.\(fm
347 draws a half-inch line of dots: \l'.5i.'.
348 The construction
349 .BD \eL
350 is entirely analogous,
351 except that it draws a vertical line instead of horizontal.