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