Commit | Line | Data |
---|---|---|
220e3522 BK |
1 | .SC "A Large Example" |
2 | .PP | |
3 | Here is the complete source for the three display equations | |
4 | in the abstract of this guide. | |
5 | .sp | |
6 | .nf | |
7 | .ps -2 | |
8 | .vs -2 | |
9 | .EQ I | |
10 | G(z)~mark =~ e sup { ln ~ G(z) } | |
11 | ~=~ exp left ( | |
12 | sum from k>=1 {S sub k z sup k} over k right ) | |
13 | ~=~ prod from k>=1 e sup {S sub k z sup k /k} | |
14 | .EN | |
15 | .EQ I | |
16 | lineup = left ( 1 + S sub 1 z + | |
17 | { S sub 1 sup 2 z sup 2 } over 2! + ... right ) | |
18 | left ( 1+ { S sub 2 z sup 2 } over 2 | |
19 | + { S sub 2 sup 2 z sup 4 } over { 2 sup 2 cdot 2! } | |
20 | + ... right ) ... | |
21 | .EN | |
22 | .EQ I | |
23 | lineup = sum from m>=0 left ( | |
24 | sum from | |
25 | pile { k sub 1 ,k sub 2 ,..., k sub m >=0 | |
26 | above | |
27 | k sub 1 +2k sub 2 + ... +mk sub m =m} | |
28 | { S sub 1 sup {k sub 1} } over {1 sup k sub 1 k sub 1 ! } ~ | |
29 | { S sub 2 sup {k sub 2} } over {2 sup k sub 2 k sub 2 ! } ~ | |
30 | ... | |
31 | { S sub m sup {k sub m} } over {m sup k sub m k sub m ! } | |
32 | right ) z sup m | |
33 | .EN | |
34 | .sp | |
35 | .fi | |
36 | .ps +2 | |
37 | .vs +2 | |
38 | .SC "Keywords, Precedences, Etc." | |
39 | .PP | |
40 | If you don't use braces, | |
41 | .UC EQN | |
42 | will | |
43 | do operations in the order shown in this list. | |
44 | .P1 3 | |
45 | .ft I | |
46 | dyad vec under bar tilde hat dot dotdot | |
47 | fwd back down up | |
48 | fat roman italic bold size | |
49 | sub sup sqrt over | |
50 | from to | |
51 | .ft R | |
52 | .P2 | |
53 | These operations group to the left: | |
54 | .P1 | |
55 | .ft I | |
56 | over sqrt left right | |
57 | .ft R | |
58 | .P2 | |
59 | All others group to the right. | |
60 | .PP | |
61 | Digits, parentheses, brackets, punctuation marks, and these mathematical words | |
62 | are converted | |
63 | to Roman font when encountered: | |
64 | .P1 | |
65 | sin cos tan sinh cosh tanh arc | |
66 | max min lim log ln exp | |
67 | Re Im and if for det | |
68 | .P2 | |
69 | These character sequences are recognized and translated as shown. | |
70 | .sp | |
71 | .nf | |
72 | .tr -\(mi | |
73 | .in .5i | |
74 | .ta 1i | |
75 | >= $>=$ | |
76 | <= $<=$ | |
77 | == $==$ | |
78 | != $!=$ | |
79 | +- $+-$ | |
80 | -> $->$ | |
81 | <- $<-$ | |
82 | << $<<$ | |
83 | >> $>>$ | |
84 | inf $inf$ | |
85 | partial $partial$ | |
86 | half $half$ | |
87 | prime $prime$ | |
88 | approx $approx$ | |
89 | nothing $nothing$ | |
90 | cdot $cdot$ | |
91 | times $times$ | |
92 | del $del$ | |
93 | grad $grad$ | |
94 | \&... $...$ | |
95 | ,..., $,...,$ | |
96 | sum $sum$ | |
97 | .sp 3p | |
98 | int $int$ | |
99 | .sp 2p | |
100 | prod $prod$ | |
101 | union $union$ | |
102 | inter $inter$ | |
103 | .sp | |
104 | .in | |
105 | .fi | |
106 | .tr -- | |
107 | .PP | |
108 | To obtain Greek letters, | |
109 | simply spell them out in whatever case you want: | |
110 | .sp | |
111 | .nf | |
112 | .in .2i | |
113 | .ta .7i 1.4i 2.1i | |
114 | DELTA $DELTA$ iota $iota$ | |
115 | GAMMA $GAMMA$ kappa $kappa$ | |
116 | LAMBDA $LAMBDA$ lambda $lambda$ | |
117 | OMEGA $OMEGA$ mu $mu$ | |
118 | PHI $PHI$ nu $nu$ | |
119 | PI $PI$ omega $omega$ | |
120 | PSI $PSI$ omicron $omicron$ | |
121 | SIGMA $SIGMA$ phi $phi$ | |
122 | THETA $THETA$ pi $pi$ | |
123 | UPSILON $UPSILON$ psi $psi$ | |
124 | XI $XI$ rho $rho$ | |
125 | alpha $alpha$ sigma $sigma$ | |
126 | beta $beta$ tau $tau$ | |
127 | chi $chi$ theta $theta$ | |
128 | delta $delta$ upsilon $upsilon$ | |
129 | epsilon $epsilon$ xi $xi$ | |
130 | eta $eta$ zeta $zeta$ | |
131 | gamma $gamma$ | |
132 | .sp | |
133 | .in | |
134 | .fi | |
135 | .PP | |
136 | These are all the words known to | |
137 | .UC EQN | |
138 | (except for characters with names), | |
139 | together with the section where they are discussed. | |
140 | .sp | |
141 | .nf | |
142 | .in .2i | |
143 | .ta .7i 1.4i 2.1i | |
144 | above 17, 18 lpile 17 | |
145 | back 21 mark 15 | |
146 | bar 13 matrix 18 | |
147 | bold 12 ndefine 20 | |
148 | ccol 18 over 9 | |
149 | col 18 pile 17 | |
150 | cpile 17 rcol 18 | |
151 | define 20 right 16 | |
152 | delim 19 roman 12 | |
153 | dot 13 rpile 17 | |
154 | dotdot 13 size 12 | |
155 | down 21 sqrt 10 | |
156 | dyad 13 sub 7 | |
157 | fat 12 sup 7 | |
158 | font 12 tdefine 20 | |
159 | from 11 tilde 13 | |
160 | fwd 21 to 11 | |
161 | gfont 12 under 13 | |
162 | gsize 12 up 21 | |
163 | hat 13 vec 13 | |
164 | italic 12 ~, ^ 4, 6 | |
165 | lcol 18 { } 8 | |
166 | left 16 "..." 8, 14 | |
167 | lineup 15 | |
168 | .sp | |
169 | .in 0 | |
170 | .fi | |
171 | .SC Troubleshooting | |
172 | .PP | |
173 | If you make a mistake in an equation, | |
174 | like leaving out a brace (very common) | |
175 | or having one too many (very common) | |
176 | or having a | |
177 | .ul | |
178 | sup | |
179 | with nothing before it (common), | |
180 | .UC EQN | |
181 | will tell you with the message | |
182 | .P1 2 | |
183 | .ft I | |
184 | syntax error between lines x and y, file z | |
185 | .ft R | |
186 | .P2 | |
187 | where | |
188 | .ul | |
189 | x | |
190 | and | |
191 | .ul | |
192 | y | |
193 | are approximately the lines | |
194 | between which the trouble occurred, and | |
195 | .ul | |
196 | z | |
197 | is the name | |
198 | of the file in question. | |
199 | The line numbers are approximate _ look nearby as well. | |
200 | There are also self-explanatory messages that arise if you leave out a quote | |
201 | or try to run | |
202 | .UC EQN | |
203 | on a non-existent file. | |
204 | .PP | |
205 | If you want to check a document before actually printing it | |
206 | (on | |
207 | .UC UNIX | |
208 | only), | |
209 | .P1 | |
210 | eqn files >/dev/null | |
211 | .P2 | |
212 | will | |
213 | throw away the output but print the messages. | |
214 | .PP | |
215 | If you use something like dollar signs as delimiters, | |
216 | it is easy to leave one out. | |
217 | This causes very strange troubles. | |
218 | The program | |
219 | .ul | |
220 | checkeq | |
221 | (on | |
222 | .UC GCOS , | |
223 | use | |
224 | .ul | |
225 | \&./checkeq | |
226 | instead) | |
227 | checks for misplaced or missing dollar signs | |
228 | and similar troubles. | |
229 | .PP | |
230 | In-line equations can only be so big | |
231 | because of an internal buffer in | |
232 | .UC TROFF . | |
233 | If you get a message | |
234 | ``word overflow'', | |
235 | you have exceeded this limit. | |
236 | If you print the equation as a displayed equation | |
237 | this message will usually go away. | |
238 | The message | |
239 | ``line overflow'' | |
240 | indicates you have exceeded an even bigger buffer. | |
241 | The only cure for this is to break the equation into two separate ones. | |
242 | .PP | |
243 | On a related topic, | |
244 | .UC EQN | |
245 | does not break equations by itself _ | |
246 | you must split long equations up across multiple lines | |
247 | by yourself, | |
248 | marking each by a separate | |
249 | .UC .EQ | |
250 | \&...\& | |
251 | .UC .EN | |
252 | sequence. | |
253 | .UC EQN | |
254 | does warn about equations that are too long | |
255 | to fit on one line. |