1eqn(1)                      General Commands Manual                     eqn(1)
2
3
4

Name

6       eqn - format mathematics (equations) for groff or MathML
7

Synopsis

9       eqn [-CNrR] [-d xy] [-f F] [-m n] [-M dir] [-p n] [-s n] [-T dev]
10           [file ...]
11
12       eqn --help
13
14       eqn -v
15       eqn --version
16

Description

18       The GNU implementation of eqn is part of the groff(7) document  format‐
19       ting  system.   eqn  is a troff(1) preprocessor that translates expres‐
20       sions in its own language, embedded in roff(7) input files, into mathe‐
21       matical  notation  typeset by troff(1).  It copies each file's contents
22       to the standard output stream, translating each equation between  lines
23       starting  with  .EQ  and .EN, or within a pair of user-specified delim‐
24       iters.  Normally, eqn is not executed directly by the user, but invoked
25       by  specifying the -e option to groff(1).  While GNU eqn's input syntax
26       is highly compatible with AT&T eqn, the output eqn produces  cannot  be
27       processed  by  AT&T  troff; GNU troff (or a troff implementing relevant
28       GNU extensions) must be used.  If no file operands  are  given  on  the
29       command line, or if file is “-”, eqn reads the standard input stream.
30
31       Unless  the  -R  option is used, eqn searches for the file eqnrc in the
32       directories given  with  the  -M  option  first,  then  in  /etc/groff/
33       site-tmac,  and  finally  in  the  standard macro directory /usr/share/
34       groff/1.23.0/tmac.  If it exists and is readable, eqn processes it  be‐
35       fore any input files.
36
37       This  man  page primarily discusses the differences between GNU eqn and
38       AT&T eqn.  Most of the new features of the GNU eqn input  language  are
39       based on TeX.  There are some references to the differences between TeX
40       and GNU eqn below; these may safely be ignored if you do not know TeX.
41
42       Three points are worth special note.
43
44       • GNU eqn emits  Presentation  MathML  output  when  invoked  with  the
45-T MathML” option.
46
47       • GNU eqn does not support terminal devices well, though it may suffice
48         for simple inputs.
49
50       • GNU eqn sets the input token “...” as an ellipsis on the  text  base‐
51         line,  not  the  three centered dots of AT&T eqn.  Set an ellipsis on
52         the math axis with the GNU extension macro cdots.
53
54   Anatomy of an equation
55       eqn input consists of tokens.  Consider a form of Newton's  second  law
56       of motion.  The input
57
58              .EQ
59              F =
60              m a
61              .EN
62
63       becomes  F=ma.  Each of F, =, m, and a is a token.  Spaces and newlines
64       are interchangeable; they separate tokens but do  not  break  lines  or
65       produce space in the output.
66
67       The  following  input  characters  not only separate tokens, but manage
68       their grouping and spacing as well.
69
70       { }    Braces perform grouping.  Whereas “e sup a b” expresses  “(e  to
71              the  a)  times b”, “e sup { a b }” means “e to the (a times b)”.
72              When immediately preceded by a “left” or  “right”  primitive,  a
73              brace loses its special meaning.
74
75       ^ ~    are  the  half  space and full space, respectively.  Use them to
76              tune the appearance of the output.
77
78       Tab and leader characters separate tokens  as  well  as  advancing  the
79       drawing  position  to the next tab stop, but are seldom used in eqn in‐
80       put.  When they occur, they must appear at the outermost lexical scope.
81       This roughly means that they can't appear within braces that are neces‐
82       sary to disambiguate the input; eqn will  diagnose  an  error  in  this
83       event.   (See subsection “Macros” below for additional token separation
84       rules.)
85
86       Other tokens are primitives, macros, an argument to either of the fore‐
87       going, or components of an equation.
88
89       Primitives are fundamental keywords of the eqn language.  They can con‐
90       figure an aspect  of  the  preprocessor's  state,  as  when  setting  a
91       “global” font selection or type size (gfont and gsize), or declaring or
92       deleting macros (“define” and undef); these are termed commands.  Other
93       primitives  perform  formatting operations on the tokens after them (as
94       with fat, over, sqrt, or up).
95
96       Equation components include mathematical variables, constants,  numeric
97       literals,  and operators.  eqn remaps some input character sequences to
98       groff special character escape sequences for economy in equation  entry
99       and  to  ensure  that  glyphs  from  an  unstyled  font  are  used; see
100       groff_char(7).
101
102              +   \[pl]                '    \[fm]
103              -   \[mi]                <=   \[<=]
104              =   \[eq]                >=   \[>=]
105
106       Macros permit primitives, components, and other macros to be  collected
107       and  referred  to by a single token.  Predefined macros make convenient
108       the preparation of eqn input in a form resembling  its  spoken  expres‐
109       sion; for example, consider cos, hat, inf, and lim.
110
111   Spacing and typeface
112       GNU  eqn  imputes types to the components of an equation, adjusting the
113       spacing between them accordingly.  Recognized  types  are  as  follows;
114       most  affect  spacing  only, whereas the “letter” subtype of “ordinary
115       also assigns a style.
116
117         ordinary      character such as “1”, “a”, or “!”
118           letter      character to be italicized by default
119           digit       n/a
120         operator      large operator such as “Σ”
121         binary        binary operator such as “+”
122         relation      relational operator such as “=”
123         opening       opening bracket such as “(”
124         closing       closing bracket such as “)”
125         punctuation   punctuation character such as “,”
126         inner         sub-formula contained within brackets
127         suppress      component to which automatic spacing is not applied
128
129       Two primitives apply types to equation components.
130
131       type t e
132              Apply type t to expression e.
133
134       chartype t text
135              Assign each character in (unquoted) text type t, persistently.
136
137       eqn sets up spacings and styles as if by the following commands.
138
139              chartype "letter"      abcdefghiklmnopqrstuvwxyz
140              chartype "letter"      ABCDEFGHIKLMNOPQRSTUVWXYZ
141              chartype "letter"      \[*a]\[*b]\[*g]\[*d]\[*e]\[*z]
142              chartype "letter"      \[*y]\[*h]\[*i]\[*k]\[*l]\[*m]
143              chartype "letter"      \[*n]\[*c]\[*o]\[*p]\[*r]\[*s]
144              chartype "letter"      \[*t]\[*u]\[*f]\[*x]\[*q]\[*w]
145              chartype "binary"      *\[pl]\[mi]
146              chartype "relation"    <>\[eq]\[<=]\[>=]
147              chartype "opening"     {([
148              chartype "closing"     })]
149              chartype "punctuation" ,;:.
150              chartype "suppress"    ^~
151
152       eqn assigns all other ordinary and special roff  characters,  including
153       numerals  0–9, the “ordinary” type.  (The “digit” type is not used, but
154       is available for customization.)  In keeping with  common  practice  in
155       mathematical  typesetting,  lowercase, but not uppercase, Greek letters
156       are assigned the “letter” type to style them in  italics.   The  macros
157       for producing ellipses, “...”, cdots, and ldots, use the “inner” type.
158
159   Primitives
160       eqn  supports  without  alteration the AT&T eqn primitives above, back,
161       bar, bold, define, down, fat, font, from, fwd,  gfont,  gsize,  italic,
162       left,  lineup,  mark,  matrix, ndefine, over, right, roman, size, sqrt,
163       sub, sup, tdefine, to, under, and up.
164
165   New primitives
166       The GNU extension primitives “type” and chartype are discussed in  sub‐
167       section  “Spacing  and typeface” above; “set” in subsection “Customiza‐
168       tion” below; and grfont and gbfont in subsection “Fonts” below.  In the
169       following synopses, X can be any character not appearing in the parame‐
170       ter thus bracketed.
171
172       e1 accent e2
173              Set e2 as an accent over e1.  e2 is assumed to be at the  appro‐
174              priate  height  for a lowercase letter without an ascender;  eqn
175              vertically shifts it depending on e1's height.  For example, hat
176              is defined as follows.
177
178                     accent { "^" }
179
180              dotdot,  dot,  tilde,  vec,  and dyad are also defined using the
181              accent primitive.
182
183       big e  Enlarge the expression e; semantics like those  of  CSS  “large”
184              are  intended.  In troff output, the type size is increased by 5
185              scaled points.  MathML output emits the following.
186
187                     <mstyle mathsize='big'>
188
189       copy file
190       include file
191              Interpolate the contents of file, omitting lines beginning  with
192              .EQ or .EN.  If a relative path name, file is sought relative to
193              the current working directory.
194
195       ifdef name X anything X
196              If name is defined as a primitive or macro, interpret anything.
197
198       nosplit text
199              As "text", but since text is not quoted it is subject  to  macro
200              expansion; it is not split up and the spacing between characters
201              not adjusted per subsection “Spacing and typeface” above.
202
203       e opprime
204              As prime, but set the prime symbol as an operator on e.  In  the
205              input  “A opprime sub 1”, the “1” is tucked under the prime as a
206              subscript to the “A” (as is conventional in  mathematical  type‐
207              setting),  whereas when prime is used, the “1” is a subscript to
208              the prime character.  The precedence of opprime is the  same  as
209              that  of  bar  and “under”, and higher than that of other primi‐
210              tives except accent and uaccent.  In unquoted  text,  a  neutral
211              apostrophe (') that is not the first character on the input line
212              is treated like opprime.
213
214       sdefine name X anything X
215              As “define”, but name is not recognized as  a  macro  if  called
216              with arguments.
217
218       e1 smallover e2
219              As  over,  but reduces the type size of e1 and e2, and puts less
220              vertical space between e1 and e2 and the fraction bar.  The over
221              primitive  corresponds  to  the TeX \over primitive in displayed
222              equation styles; smallover corresponds to \over  in  non-display
223              (“inline”) styles.
224
225       space n
226              Set  extra  vertical  spacing around the equation, replacing the
227              default values, where n is an integer in hundredths  of  an  em.
228              If  positive,  n increases vertical spacing before the equation;
229              if negative, it does so after the equation.  This primitive pro‐
230              vides  an  interface to groff's \x escape sequence, but with the
231              opposite sign convention.  It has no effect if the  equation  is
232              part of a pic(1) picture.
233
234       special troff-macro e
235              Construct  an  object  by  calling  troff-macro on e.  The troff
236              string 0s contains the eqn output for e, and the  registers  0w,
237              0h,  0d,  0skern,  and 0skew the width, height, depth, subscript
238              kern, and skew of e, respectively.  (The subscript  kern  of  an
239              object  indicates  how much a subscript on that object should be
240              “tucked in”, or placed to the left relative to a non-subscripted
241              glyph of the same size.  The skew of an object is how far to the
242              right of the center of the object an accent over  it  should  be
243              placed.)   The  macro  must modify 0s so that it outputs the de‐
244              sired result, returns the drawing position to the text  baseline
245              at  the  beginning  of e, and updates the foregoing registers to
246              correspond to the new dimensions of the result.
247
248              Suppose you want a construct that  “cancels”  an  expression  by
249              drawing a diagonal line through it.
250
251                     .de Ca
252                     .  ds 0s \
253                     \Z'\\*(0s'\
254                     \v'\\n(0du'\
255                     \D'l \\n(0wu -\\n(0hu-\\n(0du'\
256                     \v'\\n(0hu'
257                     ..
258                     .EQ
259                     special Ca "x \[mi] 3 \[pl] x" ~ 3
260                     .EN
261
262              We use the \[mi] and \[pl] special characters instead of + and -
263              because they are part of the argument to a troff macro,  so  eqn
264              does not transform them to mathematical glyphs for us.  Here's a
265              more complicated construct that draws a box  around  an  expres‐
266              sion;  the bottom of the box rests on the text baseline.  We de‐
267              fine the eqn macro box to wrap the call of the troff macro Bx.
268
269                     .de Bx
270                     .ds 0s \
271                     \Z'\\h'1n'\\*[0s]'\
272                     \v'\\n(0du+1n'\
273                     \D'l \\n(0wu+2n 0'\
274                     \D'l 0 -\\n(0hu-\\n(0du-2n'\
275                     \D'l -\\n(0wu-2n 0'\
276                     \D'l 0 \\n(0hu+\\n(0du+2n'\
277                     \h'\\n(0wu+2n'
278                     .nr 0w +2n
279                     .nr 0d +1n
280                     .nr 0h +1n
281                     ..
282                     .EQ
283                     define box ' special Bx $1 '
284                     box(foo) ~ "bar"
285                     .EN
286
287       split "text"
288              As text, but since text is quoted, it is not  subject  to  macro
289              expansion; it is split up and the spacing between characters ad‐
290              justed per subsection “Spacing and typeface” above.
291
292       e1 uaccent e2
293              Set e2 as an accent under e1.  e2 is assumed to be at the appro‐
294              priate  height for a letter without a descender;  eqn vertically
295              shifts it depending on whether e1 has a  descender.   utilde  is
296              predefined using uaccent as a tilde accent below the baseline.
297
298       undef name
299              Remove  definition  of  macro or primitive name, making it unde‐
300              fined.
301
302       vcenter e
303              Vertically center e about the math axis, a horizontal line  upon
304              which  fraction  bars  and  characters  such  as “+” and “−” are
305              aligned.  MathML already behaves this way, so eqn  ignores  this
306              primitive  when  producing that output format.  The built-in sum
307              macro is defined as if by the following.
308
309                     define sum ! { type "operator" vcenter size +5 \(*S } !
310
311   Extended primitives
312       GNU eqn extends the syntax of some AT&T eqn primitives, introducing one
313       deliberate incompatibility.
314
315       delim on
316              eqn  recognizes  an  “on”  argument  to the delim primitive spe‐
317              cially, restoring any delimiters previously disabled with “delim
318              off”.  If delimiters haven't been specified, neither command has
319              effect.  Few eqn documents are expected to use “o”  and  “n”  as
320              left  and  right  delimiters, respectively.  If yours does, con‐
321              sider swapping them, or select others.
322
323       col n { ... }
324       ccol n { ... }
325       lcol n { ... }
326       rcol n { ... }
327       pile n { ... }
328       cpile n { ... }
329       lpile n { ... }
330       rpile n { ... }
331              The integer value n (in hundredths of an em) increases the  ver‐
332              tical  spacing  between  rows,  using groff's \x escape sequence
333              (the value has no effect in MathML mode).  Negative  values  are
334              accepted but have no effect.  If more than one n occurs in a ma‐
335              trix or pile, the largest is used.
336
337   Customization
338       When eqn generates troff input, the appearance  of  equations  is  con‐
339       trolled by a large number of parameters.  They have no effect when gen‐
340       erating MathML, which delegates typesetting to a MathML  rendering  en‐
341       gine.  Configure these parameters with the set primitive.
342
343       set p n
344              assigns  parameter  p  the  integer value n; n is interpreted in
345              units of hundredths of an em unless otherwise stated.  For exam‐
346              ple,
347
348                     set x_height 45
349
350              says  that  eqn  should  assume  that  the  font's  x-height  is
351              0.45 ems.
352
353              Available parameters are  as  follows;  defaults  are  shown  in
354              parentheses.   We  intend  these  descriptions  to be expository
355              rather than rigorous.
356
357              minimum_size     sets a floor  for  the  type  size  (in  scaled
358                               points) at which equations are set (5).
359
360              fat_offset       The  fat  primitive  emboldens  an  equation by
361                               overprinting two copies of the  equation  hori‐
362                               zontally  offset by this amount (4).  In MathML
363                               mode, components to  which  fat_offset  applies
364                               instead use the following.
365                                      <mstyle mathvariant='double-struck'>
366
367              over_hang        A  fraction  bar is longer by twice this amount
368                               than the maximum of the widths of the numerator
369                               and  denominator;  in other words, it overhangs
370                               the numerator and denominator by at least  this
371                               amount (0).
372
373              accent_width     When  bar or under is applied to a single char‐
374                               acter, the line is this long  (31).   Normally,
375                               bar  or  under  produces a line whose length is
376                               the width of the object to which it applies; in
377                               the  case  of a single character, this tends to
378                               produce a line that looks too long.
379
380              delimiter_factor Extensible delimiters produced  with  the  left
381                               and right primitives have a combined height and
382                               depth of at  least  this  many  thousandths  of
383                               twice the maximum amount by which the sub-equa‐
384                               tion that the delimiters enclose  extends  away
385                               from the axis (900).
386
387              delimiter_shortfall
388                               Extensible  delimiters  produced  with the left
389                               and right primitives have a combined height and
390                               depth not less than the difference of twice the
391                               maximum amount by which the  sub-equation  that
392                               the  delimiters  enclose  extends away from the
393                               axis and this amount (50).
394
395              null_delimiter_space
396                               This much horizontal space is inserted on  each
397                               side of a fraction (12).
398
399              script_space     The width of subscripts and superscripts is in‐
400                               creased by this amount (5).
401
402              thin_space       This amount of space is automatically  inserted
403                               after  punctuation characters.  It also config‐
404                               ures the width of the space produced by  the  ^
405                               token (17).
406
407              medium_space     This  amount of space is automatically inserted
408                               on either side of binary operators (22).
409
410              thick_space      This amount of space is automatically  inserted
411                               on  either  side of relations.  It also config‐
412                               ures the width of the space produced by  the  ~
413                               token (28).
414
415              x_height         The  height of lowercase letters without ascen‐
416                               ders such as “x” (45).
417
418              axis_height      The height above the baseline of the center  of
419                               characters such as “+” and “−” (26).  It is im‐
420                               portant that this value is correct for the font
421                               you are using.
422
423              default_rule_thickness
424                               This  should  be  set  to  the thickness of the
425                               \[ru] character, or the thickness of horizontal
426                               lines produced with the \D escape sequence (4).
427
428              num1             The  over  primitive shifts up the numerator by
429                               at least this amount (70).
430
431              num2             The smallover primitive shifts up the numerator
432                               by at least this amount (36).
433
434              denom1           The  over primitive shifts down the denominator
435                               by at least this amount (70).
436
437              denom2           The smallover primitive shifts down the denomi‐
438                               nator by at least this amount (36).
439
440              sup1             Normally  superscripts  are  shifted  up  by at
441                               least this amount (42).
442
443              sup2             Superscripts within superscripts or upper  lim‐
444                               its  or  numerators  of smallover fractions are
445                               shifted up by at least this amount (37).   Con‐
446                               ventionally, this is less than sup1.
447
448              sup3             Superscripts   within  denominators  or  square
449                               roots or subscripts or lower limits are shifted
450                               up  by  at least this amount (28).  Convention‐
451                               ally, this is less than sup2.
452
453              sub1             Subscripts are  normally  shifted  down  by  at
454                               least this amount (20).
455
456              sub2             When  there  is  both  a subscript and a super‐
457                               script, the subscript is  shifted  down  by  at
458                               least this amount (23).
459
460              sup_drop         The  baseline  of a superscript is no more than
461                               this much below the top of the object on  which
462                               the superscript is set (38).
463
464              sub_drop         The  baseline  of  a subscript is at least this
465                               much below the bottom of the  object  on  which
466                               the subscript is set (5).
467
468              big_op_spacing1  The baseline of an upper limit is at least this
469                               much above the top of the object on  which  the
470                               limit is set (11).
471
472              big_op_spacing2  The  baseline of a lower limit is at least this
473                               much below the bottom of the  object  on  which
474                               the limit is set (17).
475
476              big_op_spacing3  The  bottom  of an upper limit is at least this
477                               much above the top of the object on  which  the
478                               limit is set (20).
479
480              big_op_spacing4  The  top of a lower limit is at least this much
481                               below the bottom of the  object  on  which  the
482                               limit is set (60).
483
484              big_op_spacing5  This much vertical space is added above and be‐
485                               low limits (10).
486
487              baseline_sep     The baselines of the rows in a pile  or  matrix
488                               are  normally  this  far  apart (140).  Usually
489                               equal to the sum of num1 and denom1.
490
491              shift_down       The midpoint between the top baseline  and  the
492                               bottom  baseline in a matrix or pile is shifted
493                               down by this much from the axis (26).   Usually
494                               equal to axis_height.
495
496              column_sep       This  much  space is added between columns in a
497                               matrix (100).
498
499              matrix_side_sep  This much space is added at each side of a  ma‐
500                               trix (17).
501
502              draw_lines       If non-zero, eqn draws lines using the troff \D
503                               escape sequence, rather than the \l escape  se‐
504                               quence  and  the  \[ru] special character.  The
505                               eqnrc file sets the default: 1 on ps, html, and
506                               the X11 devices, otherwise 0.
507
508              body_height      is the presumed height of an equation above the
509                               text baseline; eqn adds  any  excess  as  extra
510                               pre-vertical  line  spacing with troff's \x es‐
511                               cape sequence (85).
512
513              body_depth       is the presumed depth of an equation below  the
514                               text  baseline;  eqn  adds  any excess as extra
515                               post-vertical line spacing with troff's \x  es‐
516                               cape sequence (35).
517
518              nroff            If  non-zero,  then ndefine behaves like define
519                               and tdefine is ignored, otherwise  tdefine  be‐
520                               haves  like define and ndefine is ignored.  The
521                               eqnrc  file  sets  the  default:  1  on  ascii,
522                               latin1, utf8, and cp1047 devices, otherwise 0.
523
524   Macros
525       In  GNU  eqn,  macros can take arguments.  A word defined by any of the
526       define, ndefine, or tdefine primitives followed immediately by  a  left
527       parenthesis is treated as a parameterized macro call: subsequent tokens
528       up to a matching right parenthesis are treated as comma-separated argu‐
529       ments.   In this context only, commas and parentheses also serve as to‐
530       ken separators.  A macro argument is not terminated by a  comma  inside
531       parentheses  nested  within  it.  In a macro definition, $n, where n is
532       between 1 and 9 inclusive, is replaced by the nth  argument;  if  there
533       are fewer than n arguments, it is replaced by nothing.
534
535   Predefined macros
536       GNU  eqn  supports  the  predefined  macros  offered  by AT&T eqn: and,
537       approx, arc, cos, cosh, del, det, dot, dotdot, dyad,  exp,  for,  grad,
538       half,  hat,  if,  inter, Im, inf, int, lim, ln, log, max, min, nothing,
539       partial, prime, prod, Re, sin, sinh,  sum,  tan,  tanh,  tilde,  times,
540       union, vec, ==, !=, +=, ->, <-, <<, >>, and “...”.  The lowercase clas‐
541       sical Greek letters are available as alpha, beta, chi, delta,  epsilon,
542       eta,  gamma, iota, kappa, lambda, mu, nu, omega, omicron, phi, pi, psi,
543       rho, sigma, tau, theta, upsilon, xi, and zeta.  Spell them with an ini‐
544       tial  capital  letter (Alpha) or in full capitals (ALPHA) to obtain up‐
545       percase forms.
546
547       GNU eqn further defines the macros cdot, cdots, and  utilde  (all  dis‐
548       cussed  above), dollar, which sets a dollar sign, and ldots, which sets
549       an ellipsis on the text baseline.
550
551   Fonts
552       eqn uses up to three typefaces to set an  equation:  italic  (oblique),
553       roman (upright), and bold.  Assign each a groff typeface with the prim‐
554       itives gfont, grfont, and gbfont.  The defaults are the  styles  I,  R,
555       and  B  (applied  to  the current font family).  The chartype primitive
556       (see above) sets a character's type, which determines the face used  to
557       set  it.  The “letter” type is set in italics; others are set in roman.
558       Use the bold primitive to select an (upright) bold style.
559
560       gbfont f
561              Select f as the bold font.  This is a GNU extension.
562
563       gfont f
564              Select f as the italic font.
565
566       grfont f
567              Select f as the roman font.  This is a GNU extension.
568

Options

570       --help displays a usage message, while -v and  --version  show  version
571       information; all exit afterward.
572
573       -C     Recognize  .EQ  and  .EN even when followed by a character other
574              than space or newline.
575
576       -d xy  Specify delimiters x for left and y for right ends of  equations
577              not  bracketed  by  .EQ/.EN.  x and y need not be distinct.  Any
578delim xy” statements in the source file override this option.
579
580       -f F   is equivalent to “gfont F”.
581
582       -m n   is equivalent to “set minimum_size n”.
583
584       -M dir Search dir for eqnrc before those listed  in  section  “Descrip‐
585              tion” above.
586
587       -N     Prohibit  newlines within delimiters.  This option allows eqn to
588              recover better from missing closing delimiters.
589
590       -p n   Set sub- and superscripts n points smaller than the  surrounding
591              text.   This  option  is deprecated.  eqn normally sets sub- and
592              superscripts at 70% of the type size of the surrounding text.
593
594       -r     Reduce the type size of subscripts at most once relative to  the
595              base type size for the equation.
596
597       -R     Don't load eqnrc.
598
599       -s n   is equivalent to “gsize n”.  This option is deprecated.
600
601       -T dev Prepare output for the device dev.  In most cases, the effect of
602              this is to define a macro dev with a value of 1; eqnrc uses this
603              to  provide definitions appropriate for the device.  However, if
604              the specified driver is “MathML”, the output  is  MathML  markup
605              rather  than  troff  input, and eqnrc is not loaded at all.  The
606              default output device is ps.
607

Files

609       /usr/share/groff/1.23.0/tmac/eqnrc
610              Initialization file.
611

MathML mode limitations

613       MathML is designed on the assumption that  it  cannot  know  the  exact
614       physical  characteristics  of the media and devices on which it will be
615       rendered.  It does not support control of motions and sizes to the same
616       degree troff does.
617
618eqn customization parameters have no effect on generated MathML.
619
620       • The  special,  up,  down,  fwd,  and back primitives cannot be imple‐
621         mented, and yield a MathML “<merror>” message instead.
622
623       • The vcenter primitive is silently ignored, as centering on  the  math
624         axis is the MathML default.
625
626       • Characters  that eqn sets extra large in troff mode—notably the inte‐
627         gral sign—may appear too small and  need  to  have  their  “<mstyle>”
628         wrappers adjusted by hand.
629
630       As  in its troff mode, eqn in MathML mode leaves the .EQ and .EN tokens
631       in place, but emits nothing corresponding to  delim  delimiters.   They
632       can,  however,  be  recognized  as  character sequences that begin with
633       “<math>”, end with “</math>”, and do not cross line boundaries.
634

Caveats

636       Tokens must be double-quoted in eqn input if they are not to be  recog‐
637       nized  as  names  of  macros or primitives, or if they are to be inter‐
638       preted by troff.  In particular, short ones, like “pi”  and  “PI”,  can
639       collide  with  troff identifiers.  For instance, the eqn command “gfont
640       PI” does not select groff's Palatino italic font for the global  italic
641       face; you must use “gfont "PI"” instead.
642
643       Delimited  equations  are set at the type size current at the beginning
644       of the input line, not necessarily that immediately preceding the open‐
645       ing delimiter.
646
647       Unlike  TeX,  eqn  does not inherently distinguish displayed and inline
648       equation styles; see the smallover  primitive  above.   However,  macro
649       packages  frequently  define  EQ  and  EN macros such that the equation
650       within is displayed.  These macros may accept arguments permitting  the
651       equation to be labeled or captioned; see the package's documentation.
652

Bugs

654       eqn  abuses  terminology—its  “equations” can be inequalities, bare ex‐
655       pressions, or unintelligible gibberish.  But  there's  no  changing  it
656       now.
657
658       In nroff mode, lowercase Greek letters are rendered in roman instead of
659       italic style.
660
661       In MathML mode, the mark and lineup features don't work.  These  could,
662       in theory, be implemented with “<maligngroup>” elements.
663
664       In  MathML  mode, each digit of a numeric literal gets a separate “<mn>
665       </mn>” pair, and decimal points are tagged with “<mo></mo>”.   This  is
666       allowed by the specification, but inefficient.
667

Examples

669       We first illustrate eqn usage with a trigonometric identity.
670
671              .EQ
672              sin ( alpha + beta ) = sin alpha cos beta + cos alpha sin beta
673              .EN
674
675       It  can be convenient to set up delimiters if mathematical content will
676       appear frequently in running text.
677
678              .EQ
679              delim $$
680              .EN
681              Having cached a table of logarithms,
682              the property $ln ( x y ) = ln x + ln y$ sped calculations.
683
684       The quadratic formula illustrates use of fractions  and  radicals,  and
685       affords an opportunity to use the full space token ~.
686
687              .EQ
688              x = { - b ~ \[+-] ~ sqrt { b sup 2 - 4 a c } } over { 2 a }
689              .EN
690
691       Alternatively,  we  could define the plus-minus sign as a binary opera‐
692       tor.  Automatic spacing puts 0.06 em less space on either side  of  the
693       plus-minus than ~ does, this being the difference between the widths of
694       the medium_space parameter used by binary operators  and  that  of  the
695       full  space.   Independently,  we can define a macro “frac” for setting
696       fractions.
697
698              .EQ
699              chartype "binary" \[+-]
700              define frac ! { $1 } over { $2 } !
701              x = frac(- b \[+-] sqrt { b sup 2 - 4 a c }, 2 a)
702              .EN
703

See also

705       “Typesetting Mathematics—User's  Guide”  (2nd  edition),  by  Brian  W.
706       Kernighan and Lorinda L. Cherry, 1978, AT&T Bell Laboratories Computing
707       Science Technical Report No. 17.
708
709       The TeXbook, by Donald E.  Knuth,  1984,  Addison-Wesley  Professional.
710       Appendix  G  discusses  many of the parameters from section “Customiza‐
711       tion” above in greater detail.
712
713       groff_char(7), particularly subsections “Logical symbols”,  “Mathemati‐
714       cal  symbols”, and “Greek glyphs”, documents a variety of special char‐
715       acter escape sequences useful in mathematical typesetting.
716
717       groff(1), troff(1), pic(1), groff_font(5)
718
719
720
721groff 1.23.0                    2 November 2023                         eqn(1)
Impressum