1EQN(1) General Commands Manual EQN(1)
2
3
4
6 eqn - format equations for troff
7
9 eqn [ -rvCNR ] [ -dxy ] [ -Tname ] [ -Mdir ] [ -fF ] [ -sn ] [ -pn ]
10 [ -mn ] [ files... ]
11
12 It is possible to have whitespace between a command line option and its
13 parameter.
14
16 This manual page describes the GNU version of eqn, which is part of the
17 groff document formatting system. eqn compiles descriptions of equa‐
18 tions embedded within troff input files into commands that are under‐
19 stood by troff. Normally, it should be invoked using the -e option of
20 groff. The syntax is quite compatible with Unix eqn. The output of
21 GNU eqn cannot be processed with Unix troff; it must be processed with
22 GNU troff. If no files are given on the command line, the standard
23 input will be read. A filename of - will cause the standard input to
24 be read.
25
26 eqn searches for the file eqnrc in the directories given with the -M
27 option first, then in /usr/lib64/groff/site-tmac,
28 /usr/share/groff/site-tmac, and finally in the standard macro directory
29 /usr/share/groff/1.18.1.4/tmac. If it exists, eqn will process it
30 before the other input files. The -R option prevents this.
31
32 GNU eqn does not provide the functionality of neqn: it does not support
33 low-resolution, typewriter-like devices (although it may work ade‐
34 quately for very simple input).
35
37 -dxy Specify delimiters x and y for the left and right end, respec‐
38 tively, of in-line equations. Any delim statements in the
39 source file overrides this.
40
41 -C Recognize .EQ and .EN even when followed by a character other
42 than space or newline.
43
44 -N Don't allow newlines within delimiters. This option allows eqn
45 to recover better from missing closing delimiters.
46
47 -v Print the version number.
48
49 -r Only one size reduction.
50
51 -mn The minimum point-size is n. eqn will not reduce the size of
52 subscripts or superscripts to a smaller size than n.
53
54 -Tname The output is for device name. The only effect of this is to
55 define a macro name with a value of 1. Typically eqnrc will use
56 this to provide definitions appropriate for the output device.
57 The default output device is ps.
58
59 -Mdir Search dir for eqnrc before the default directories.
60
61 -R Don't load eqnrc.
62
63 -fF This is equivalent to a gfont F command.
64
65 -sn This is equivalent to a gsize n command. This option is depre‐
66 cated. eqn will normally set equations at whatever the current
67 point size is when the equation is encountered.
68
69 -pn This says that subscripts and superscripts should be n points
70 smaller than the surrounding text. This option is deprecated.
71 Normally eqn makes sets subscripts and superscripts at 70% of
72 the size of the surrounding text.
73
75 Only the differences between GNU eqn and Unix eqn are described here.
76
77 Most of the new features of GNU eqn are based on TeX. There are some
78 references to the differences between TeX and GNU eqn below; these may
79 safely be ignored if you do not know TeX.
80
81 Automatic spacing
82 eqn gives each component of an equation a type, and adjusts the spacing
83 between components using that type. Possible types are:
84
85 ordinary an ordinary character such as 1 or x;
86
87 operator a large operator such as Σ;
88
89 binary a binary operator such as +;
90
91 relation a relation such as =;
92
93 opening a opening bracket such as (;
94
95 closing a closing bracket such as );
96
97 punctuation a punctuation character such as ,;
98
99 inner a subformula contained within brackets;
100
101 suppress spacing that suppresses automatic spacing adjustment.
102
103 Components of an equation get a type in one of two ways.
104
105 type t e
106 This yields an equation component that contains e but that has
107 type t, where t is one of the types mentioned above. For exam‐
108 ple, times is defined as
109
110 type "binary" \(mu
111
112 The name of the type doesn't have to be quoted, but quoting pro‐
113 tects from macro expansion.
114
115 chartype t text
116 Unquoted groups of characters are split up into individual char‐
117 acters, and the type of each character is looked up; this
118 changes the type that is stored for each character; it says that
119 the characters in text from now on have type t. For example,
120
121 chartype "punctuation" .,;:
122
123 would make the characters .,;: have type punctuation whenever
124 they subsequently appeared in an equation. The type t can also
125 be letter or digit; in these cases chartype changes the font
126 type of the characters. See the Fonts subsection.
127
128 New primitives
129 e1 smallover e2
130 This is similar to over; smallover reduces the size of e1 and
131 e2; it also puts less vertical space between e1 or e2 and the
132 fraction bar. The over primitive corresponds to the TeX \over
133 primitive in display styles; smallover corresponds to \over in
134 non-display styles.
135
136 vcenter e
137 This vertically centers e about the math axis. The math axis is
138 the vertical position about which characters such as + and - are
139 centered; also it is the vertical position used for the bar of
140 fractions. For example, sum is defined as
141
142 { type "operator" vcenter size +5 \(*S }
143
144 e1 accent e2
145 This sets e2 as an accent over e1. e2 is assumed to be at the
146 correct height for a lowercase letter; e2 will be moved down
147 according if e1 is taller or shorter than a lowercase letter.
148 For example, hat is defined as
149
150 accent { "^" }
151
152 dotdot, dot, tilde, vec and dyad are also defined using the
153 accent primitive.
154
155 e1 uaccent e2
156 This sets e2 as an accent under e1. e2 is assumed to be at the
157 correct height for a character without a descender; e2 will be
158 moved down if e1 has a descender. utilde is pre-defined using
159 uaccent as a tilde accent below the baseline.
160
161 split "text"
162 This has the same effect as simply
163
164 text
165
166 but text is not subject to macro expansion because it is quoted;
167 text will be split up and the spacing between individual charac‐
168 ters will be adjusted.
169
170 nosplit text
171 This has the same effect as
172
173 "text"
174
175 but because text is not quoted it will be subject to macro
176 expansion; text will not be split up and the spacing between
177 individual characters will not be adjusted.
178
179 e opprime
180 This is a variant of prime that acts as an operator on e. It
181 produces a different result from prime in a case such as
182 A opprime sub 1: with opprime the 1 will be tucked under the
183 prime as a subscript to the A (as is conventional in mathemati‐
184 cal typesetting), whereas with prime the 1 will be a subscript
185 to the prime character. The precedence of opprime is the same
186 as that of bar and under, which is higher than that of every‐
187 thing except accent and uaccent. In unquoted text a ' that is
188 not the first character will be treated like opprime.
189
190 special text e
191 This constructs a new object from e using a troff(1) macro named
192 text. When the macro is called, the string 0s will contain the
193 output for e, and the number registers 0w, 0h, 0d, 0skern and
194 0skew will contain the width, height, depth, subscript kern, and
195 skew of e. (The subscript kern of an object says how much a
196 subscript on that object should be tucked in; the skew of an
197 object says how far to the right of the center of the object an
198 accent over the object should be placed.) The macro must modify
199 0s so that it will output the desired result with its origin at
200 the current point, and increase the current horizontal position
201 by the width of the object. The number registers must also be
202 modified so that they correspond to the result.
203
204 For example, suppose you wanted a construct that `cancels' an
205 expression by drawing a diagonal line through it.
206
207 .EQ
208 define cancel 'special Ca'
209 .EN
210 .de Ca
211 .ds 0s \Z'\\*(0s'\v'\\n(0du'\D'l \\n(0wu -\\n(0hu-\\n(0du'\v'\\n(0hu'
212 ..
213
214 Then you could cancel an expression e with cancel { e }
215
216 Here's a more complicated construct that draws a box round an
217 expression:
218
219 .EQ
220 define box 'special Bx'
221 .EN
222 .de Bx
223 .ds 0s \Z'\h'1n'\\*(0s'\
224 \Z'\v'\\n(0du+1n'\D'l \\n(0wu+2n 0'\D'l 0 -\\n(0hu-\\n(0du-2n'\
225 \D'l -\\n(0wu-2n 0'\D'l 0 \\n(0hu+\\n(0du+2n''\h'\\n(0wu+2n'
226 .nr 0w +2n
227 .nr 0d +1n
228 .nr 0h +1n
229 ..
230
231 Customization
232 The appearance of equations is controlled by a large number of parame‐
233 ters. These can be set using the set command.
234
235 set p n
236 This sets parameter p to value n ; n is an integer. For exam‐
237 ple,
238
239 set x_height 45
240
241 says that eqn should assume an x height of 0.45 ems.
242
243 Possible parameters are as follows. Values are in units of hun‐
244 dredths of an em unless otherwise stated. These descriptions
245 are intended to be expository rather than definitive.
246
247 minimum_size eqn will not set anything at a smaller
248 point-size than this. The value is in
249 points.
250
251 fat_offset The fat primitive emboldens an equation
252 by overprinting two copies of the equa‐
253 tion horizontally offset by this amount.
254
255 over_hang A fraction bar will be longer by twice
256 this amount than the maximum of the
257 widths of the numerator and denominator;
258 in other words, it will overhang the
259 numerator and denominator by at least
260 this amount.
261
262 accent_width When bar or under is applied to a single
263 character, the line will be this long.
264 Normally, bar or under produces a line
265 whose length is the width of the object
266 to which it applies; in the case of a
267 single character, this tends to produce
268 a line that looks too long.
269
270 delimiter_factor Extensible delimiters produced with the
271 left and right primitives will have a
272 combined height and depth of at least
273 this many thousandths of twice the maxi‐
274 mum amount by which the sub-equation
275 that the delimiters enclose extends away
276 from the axis.
277
278 delimiter_shortfall Extensible delimiters produced with the
279 left and right primitives will have a
280 combined height and depth not less than
281 the difference of twice the maximum
282 amount by which the sub-equation that
283 the delimiters enclose extends away from
284 the axis and this amount.
285
286 null_delimiter_space This much horizontal space is inserted
287 on each side of a fraction.
288
289 script_space The width of subscripts and superscripts
290 is increased by this amount.
291
292 thin_space This amount of space is automatically
293 inserted after punctuation characters.
294
295 medium_space This amount of space is automatically
296 inserted on either side of binary opera‐
297 tors.
298
299 thick_space This amount of space is automatically
300 inserted on either side of relations.
301
302 x_height The height of lowercase letters without
303 ascenders such as x.
304
305 axis_height The height above the baseline of the
306 center of characters such as + and −.
307 It is important that this value is cor‐
308 rect for the font you are using.
309
310 default_rule_thickness This should set to the thickness of the
311 \(ru character, or the thickness of hor‐
312 izontal lines produced with the \D
313 escape sequence.
314
315 num1 The over command will shift up the
316 numerator by at least this amount.
317
318 num2 The smallover command will shift up the
319 numerator by at least this amount.
320
321 denom1 The over command will shift down the
322 denominator by at least this amount.
323
324 denom2 The smallover command will shift down
325 the denominator by at least this amount.
326
327 sup1 Normally superscripts will be shifted up
328 by at least this amount.
329
330 sup2 Superscripts within superscripts or
331 upper limits or numerators of smallover
332 fractions will be shifted up by at least
333 this amount. This is usually less than
334 sup1.
335
336 sup3 Superscripts within denominators or
337 square roots or subscripts or lower lim‐
338 its will be shifted up by at least this
339 amount. This is usually less than sup2.
340
341 sub1 Subscripts will normally be shifted down
342 by at least this amount.
343
344 sub2 When there is both a subscript and a
345 superscript, the subscript will be
346 shifted down by at least this amount.
347
348 sup_drop The baseline of a superscript will be no
349 more than this much amount below the top
350 of the object on which the superscript
351 is set.
352
353 sub_drop The baseline of a subscript will be at
354 least this much below the bottom of the
355 object on which the subscript is set.
356
357 big_op_spacing1 The baseline of an upper limit will be
358 at least this much above the top of the
359 object on which the limit is set.
360
361 big_op_spacing2 The baseline of a lower limit will be at
362 least this much below the bottom of the
363 object on which the limit is set.
364
365 big_op_spacing3 The bottom of an upper limit will be at
366 least this much above the top of the
367 object on which the limit is set.
368
369 big_op_spacing4 The top of a lower limit will be at
370 least this much below the bottom of the
371 object on which the limit is set.
372
373 big_op_spacing5 This much vertical space will be added
374 above and below limits.
375
376 baseline_sep The baselines of the rows in a pile or
377 matrix will normally be this far apart.
378 In most cases this should be equal to
379 the sum of num1 and denom1.
380
381 shift_down The midpoint between the top baseline
382 and the bottom baseline in a matrix or
383 pile will be shifted down by this much
384 from the axis. In most cases this
385 should be equal to axis_height.
386
387 column_sep This much space will be added between
388 columns in a matrix.
389
390 matrix_side_sep This much space will be added at each
391 side of a matrix.
392
393 draw_lines If this is non-zero, lines will be drawn
394 using the \D escape sequence, rather
395 than with the \l escape sequence and the
396 \(ru character.
397
398 body_height The amount by which the height of the
399 equation exceeds this will be added as
400 extra space before the line containing
401 the equation (using \x.) The default
402 value is 85.
403
404 body_depth The amount by which the depth of the
405 equation exceeds this will be added as
406 extra space after the line containing
407 the equation (using \x.) The default
408 value is 35.
409
410 nroff If this is non-zero, then ndefine will
411 behave like define and tdefine will be
412 ignored, otherwise tdefine will behave
413 like define and ndefine will be ignored.
414 The default value is 0 (This is typi‐
415 cally changed to 1 by the eqnrc file for
416 the ascii, latin1, utf8, and cp1047
417 devices.)
418
419 A more precise description of the role of many of these parame‐
420 ters can be found in Appendix H of The TeXbook.
421
422 Macros
423 Macros can take arguments. In a macro body, $n where n is between 1
424 and 9, will be replaced by the n-th argument if the macro is called
425 with arguments; if there are fewer than n arguments, it will be
426 replaced by nothing. A word containing a left parenthesis where the
427 part of the word before the left parenthesis has been defined using the
428 define command will be recognized as a macro call with arguments; char‐
429 acters following the left parenthesis up to a matching right parenthe‐
430 sis will be treated as comma-separated arguments; commas inside nested
431 parentheses do not terminate an argument.
432
433 sdefine name X anything X
434 This is like the define command, but name will not be recognized
435 if called with arguments.
436
437 include "file"
438 Include the contents of file. Lines of file beginning with .EQ
439 or .EN will be ignored.
440
441 ifdef name X anything X
442 If name has been defined by define (or has been automatically
443 defined because name is the output device) process anything;
444 otherwise ignore anything. X can be any character not appearing
445 in anything.
446
447 Fonts
448 eqn normally uses at least two fonts to set an equation: an italic font
449 for letters, and a roman font for everything else. The existing gfont
450 command changes the font that is used as the italic font. By default
451 this is I. The font that is used as the roman font can be changed
452 using the new grfont command.
453
454 grfont f
455 Set the roman font to f.
456
457 The italic primitive uses the current italic font set by gfont; the
458 roman primitive uses the current roman font set by grfont. There is
459 also a new gbfont command, which changes the font used by the bold
460 primitive. If you only use the roman, italic and bold primitives to
461 changes fonts within an equation, you can change all the fonts used by
462 your equations just by using gfont, grfont and gbfont commands.
463
464 You can control which characters are treated as letters (and therefore
465 set in italics) by using the chartype command described above. A type
466 of letter will cause a character to be set in italic type. A type of
467 digit will cause a character to be set in roman type.
468
470 /usr/share/groff/1.18.1.4/tmac/eqnrc
471 Initialization file.
472
474 Inline equations will be set at the point size that is current at the
475 beginning of the input line.
476
478 groff(1), troff(1), groff_font(5), The TeXbook
479
480
481
482Groff Version 1.18.1.4 05 October 2001 EQN(1)