xref: /original-bsd/old/eqn/eqn/eqn.1 (revision f91c1509)
1.\" Copyright (c) 1990 Regents of the University of California.
2.\" All rights reserved.  The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\"     @(#)eqn.1	6.5 (Berkeley) 03/13/91
6.\"
7.Vx
8.Dd
9.Dt EQN 1
10.Os ATT 7th
11.EQ
12delim $$
13.EN
14.Sh NAME
15.Nm eqn, neqn , checkeq
16.Nd typeset mathematics
17.Sh SYNOPSIS
18.Nm eqn
19.Oo
20.Op Fl d Ar xy
21.Op Fl p Ar n
22.Op Fl s Ar n
23.Op Fl f Ar n
24.Op  file
25\&...
26.Nm checkeq
27.Op  file
28\&...
29.Sh DESCRIPTION
30.Nm Eqn
31is a
32.Xr troff 1
33preprocessor
34for typesetting mathematics
35on a Graphic Systems phototypesetter,
36.Xr neqn
37on terminals.
38Usage is almost always
39.Pp
40.Dl eqn file ... | troff
41.Pp
42.Dl neqn file ... | nroff
43.Pp
44If no files are specified,
45these programs
46read from the standard input.
47A line beginning with `.EQ' marks the start of an equation;
48the end of an equation
49is marked by a line beginning with `.EN'.
50Neither of these lines is altered,
51so they may be defined in macro packages
52to get
53centering, numbering, etc.
54It is also possible to set two characters as `delimiters';
55subsequent text between delimiters is also treated as
56.Nm eqn
57input.
58Delimiters may be set to characters
59.Ar x
60and
61.Ar y
62with the command-line argument
63.Fl d xy
64or (more commonly) with
65`delim
66.Ar xy  '
67between .EQ and .EN.
68The left and right delimiters may be identical.
69Delimiters are turned off by `delim off'.
70All text that is neither between delimiters nor between .EQ and .EN
71is passed through untouched.
72.Pp
73The program
74.Nm checkeq
75reports missing or unbalanced delimiters and .EQ/.EN pairs.
76.Pp
77Tokens within
78.Nm eqn
79are separated by
80spaces, tabs, newlines, braces, double quotes,
81tildes or circumflexes.
82Braces {} are used for grouping;
83generally speaking,
84anywhere a single character like
85.Ar x
86could appear, a complicated construction
87enclosed in braces may be used instead.
88Tilde ~ represents a full space in the output,
89circumflex ^ half as much.
90.Pp
91.vs 13p
92Subscripts and superscripts are produced with the keywords
93.Ic sub
94and
95.Ic sup .
96Thus
97.Ar "x sub i"
98makes
99$x sub i$,
100.Ar "a sub i sup 2"
101produces
102$a sub i sup 2$,
103and
104.Ar "e sup {x sup 2 +
105.Ar y sup 2}"
106gives
107$e sup {x sup 2 + y sup 2}$.
108.Pp
109Fractions are made with
110.Ic over :
111.Ar "a over b"
112yields $a over b$.
113.Pp
114.Ic sqrt
115makes square roots:
116.Ar "1 over sqrt
117.Ar {ax sup 2 +bx+c}"
118results in
119$1 over sqrt {ax sup 2 +bx+c}$ .
120.Pp
121The keywords
122.Ic from
123and
124.Ic to
125introduce lower and upper limits on arbitrary things:
126$lim from {n-> inf} sum from 0 to n x sub i$
127is made with
128.Ar "lim from {n\-> inf }
129.Ar sum from 0 to n x
130.Ar sub i."
131.Pp
132Left and right brackets, braces, etc., of the right height are made with
133.Ic left
134and
135.Ic right :
136.Op Ar "left
137.Ar  x sup 2 + y sup 2
138.AR over alpha right
139.Ar \&~=~1"
140produces
141$left [ x sup 2 + y sup 2 over alpha right ] ~=~1$.
142The
143.Ic right
144clause is optional.
145Legal characters after
146.Ic left
147and
148.Ic right
149are braces, brackets, bars,
150.Ic c
151and
152.Ic f
153for ceiling and floor,
154and "" for nothing at all (useful for a right-side-only bracket).
155.Pp
156Vertical piles of things are made with
157.Ic pile  ,
158.Ic lpile ,
159.Ic cpile  ,
160and
161.Ic rpile  :
162.Ar "pile {a above b above c}"
163produces
164$pile {a above b above c}$.
165There can be an arbitrary number of elements in a pile.
166.Ic lpile
167left-justifies,
168.Ic pile
169and
170.Ic cpile
171center, with different vertical spacing,
172and
173.Ic rpile
174right justifies.
175.Pp
176Matrices are made with
177.Ic matrix  :
178.Ar "matrix { lcol { x sub i
179.Ar above y sub 2 } ccol {
180.Ar 1 above 2 } }"
181produces
182$matrix { lcol { x sub i above y sub 2 } ccol { 1 above 2 } }$.
183In addition, there is
184.Ic rcol
185for a right-justified column.
186.Pp
187.vs 12p
188Diacritical marks are made with
189.Ic dot  ,
190.Ic dotdot ,
191.Ic hat  ,
192.Ic tilde ,
193.Ic bar  ,
194.Ic vec ,
195.Ic dyad  ,
196and
197.Ic under  :
198.Ar "x dot \&= f(t) bar"
199is
200$x dot = f(t) bar$,
201.Ar "y dotdot bar \&~=~
202.Ar n under"
203is
204$y dotdot bar ~=~ n under$,
205and
206.Ar "x vec \&~=~ y dyad"
207is
208$x vec ~=~ y dyad$.
209.Pp
210Sizes and font can be changed with
211.Ic size
212.Op Ar n
213or
214.Ic size
215.Sf Sy \(+- n,
216.Ic roman  ,
217.Ic italic ,
218.Ic bold  ,
219and
220.Ic font
221.Ar n.
222Size and fonts can be changed globally in a document by
223.Ic gsize
224.Ar n
225and
226.Ic gfont
227.Ar n ,
228or by the command-line arguments
229.Cx Fl s
230.Ar n
231.Cx
232and
233.Cx Fl f
234.Ar n
235.Cx .
236.Cx
237.Pp
238Normally subscripts and superscripts are reduced by
2393 point sizes from the previous size;
240this may be changed by the command-line argument
241.Cx Fl p
242.Ar n .
243.Cx
244.Pp
245Successive display arguments can be lined up.
246Place
247.Ic mark
248before the desired lineup point in the first equation;
249place
250.Ic lineup
251at the place that is to line up vertically in subsequent equations.
252.Pp
253Shorthands may be defined
254or existing keywords redefined with
255.Ic define  :
256.Ar "define thing \&% replacement \&%"
257defines a new token called
258.Ar thing
259which will be replaced by
260.Ar replacement
261whenever it appears thereafter.
262The
263.Ic \&%
264may be any character that does not occur in
265.Ar replacement .
266.Pp
267Keywords like
268.Ar sum
269.EQ
270( sum )
271.EN
272.Ar int
273.EQ
274( int )
275.EN
276.Ar inf
277.EQ
278( inf )
279.EN
280and shorthands like
281>=
282.EQ
283(>=)
284.EN
285\->
286.EQ
287(->),
288.EN
289and
290!=
291.EQ
292( != )
293.EN
294are recognized.
295Greek letters are spelled out in the desired case, as in
296.Ar alpha
297or
298.Ar GAMMA .
299Mathematical words like sin, cos, log are made Roman automatically.
300.Xr Troff  1
301four-character escapes like \e(bs (\(bs)
302can be used anywhere.
303Strings enclosed in double quotes "..."
304are passed through untouched;
305this permits keywords to be entered as text,
306and can be used to communicate
307with
308.Xr troff 1
309when all else fails.
310.Sh SEE ALSO
311.Xr troff 1 ,
312.Xr tbl 1 ,
313.Xr ms 7 ,
314.Xr eqnchar 7
315.br
316B. W. Kernighan and L. L. Cherry,
317.Em Typesetting Mathematics\-User's Guide
318.Br
319J. F. Ossanna,
320.Em NROFF/TROFF User's Manual
321.Sh HISTORY
322.Nm Eqn
323appeared in Version 6 AT&T Unix.
324.Sh BUGS
325.Pp
326To embolden digits, parens, etc.,
327it is necessary to quote them,
328as in `bold "12.3"'.
329