BSD 4_3_Reno release
[unix-history] / usr / src / share / doc / usd / 27.eqnguide / g2
CommitLineData
95f51977 1.\" @(#)g2 6.1 (Berkeley) 5/22/86
40ab3b5a
KD
2.\"
3.SC "Size and Font Changes"
4.PP
5By default, equations are set in 10-point type (the same size as this guide),
6with standard mathematical conventions
7to determine what characters are in roman and what in italic.
8Although
9.UC EQN
10makes a valiant attempt to use
11esthetically pleasing sizes and fonts,
12it is not perfect.
13To change sizes and fonts, use
14.ul
15size n
16and
17.ul
18roman, italic,
19.ul
20bold
21and
22.ul
23fat.
24Like
25.ul
26sub
27and
28.ul
29sup,
30size
31and font changes affect only the thing that follows
32them, and revert to the normal situation
33at the end of it. Thus
34.P1
35bold x y
36.P2
37is
38.EQ
39bold x y
40.EN
41and
42.P1
43size 14 bold x = y +
44 size 14 {alpha + beta}
45.P2
46gives
47.EQ
48size 14 bold x = y +
49 size 14 {alpha + beta}
50.EN
51As always, you can use braces if you want to affect something
52more complicated than a single letter.
53For example, you can change the size of an entire equation by
54.P1
55size 12 { ... }
56.P2
57.PP
58Legal sizes which may follow
59.ul
60size
61are
626, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 28, 36.
63You can also change the size
64.ul
65by
66a given amount;
67for example, you can say
68.ul
69size~+2
70to make the size two points bigger,
71or
72.ul
73size~\(mi3
74to make it three points smaller.
75This has the advantage that you don't have
76to know what the current size is.
77.PP
78If you are using fonts other than roman, italic and bold,
79you can say
80.ul
81font X
82where
83.ul
84X
85is a one character
86.UC TROFF
87name or number for the font.
88Since
89.UC EQN
90is tuned for roman, italic and bold,
91other fonts may not give quite as good an appearance.
92.PP
93The
94.ul
95fat
96operation takes the current font and widens it by overstriking:
97.ul
98fat\ grad
99is
100$fat grad$ and
101.ul
102fat {x sub i}
103is
104$fat {x sub i}$.
105.PP
106If an entire document is to be in a non-standard size
107or font, it is a severe nuisance
108to have to write out a size and font change for each
109equation.
110Accordingly, you can set a ``global'' size or font
111which thereafter affects all equations.
112At the beginning of any equation, you might say, for instance,
113.P1
114^EQ
115gsize 16
116gfont R
117 ...
118^EN
119.P2
120to set the size to 16 and the font to roman thereafter.
121In place of R, you can use any of the
122.UC TROFF
123font names.
124The size after
125.ul
126gsize
127can be a relative change with + or \(mi.
128.PP
129Generally,
130.ul
131gsize
132and
133.ul
134gfont
135will appear at the beginning of a document
136but they can also appear
137thoughout a document: the global font and size
138can be changed as often as needed.
139For example, in a footnote\(dd
140.FS
141\(ddLike this one, in which we have a
142$gsize -2$few random
143expressions like $x sub i$ and $pi sup 2$.
144The sizes for these were set by the command
145.ul
146gsize~\(mi2.
147.FE $gsize +2$
148you will typically want the size of equations to match
149the size of the footnote text, which is two points smaller
150than the main text.
151Don't forget to reset the global size
152at the end of the footnote.
153.SC "Diacritical Marks"
154.PP
155To get funny marks on top of letters,
156there are several words:
157.P1
158.tr ^^
159.tr ~~
160.ta 1i
161x dot $x dot$
162x dotdot $x dotdot$
163x hat $x hat$
164x tilde $x tilde$
165x vec $x vec$
166x dyad $x dyad$
167x bar $x bar$
168x under $x under$
169.P2
170The diacritical mark is placed at the right height.
171The
172.ul
173bar
174and
175.ul
176under
177are made the right length for the entire construct,
178as in $x+y+z bar$;
179other marks are centered.
180.SC "Quoted Text"
181.PP
182Any input entirely within quotes (\|"..."\|)
183is not subject to any of the font changes and spacing
184adjustments normally done by the equation setter.
185This provides a way to do your own spacing and adjusting if needed:
186.P1
187italic "sin(x)" + sin (x)
188.P2
189is
190.EQ
191italic "sin(x)" + sin (x)
192.EN
193.PP
194Quotes are also used to get braces and other
195.UC EQN
196keywords printed:
197.P1
198"{ size alpha }"
199.P2
200is
201.EQ
202"{ size alpha }"
203.EN
204and
205.P1
206roman "{ size alpha }"
207.P2
208is
209.EQ
210roman "{ size alpha }"
211.EN
212.PP
213The construction "" is often used as a place-holder
214when grammatically
215.UC EQN
216needs something, but you don't actually want anything in your output.
217For example, to make
218$"" sup 2 roman He$,
219you can't just type
220.ul
221sup 2 roman He
222because a
223.ul
224sup
225has to be a superscript
226.ul
227on
228something.
229Thus you must say
230.P1
231"" sup 2 roman He
232.P2
233.PP
234To get a literal quote
235use ``\\"''.
236.UC TROFF
237characters like
238.ul
239\e(bs
240can appear unquoted, but more complicated things like
241horizontal and vertical motions with
242.ul
243\eh
244and
245.ul
246\ev
247should
248always
249be quoted.
250(If you've never heard of
251.ul
252\\h
253and
254.ul
255\\v,
256ignore this section.)
257.SC "Lining Up Equations"
258.PP
259Sometimes it's necessary to line up a series of equations
260at some horizontal position, often at an equals sign.
261This is done with two operations called
262.ul
263mark
264and
265.ul
266lineup.
267.PP
268The word
269.ul
270mark
271may appear once at any place in an equation.
272It remembers the horizontal position where it appeared.
273Successive equations can contain one occurrence of the word
274.ul
275lineup.
276The place where
277.ul
278lineup
279appears is made to line up
280with the place marked by the previous
281.ul
282mark
283if at all possible.
284Thus, for example,
285you can say
286.P1
287^EQ I
288x+y mark = z
289^EN
290^EQ I
291x lineup = 1
292^EN
293.P2
294to produce
295.EQ I
296x+y mark = z
297.EN
298.EQ I
299x lineup = 1
300.EN
301For reasons too complicated to talk about,
302when you use
303.UC EQN
304and
305`\(mims',
306use either
307.UC .EQ\ I
308or
309.UC .EQ\ L .
310mark
311and
312.ul
313lineup
314don't work with centered equations.
315Also bear in mind that
316.ul
317mark
318doesn't look ahead;
319.P1
320x mark =1
321 ...
322x+y lineup =z
323.P2
324isn't going to work, because there isn't room
325for the
326.ul
327x+y
328part after the
329.ul
330mark
331remembers where the
332.ul
333x
334is.
335.SC "Big Brackets, Etc."
336.PP
337.tr ~
338To get big brackets [~],
339braces {~}, parentheses (~), and bars |~|
340around things, use the
341.ul
342left
343and
344.ul
345right
346commands:
347.tr ~~
348.P1
349left { a over b + 1 right }
350 ~=~ left ( c over d right )
351 + left [ e right ]
352.P2
353is
354.EQ
355left { a over b + 1 right } ~=~ left ( c over d right ) + left [ e right ]
356.EN
357The resulting brackets are made big enough to cover whatever they enclose.
358Other characters can be used besides these,
359but the are not likely to look very good.
360One exception is the
361.ul
362floor
363and
364.ul
365ceiling
366characters:
367.P1
368left floor x over y right floor
369<= left ceiling a over b right ceiling
370.P2
371produces
372.EQ
373left floor x over y right floor
374<= left ceiling a over b right ceiling
375.EN
376.PP
377Several warnings about brackets are in order.
378First, braces are typically bigger than brackets and parentheses,
379because they are made up of three, five, seven, etc., pieces,
380while brackets can be made up of two, three, etc.
381Second, big left and right parentheses often look poor,
382because the character set is poorly designed.
383.PP
384The
385.ul
386right
387part may be omitted:
388a ``left something'' need not have a
389corresponding
390``right
391something''.
392If the
393.ul
394right
395part is omitted,
396put braces around the thing you want the left bracket
397to encompass.
398Otherwise, the resulting brackets may be too large.
399.PP
400If you want to omit the
401.ul
402left
403part, things are more complicated,
404because technically you can't have a
405.ul
406right
407without a corresponding
408.ul
409left.
410Instead you have to say
411.P1
412left "" ..... right )
413.P2
414for example.
415The
416.ul
417left ""
418means a ``left nothing''.
419This satisfies the rules without hurting your output.
420.SC "Piles"
421.PP
422There is a general facility for making vertical piles
423of things; it comes in several flavors.
424For example:
425.P1
426.tr ~~
427A ~=~ left [
428 pile { a above b above c }
429 ~~ pile { x above y above z }
430right ]
431.P2
432will make
433.EQ
434A ~=~ left [
435pile { a above b above c } ~~ pile { x above y above z }
436right ]
437.EN
438The elements of the pile (there can be as many as you want)
439are centered one above another, at the right height for
440most purposes.
441The keyword
442.ul
443above
444is used to separate the pieces;
445braces are used around the entire list.
446The elements of a pile can be as complicated as needed, even containing more piles.
447.PP
448Three other forms of pile exist:
449.ul
450lpile
451makes a pile with the elements left-justified;
452.ul
453rpile
454makes a right-justified pile;
455and
456.ul
457cpile
458makes a centered pile, just like
459.ul
460pile.
461The vertical spacing between the pieces
462is somewhat larger for
463.ul
464l-,
465.ul
466r-
467and
468.ul
469cpiles
470than it is for ordinary piles.
471.P1 2
472roman sign (x)~=~
473left {
474 lpile {1 above 0 above -1}
475 ~~ lpile
476 {if~x>0 above if~x=0 above if~x<0}
477.P2
478makes
479.EQ
480roman sign (x)~=~
481left {
482 lpile {1 above 0 above -1}
483 ~~ lpile
484 {if~x>0 above if~x=0 above if~x<0}
485.EN
486Notice the left brace
487without a matching right one.
488.SC Matrices
489.PP
490It is also possible to make matrices.
491For example, to make
492a neat array like
493.EQ
494matrix {
495 ccol { x sub i above y sub i }
496 ccol { x sup 2 above y sup 2 }
497}
498.EN
499you have to type
500.P1
501matrix {
502 ccol { x sub i above y sub i }
503 ccol { x sup 2 above y sup 2 }
504}
505.P2
506This produces a matrix with
507two centered columns.
508The elements of the columns are then listed just as for a pile,
509each element separated by the word
510.ul
511above.
512You can also use
513.ul
514lcol
515or
516.ul
517rcol
518to left or right adjust columns.
519Each column can be separately adjusted,
520and there can be as many columns as you like.
521.PP
522The reason for using a matrix instead of two adjacent piles, by the way,
523is that if the elements of the piles don't all have the same height,
524they won't line up properly.
525A matrix forces them to line up,
526because it looks at the entire structure before deciding what
527spacing to use.
528.PP
529A word of warning about matrices _
530.ul
531each column must have the same number of elements in it.
532The world will end if you get this wrong.