{
    "mode": "man",
    "parameter": "eqn",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/eqn/1/json",
    "generated": "2026-10-07T18:37:07Z",
    "sections": {
        "Name": {
            "content": "eqn - format mathematics (equations) for groff or MathML\n",
            "subsections": []
        },
        "Synopsis": {
            "content": "eqn [-CNrR] [-d xy] [-f F] [-m n] [-M dir] [-p n] [-s n] [-T dev] [file ...]\n",
            "subsections": [
                {
                    "name": "eqn --help",
                    "content": ""
                },
                {
                    "name": "eqn -v",
                    "content": ""
                },
                {
                    "name": "eqn --version",
                    "content": ""
                }
            ]
        },
        "Description": {
            "content": "The  GNU  implementation of eqn is part of the groff(7) document formatting system.  eqn is a\ntroff(1) preprocessor that translates expressions in its own language,  embedded  in  roff(7)\ninput  files, into mathematical notation typeset by troff(1).  It copies each file's contents\nto the standard output stream, translating each equation between lines starting with .EQ  and\n.EN,  or  within a pair of user-specified delimiters.  Normally, eqn is not executed directly\nby the user, but invoked by specifying the -e option to groff(1).  While GNU eqn's input syn‐\ntax is highly compatible with AT&T eqn, the output eqn produces cannot be processed  by  AT&T\ntroff;  GNU troff (or a troff implementing relevant GNU extensions) must be used.  If no file\noperands are given on the command line, or if file is  “-”,  eqn  reads  the  standard  input\nstream.\n\nUnless  the  -R option is used, eqn searches for the file eqnrc in the directories given with\nthe -M option first, then in /usr/share/groff/site-tmac, and finally in  the  standard  macro\ndirectory  /usr/share/groff/1.23.0/tmac.   If it exists and is readable, eqn processes it be‐\nfore any input files.\n\nThis man page primarily discusses the differences between GNU eqn and AT&T eqn.  Most of  the\nnew  features  of  the GNU eqn input language are based on TeX.  There are some references to\nthe differences between TeX and GNU eqn below; these may safely be ignored if you do not know\nTeX.\n\nThree points are worth special note.\n\n• GNU eqn emits Presentation MathML output when invoked with the “-T MathML” option.\n\n• GNU eqn does not support terminal devices well, though it may suffice for simple inputs.\n\n• GNU eqn sets the input token “...” as an ellipsis on the text baseline, not the three  cen‐\ntered  dots  of  AT&T  eqn.   Set an ellipsis on the math axis with the GNU extension macro\ncdots.\n",
            "subsections": [
                {
                    "name": "Anatomy of an equation",
                    "content": "eqn input consists of tokens.  Consider a form of Newton's second law of motion.  The input\n\n.EQ\nF =\nm a\n.EN\n\nbecomes F=ma.  Each of F, =, m, and a is a token.  Spaces and newlines  are  interchangeable;\nthey separate tokens but do not break lines or produce space in the output.\n\nThe  following input characters not only separate tokens, but manage their grouping and spac‐\ning as well.\n\n{ }    Braces perform grouping.  Whereas “e sup a b” expresses “(e to the a) times b”, “e sup\n{ a b }” means “e to the (a times b)”.  When  immediately  preceded  by  a  “left”  or\n“right” primitive, a brace loses its special meaning.\n\n^ ~    are  the  half space and full space, respectively.  Use them to tune the appearance of\nthe output.\n\nTab and leader characters separate tokens as well as advancing the drawing  position  to  the\nnext  tab  stop,  but are seldom used in eqn input.  When they occur, they must appear at the\noutermost lexical scope.  This roughly means that they can't appear within  braces  that  are\nnecessary  to disambiguate the input; eqn will diagnose an error in this event.  (See subsec‐\ntion “Macros” below for additional token separation rules.)\n\nOther tokens are primitives, macros, an argument to either of the foregoing, or components of\nan equation.\n\nPrimitives are fundamental keywords of the eqn language.  They can configure an aspect of the\npreprocessor's state, as when setting a “global” font  selection  or  type  size  (gfont  and\ngsize),  or  declaring  or  deleting  macros (“define” and undef); these are termed commands.\nOther primitives perform formatting operations on the tokens after them (as with  fat,  over,\nsqrt, or up).\n\nEquation  components  include mathematical variables, constants, numeric literals, and opera‐\ntors.  eqn remaps some input character sequences to groff special character escape  sequences\nfor  economy  in equation entry and to ensure that glyphs from an unstyled font are used; see\ngroffchar(7).\n\n+   \\[pl]                '    \\[fm]\n-   \\[mi]                <=   \\[<=]\n=   \\[eq]                >=   \\[>=]\n\nMacros permit primitives, components, and other macros to be collected and referred to  by  a\nsingle  token.   Predefined macros make convenient the preparation of eqn input in a form re‐\nsembling its spoken expression; for example, consider cos, hat, inf, and lim.\n"
                },
                {
                    "name": "Spacing and typeface",
                    "content": "GNU eqn imputes types to the components of an equation, adjusting the  spacing  between  them\naccordingly.  Recognized types are as follows; most affect spacing only, whereas the “letter”\nsubtype of “ordinary” also assigns a style.\n\nordinary      character such as “1”, “a”, or “!”\nletter      character to be italicized by default\ndigit       n/a\noperator      large operator such as “Σ”\nbinary        binary operator such as “+”\nrelation      relational operator such as “=”\nopening       opening bracket such as “(”\nclosing       closing bracket such as “)”\npunctuation   punctuation character such as “,”\ninner         sub-formula contained within brackets\nsuppress      component to which automatic spacing is not applied\n\nTwo primitives apply types to equation components.\n\ntype t e\nApply type t to expression e.\n\nchartype t text\nAssign each character in (unquoted) text type t, persistently.\n\neqn sets up spacings and styles as if by the following commands.\n\nchartype \"letter\"      abcdefghiklmnopqrstuvwxyz\nchartype \"letter\"      ABCDEFGHIKLMNOPQRSTUVWXYZ\nchartype \"letter\"      \\[*a]\\[*b]\\[*g]\\[*d]\\[*e]\\[*z]\nchartype \"letter\"      \\[*y]\\[*h]\\[*i]\\[*k]\\[*l]\\[*m]\nchartype \"letter\"      \\[*n]\\[*c]\\[*o]\\[*p]\\[*r]\\[*s]\nchartype \"letter\"      \\[*t]\\[*u]\\[*f]\\[*x]\\[*q]\\[*w]\nchartype \"binary\"      *\\[pl]\\[mi]\nchartype \"relation\"    <>\\[eq]\\[<=]\\[>=]\nchartype \"opening\"     {([\nchartype \"closing\"     })]\nchartype \"punctuation\" ,;:.\nchartype \"suppress\"    ^~\n\neqn  assigns  all  other  ordinary  and  special roff characters, including numerals 0–9, the\n“ordinary” type.  (The “digit” type is not used, but is  available  for  customization.)   In\nkeeping with common practice in mathematical typesetting, lowercase, but not uppercase, Greek\nletters  are  assigned  the “letter” type to style them in italics.  The macros for producing\nellipses, “...”, cdots, and ldots, use the “inner” type.\n"
                },
                {
                    "name": "Primitives",
                    "content": "eqn supports without alteration the AT&T eqn primitives above, back, bar, bold, define, down,\nfat, font, from, fwd, gfont, gsize, italic, left, lineup, mark, matrix, ndefine, over, right,\nroman, size, sqrt, sub, sup, tdefine, to, under, and up.\n"
                },
                {
                    "name": "New primitives",
                    "content": "The GNU extension primitives “type” and chartype are discussed  in  subsection  “Spacing  and\ntypeface”  above; “set” in subsection “Customization” below; and grfont and gbfont in subsec‐\ntion “Fonts” below.  In the following synopses, X can be any character not appearing  in  the\nparameter thus bracketed.\n\ne1 accent e2\nSet e2 as an accent over e1.  e2 is assumed to be at the appropriate height for a low‐\nercase letter without an ascender;  eqn vertically shifts it depending on e1's height.\nFor example, hat is defined as follows.\n\naccent { \"^\" }\n\ndotdot, dot, tilde, vec, and dyad are also defined using the accent primitive.\n\nbig e  Enlarge  the expression e; semantics like those of CSS “large” are intended.  In troff\noutput, the type size is increased by 5 scaled points.  MathML output emits  the  fol‐\nlowing.\n\n<mstyle mathsize='big'>\n\ncopy file\ninclude file\nInterpolate the contents of file, omitting lines beginning with .EQ or .EN.  If a rel‐\native path name, file is sought relative to the current working directory.\n\nifdef name X anything X\nIf name is defined as a primitive or macro, interpret anything.\n\nnosplit text\nAs  \"text\",  but  since text is not quoted it is subject to macro expansion; it is not\nsplit up and the spacing between characters not adjusted per subsection  “Spacing  and\ntypeface” above.\n\ne opprime\nAs  prime,  but set the prime symbol as an operator on e.  In the input “A opprime sub\n1”, the “1” is tucked under the prime as a subscript to the “A” (as is conventional in\nmathematical typesetting), whereas when prime is used, the “1” is a subscript  to  the\nprime  character.   The  precedence of opprime is the same as that of bar and “under”,\nand higher than that of other primitives except accent and uaccent.  In unquoted text,\na neutral apostrophe (') that is not the first character on the input line is  treated\nlike opprime.\n\nsdefine name X anything X\nAs “define”, but name is not recognized as a macro if called with arguments.\n\ne1 smallover e2\nAs  over, but reduces the type size of e1 and e2, and puts less vertical space between\ne1 and e2 and the fraction bar.  The over primitive corresponds to the TeX \\over prim‐\nitive in displayed equation styles; smallover  corresponds  to  \\over  in  non-display\n(“inline”) styles.\n\nspace n\nSet  extra  vertical  spacing around the equation, replacing the default values, where\nn is an integer in hundredths of an em.  If positive, n increases vertical spacing be‐\nfore the equation; if negative, it does so after the equation.   This  primitive  pro‐\nvides  an  interface to groff's \\x escape sequence, but with the opposite sign conven‐\ntion.  It has no effect if the equation is part of a pic(1) picture.\n\nspecial troff-macro e\nConstruct an object by calling troff-macro on e.  The troff string 0s contains the eqn\noutput for e, and the registers 0w, 0h, 0d,  0skern,  and  0skew  the  width,  height,\ndepth,  subscript kern, and skew of e, respectively.  (The subscript kern of an object\nindicates how much a subscript on that object should be “tucked in”, or placed to  the\nleft  relative  to a non-subscripted glyph of the same size.  The skew of an object is\nhow far to the right of the center of the object an accent over it should be  placed.)\nThe  macro  must  modify 0s so that it outputs the desired result, returns the drawing\nposition to the text baseline at the beginning of e, and updates the foregoing  regis‐\nters to correspond to the new dimensions of the result.\n\nSuppose  you  want a construct that “cancels” an expression by drawing a diagonal line\nthrough it.\n\n.de Ca\n.  ds 0s \\\n\\Z'\\\\*(0s'\\\n\\v'\\\\n(0du'\\\n\\D'l \\\\n(0wu -\\\\n(0hu-\\\\n(0du'\\\n\\v'\\\\n(0hu'\n..\n.EQ\nspecial Ca \"x \\[mi] 3 \\[pl] x\" ~ 3\n.EN\n\nWe use the \\[mi] and \\[pl] special characters instead of + and - because they are part\nof the argument to a troff macro, so eqn  does  not  transform  them  to  mathematical\nglyphs for us.  Here's a more complicated construct that draws a box around an expres‐\nsion;  the  bottom of the box rests on the text baseline.  We define the eqn macro box\nto wrap the call of the troff macro Bx.\n\n.de Bx\n.ds 0s \\\n\\Z'\\\\h'1n'\\\\*[0s]'\\\n\\v'\\\\n(0du+1n'\\\n\\D'l \\\\n(0wu+2n 0'\\\n\\D'l 0 -\\\\n(0hu-\\\\n(0du-2n'\\\n\\D'l -\\\\n(0wu-2n 0'\\\n\\D'l 0 \\\\n(0hu+\\\\n(0du+2n'\\\n\\h'\\\\n(0wu+2n'\n.nr 0w +2n\n.nr 0d +1n\n.nr 0h +1n\n..\n.EQ\ndefine box ' special Bx $1 '\nbox(foo) ~ \"bar\"\n.EN\n\nsplit \"text\"\nAs text, but since text is quoted, it is not subject to macro expansion; it  is  split\nup  and  the spacing between characters adjusted per subsection “Spacing and typeface”\nabove.\n\ne1 uaccent e2\nSet e2 as an accent under e1.  e2 is assumed to be at the  appropriate  height  for  a\nletter  without  a  descender;  eqn vertically shifts it depending on whether e1 has a\ndescender.  utilde is predefined using uaccent as a tilde accent below the baseline.\n\nundef name\nRemove definition of macro or primitive name, making it undefined.\n\nvcenter e\nVertically center e about the math axis, a horizontal line upon  which  fraction  bars\nand  characters  such as “+” and “−” are aligned.  MathML already behaves this way, so\neqn ignores this primitive when producing that output format.  The built-in sum  macro\nis defined as if by the following.\n\ndefine sum ! { type \"operator\" vcenter size +5 \\(*S } !\n"
                },
                {
                    "name": "Extended primitives",
                    "content": "GNU eqn extends the syntax of some AT&T eqn primitives, introducing one deliberate incompati‐\nbility.\n"
                },
                {
                    "name": "delim on",
                    "content": "eqn recognizes an “on” argument to the delim primitive specially, restoring any delim‐\niters  previously  disabled  with  “delim off”.  If delimiters haven't been specified,\nneither command has effect.  Few eqn documents are expected to use “o” and “n” as left\nand right delimiters, respectively.  If yours does, consider swapping them, or  select\nothers.\n\ncol n { ... }\nccol n { ... }\nlcol n { ... }\nrcol n { ... }\npile n { ... }\ncpile n { ... }\nlpile n { ... }\nrpile n { ... }\nThe  integer  value  n (in hundredths of an em) increases the vertical spacing between\nrows, using groff's \\x escape sequence (the value has no effect in MathML mode).  Neg‐\native values are accepted but have no effect.  If more than one n occurs in  a  matrix\nor pile, the largest is used.\n"
                },
                {
                    "name": "Customization",
                    "content": "When  eqn  generates troff input, the appearance of equations is controlled by a large number\nof parameters.  They have no effect when generating MathML, which delegates typesetting to  a\nMathML rendering engine.  Configure these parameters with the set primitive.\n\nset p n\nassigns parameter p the integer value n; n is interpreted in units of hundredths of an\nem unless otherwise stated.  For example,\n\nset xheight 45\n\nsays that eqn should assume that the font's x-height is 0.45 ems.\n\nAvailable  parameters  are  as  follows; defaults are shown in parentheses.  We intend\nthese descriptions to be expository rather than rigorous.\n\nminimumsize     sets a floor for the type size (in scaled points) at which  equations\nare set (5).\n\nfatoffset       The fat primitive emboldens an equation by overprinting two copies of\nthe equation horizontally offset by this amount (4).  In MathML mode,\ncomponents to which fatoffset applies instead use the following.\n<mstyle mathvariant='double-struck'>\n\noverhang        A fraction bar is longer by twice this amount than the maximum of the\nwidths of the numerator and denominator; in other words, it overhangs\nthe numerator and denominator by at least this amount (0).\n\naccentwidth     When  bar or under is applied to a single character, the line is this\nlong (31).  Normally, bar or under produces a line  whose  length  is\nthe  width of the object to which it applies; in the case of a single\ncharacter, this tends to produce a line that looks too long.\n\ndelimiterfactor Extensible delimiters produced with the  left  and  right  primitives\nhave a combined height and depth of at least this many thousandths of\ntwice  the  maximum  amount by which the sub-equation that the delim‐\niters enclose extends away from the axis (900).\n\ndelimitershortfall\nExtensible delimiters produced with the  left  and  right  primitives\nhave  a  combined  height  and  depth not less than the difference of\ntwice the maximum amount by which the sub-equation  that  the  delim‐\niters enclose extends away from the axis and this amount (50).\n\nnulldelimiterspace\nThis  much  horizontal  space  is inserted on each side of a fraction\n(12).\n\nscriptspace     The width of subscripts and superscripts is increased by this  amount\n(5).\n\nthinspace       This  amount  of  space  is  automatically inserted after punctuation\ncharacters.  It also configures the width of the  space  produced  by\nthe ^ token (17).\n\nmediumspace     This  amount of space is automatically inserted on either side of bi‐\nnary operators (22).\n\nthickspace      This amount of space is automatically inserted on either side of  re‐\nlations.  It also configures the width of the space produced by the ~\ntoken (28).\n\nxheight         The height of lowercase letters without ascenders such as “x” (45).\n\naxisheight      The height above the baseline of the center of characters such as “+”\nand  “−”  (26).   It  is important that this value is correct for the\nfont you are using.\n\ndefaultrulethickness\nThis should be set to the thickness of the \\[ru]  character,  or  the\nthickness  of  horizontal  lines produced with the \\D escape sequence\n(4).\n\nnum1             The over primitive shifts up the numerator by at  least  this  amount\n(70).\n\nnum2             The  smallover  primitive  shifts  up  the numerator by at least this\namount (36).\n\ndenom1           The over primitive shifts down  the  denominator  by  at  least  this\namount (70).\n\ndenom2           The  smallover primitive shifts down the denominator by at least this\namount (36).\n\nsup1             Normally superscripts are shifted up by at least this amount (42).\n\nsup2             Superscripts within superscripts or upper  limits  or  numerators  of\nsmallover  fractions  are  shifted  up  by at least this amount (37).\nConventionally, this is less than sup1.\n\nsup3             Superscripts within denominators or square  roots  or  subscripts  or\nlower  limits  are  shifted up by at least this amount (28).  Conven‐\ntionally, this is less than sup2.\n\nsub1             Subscripts are normally shifted down by at least this amount (20).\n\nsub2             When there is both a subscript and a superscript,  the  subscript  is\nshifted down by at least this amount (23).\n\nsupdrop         The baseline of a superscript is no more than this much below the top\nof the object on which the superscript is set (38).\n\nsubdrop         The baseline of a subscript is at least this much below the bottom of\nthe object on which the subscript is set (5).\n\nbigopspacing1  The baseline of an upper limit is at least this much above the top of\nthe object on which the limit is set (11).\n\nbigopspacing2  The  baseline of a lower limit is at least this much below the bottom\nof the object on which the limit is set (17).\n\nbigopspacing3  The bottom of an upper limit is at least this much above the  top  of\nthe object on which the limit is set (20).\n\nbigopspacing4  The  top  of  a lower limit is at least this much below the bottom of\nthe object on which the limit is set (60).\n\nbigopspacing5  This much vertical space is added above and below limits (10).\n\nbaselinesep     The baselines of the rows in a pile or matrix are normally  this  far\napart (140).  Usually equal to the sum of num1 and denom1.\n\nshiftdown       The  midpoint  between  the top baseline and the bottom baseline in a\nmatrix or pile is shifted down by this much from the axis (26).  Usu‐\nally equal to axisheight.\n\ncolumnsep       This much space is added between columns in a matrix (100).\n\nmatrixsidesep  This much space is added at each side of a matrix (17).\n\ndrawlines       If non-zero, eqn draws lines using  the  troff  \\D  escape  sequence,\nrather  than  the \\l escape sequence and the \\[ru] special character.\nThe eqnrc file sets the default: 1 on ps, html, and the X11  devices,\notherwise 0.\n\nbodyheight      is  the  presumed  height of an equation above the text baseline; eqn\nadds any excess as extra pre-vertical line spacing  with  troff's  \\x\nescape sequence (85).\n\nbodydepth       is  the  presumed  depth  of an equation below the text baseline; eqn\nadds any excess as extra post-vertical line spacing with  troff's  \\x\nescape sequence (35).\n\nnroff            If non-zero, then ndefine behaves like define and tdefine is ignored,\notherwise  tdefine  behaves  like define and ndefine is ignored.  The\neqnrc file sets the default: 1 on ascii, latin1, utf8, and cp1047 de‐\nvices, otherwise 0.\n"
                },
                {
                    "name": "Macros",
                    "content": "In GNU eqn, macros can take arguments.  A word defined by any  of  the  define,  ndefine,  or\ntdefine  primitives  followed immediately by a left parenthesis is treated as a parameterized\nmacro call: subsequent tokens up to a matching right parenthesis are treated  as  comma-sepa‐\nrated  arguments.   In  this context only, commas and parentheses also serve as token separa‐\ntors.  A macro argument is not terminated by a comma inside parentheses nested within it.  In\na macro definition, $n, where n is between 1 and 9 inclusive, is replaced by  the  nth  argu‐\nment; if there are fewer than n arguments, it is replaced by nothing.\n"
                },
                {
                    "name": "Predefined macros",
                    "content": "GNU eqn supports the predefined macros offered by AT&T eqn: and, approx, arc, cos, cosh, del,\ndet,  dot,  dotdot,  dyad,  exp, for, grad, half, hat, if, inter, Im, inf, int, lim, ln, log,\nmax, min, nothing, partial, prime, prod, Re, sin, sinh, sum, tan, tanh, tilde, times,  union,\nvec, ==, !=, +=, ->, <-, <<, >>, and “...”.  The lowercase classical Greek letters are avail‐\nable  as  alpha,  beta,  chi, delta, epsilon, eta, gamma, iota, kappa, lambda, mu, nu, omega,\nomicron, phi, pi, psi, rho, sigma, tau, theta, upsilon, xi, and zeta.   Spell  them  with  an\ninitial capital letter (Alpha) or in full capitals (ALPHA) to obtain uppercase forms.\n\nGNU  eqn  further  defines  the macros cdot, cdots, and utilde (all discussed above), dollar,\nwhich sets a dollar sign, and ldots, which sets an ellipsis on the text baseline.\n"
                },
                {
                    "name": "Fonts",
                    "content": "eqn uses up to three typefaces to set an equation: italic  (oblique),  roman  (upright),  and\nbold.   Assign  each a groff typeface with the primitives gfont, grfont, and gbfont.  The de‐\nfaults are the styles I, R, and B (applied to the current font family).  The chartype  primi‐\ntive  (see  above)  sets  a  character's type, which determines the face used to set it.  The\n“letter” type is set in italics; others are set in roman.  Use the bold primitive  to  select\nan (upright) bold style.\n\ngbfont f\nSelect f as the bold font.  This is a GNU extension.\n\ngfont f\nSelect f as the italic font.\n\ngrfont f\nSelect f as the roman font.  This is a GNU extension.\n"
                }
            ]
        },
        "Options": {
            "content": "--help  displays  a  usage message, while -v and --version show version information; all exit\nafterward.\n",
            "subsections": [
                {
                    "name": "-C",
                    "content": "",
                    "flag": "-C"
                },
                {
                    "name": "-d _",
                    "content": ".EQ/.EN.   x and y need not be distinct.  Any “delim xy” statements in the source file\noverride this option.\n",
                    "flag": "-d"
                },
                {
                    "name": "-f _",
                    "content": "",
                    "flag": "-f"
                },
                {
                    "name": "-m _",
                    "content": "",
                    "flag": "-m"
                },
                {
                    "name": "-M _",
                    "content": "",
                    "flag": "-M"
                },
                {
                    "name": "-N",
                    "content": "missing closing delimiters.\n",
                    "flag": "-N"
                },
                {
                    "name": "-p _",
                    "content": "deprecated.  eqn normally sets sub- and superscripts at 70% of the type  size  of  the\nsurrounding text.\n",
                    "flag": "-p"
                },
                {
                    "name": "-r",
                    "content": "equation.\n",
                    "flag": "-r"
                },
                {
                    "name": "-R",
                    "content": "",
                    "flag": "-R"
                },
                {
                    "name": "-s _",
                    "content": "",
                    "flag": "-s"
                },
                {
                    "name": "-T _",
                    "content": "macro dev with a value of 1; eqnrc uses this to provide  definitions  appropriate  for\nthe device.  However, if the specified driver is “MathML”, the output is MathML markup\nrather than troff input, and eqnrc is not loaded at all.  The default output device is\nps.\n",
                    "flag": "-T"
                }
            ]
        },
        "Files": {
            "content": "/usr/share/groff/1.23.0/tmac/eqnrc\nInitialization file.\n",
            "subsections": []
        },
        "MathML mode limitations": {
            "content": "MathML  is  designed on the assumption that it cannot know the exact physical characteristics\nof the media and devices on which it will be rendered.  It does not support  control  of  mo‐\ntions and sizes to the same degree troff does.\n\n• eqn customization parameters have no effect on generated MathML.\n\n• The  special,  up, down, fwd, and back primitives cannot be implemented, and yield a MathML\n“<merror>” message instead.\n\n• The vcenter primitive is silently ignored, as centering on the math axis is the MathML  de‐\nfault.\n\n• Characters that eqn sets extra large in troff mode—notably the integral sign—may appear too\nsmall and need to have their “<mstyle>” wrappers adjusted by hand.\n\nAs  in  its  troff mode, eqn in MathML mode leaves the .EQ and .EN tokens in place, but emits\nnothing corresponding to delim delimiters.  They can, however, be recognized as character se‐\nquences that begin with “<math>”, end with “</math>”, and do not cross line boundaries.\n",
            "subsections": []
        },
        "Caveats": {
            "content": "Tokens must be double-quoted in eqn input if they are not to be recognized as names of macros\nor primitives, or if they are to be interpreted by troff.  In particular,  short  ones,  like\n“pi”  and “PI”, can collide with troff identifiers.  For instance, the eqn command “gfont PI”\ndoes not select groff's Palatino italic font for the global italic face; you must use  “gfont\n\"PI\"” instead.\n\nDelimited  equations are set at the type size current at the beginning of the input line, not\nnecessarily that immediately preceding the opening delimiter.\n\nUnlike TeX, eqn does not inherently distinguish displayed and inline equation styles; see the\nsmallover primitive above.  However, macro packages frequently define EQ and EN  macros  such\nthat  the  equation  within  is  displayed.  These macros may accept arguments permitting the\nequation to be labeled or captioned; see the package's documentation.\n",
            "subsections": []
        },
        "Bugs": {
            "content": "eqn abuses terminology—its “equations” can be inequalities, bare expressions, or unintelligi‐\nble gibberish.  But there's no changing it now.\n\nIn nroff mode, lowercase Greek letters are rendered in roman instead of italic style.\n\nIn MathML mode, the mark and lineup features don't work.  These could, in theory,  be  imple‐\nmented with “<maligngroup>” elements.\n\nIn MathML mode, each digit of a numeric literal gets a separate “<mn></mn>” pair, and decimal\npoints are tagged with “<mo></mo>”.  This is allowed by the specification, but inefficient.\n",
            "subsections": []
        },
        "Examples": {
            "content": "We first illustrate eqn usage with a trigonometric identity.\n\n.EQ\nsin ( alpha + beta ) = sin alpha cos beta + cos alpha sin beta\n.EN\n\nIt  can  be convenient to set up delimiters if mathematical content will appear frequently in\nrunning text.\n\n.EQ\ndelim $$\n.EN\nHaving cached a table of logarithms,\nthe property $ln ( x y ) = ln x + ln y$ sped calculations.\n\nThe quadratic formula illustrates use of fractions and radicals, and affords  an  opportunity\nto use the full space token ~.\n\n.EQ\nx = { - b ~ \\[+-] ~ sqrt { b sup 2 - 4 a c } } over { 2 a }\n.EN\n\nAlternatively,  we  could define the plus-minus sign as a binary operator.  Automatic spacing\nputs 0.06 em less space on either side of the plus-minus than ~ does, this being the  differ‐\nence  between  the  widths of the mediumspace parameter used by binary operators and that of\nthe full space.  Independently, we can define a macro “frac” for setting fractions.\n\n.EQ\nchartype \"binary\" \\[+-]\ndefine frac ! { $1 } over { $2 } !\nx = frac(- b \\[+-] sqrt { b sup 2 - 4 a c }, 2 a)\n.EN\n\nSee also\n“Typesetting Mathematics—User's Guide” (2nd edition), by Brian W. Kernighan  and  Lorinda  L.\nCherry, 1978, AT&T Bell Laboratories Computing Science Technical Report No. 17.\n\nThe  TeXbook,  by  Donald  E. Knuth, 1984, Addison-Wesley Professional.  Appendix G discusses\nmany of the parameters from section “Customization” above in greater detail.\n\ngroffchar(7), particularly subsections “Logical symbols”, “Mathematical symbols”, and “Greek\nglyphs”, documents a variety of special character escape  sequences  useful  in  mathematical\ntypesetting.\n\ngroff(1), troff(1), pic(1), grofffont(5)\n\ngroff 1.23.0                                31 March 2024                                     eqn(1)",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Equation preprocessor for the groff (GNU Troff) document formatting system.",
        "examples": [
            {
                "description": "Process input with equations, saving the output for future typesetting with groff to PostScript",
                "command": "eqn {{path/to/input.eqn}} > {{path/to/output.roff}}"
            },
            {
                "description": "Typeset an input file with equations to PDF using the [me] macro package",
                "command": "eqn -T {{pdf}} {{path/to/input.eqn}} | groff -{{me}} -T {{pdf}} > {{path/to/output.pdf}}"
            }
        ]
    }
}