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