# eqn - format mathematics (equations) for groff or MathML - man(1) - [phpMan]

> **TLDR:** Equation preprocessor for the groff (GNU Troff) document formatting system.
>
- Process input with equations, saving the output for future typesetting with groff to PostScript:
  `eqn {{path/to/input.eqn}} > {{path/to/output.roff}}`
- Typeset an input file with equations to PDF using the [me] macro package:
  `eqn -T {{pdf}} {{path/to/input.eqn}} | groff -{{me}} -T {{pdf}} > {{path/to/output.pdf}}`

*Source: tldr-pages*

---

[_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 mathematics (equations) for _groff_ or MathML

## Synopsis
       **eqn **[**-CNrR**] [**-**d _xy_] [**-f _**F_] [**-m _**n_] [**-M _**dir_] [**-p _**n_] [**-s _**n_] [**-T _**dev_] [_file_ ...]

### eqn --help

### eqn -v
### eqn --version

## Description
       The  GNU  implementation of _eqn_ is part of the [_groff_(7)](https://www.chedong.com/phpMan.php/man/groff/7/markdown) document formatting system.  _eqn_ is a
       [_troff_(1)](https://www.chedong.com/phpMan.php/man/troff/1/markdown) preprocessor that translates expressions in its own language,  embedded  in  [_roff_(7)](https://www.chedong.com/phpMan.php/man/roff/7/markdown)
       input  files, into mathematical notation typeset by [_troff_(1)](https://www.chedong.com/phpMan.php/man/troff/1/markdown).  It copies each _file_'s contents
       to the standard output stream, translating each _equation_ between lines starting with **.EQ  **and
       **.EN**,  or  within a pair of user-specified delimiters.  Normally, _eqn_ is not executed directly
       by the user, but invoked by specifying the **-e **option to [_groff_(1)](https://www.chedong.com/phpMan.php/man/groff/1/markdown).  While GNU _eqn_'s input syn‐
       tax is highly compatible with AT&T _eqn_, the output _eqn_ produces cannot be processed  by  AT&T
       _troff_;  GNU _troff_ (or a _troff_ implementing relevant GNU extensions) must be used.  If no _file_
       operands are given on the command line, or if _file_ is  “**-**”,  _eqn_  reads  the  standard  input
       stream.

       Unless  the  **-R **option is used, _eqn_ searches for the file _eqnrc_ in the directories given with
       the **-M **option first, then in _/usr/share/groff/site-tmac_, and finally in  the  standard  macro
       directory  _/usr/share/groff/1.23.0/tmac_.   If it exists and is readable, _eqn_ processes it be‐
       fore any input files.

       This man page primarily discusses the differences between GNU _eqn_ and AT&T _eqn_.  Most of  the
       new  features  of  the GNU _eqn_ input language are based on TeX.  There are some references to
       the differences between TeX and GNU _eqn_ below; these may safely be ignored if you do not know
       TeX.

       Three points are worth special note.

       • GNU _eqn_ emits Presentation MathML output when invoked with the “**-T MathML**” option.

       • GNU _eqn_ does not support terminal devices well, though it may suffice for simple inputs.

       • GNU _eqn_ sets the input token “**...**” as an ellipsis on the text baseline, not the three  cen‐
         tered  dots  of  AT&T  _eqn_.   Set an ellipsis on the math axis with the GNU extension macro
         **cdots**.

### Anatomy of an equation
       _eqn_ input consists of tokens.  Consider a form of Newton's second law of motion.  The input

              .EQ
              F =
              m a
              .EN

       becomes _F_=_ma_.  Each of **F**, **=**, **m**, and **a **is a token.  Spaces and newlines  are  interchangeable;
       they separate tokens but do not break lines or produce space in the output.

       The  following input characters not only separate tokens, but manage their grouping and spac‐
       ing as well.

       **{ }    **Braces perform grouping.  Whereas “**e sup a b**” expresses “(_e_ to the _a_) times _b_”, “**e sup**
              **{ a b }**” means “_e_ to the (_a_ times _b_)”.  When  immediately  preceded  by  a  “**left**”  or
              “**right**” primitive, a brace loses its special meaning.

       **^ ~    **are  the  _half_ _space_ and _full_ _space,_ respectively.  Use them to tune the appearance of
              the output.

       Tab and leader characters separate tokens as well as advancing the drawing  position  to  the
       next  tab  stop,  but are seldom used in _eqn_ input.  When they occur, they must appear at the
       outermost lexical scope.  This roughly means that they can't appear within  braces  that  are
       necessary  to disambiguate the input; _eqn_ will diagnose an error in this event.  (See subsec‐
       tion “Macros” below for additional token separation rules.)

       Other tokens are primitives, macros, an argument to either of the foregoing, or components of
       an equation.

       _Primitives_ are fundamental keywords of the _eqn_ language.  They can configure an aspect of the
       preprocessor's state, as when setting a “global” font  selection  or  type  size  (**gfont  **and
       **gsize**),  or  declaring  or  deleting  macros (“**define**” and **undef**); these are termed _commands._
       Other primitives perform formatting operations on the tokens after them (as with  **fat**,  **over**,
       **sqrt**, or **up**).

       Equation  _components_  include mathematical variables, constants, numeric literals, and opera‐
       tors.  _eqn_ remaps some input character sequences to _groff_ special character escape  sequences
       for  economy  in equation entry and to ensure that glyphs from an unstyled font are used; see
       [_groff_char_(7)](https://www.chedong.com/phpMan.php/man/groffchar/7/markdown).

              +   \[pl]                '    \[fm]
              -   \[mi]                <=   \[<=]
              =   \[eq]                >=   \[>=]

       _Macros_ permit primitives, components, and other macros to be collected and referred to  by  a
       single  token.   Predefined macros make convenient the preparation of _eqn_ input in a form re‐
       sembling its spoken expression; for example, consider **cos**, **hat**, **inf**, and **lim**.

### Spacing and typeface
       GNU _eqn_ imputes types to the components of an equation, adjusting the  spacing  between  them
       accordingly.  Recognized types are as follows; most affect spacing only, whereas the “**letter**”
       subtype of “**ordinary**” also assigns a style.

         ordinary      character such as “1”, “a”, or “!”
           letter      character to be italicized by default
           digit       _n/a_
         operator      large operator such as “Σ”
         binary        binary operator such as “+”
         relation      relational operator such as “=”
         opening       opening bracket such as “(”
         closing       closing bracket such as “)”
         punctuation   punctuation character such as “,”
         inner         sub-formula contained within brackets
         suppress      component to which automatic spacing is not applied

       Two primitives apply types to equation components.

       **type _**t_ _e_
              Apply type _t_ to expression _e_.

       **chartype _**t_ _text_
              Assign each character in (unquoted) _text_ type _t_, persistently.

       _eqn_ sets up spacings and styles as if by the following commands.

              chartype "letter"      abcdefghiklmnopqrstuvwxyz
              chartype "letter"      ABCDEFGHIKLMNOPQRSTUVWXYZ
              chartype "letter"      \[*a]\[*b]\[*g]\[*d]\[*e]\[*z]
              chartype "letter"      \[*y]\[*h]\[*i]\[*k]\[*l]\[*m]
              chartype "letter"      \[*n]\[*c]\[*o]\[*p]\[*r]\[*s]
              chartype "letter"      \[*t]\[*u]\[*f]\[*x]\[*q]\[*w]
              chartype "binary"      *\[pl]\[mi]
              chartype "relation"    <>\[eq]\[<=]\[>=]
              chartype "opening"     {([
              chartype "closing"     })]
              chartype "punctuation" ,;:.
              chartype "suppress"    ^~

       _eqn_  assigns  all  other  ordinary  and  special _roff_ characters, including numerals 0–9, the
       “**ordinary**” type.  (The “**digit**” type is not used, but is  available  for  customization.)   In
       keeping with common practice in mathematical typesetting, lowercase, but not uppercase, Greek
       letters  are  assigned  the “**letter**” type to style them in italics.  The macros for producing
       ellipses, “**...**”, **cdots**, and **ldots**, use the “**inner**” type.

### Primitives
       _eqn_ supports without alteration the AT&T _eqn_ primitives **above**, **back**, **bar**, **bold**, **define**, **down**,
       **fat**, **font**, **from**, **fwd**, **gfont**, **gsize**, **italic**, **left**, **lineup**, **mark**, **matrix**, **ndefine**, **over**, **right**,
       **roman**, **size**, **sqrt**, **sub**, **sup**, **tdefine**, **to**, **under**, and **up**.

### New primitives
       The GNU extension primitives “**type**” and **chartype **are discussed  in  subsection  “Spacing  and
       typeface”  above; “**set**” in subsection “Customization” below; and **grfont **and **gbfont **in subsec‐
       tion “Fonts” below.  In the following synopses, _X_ can be any character not appearing  in  the
       parameter thus bracketed.

       _e1_ **accent _**e2_
              Set _e2_ as an accent over _e1_.  _e2_ is assumed to be at the appropriate height for a low‐
              ercase letter without an ascender;  _eqn_ vertically shifts it depending on _e1_'s height.
              For example, **hat **is defined as follows.

                     accent { "^" }

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

       **big _**e_  Enlarge  the expression _e_; semantics like those of CSS “large” are intended.  In _troff_
              output, the type size is increased by 5 scaled points.  MathML output emits  the  fol‐
              lowing.

                     <mstyle mathsize='big'>

       **copy _**file_
       **include _**file_
              Interpolate the contents of _file_, omitting lines beginning with **.EQ **or **.EN**.  If a rel‐
              ative path name, _file_ is sought relative to the current working directory.

       **ifdef _**name_ _X_ _anything_ _X_
              If _name_ is defined as a primitive or macro, interpret _anything_.

       **nosplit _**text_
              As  "_text_",  but  since _text_ is not quoted it is subject to macro expansion; it is not
              split up and the spacing between characters not adjusted per subsection  “Spacing  and
              typeface” above.

       _e_ **opprime**
              As  **prime**,  but set the prime symbol as an operator on _e_.  In the input “**A opprime sub**
              **1**”, the “1” is tucked under the prime as a subscript to the “A” (as is conventional in
              mathematical typesetting), whereas when **prime **is used, the “1” is a subscript  to  the
              prime  character.   The  precedence of **opprime **is the same as that of **bar **and “**under**”,
              and higher than that of other primitives except **accent **and **uaccent**.  In unquoted text,
              a neutral apostrophe (**'**) that is not the first character on the input line is  treated
              like **opprime**.

       **sdefine _**name_ _X_ _anything_ _X_
              As “**define**”, but _name_ is not recognized as a macro if called with arguments.

       _e1_ **smallover _**e2_
              As  **over**, but reduces the type size of _e1_ and _e2_, and puts less vertical space between
              _e1_ and _e2_ and the fraction bar.  The **over **primitive corresponds to the TeX **\over **prim‐
              itive in displayed equation styles; **smallover  **corresponds  to  **\over  **in  non-display
              (“inline”) styles.

       **space _**n_
              Set  extra  vertical  spacing around the equation, replacing the default values, where
              _n_ is an integer in hundredths of an em.  If positive, _n_ increases vertical spacing be‐
              fore the equation; if negative, it does so after the equation.   This  primitive  pro‐
              vides  an  interface to _groff_'s **\x **escape sequence, but with the opposite sign conven‐
              tion.  It has no effect if the equation is part of a [_pic_(1)](https://www.chedong.com/phpMan.php/man/pic/1/markdown) picture.

       **special _**troff-macro_ _e_
              Construct an object by calling _troff-macro_ on _e_.  The _troff_ string **0s **contains the _eqn_
              output for _e_, and the registers **0w**, **0h**, **0d**,  **0skern**,  and  **0skew  **the  width,  height,
              depth,  subscript kern, and skew of _e_, respectively.  (The _subscript_ _kern_ of an object
              indicates how much a subscript on that object should be “tucked in”, or placed to  the
              left  relative  to a non-subscripted glyph of the same size.  The _skew_ of an object is
              how far to the right of the center of the object an accent over it should be  placed.)
              The  macro  must  modify **0s **so that it outputs the desired result, returns the drawing
              position to the text baseline at the beginning of _e_, and updates the foregoing  regis‐
              ters to correspond to the new dimensions of the result.

              Suppose  you  want a construct that “cancels” an expression by drawing a diagonal line
              through it.

                     .de Ca
                     .  ds 0s \
                     \Z'\\*(0s'\
                     \v'\\n(0du'\
                     \D'l \\n(0wu -\\n(0hu-\\n(0du'\
                     \v'\\n(0hu'
                     ..
                     .EQ
                     special Ca "x \[mi] 3 \[pl] x" ~ 3
                     .EN

              We use the **\[mi] **and **\[pl] **special characters instead of + and - because they are part
              of the argument to a _troff_ macro, so _eqn_  does  not  transform  them  to  mathematical
              glyphs for us.  Here's a more complicated construct that draws a box around an expres‐
              sion;  the  bottom of the box rests on the text baseline.  We define the _eqn_ macro **box**
              to wrap the call of the _troff_ macro **Bx**.

                     .de Bx
                     .ds 0s \
                     \Z'\\h'1n'\\*[0s]'\
                     \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
                     ..
                     .EQ
                     define box ' special Bx $1 '
                     box(foo) ~ "bar"
                     .EN

       **split "_**text_**"**
              As _text_, but since _text_ is quoted, it is not subject to macro expansion; it  is  split
              up  and  the spacing between characters adjusted per subsection “Spacing and typeface”
              above.

       _e1_ **uaccent _**e2_
              Set _e2_ as an accent under _e1_.  _e2_ is assumed to be at the  appropriate  height  for  a
              letter  without  a  descender;  _eqn_ vertically shifts it depending on whether _e1_ has a
              descender.  **utilde **is predefined using **uaccent **as a tilde accent below the baseline.

       **undef _**name_
              Remove definition of macro or primitive _name_, making it undefined.

       **vcenter _**e_
              Vertically center _e_ about the _math_ _axis_, a horizontal line upon  which  fraction  bars
              and  characters  such as “+” and “−” are aligned.  MathML already behaves this way, so
              _eqn_ ignores this primitive when producing that output format.  The built-in **sum  **macro
              is defined as if by the following.

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

### Extended primitives
       GNU _eqn_ extends the syntax of some AT&T _eqn_ primitives, introducing one deliberate incompati‐
       bility.

### delim on
              _eqn_ recognizes an “**on**” argument to the **delim **primitive specially, restoring any delim‐
              iters  previously  disabled  with  “**delim off**”.  If delimiters haven't been specified,
              neither command has effect.  Few _eqn_ documents are expected to use “o” and “n” as left
              and right delimiters, respectively.  If yours does, consider swapping them, or  select
              others.

       **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 sequence (the value has no effect in MathML mode).  Neg‐
              ative values are accepted but have no effect.  If more than one _n_ occurs in  a  matrix
              or pile, the largest is used.

### Customization
       When  _eqn_  generates _troff_ input, the appearance of equations is controlled by a large number
       of parameters.  They have no effect when generating MathML, which delegates typesetting to  a
       MathML rendering engine.  Configure these parameters with the **set **primitive.

       **set _**p_ _n_
              assigns parameter _p_ the integer value _n_; _n_ is interpreted in units of hundredths of an
              em unless otherwise stated.  For example,

                     set x_height 45

              says that _eqn_ should assume that the font's x-height is 0.45 ems.

              Available  parameters  are  as  follows; defaults are shown in parentheses.  We intend
              these descriptions to be expository rather than rigorous.

              **minimum_size     **sets a floor for the type size (in scaled points) at which  equations
                               are set (**5**).

              **fat_offset       **The **fat **primitive emboldens an equation by overprinting two copies of
                               the equation horizontally offset by this amount (**4**).  In MathML mode,
                               components to which **fat_offset **applies instead use the following.
                                      <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 (**0**).

              **accent_width     **When  **bar **or **under **is applied to a single character, the line is this
                               long (**31**).  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 combined height and depth of at least this many thousandths of
                               twice  the  maximum  amount by which the sub-equation that the delim‐
                               iters enclose extends away from the axis (**900**).

              **delimiter_shortfall**
                               Extensible delimiters produced with the  **left  **and  **right  **primitives
                               have  a  combined  height  and  depth not less than the difference of
                               twice the maximum amount by which the sub-equation  that  the  delim‐
                               iters enclose extends away from the axis and this amount (**50**).

              **null_delimiter_space**
                               This  much  horizontal  space  is inserted on each side of a fraction
                               (**12**).

              **script_space     **The width of subscripts and superscripts is increased by this  amount
                               (**5**).

              **thin_space       **This  amount  of  space  is  automatically inserted after punctuation
                               characters.  It also configures the width of the  space  produced  by
                               the **^ **token (**17**).

              **medium_space     **This  amount of space is automatically inserted on either side of bi‐
                               nary operators (**22**).

              **thick_space      **This amount of space is automatically inserted on either side of  re‐
                               lations.  It also configures the width of the space produced by the **~**
                               token (**28**).

              **x_height         **The height of lowercase letters without ascenders such as “x” (**45**).

              **axis_height      **The height above the baseline of the center of characters such as “+”
                               and  “−”  (**26**).   It  is important that this value is correct for the
                               font you are using.

              **default_rule_thickness**
                               This should be set to the thickness of the **\[ru]  **character,  or  the
                               thickness  of  horizontal  lines produced with the **\D **escape sequence
                               (**4**).

              **num1             **The **over **primitive shifts up the numerator by at  least  this  amount
                               (**70**).

              **num2             **The  **smallover  **primitive  shifts  up  the numerator by at least this
                               amount (**36**).

              **denom1           **The **over **primitive shifts down  the  denominator  by  at  least  this
                               amount (**70**).

              **denom2           **The  **smallover **primitive shifts down the denominator by at least this
                               amount (**36**).

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

              **sup2             **Superscripts within superscripts or upper  limits  or  numerators  of
                               **smallover  **fractions  are  shifted  up  by at least this amount (**37**).
                               Conventionally, this is less than **sup1**.

              **sup3             **Superscripts within denominators or square  roots  or  subscripts  or
                               lower  limits  are  shifted up by at least this amount (**28**).  Conven‐
                               tionally, this is less than **sup2**.

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

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

              **sup_drop         **The baseline of a superscript is no more than this much below the top
                               of the object on which the superscript is set (**38**).

              **sub_drop         **The baseline of a subscript is at least this much below the bottom of
                               the object on which the subscript is set (**5**).

              **big_op_spacing1  **The baseline of an upper limit is at least this much above the top of
                               the object on which the limit is set (**11**).

              **big_op_spacing2  **The  baseline of a lower limit is at least this much below the bottom
                               of the object on which the limit is set (**17**).

              **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 (**20**).

              **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 (**60**).

              **big_op_spacing5  **This much vertical space is added above and below limits (**10**).

              **baseline_sep     **The baselines of the rows in a pile or matrix are normally  this  far
                               apart (**140**).  Usually 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 (**26**).  Usu‐
                               ally equal to **axis_height**.

              **column_sep       **This much space is added between columns in a matrix (**100**).

              **matrix_side_sep  **This much space is added at each side of a matrix (**17**).

              **draw_lines       **If non-zero, _eqn_ draws lines using  the  _troff_  **\D  **escape  sequence,
                               rather  than  the **\l **escape sequence and the **\[ru] **special character.
                               The _eqnrc_ file sets the default: **1 **on **ps**, **html**, and the X11  devices,
                               otherwise **0**.

              **body_height      **is  the  presumed  height of an equation above the text baseline; _eqn_
                               adds any excess as extra pre-vertical line spacing  with  _troff_'s  **\x**
                               escape sequence (**85**).

              **body_depth       **is  the  presumed  depth  of an equation below the text baseline; _eqn_
                               adds any excess as extra post-vertical line spacing with  _troff_'s  **\x**
                               escape sequence (**35**).

              **nroff            **If non-zero, then **ndefine **behaves like **define **and **tdefine **is ignored,
                               otherwise  **tdefine  **behaves  like **define **and **ndefine **is ignored.  The
                               _eqnrc_ file sets the default: **1 **on **ascii**, **latin1**, **utf8**, and **cp1047 **de‐
                               vices, otherwise **0**.

### Macros
       In GNU _eqn_, macros can take arguments.  A word defined by any  of  the  **define**,  **ndefine**,  or
       **tdefine  **primitives  followed immediately by a left parenthesis is treated as a _parameterized_
       _macro_ _call:_ subsequent tokens up to a matching right parenthesis are treated  as  comma-sepa‐
       rated  arguments.   In  this context only, commas and parentheses also serve as token separa‐
       tors.  A macro argument is not terminated by a comma inside parentheses nested within it.  In
       a macro definition, **$_**n_, where _n_ is between 1 and 9 inclusive, is replaced by  the  _n_th  argu‐
       ment; if there are fewer than _n_ arguments, it is replaced by nothing.

### Predefined macros
       GNU _eqn_ supports the predefined macros offered by AT&T _eqn_: **and**, **approx**, **arc**, **cos**, **cosh**, **del**,
       **det**,  **dot**,  **dotdot**,  **dyad**,  **exp**, **for**, **grad**, **half**, **hat**, **if**, **inter**, **Im**, **inf**, **int**, **lim**, **ln**, **log**,
       **max**, **min**, **nothing**, **partial**, **prime**, **prod**, **Re**, **sin**, **sinh**, **sum**, **tan**, **tanh**, **tilde**, **times**,  **union**,
       **vec**, **==**, **!=**, **+=**, **->**, **<-**, **<<**, **>>**, and “**...**”.  The lowercase classical Greek letters are avail‐
       able  as  **alpha**,  **beta**,  **chi**, **delta**, **epsilon**, **eta**, **gamma**, **iota**, **kappa**, **lambda**, **mu**, **nu**, **omega**,
       **omicron**, **phi**, **pi**, **psi**, **rho**, **sigma**, **tau**, **theta**, **upsilon**, **xi**, and **zeta**.   Spell  them  with  an
       initial capital letter (**Alpha**) or in full capitals (**ALPHA**) to obtain uppercase forms.

       GNU  _eqn_  further  defines  the macros **cdot**, **cdots**, and **utilde **(all discussed above), **dollar**,
       which sets a dollar sign, and **ldots**, which sets an ellipsis on the text baseline.

### Fonts
       _eqn_ uses up to three typefaces to set an equation: italic  (oblique),  roman  (upright),  and
       bold.   Assign  each a _groff_ typeface with the primitives **gfont**, **grfont**, and **gbfont.  **The de‐
       faults are the styles **I**, **R**, and **B **(applied to the current font family).  The **chartype  **primi‐
       tive  (see  above)  sets  a  character's type, which determines the face used to set it.  The
       “**letter**” type is set in italics; others are set in roman.  Use the **bold **primitive  to  select
       an (upright) bold style.

       **gbfont _**f_
              Select _f_ as the bold font.  This is a GNU extension.

       **gfont _**f_
              Select _f_ as the italic font.

       **grfont _**f_
              Select _f_ as the roman font.  This is a GNU extension.

## Options
       **--help  **displays  a  usage message, while **-v **and **--version **show version information; all exit
       afterward.

### -C     

### -d _
              **.EQ**/**.EN**.   _x_ and _y_ need not be distinct.  Any “**delim _**xy_” statements in the source file
              override this option.

### -f _

### -m _

### -M _

### -N     
              missing closing delimiters.

### -p _
              deprecated.  _eqn_ normally sets sub- and superscripts at 70% of the type  size  of  the
              surrounding text.

### -r     
              equation.

### -R     

### -s _

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

## Files
       _/usr/share/groff/1.23.0/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  control  of  mo‐
       tions and sizes to the same degree _troff_ does.

       • _eqn_ customization parameters have no effect on generated MathML.

       • The  **special**,  **up**, **down**, **fwd**, and **back **primitives cannot be implemented, and yield a MathML
         “<merror>” message instead.

       • The **vcenter **primitive is silently ignored, as centering on the math axis is the MathML  de‐
         fault.

       • Characters that _eqn_ sets extra large in _troff_ mode—notably the integral sign—may appear 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 **tokens in place, but emits
       nothing corresponding to **delim **delimiters.  They can, however, be recognized as character se‐
       quences that begin with “<math>”, end with “</math>”, and do not cross line boundaries.

## Caveats
       Tokens must be double-quoted in _eqn_ input if they are not to be recognized as names of macros
       or primitives, or if they are to be interpreted by _troff_.  In particular,  short  ones,  like
       “**pi**”  and “**PI**”, can collide with _troff_ identifiers.  For instance, the _eqn_ command “**gfont PI**”
       does not select _groff_'s Palatino italic font for the global italic face; you must use  “**gfont**
       **"PI"**” instead.

       Delimited  equations are set at the type size current at the beginning of the input line, not
       necessarily that immediately preceding the opening delimiter.

       Unlike TeX, _eqn_ does not inherently distinguish displayed and inline equation styles; see the
       **smallover **primitive above.  However, macro packages frequently define **EQ **and **EN  **macros  such
       that  the  equation  within  is  displayed.  These macros may accept arguments permitting the
       equation to be labeled or captioned; see the package's documentation.

## Bugs
       _eqn_ abuses terminology—its “equations” can be inequalities, bare expressions, or unintelligi‐
       ble gibberish.  But there's no changing it now.

       In _nroff_ mode, lowercase Greek letters are rendered in roman instead of italic style.

       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.

## Examples
       We first illustrate _eqn_ usage with a trigonometric identity.

              .EQ
              sin ( alpha + beta ) = sin alpha cos beta + cos alpha sin beta
              .EN

       It  can  be convenient to set up delimiters if mathematical content will appear frequently in
       running text.

              .EQ
              delim $$
              .EN
              Having cached a table of logarithms,
              the property $ln ( x y ) = ln x + ln y$ sped calculations.

       The quadratic formula illustrates use of fractions and radicals, and affords  an  opportunity
       to use the full space token **~**.

              .EQ
              x = { - b ~ \[+-] ~ sqrt { b sup 2 - 4 a c } } over { 2 a }
              .EN

       Alternatively,  we  could define the plus-minus sign as a binary operator.  Automatic spacing
       puts 0.06 em less space on either side of the plus-minus than ~ does, this being the  differ‐
       ence  between  the  widths of the **medium_space **parameter used by binary operators and that of
       the full space.  Independently, we can define a macro “frac” for setting fractions.

              .EQ
              chartype "binary" \[+-]
              define frac ! { $1 } over { $2 } !
              x = frac(- b \[+-] sqrt { b sup 2 - 4 a c }, 2 a)
              .EN

**See also**
       “Typesetting Mathematics—User's Guide” (2nd edition), by Brian W. Kernighan  and  Lorinda  L.
       Cherry, 1978, AT&T Bell Laboratories Computing Science Technical Report No. 17.

       _The_  _TeXbook_,  by  Donald  E. Knuth, 1984, Addison-Wesley Professional.  Appendix G discusses
       many of the parameters from section “Customization” above in greater detail.

       [_groff_char_(7)](https://www.chedong.com/phpMan.php/man/groffchar/7/markdown), particularly subsections “Logical symbols”, “Mathematical symbols”, and “Greek
       glyphs”, documents a variety of special character escape  sequences  useful  in  mathematical
       typesetting.

       [_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/grofffont/5/markdown)

groff 1.23.0                                31 March 2024                                     [_eqn_(1)](https://www.chedong.com/phpMan.php/man/eqn/1/markdown)
