1.\" NOTE: use this with the tmac.doc.old package!
2.\" NOTE: this manpage *and* the tmac.doc.old package are buggy,
3.\"	especially this page is totally bogus and better be rewritten.
4.\"-
5.\" $MirOS: src/usr.bin/oldroff/neqn/neqn.1eqn,v 1.3 2009/11/22 17:08:22 tg Exp $
6.\"
7.\" Copyright (c) 1979, 1980, 1981, 1986, 1988, 1990, 1991, 1992
8.\"     The Regents of the University of California.
9.\" Copyright (C) Caldera International Inc.  2001-2002.
10.\" Copyright (c) 2003, 2004
11.\"	Thorsten "mirabilos" Glaser <tg@mirbsd.de>
12.\" All rights reserved.
13.\"
14.\" Redistribution and use in source and binary forms,
15.\" with or without modification, are permitted provided
16.\" that the following conditions are met:
17.\"
18.\" Redistributions of source code and documentation must retain
19.\" the above copyright notice, this list of conditions and the
20.\" following disclaimer.  Redistributions in binary form must
21.\" reproduce the above copyright notice, this list of conditions
22.\" and the following disclaimer in the documentation and/or other
23.\" materials provided with the distribution.
24.\"
25.\" All advertising materials mentioning features or use of this
26.\" software must display the following acknowledgement:
27.\"   This product includes software developed or owned by
28.\"   Caldera International, Inc.
29.\"
30.\" Neither the name of Caldera International, Inc. nor the names
31.\" of other contributors may be used to endorse or promote products
32.\" derived from this software without specific prior written permission.
33.\"
34.\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
35.\" INTERNATIONAL, INC. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
36.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
37.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38.\" ARE DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
39.\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
40.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
41.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
43.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
44.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
45.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46.\"
47.\"	@(#)eqn.1	6.6 (Berkeley) 4/17/91
48.\"
49.Vx
50.Dd April 17, 1991
51.Dt EQN 1
52.Os ATT 7th
53.EQ
54delim $$
55.EN
56.Sh NAME
57.Nm eqn , neqn , checkeq
58.Nd typeset mathematics
59.Sh SYNOPSIS
60.Nm eqn
61.Oo
62.Op Fl d Ar xy
63.Op Fl p Ar n
64.Op Fl s Ar n
65.Op Fl f Ar n
66.Op  file
67\&...
68.Nm neqn
69.Oo
70.Op Fl d Ar xy
71.Op Fl p Ar n
72.Op Fl s Ar n
73.Op Fl f Ar n
74.Op  file
75\&...
76.Nm checkeq
77.Op  file
78\&...
79.Sh DESCRIPTION
80.Nm Eqn
81is a
82.Xr troff 1
83preprocessor
84for typesetting mathematics
85on a Graphic Systems phototypesetter,
86.Xr neqn
87on terminals.
88Usage is almost always
89.Pp
90.Dl eqn file ... | troff
91.Pp
92.Dl neqn file ... | nroff
93.Pp
94If no files are specified,
95these programs
96read from the standard input.
97A line beginning with `.EQ' marks the start of an equation;
98the end of an equation
99is marked by a line beginning with `.EN'.
100Neither of these lines is altered,
101so they may be defined in macro packages
102to get
103centering, numbering, etc.
104It is also possible to set two characters as `delimiters';
105subsequent text between delimiters is also treated as
106.Nm eqn
107input.
108Delimiters may be set to characters
109.Ar x
110and
111.Ar y
112with the command-line argument
113.Fl d xy
114or (more commonly) with
115`delim
116.Ar xy  '
117between .EQ and .EN.
118The left and right delimiters may be identical.
119Delimiters are turned off by `delim off'.
120All text that is neither between delimiters nor between .EQ and .EN
121is passed through untouched.
122.Pp
123The program
124.Nm checkeq
125reports missing or unbalanced delimiters and .EQ/.EN pairs.
126.Pp
127Tokens within
128.Nm eqn
129are separated by
130spaces, tabs, newlines, braces, double quotes,
131tildes or circumflexes.
132Braces {} are used for grouping;
133generally speaking,
134anywhere a single character like
135.Ar x
136could appear, a complicated construction
137enclosed in braces may be used instead.
138Tilde ~ represents a full space in the output,
139circumflex ^ half as much.
140.Pp
141.vs 13p
142Subscripts and superscripts are produced with the keywords
143.Ic sub
144and
145.Ic sup .
146Thus
147.Ar "x sub i"
148makes
149$x sub i$,
150.Ar "a sub i sup 2"
151produces
152$a sub i sup 2$,
153and
154.Ar "e sup {x sup 2 +
155.Ar y sup 2}"
156gives
157$e sup {x sup 2 + y sup 2}$.
158.Pp
159Fractions are made with
160.Ic over :
161.Ar "a over b"
162yields $a over b$.
163.Pp
164.Ic sqrt
165makes square roots:
166.Ar "1 over sqrt
167.Ar {ax sup 2 +bx+c}"
168results in
169$1 over sqrt {ax sup 2 +bx+c}$ .
170.Pp
171The keywords
172.Ic from
173and
174.Ic to
175introduce lower and upper limits on arbitrary things:
176$lim from {n-> inf} sum from 0 to n x sub i$
177is made with
178.Ar "lim from {n\-> inf }
179.Ar sum from 0 to n x
180.Ar sub i."
181.Pp
182Left and right brackets, braces, etc., of the right height are made with
183.Ic left
184and
185.Ic right :
186.Op Ar "left
187.Ar  x sup 2 + y sup 2
188.AR over alpha right
189.Ar \&~=~1"
190produces
191$left [ x sup 2 + y sup 2 over alpha right ] ~=~1$.
192The
193.Ic right
194clause is optional.
195Legal characters after
196.Ic left
197and
198.Ic right
199are braces, brackets, bars,
200.Ic c
201and
202.Ic f
203for ceiling and floor,
204and "" for nothing at all (useful for a right-side-only bracket).
205.Pp
206Vertical piles of things are made with
207.Ic pile  ,
208.Ic lpile ,
209.Ic cpile  ,
210and
211.Ic rpile  :
212.Ar "pile {a above b above c}"
213produces
214$pile {a above b above c}$.
215There can be an arbitrary number of elements in a pile.
216.Ic lpile
217left-justifies,
218.Ic pile
219and
220.Ic cpile
221center, with different vertical spacing,
222and
223.Ic rpile
224right justifies.
225.Pp
226Matrices are made with
227.Ic matrix  :
228.Ar "matrix { lcol { x sub i
229.Ar above y sub 2 } ccol {
230.Ar 1 above 2 } }"
231produces
232$matrix { lcol { x sub i above y sub 2 } ccol { 1 above 2 } }$.
233In addition, there is
234.Ic rcol
235for a right-justified column.
236.Pp
237.vs 12p
238Diacritical marks are made with
239.Ic dot  ,
240.Ic dotdot ,
241.Ic hat  ,
242.Ic tilde ,
243.Ic bar  ,
244.Ic vec ,
245.Ic dyad  ,
246and
247.Ic under  :
248.Ar "x dot \&= f(t) bar"
249is
250$x dot = f(t) bar$,
251.Ar "y dotdot bar \&~=~
252.Ar n under"
253is
254$y dotdot bar ~=~ n under$,
255and
256.Ar "x vec \&~=~ y dyad"
257is
258$x vec ~=~ y dyad$.
259.Pp
260Sizes and font can be changed with
261.Ic size
262.Op Ar n
263or
264.Ic size
265.Sf Sy \(+- n,
266.Ic roman  ,
267.Ic italic ,
268.Ic bold  ,
269and
270.Ic font
271.Ar n.
272Size and fonts can be changed globally in a document by
273.Ic gsize
274.Ar n
275and
276.Ic gfont
277.Ar n ,
278or by the command-line arguments
279.Cx Fl s
280.Ar n
281.Cx
282and
283.Cx Fl f
284.Ar n
285.Cx .
286.Cx
287.Pp
288Normally subscripts and superscripts are reduced by
2893 point sizes from the previous size;
290this may be changed by the command-line argument
291.Cx Fl p
292.Ar n .
293.Cx
294.Pp
295Successive display arguments can be lined up.
296Place
297.Ic mark
298before the desired lineup point in the first equation;
299place
300.Ic lineup
301at the place that is to line up vertically in subsequent equations.
302.Pp
303Shorthands may be defined
304or existing keywords redefined with
305.Ic define  :
306.Ar "define thing \&% replacement \&%"
307defines a new token called
308.Ar thing
309which will be replaced by
310.Ar replacement
311whenever it appears thereafter.
312The
313.Ic \&%
314may be any character that does not occur in
315.Ar replacement .
316.Pp
317Keywords like
318.Ar sum
319.EQ
320( sum )
321.EN
322.Ar int
323.EQ
324( int )
325.EN
326.Ar inf
327.EQ
328( inf )
329.EN
330and shorthands like
331>=
332.EQ
333(>=)
334.EN
335\->
336.EQ
337(->),
338.EN
339and
340!=
341.EQ
342( != )
343.EN
344are recognized.
345Greek letters are spelled out in the desired case, as in
346.Ar alpha
347or
348.Ar GAMMA .
349Mathematical words like sin, cos, log are made Roman automatically.
350.Xr Troff 1
351four-character escapes like \e(co (\(co)
352can be used anywhere.
353Strings enclosed in double quotes "..."
354are passed through untouched;
355this permits keywords to be entered as text,
356and can be used to communicate
357with
358.Xr troff 1
359when all else fails.
360.Sh SEE ALSO
361.Xr nroff 1 ,
362.Xr troff 1 ,
363.Xr tbl 1 ,
364.Xr ms 7 ,
365.Xr eqnchar 7
366.br
367B. W. Kernighan and L. L. Cherry,
368.Em Typesetting Mathematics\-User's Guide
369.Br
370J. F. Ossanna,
371.Em NROFF/TROFF User's Manual
372.Sh HISTORY
373.Nm Eqn
374appeared in Version 6 AT&T Unix.
375.Sh BUGS
376.Pp
377To embolden digits, parens, etc.,
378it is necessary to quote them,
379as in `bold "12.3"'.
380