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

FILES

540       /usr/share/groff/1.22.3/tmac/eqnrc
541              Initialization file.
542

MATHML MODE LIMITATIONS

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

BUGS

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

SEE ALSO

581       groff(1), troff(1), pic(1), groff_font(5), The TeXbook
582

COPYING

584       Copyright © 1989-2014 Free Software Foundation, Inc.
585
586       Permission is granted to make and distribute verbatim  copies  of  this
587       manual  provided  the  copyright  notice and this permission notice are
588       preserved on all copies.
589
590       Permission is granted to copy and distribute modified versions of  this
591       manual  under  the  conditions  for verbatim copying, provided that the
592       entire resulting derived work is distributed under the terms of a  per‐
593       mission notice identical to this one.
594
595       Permission  is granted to copy and distribute translations of this man‐
596       ual into another language, under the above conditions for modified ver‐
597       sions,  except  that this permission notice may be included in transla‐
598       tions approved by the Free Software Foundation instead of in the origi‐
599       nal English.
600
601
602
603Groff Version 1.22.3            4 November 2014                         EQN(1)
Impressum