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

NAME

6       eqn - format equations for troff or MathML
7

SYNOPSIS

9       eqn [-rvCNR] [-d xy] [-T name] [-M dir] [-f F] [-s n] [-p n] [-m n]
10           [files...]
11

DESCRIPTION

13       This manual page describes the GNU version of eqn, which is part of the
14       groff  document  formatting system.  eqn compiles descriptions of equa‐
15       tions embedded within troff input files into commands that  are  under‐
16       stood  by troff.  Normally, it should be invoked using the -e option of
17       groff.  The syntax is quite compatible with Unix eqn.   The  output  of
18       GNU  eqn cannot be processed with Unix troff; it must be processed with
19       GNU troff.  If no files are given on the  command  line,  the  standard
20       input is read.  A filename of - causes the standard input to be read.
21
22       eqn  searches  for  the file eqnrc in the directories given with the -M
23       option first, then in /etc/groff/site-tmac,  /etc/groff/site-tmac,  and
24       finally  in  the standard macro directory /usr/share/groff/1.22.2/tmac.
25       If it exists, eqn processes it before the other input  files.   The  -R
26       option prevents this.
27
28       GNU eqn does not provide the functionality of neqn: it does not support
29       low-resolution, typewriter-like devices  (although  it  may  work  ade‐
30       quately for very simple input).
31

OPTIONS

33       It is possible to have whitespace between a command line option and its
34       parameter.
35
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.  Also, the statement `delim on' is not
42              handled specially.
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 does not reduce the size of
52              subscripts or superscripts to a smaller size than n.
53
54       -Tname The output is for device name.  Normally,  the  only  effect  of
55              this  is  to  define  a macro name with a value of 1; eqnrc uses
56              this to provide definitions appropriate for the  output  device.
57              However,  if  the  specified  device  is “MathML”, the output is
58              MathML markup rather than  troff  commands,  and  eqnrc  is  not
59              loaded at all.  The default output device is ps.
60
61       -Mdir  Search dir for eqnrc before the default directories.
62
63       -R     Don't load eqnrc.
64
65       -fF    This is equivalent to a gfont F command.
66
67       -sn    This  is equivalent to a gsize n command.  This option is depre‐
68              cated.  eqn normally sets  equations  at  whatever  the  current
69              point size is when the equation is encountered.
70
71       -pn    This  says  that  subscripts and superscripts should be n points
72              smaller than the surrounding text.  This option  is  deprecated.
73              Normally eqn sets subscripts and superscripts at 70% of the size
74              of the surrounding text.
75

USAGE

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

FILES

539       /usr/share/groff/1.22.2/tmac/eqnrc
540              Initialization file.
541

MATHML MODE LIMITATIONS

543       MathML is designed on the assumption that  it  cannot  know  the  exact
544       physical  characteristics  of the media and devices on which it will be
545       rendered.  It does not support fine control of motions and sizes to the
546       same degree troff does.  Thus:
547
548       *      eqn parameters have no effect on the generated MathML.
549
550       *      The special, up, down, fwd, and back operations cannot be imple‐
551              mented, and yield a MathML `<merror>' message instead.
552
553       *      The vcenter keyword is silently ignored,  as  centering  on  the
554              math axis is the MathML default.
555
556       *      Characters  that  eqn  over troff sets extra large – notably the
557              integral sign – may appear too small  and  need  to  have  their
558              `<mstyle>' wrappers adjusted by hand.
559
560       As  in its troff mode, eqn in MathML mode leaves the .EQ and .EN delim‐
561       iters in place for displayed equations, but emits  no  explicit  delim‐
562       iters  around  inline  equations.   They can, however, be recognized as
563       strings that begin with `<math>' and end  with  `</math>'  and  do  not
564       cross line boundaries.
565
566       See the BUGS section for translation limits specific to eqn.
567

BUGS

569       Inline  equations  are  set  at  the  point size that is current at the
570       beginning of the input line.
571
572       In MathML mode, the mark and lineup features don't work.  These  could,
573       in theory, be implemented with `<maligngroup>' elements.
574
575       In  MathML  mode, each digit of a numeric literal gets a separate `<mn>
576       </mn>' pair, and decimal points are tagged with `<mo></mo>'.   This  is
577       allowed by the specification, but inefficient.
578

SEE ALSO

580       groff(1), troff(1), pic(1), groff_font(5), The TeXbook
581
582
583
584Groff Version 1.22.2            7 February 2013                         EQN(1)
Impressum