1EQN(1) General Commands Manual EQN(1)
2
3
4
6 eqn - format equations for troff or MathML
7
9 eqn [-rvCNR] [-d xy] [-T name] [-M dir] [-f F] [-s n] [-p n] [-m n]
10 [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 is read. A filename of - causes the standard input to be read.
24
25 eqn searches for the file eqnrc in the directories given with the -M
26 option first, then in /usr/lib64/groff/site-tmac,
27 /usr/share/groff/site-tmac, and finally in the standard macro directory
28 /usr/share/groff/1.20.1/tmac. If it exists, eqn processes it before
29 the other input files. The -R option prevents this.
30
31 GNU eqn does not provide the functionality of neqn: it does not support
32 low-resolution, typewriter-like devices (although it may work ade‐
33 quately for very simple input).
34
36 -dxy Specify delimiters x and y for the left and right end, respec‐
37 tively, of in-line equations. Any delim statements in the
38 source file overrides this.
39
40 -C Recognize .EQ and .EN even when followed by a character other
41 than space or newline.
42
43 -N Don't allow newlines within delimiters. This option allows eqn
44 to recover better from missing closing delimiters.
45
46 -v Print the version number.
47
48 -r Only one size reduction.
49
50 -mn The minimum point-size is n. eqn does not reduce the size of
51 subscripts or superscripts to a smaller size than n.
52
53 -Tname The output is for device name. Normally, the only effect of
54 this is to define a macro name with a value of 1; eqnrc uses
55 this to provide definitions appropriate for the output device.
56 However, if the specified device is “MathML”, the output is
57 MathML markup rather than troff commands, and eqnrc is not
58 loaded at all. The default output device is ps.
59
60 -Mdir Search dir for eqnrc before the default directories.
61
62 -R Don't load eqnrc.
63
64 -fF This is equivalent to a gfont F command.
65
66 -sn This is equivalent to a gsize n command. This option is depre‐
67 cated. eqn normally sets equations at whatever the current
68 point size is when the equation is encountered.
69
70 -pn This says that subscripts and superscripts should be n points
71 smaller than the surrounding text. This option is deprecated.
72 Normally eqn sets subscripts and superscripts at 70% of the size
73 of the surrounding text.
74
76 Only the differences between GNU eqn and Unix eqn are described here.
77
78 GNU eqn emits Presentation MathML output when invoked with the
79 -T MathML option.
80
81 GNU eqn sets the input token "..." as three periods or low dots,
82 rather than the three centered dots of classic eqn. To get three cen‐
83 tered dots, write cdots or cdot cdot cdot.
84
85 Most of the new features of the GNU eqn input language are based on
86 TeX. There are some references to the differences between TeX and GNU
87 eqn below; these may safely be ignored if you do not know TeX.
88
89 Automatic spacing
90 eqn gives each component of an equation a type, and adjusts the spacing
91 between components using that type. Possible types are:
92
93 ordinary an ordinary character such as `1' or `x';
94
95 operator a large operator such as `Σ';
96
97 binary a binary operator such as `+';
98
99 relation a relation such as `=';
100
101 opening a opening bracket such as `(';
102
103 closing a closing bracket such as `)';
104
105 punctuation a punctuation character such as `,';
106
107 inner a subformula contained within brackets;
108
109 suppress spacing that suppresses automatic spacing adjust‐
110 ment.
111
112 Components of an equation get a type in one of two ways.
113
114 type t e
115 This yields an equation component that contains e but that has
116 type t, where t is one of the types mentioned above. For exam‐
117 ple, times is defined as
118
119 type "binary" \(mu
120
121 The name of the type doesn't have to be quoted, but quoting pro‐
122 tects from macro expansion.
123
124 chartype t text
125 Unquoted groups of characters are split up into individual char‐
126 acters, and the type of each character is looked up; this
127 changes the type that is stored for each character; it says that
128 the characters in text from now on have type t. For example,
129
130 chartype "punctuation" .,;:
131
132 would make the characters `.,;:' have type punctuation whenever
133 they subsequently appeared in an equation. The type t can also
134 be letter or digit; in these cases chartype changes the font
135 type of the characters. See the Fonts subsection.
136
137 New primitives
138 big e Enlarges the expression it modifies; intended to have semantics
139 like CSS `large'. In troff output, the point size is increased
140 by 5; in MathML output, the expression uses
141
142 <mstyle mathsize='big'>
143
144 e1 smallover e2
145 This is similar to over; smallover reduces the size of e1 and
146 e2; it also puts less vertical space between e1 or e2 and the
147 fraction bar. The over primitive corresponds to the TeX \over
148 primitive in display styles; smallover corresponds to \over in
149 non-display styles.
150
151 vcenter e
152 This vertically centers e about the math axis. The math axis is
153 the vertical position about which characters such as `+' and `−'
154 are centered; also it is the vertical position used for the bar
155 of fractions. For example, sum is defined as
156
157 { type "operator" vcenter size +5 \(*S }
158
159 (Note that vcenter is silently ignored when generating MathML.)
160
161 e1 accent e2
162 This sets e2 as an accent over e1. e2 is assumed to be at the
163 correct height for a lowercase letter; e2 is moved down accord‐
164 ing to whether e1 is taller or shorter than a lowercase letter.
165 For example, hat is defined as
166
167 accent { "^" }
168
169 dotdot, dot, tilde, vec, and dyad are also defined using the
170 accent primitive.
171
172 e1 uaccent e2
173 This sets e2 as an accent under e1. e2 is assumed to be at the
174 correct height for a character without a descender; e2 is moved
175 down if e1 has a descender. utilde is pre-defined using uaccent
176 as a tilde accent below the baseline.
177
178 split "text"
179 This has the same effect as simply
180
181 text
182
183 but text is not subject to macro expansion because it is quoted;
184 text is split up and the spacing between individual characters
185 is adjusted.
186
187 nosplit text
188 This has the same effect as
189
190 "text"
191
192 but because text is not quoted it is subject to macro expansion;
193 text is not split up and the spacing between individual charac‐
194 ters is not adjusted.
195
196 e opprime
197 This is a variant of prime that acts as an operator on e. It
198 produces a different result from prime in a case such as
199 A opprime sub 1: with opprime the 1 is tucked under the prime as
200 a subscript to the A (as is conventional in mathematical type‐
201 setting), whereas with prime the 1 is a subscript to the prime
202 character. The precedence of opprime is the same as that of bar
203 and under, which is higher than that of everything except accent
204 and uaccent. In unquoted text a ' that is not the first charac‐
205 ter is treated like opprime.
206
207 special text e
208 This constructs a new object from e using a troff(1) macro named
209 text. When the macro is called, the string 0s contains the out‐
210 put for e, and the number registers 0w, 0h, 0d, 0skern, and
211 0skew contain the width, height, depth, subscript kern, and skew
212 of e. (The subscript kern of an object says how much a sub‐
213 script on that object should be tucked in; the skew of an object
214 says how far to the right of the center of the object an accent
215 over the object should be placed.) The macro must modify 0s so
216 that it outputs the desired result with its origin at the cur‐
217 rent point, and increase the current horizontal position by the
218 width of the object. The number registers must also be modified
219 so that they correspond to the result.
220
221 For example, suppose you wanted a construct that `cancels' an
222 expression by drawing a diagonal line through it.
223
224 .EQ
225 define cancel 'special Ca'
226 .EN
227 .de Ca
228 . ds 0s \
229 \Z'\\*(0s'\
230 \v'\\n(0du'\
231 \D'l \\n(0wu -\\n(0hu-\\n(0du'\
232 \v'\\n(0hu'
233 ..
234
235 Then you could cancel an expression e with cancel { e }
236
237 Here's a more complicated construct that draws a box round an
238 expression:
239
240 .EQ
241 define box 'special Bx'
242 .EN
243 .de Bx
244 . ds 0s \
245 \Z'\h'1n'\\*(0s'\
246 \Z'\
247 \v'\\n(0du+1n'\
248 \D'l \\n(0wu+2n 0'\
249 \D'l 0 -\\n(0hu-\\n(0du-2n'\
250 \D'l -\\n(0wu-2n 0'\
251 \D'l 0 \\n(0hu+\\n(0du+2n'\
252 '\
253 \h'\\n(0wu+2n'
254 . nr 0w +2n
255 . nr 0d +1n
256 . nr 0h +1n
257 ..
258
259 space n
260 A positive value of the integer n (in hundredths of an em) sets
261 the vertical spacing before the equation, a negative value sets
262 the spacing after the equation, replacing the default values.
263 This primitive provides an interface to groff's \x escape (but
264 with opposite sign).
265
266 This keyword has no effect if the equation is part of a pic pic‐
267 ture.
268
269 Extended primitives
270 col n { ... }
271 ccol n { ... }
272 lcol n { ... }
273 rcol n { ... }
274 pile n { ... }
275 cpile n { ... }
276 lpile n { ... }
277 rpile n { ... }
278 The integer value n (in hundredths of an em) increases the ver‐
279 tical spacing between rows, using groff's \x escape (the value
280 has no effect in MathML mode). Negative values are possible but
281 have no effect. If there is more than a single value given in a
282 matrix, the biggest one is used.
283
284 Customization
285 When eqn is generating troff markup, the appearance of equations is
286 controlled by a large number of parameters. They have no effect when
287 generating MathML mode, which pushes typesetting and fine motions down‐
288 stream to a MathML rendering engine. These parameters can be set using
289 the set command.
290
291 set p n
292 This sets parameter p to value n; n is an integer. For example,
293
294 set x_height 45
295
296 says that eqn should assume an x height of 0.45 ems.
297
298 Possible parameters are as follows. Values are in units of hun‐
299 dredths of an em unless otherwise stated. These descriptions
300 are intended to be expository rather than definitive.
301
302 minimum_size
303 eqn doesn't set anything at a smaller point-size than
304 this. The value is in points.
305
306 fat_offset
307 The fat primitive emboldens an equation by overprinting
308 two copies of the equation horizontally offset by this
309 amount. This parameter is not used in MathML mode;
310 instead, fat text uses
311
312 <mstyle mathvariant='double-struck'>
313
314 over_hang
315 A fraction bar is longer by twice this amount than the
316 maximum of the widths of the numerator and denominator;
317 in other words, it overhangs the numerator and denomina‐
318 tor by at least this amount.
319
320 accent_width
321 When bar or under is applied to a single character, the
322 line is this long. Normally, bar or under produces a
323 line whose length is the width of the object to which it
324 applies; in the case of a single character, this tends to
325 produce a line that looks too long.
326
327 delimiter_factor
328 Extensible delimiters produced with the left and right
329 primitives have a combined height and depth of at least
330 this many thousandths of twice the maximum amount by
331 which the sub-equation that the delimiters enclose
332 extends away from the axis.
333
334 delimiter_shortfall
335 Extensible delimiters produced with the left and right
336 primitives have a combined height and depth not less than
337 the difference of twice the maximum amount by which the
338 sub-equation that the delimiters enclose extends away
339 from the axis and this amount.
340
341 null_delimiter_space
342 This much horizontal space is inserted on each side of a
343 fraction.
344
345 script_space
346 The width of subscripts and superscripts is increased by
347 this amount.
348
349 thin_space
350 This amount of space is automatically inserted after
351 punctuation characters.
352
353 medium_space
354 This amount of space is automatically inserted on either
355 side of binary operators.
356
357 thick_space
358 This amount of space is automatically inserted on either
359 side of relations.
360
361 x_height
362 The height of lowercase letters without ascenders such as
363 `x'.
364
365 axis_height
366 The height above the baseline of the center of characters
367 such as `+' and `−'. It is important that this value is
368 correct for the font you are using.
369
370 default_rule_thickness
371 This should set to the thickness of the \(ru character,
372 or the thickness of horizontal lines produced with the \D
373 escape sequence.
374
375 num1 The over command shifts up the numerator by at least this
376 amount.
377
378 num2 The smallover command shifts up the numerator by at least
379 this amount.
380
381 denom1 The over command shifts down the denominator by at least
382 this amount.
383
384 denom2 The smallover command shifts down the denominator by at
385 least this amount.
386
387 sup1 Normally superscripts are shifted up by at least this
388 amount.
389
390 sup2 Superscripts within superscripts or upper limits or
391 numerators of smallover fractions are shifted up by at
392 least this amount. This is usually less than sup1.
393
394 sup3 Superscripts within denominators or square roots or sub‐
395 scripts or lower limits are shifted up by at least this
396 amount. This is usually less than sup2.
397
398 sub1 Subscripts are normally shifted down by at least this
399 amount.
400
401 sub2 When there is both a subscript and a superscript, the
402 subscript is shifted down by at least this amount.
403
404 sup_drop
405 The baseline of a superscript is no more than this much
406 amount below the top of the object on which the super‐
407 script is set.
408
409 sub_drop
410 The baseline of a subscript is at least this much below
411 the bottom of the object on which the subscript is set.
412
413 big_op_spacing1
414 The baseline of an upper limit is at least this much
415 above the top of the object on which the limit is set.
416
417 big_op_spacing2
418 The baseline of a lower limit is at least this much below
419 the bottom of the object on which the limit is set.
420
421 big_op_spacing3
422 The bottom of an upper limit is at least this much above
423 the top of the object on which the limit is set.
424
425 big_op_spacing4
426 The top of a lower limit is at least this much below the
427 bottom of the object on which the limit is set.
428
429 big_op_spacing5
430 This much vertical space is added above and below limits.
431
432 baseline_sep
433 The baselines of the rows in a pile or matrix are nor‐
434 mally this far apart. In most cases this should be equal
435 to the sum of num1 and denom1.
436
437 shift_down
438 The midpoint between the top baseline and the bottom
439 baseline in a matrix or pile is shifted down by this much
440 from the axis. In most cases this should be equal to
441 axis_height.
442
443 column_sep
444 This much space is added between columns in a matrix.
445
446 matrix_side_sep
447 This much space is added at each side of a matrix.
448
449 draw_lines
450 If this is non-zero, lines are drawn using the \D escape
451 sequence, rather than with the \l escape sequence and the
452 \(ru character.
453
454 body_height
455 The amount by which the height of the equation exceeds
456 this is added as extra space before the line containing
457 the equation (using \x). The default value is 85.
458
459 body_depth
460 The amount by which the depth of the equation exceeds
461 this is added as extra space after the line containing
462 the equation (using \x). The default value is 35.
463
464 nroff If this is non-zero, then ndefine behaves like define and
465 tdefine is ignored, otherwise tdefine behaves like define
466 and ndefine is ignored. The default value is 0 (This is
467 typically changed to 1 by the eqnrc file for the ascii,
468 latin1, utf8, and cp1047 devices.)
469
470 A more precise description of the role of many of these parame‐
471 ters can be found in Appendix H of The TeXbook.
472
473 Macros
474 Macros can take arguments. In a macro body, $n where n is between 1
475 and 9, is replaced by the n-th argument if the macro is called with
476 arguments; if there are fewer than n arguments, it is replaced by noth‐
477 ing. A word containing a left parenthesis where the part of the word
478 before the left parenthesis has been defined using the define command
479 is recognized as a macro call with arguments; characters following the
480 left parenthesis up to a matching right parenthesis are treated as
481 comma-separated arguments; commas inside nested parentheses do not ter‐
482 minate an argument.
483
484 sdefine name X anything X
485 This is like the define command, but name is not recognized if
486 called with arguments.
487
488 include "file"
489 copy "file"
490 Include the contents of file (include and copy are synonyms).
491 Lines of file beginning with .EQ or .EN are ignored.
492
493 ifdef name X anything X
494 If name has been defined by define (or has been automatically
495 defined because name is the output device) process anything;
496 otherwise ignore anything. X can be any character not appearing
497 in anything.
498
499 undef name
500 Remove definition of name, making it undefined.
501
502 Besides the macros mentioned above, the following definitions are
503 available: Alpha, Beta, ..., Omega (this is the same as ALPHA, BETA,
504 ..., OMEGA), ldots (three dots on the base line), and dollar.
505
506 Fonts
507 eqn normally uses at least two fonts to set an equation: an italic font
508 for letters, and a roman font for everything else. The existing gfont
509 command changes the font that is used as the italic font. By default
510 this is I. The font that is used as the roman font can be changed
511 using the new grfont command.
512
513 grfont f
514 Set the roman font to f.
515
516 The italic primitive uses the current italic font set by gfont; the
517 roman primitive uses the current roman font set by grfont. There is
518 also a new gbfont command, which changes the font used by the bold
519 primitive. If you only use the roman, italic and bold primitives to
520 changes fonts within an equation, you can change all the fonts used by
521 your equations just by using gfont, grfont and gbfont commands.
522
523 You can control which characters are treated as letters (and therefore
524 set in italics) by using the chartype command described above. A type
525 of letter causes a character to be set in italic type. A type of digit
526 causes a character to be set in roman type.
527
529 /usr/share/groff/1.20.1/tmac/eqnrc
530 Initialization file.
531
533 MathML is designed on the assumption that it cannot know the exact
534 physical characteristics of the media and devices on which it will be
535 rendered. It does not support fine control of motions and sizes to the
536 same degree troff does. Thus:
537
538 * eqn parameters have no effect on the generated MathML.
539
540 * The special, up, down, fwd, and back operations cannot be imple‐
541 mented, and yield a MathML `<merror>' message instead.
542
543 * The vcenter keyword is silently ignored, as centering on the
544 math axis is the MathML default.
545
546 * Characters that eqn over troff sets extra large – notably the
547 integral sign – may appear too small and need to have their
548 `<mstyle>' wrappers adjusted by hand.
549
550 As in its troff mode, eqn in MathML mode leaves the .EQ and .EN delim‐
551 iters in place for displayed equations, but emits no explicit delim‐
552 iters around inline equations. They can, however, be recognized as
553 strings that begin with `<math>' and end with `</math>' and do not
554 cross line boundaries.
555
556 See the BUGS section for translation limits specific to eqn.
557
559 Inline equations are set at the point size that is current at the
560 beginning of the input line.
561
562 In MathML mode, the mark and lineup features don't work. These could,
563 in theory, be implemented with `<maligngroup>' elements.
564
565 In MathML mode, each digit of a numeric literal gets a separate `<mn>
566 </mn>' pair, and decimal points are tagged with `<mo></mo>'. This is
567 allowed by the specification, but inefficient.
568
570 groff(1), troff(1), pic(1), groff_font(5), The TeXbook
571
572
573
574Groff Version 1.20.1 9 January 2009 EQN(1)