# EQN(1) - man - phpMan

[EQN(1)](https://www.chedong.com/phpMan.php/man/EQN/1/markdown)                                 General Commands Manual                                [EQN(1)](https://www.chedong.com/phpMan.php/man/EQN/1/markdown)



## NAME
       eqn - format equations for troff or MathML

## SYNOPSIS
       **eqn** [**-rvCNR**] [**-d** _xy_] [**-T** _name_] [**-M** _dir_] [**-f** _F_] [**-s** _n_] [**-p** _n_] [**-m** _n_] [_file_ ...]

## DESCRIPTION
       This  manual  page describes the GNU version of **eqn**, which is part of the groff document for‐
       matting system.  **eqn** compiles descriptions of equations embedded  within  **troff**  input  files
       into  commands that are understood by **troff**.  Normally, it should be invoked using the **-e** op‐
       tion of **groff**.  The syntax is quite compatible with Unix eqn.  The output of GNU  **eqn**  cannot
       be  processed with Unix troff; it must be processed with GNU troff.  If no files are given on
       the command line, the standard input is read.  A filename of **-** causes the standard  input  to
       be read.

       **eqn**  searches  for  the file _eqnrc_ in the directories given with the **-M** option first, then in
       _/usr/lib/groff/site-tmac_, _/usr/share/groff/site-tmac_, and finally in the standard  macro  di‐
       rectory  _/usr/share/groff/1.22.4/tmac_.  If it exists, **eqn** processes it before the other input
       files.  The **-R** option prevents this.

       GNU **eqn** does not provide the functionality of neqn: it does not support low-resolution, type‐
       writer-like devices (although it may work adequately for very simple input).

## OPTIONS
       Whitespace is permitted between a command-line option and its argument.

### -d
              tions.  Any **delim** statements in the source file overrides this.

### -C
              Also, the statement ‘**delim** **on**’ is not handled specially.

### -N
              missing closing delimiters.

### -v

### -r

### -m
              scripts to a smaller size than _n_.

### -T
              _name_ with a value of **1**; _eqnrc_ uses this to provide  definitions  appropriate  for  the
              output  device.   However,  if  the specified device is “MathML”, the output is MathML
              markup rather than troff commands, and _eqnrc_ is not loaded at all.  The default output
              device is **ps**.

### -M

### -R

### -f

### -s
              sets equations at whatever the current point size is when the equation is encountered.

### -p
              rounding  text.   This  option is deprecated.  Normally **eqn** sets subscripts and super‐
              scripts at 70% of the size of the surrounding text.

## USAGE
       Only the differences between GNU **eqn** and Unix eqn are described here.

       GNU **eqn** emits Presentation MathML output when invoked with the **-T** **MathML** option.

       GNU eqn sets the input token **"..."**  as three periods or low dots, rather than the three  cen‐
       tered dots of classic eqn.  To get three centered dots, write **cdots** or **cdot** **cdot** **cdot**.

       Most of the new features of the GNU **eqn** input language are based on TeX.  There are some ref‐
       erences to the differences between TeX and GNU **eqn** below; these may safely be ignored if  you
       do not know TeX.

### Controlling delimiters
       If not in compatibility mode, **eqn** recognizes

              **delim** **on**

       to restore the delimiters which have been previously disabled with a call to ‘**delim** **off**’.  If
       delimiters haven't been specified, the call has no effect.

### Automatic spacing
       **eqn** gives each component of an equation a type, and adjusts the  spacing  between  components
       using that type.  Possible types are described in the table below.

       **ordinary**      an ordinary character such as ‘1’ or ‘_x_’
       **operator**      a large operator such as ‘Σ’
       **binary**        a binary operator such as ‘+’
       **relation**      a relation such as ‘=’
       **opening**       a opening bracket such as ‘(’
       **closing**       a closing bracket such as ‘)’
       **punctuation**   a punctuation character such as ‘,’
       **inner**         a subformula contained within brackets
       **suppress**      a type that suppresses automatic spacing adjustment

       Components of an equation get a type in one of two ways.

       **type** _t_ _e_
              This  yields an equation component that contains _e_ but that has type _t_, where _t_ is one
              of the types mentioned above.  For example, **times** is defined as

                     **type** **"binary"** **\(mu**

              The name of the type doesn't have to be quoted, but quoting protects from macro expan‐
              sion.

       **chartype** _t_ _text_
              Unquoted groups of characters are split up into individual characters, and the type of
              each character is looked up; this changes the type that is stored for each  character;
              it says that the characters in _text_ from now on have type _t_.  For example,

                     **chartype** **"punctuation"** **.,;:**

              would  make the characters ‘.,;:’ have type punctuation whenever they subsequently ap‐
              peared in an equation.  The type _t_ can also be **letter** or **digit**; in these  cases  **char**‐‐
              **type** changes the font type of the characters.  See subsection “Fonts” below.

### New primitives
       **big** _e_  Enlarges  the expression it modifies; intended to have semantics like CSS ‘large’.  In
              troff output, the point size is increased by 5; in MathML output, the expression uses

                     <mstyle mathsize='big'>

       _e1_ **smallover** _e2_
              This is similar to **over**; **smallover** reduces the size of _e1_ and _e2_; it  also  puts  less
              vertical  space between _e1_ or _e2_ and the fraction bar.  The **over** primitive corresponds
              to the TeX **\over** primitive in display styles; **smallover** corresponds to **\over**  in  non-
              display styles.

       **vcenter** _e_
              This vertically centers _e_ about the math axis.  The math axis is the vertical position
              about which characters such as ‘+’ and ‘−’ are centered; also it is the vertical posi‐
              tion used for the bar of fractions.  For example, **sum** is defined as

                     **{** **type** **"operator"** **vcenter** **size** **+5** **\(*S** **}**

              (Note that vcenter is silently ignored when generating MathML.)

       _e1_ **accent** _e2_
              This  sets  _e2_  as an accent over _e1_.  _e2_ is assumed to be at the correct height for a
              lowercase letter; _e2_ is moved down according to whether _e1_ is taller or shorter than a
              lowercase letter.  For example, **hat** is defined as

                     **accent** **{** **"^"** **}**

              **dotdot**, **dot**, **tilde**, **vec**, and **dyad** are also defined using the **accent** primitive.

       _e1_ **uaccent** _e2_
              This  sets  _e2_ as an accent under _e1_.  _e2_ is assumed to be at the correct height for a
              character without a descender; _e2_ is moved down if _e1_ has a descender.  **utilde** is pre-
              defined using **uaccent** as a tilde accent below the baseline.

       **split** **"**_text_**"**
              This has the same effect as simply

                     _text_

              but  _text_ is not subject to macro expansion because it is quoted; _text_ is split up and
              the spacing between individual characters is adjusted.

       **nosplit** _text_
              This has the same effect as

                     **"**_text_**"**

              but because _text_ is not quoted it is subject to macro expansion; _text_ is not split  up
              and the spacing between individual characters is not adjusted.

       _e_ **opprime**
              This is a variant of **prime** that acts as an operator on _e_.  It produces a different re‐
              sult from **prime** in a case such as **A** **opprime** **sub** **1**: with **opprime** the **1** is tucked  under
              the  prime  as  a subscript to the **A** (as is conventional in mathematical typesetting),
              whereas with **prime** the **1** is a subscript to the prime character.  The precedence of **op**‐‐
              **prime**  is  the  same as that of **bar** and **under**, which is higher than that of everything
              except **accent** and **uaccent**.  In unquoted text a **'** that is not the  first  character  is
              treated like **opprime**.

       **special** _text_ _e_
              This constructs a new object from _e_ using a [**troff**(1)](https://www.chedong.com/phpMan.php/man/troff/1/markdown) macro named _text_.  When the macro
              is called, the string **0s** contains the output for _e_, and the number registers  **0w**,  **0h**,
              **0d**, **0skern**, and **0skew** contain the width, height, depth, subscript kern, and skew of _e_.
              (The _subscript_ _kern_ of an object says how much a subscript on that  object  should  be
              tucked in; the _skew_ of an object says how far to the right of the center of the object
              an accent over the object should be placed.)  The macro must modify **0s** so that it out‐
              puts the desired result with its origin at the current point, and increase the current
              horizontal position by the width of the object.  The number  registers  must  also  be
              modified so that they correspond to the result.

              For  example, suppose you wanted a construct that ‘cancels’ an expression by drawing a
              diagonal line through it.

                     **.EQ**
                     **define** **cancel** **'special** **Ca'**
                     **.EN**
                     **.de** **Ca**
                     **.**  **ds** **0s** **\**
                     **\Z'\\*(0s'\**
                     **\v'\\n(0du'\**
                     **\D'l** **\\n(0wu** **-\\n(0hu-\\n(0du'\**
                     **\v'\\n(0hu'**
                     **..**

              Then you could cancel an expression _e_ with **cancel** **{** _e_ **}**

              Here's a more complicated construct that draws a box round an expression:

                     **.EQ**
                     **define** **box** **'special** **Bx'**
                     **.EN**
                     **.de** **Bx**
                     **.**  **ds** **0s** **\**
                     **\Z'\h'1n'\\*(0s'\**
                     **\Z'\**
                     **\v'\\n(0du+1n'\**
                     **\D'l** **\\n(0wu+2n** **0'\**
                     **\D'l** **0** **-\\n(0hu-\\n(0du-2n'\**
                     **\D'l** **-\\n(0wu-2n** **0'\**
                     **\D'l** **0** **\\n(0hu+\\n(0du+2n'\**
                     **'\**
                     **\h'\\n(0wu+2n'**
                     **.**  **nr** **0w** **+2n**
                     **.**  **nr** **0d** **+1n**
                     **.**  **nr** **0h** **+1n**
                     **..**

       **space** _n_
              A positive value of the integer _n_ (in hundredths of an em) sets the  vertical  spacing
              before  the  equation, a negative value sets the spacing after the equation, replacing
              the default values.  This primitive provides an interface to **groff**'s  **\x**  escape  (but
              with opposite sign).

              This keyword has no effect if the equation is part of a **pic** picture.

### Extended primitives
       **col** _n_ **{** _..._ **}**
       **ccol** _n_ **{** _..._ **}**
       **lcol** _n_ **{** _..._ **}**
       **rcol** _n_ **{** _..._ **}**
       **pile** _n_ **{** _..._ **}**
       **cpile** _n_ **{** _..._ **}**
       **lpile** _n_ **{** _..._ **}**
       **rpile** _n_ **{** _..._ **}**
              The  integer  value  _n_ (in hundredths of an em) increases the vertical spacing between
              rows, using **groff**'s **\x** escape (the value has no effect in MathML mode).  Negative val‐
              ues  are possible but have no effect.  If there is more than a single value given in a
              matrix, the biggest one is used.

### Customization
       When **eqn** is generating troff markup, the appearance of equations is  controlled  by  a  large
       number of parameters.  They have no effect when generating MathML mode, which pushes typeset‐
       ting and fine motions downstream to a MathML rendering engine.  These parameters can  be  set
       using the **set** command.

       **set** _p_ _n_
              This sets parameter _p_ to value _n_; _n_ is an integer.  For example,

                     **set** **x**___**height** **45**

              says that **eqn** should assume an x height of 0.45 ems.

              Possible parameters are as follows.  Values are in units of hundredths of an em unless
              otherwise stated.  These descriptions are intended to be expository rather than defin‐
              itive.

              **minimum**___**size**
                     **eqn**  doesn't  set  anything at a smaller point-size than this.  The value is in
                     points.

              **fat**___**offset**
                     The **fat** primitive emboldens an equation by overprinting two copies of the equa‐
                     tion  horizontally offset by this amount.  This parameter is not used in MathML
                     mode; instead, fat text uses

                            <mstyle mathvariant='double-struck'>

              **over**___**hang**
                     A fraction bar is longer by twice this amount than the maximum of the widths of
                     the  numerator  and denominator; in other words, it overhangs the numerator and
                     denominator by at least this amount.

              **accent**___**width**
                     When **bar** or **under** is applied to a single character,  the  line  is  this  long.
                     Normally,  **bar** or **under** produces a line whose length is the width of the object
                     to which it applies; in the case of a single character, this tends to produce a
                     line that looks too long.

              **delimiter**___**factor**
                     Extensible  delimiters  produced with the **left** and **right** primitives have a com‐
                     bined height and depth of at least this many thousandths of twice  the  maximum
                     amount  by which the sub-equation that the delimiters enclose extends away from
                     the axis.

              **delimiter**___**shortfall**
                     Extensible delimiters produced with the **left** and **right** primitives have  a  com‐
                     bined height and depth not less than the difference of twice the maximum amount
                     by which the sub-equation that the delimiters enclose  extends  away  from  the
                     axis and this amount.

              **null**___**delimiter**___**space**
                     This much horizontal space is inserted on each side of a fraction.

              **script**___**space**
                     The width of subscripts and superscripts is increased by this amount.

              **thin**___**space**
                     This amount of space is automatically inserted after punctuation characters.

              **medium**___**space**
                     This  amount of space is automatically inserted on either side of binary opera‐
                     tors.

              **thick**___**space**
                     This amount of space is automatically inserted on either side of relations.

              **x**___**height**
                     The height of lowercase letters without ascenders such as ‘x’.

              **axis**___**height**
                     The height above the baseline of the center of characters such as ‘+’ and  ‘−’.
                     It is important that this value is correct for the font you are using.

              **default**___**rule**___**thickness**
                     This  should  set  to  the thickness of the **\(ru** character, or the thickness of
                     horizontal lines produced with the **\D** escape sequence.

              **num1**   The **over** command shifts up the numerator by at least this amount.

              **num2**   The **smallover** command shifts up the numerator by at least this amount.

              **denom1** The **over** command shifts down the denominator by at least this amount.

              **denom2** The **smallover** command shifts down the denominator by at least this amount.

              **sup1**   Normally superscripts are shifted up by at least this amount.

              **sup2**   Superscripts within superscripts or upper limits  or  numerators  of  **smallover**
                     fractions  are  shifted  up by at least this amount.  This is usually less than
                     sup1.

              **sup3**   Superscripts within denominators or square roots or subscripts or lower  limits
                     are shifted up by at least this amount.  This is usually less than sup2.

              **sub1**   Subscripts are normally shifted down by at least this amount.

              **sub2**   When there is both a subscript and a superscript, the subscript is shifted down
                     by at least this amount.

              **sup**___**drop**
                     The baseline of a superscript is no more than this much amount below the top of
                     the object on which the superscript is set.

              **sub**___**drop**
                     The  baseline  of a subscript is at least this much below the bottom of the ob‐
                     ject on which the subscript is set.

              **big**___**op**___**spacing1**
                     The baseline of an upper limit is at least this much above the top of  the  ob‐
                     ject on which the limit is set.

              **big**___**op**___**spacing2**
                     The baseline of a lower limit is at least this much below the bottom of the ob‐
                     ject on which the limit is set.

              **big**___**op**___**spacing3**
                     The bottom of an upper limit is at least this much above the top of the  object
                     on which the limit is set.

              **big**___**op**___**spacing4**
                     The  top  of a lower limit is at least this much below the bottom of the object
                     on which the limit is set.

              **big**___**op**___**spacing5**
                     This much vertical space is added above and below limits.

              **baseline**___**sep**
                     The baselines of the rows in a pile or matrix are normally this far apart.   In
                     most cases this should be equal to the sum of **num1** and **denom1**.

              **shift**___**down**
                     The  midpoint  between  the top baseline and the bottom baseline in a matrix or
                     pile is shifted down by this much from the axis.  In most cases this should  be
                     equal to **axis**___**height**.

              **column**___**sep**
                     This much space is added between columns in a matrix.

              **matrix**___**side**___**sep**
                     This much space is added at each side of a matrix.

              **draw**___**lines**
                     If  this is non-zero, lines are drawn using the **\D** escape sequence, rather than
                     with the **\l** escape sequence and the **\(ru** character.

              **body**___**height**
                     The amount by which the height of the equation exceeds this is added  as  extra
                     space before the line containing the equation (using **\x**).  The default value is
                     85.

              **body**___**depth**
                     The amount by which the depth of the equation exceeds this is  added  as  extra
                     space  after the line containing the equation (using **\x**).  The default value is
                     35.

              **nroff**  If this is non-zero, then **ndefine** behaves like **define** and **tdefine**  is  ignored,
                     otherwise  **tdefine**  behaves  like  **define**  and **ndefine** is ignored.  The default
                     value is 0 (This is typically changed to 1 by the _eqnrc_  file  for  the  **ascii**,
                     **latin1**, **utf8**, and **cp1047** devices.)

              A more precise description of the role of many of these parameters can be found in Ap‐
              pendix H of _The_ _TeXbook_.

### Macros
       Macros can take arguments.  In a macro body, **$**_n_ where _n_ is between 1 and 9,  is  replaced  by
       the  _n_th argument if the macro is called with arguments; if there are fewer than _n_ arguments,
       it is replaced by nothing.  A word containing a left parenthesis where the part of  the  word
       before  the  left  parenthesis  has  been defined using the **define** command is recognized as a
       macro call with arguments; characters following the left parenthesis up to a  matching  right
       parenthesis are treated as comma-separated arguments; commas inside nested parentheses do not
       terminate an argument.

       **sdefine** _name_ _X_ _anything_ _X_
              This is like the **define** command, but _name_ is not recognized if called with arguments.

       **include** **"**_file_**"**
       **copy** **"**_file_**"**
              Include the contents of _file_ (**include** and **copy** are synonyms).  Lines of _file_ beginning
              with **.EQ** or **.EN** are ignored.

       **ifdef** _name_ _X_ _anything_ _X_
              If  _name_ has been defined by **define** (or has been automatically defined because _name_ is
              the output device) process _anything_; otherwise ignore _anything_.  _X_ can be any  charac‐
              ter not appearing in _anything_.

       **undef** _name_
              Remove definition of _name_, making it undefined.

       Besides  the  macros  mentioned  above, the following definitions are available: **Alpha**, **Beta**,
       ..., **Omega** (this is the same as **ALPHA**, **BETA**, ..., **OMEGA**),  **ldots**  (three  dots  on  the  base
       line), and **dollar**.

### Fonts
       **eqn**  normally  uses  at least two fonts to set an equation: an italic font for letters, and a
       roman font for everything else.  The existing **gfont** command changes the font that is used  as
       the  italic  font.   By  default  this  is **I**.  The font that is used as the roman font can be
       changed using the new **grfont** command.

       **grfont** _f_
              Set the roman font to _f_.

       The **italic** primitive uses the current italic font set by **gfont**; the **roman** primitive uses  the
       current roman font set by **grfont**.  There is also a new **gbfont** command, which changes the font
       used by the **bold** primitive.  If you only use the **roman**, **italic** and **bold** primitives to changes
       fonts  within  an equation, you can change all the fonts used by your equations just by using
       **gfont**, **grfont** and **gbfont** commands.

       You can control which characters are treated as letters (and therefore set in italics) by us‐
       ing  the  **chartype** command described above.  A type of **letter** causes a character to be set in
       italic type.  A type of **digit** causes a character to be set in roman type.

## FILES
       _/usr/share/groff/1.22.4/tmac/eqnrc_
              Initialization file.

## MATHML MODE LIMITATIONS
       MathML is designed on the assumption that it cannot know the exact  physical  characteristics
       of  the  media and devices on which it will be rendered.  It does not support fine control of
       motions and sizes to the same degree troff does.  Thus:

       *      **eqn** parameters have no effect on the generated MathML.

       *      The **special**, **up**, **down**, **fwd**, and **back** operations cannot be  implemented,  and  yield  a
              MathML ‘<merror>’ message instead.

       *      The  **vcenter**  keyword is silently ignored, as centering on the math axis is the MathML
              default.

       *      Characters that **eqn** over troff sets extra large – notably the integral sign – may  ap‐
              pear too small and need to have their ‘<mstyle>’ wrappers adjusted by hand.

       As  in its troff mode, **eqn** in MathML mode leaves the **.EQ** and **.EN** delimiters in place for dis‐
       played equations, but emits no explicit delimiters around inline equations.  They  can,  how‐
       ever,  be  recognized  as  strings that begin with ‘<math>’ and end with ‘</math>’ and do not
       cross line boundaries.

       See section “Bugs” below for translation limits specific to **eqn**.

## BUGS
       Inline equations are set at the point size that is current at  the  beginning  of  the  input
       line.

       In  MathML  mode, the **mark** and **lineup** features don't work.  These could, in theory, be imple‐
       mented with ‘<maligngroup>’ elements.

       In MathML mode, each digit of a numeric literal gets a separate ‘<mn></mn>’ pair, and decimal
       points are tagged with ‘<mo></mo>’.  This is allowed by the specification, but inefficient.

## SEE ALSO
       [**groff**(1)](https://www.chedong.com/phpMan.php/man/groff/1/markdown), [**troff**(1)](https://www.chedong.com/phpMan.php/man/troff/1/markdown), [**pic**(1)](https://www.chedong.com/phpMan.php/man/pic/1/markdown), **groff**___**[font**(5)](https://www.chedong.com/phpMan.php/man/font/5/markdown), _The_ _TeXbook_



groff 1.22.4                                23 March 2022                                     [EQN(1)](https://www.chedong.com/phpMan.php/man/EQN/1/markdown)
