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