**NAME**

eqn - format equations for troff or MathML

**SYNOPSIS**

eqn[-rvCNR] [-dxy] [-Tname] [-Mdir] [-fF] [-sn] [-pn] [-mn] [files...]

**DESCRIPTION**

This manual page describes the GNU version ofeqn, which is part of the groff document formatting system.eqncompiles descriptions of equations embedded withintroffinput files into commands that are understood bytroff. Normally, it should be invoked using the-eoption ofgroff. The syntax is quite compatible with Unix eqn. The output of GNUeqncannot 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.eqnsearches for the fileeqnrcin the directories given with the-Moption first, then in/usr/lib/groff/site-tmac,/usr/share/groff/site-tmac, and finally in the standard macro directory/usr/share/groff/1.22.2/tmac. If it exists,eqnprocesses it before the other input files. The-Roption prevents this. GNUeqndoes not provide the functionality of neqn: it does not support low-resolution, typewriter-like devices (although it may work adequately for very simple input).

**OPTIONS**

It is possible to have whitespace between a command line option and its parameter.-dxySpecify delimitersxandyfor the left and right end, respectively, of in-line equations. Anydelimstatements in the source file overrides this.-CRecognize.EQand.ENeven when followed by a character other than space or newline. Also, the statement `delimon' is not handled specially.-NDon't allow newlines within delimiters. This option allowseqnto recover better from missing closing delimiters.-vPrint the version number.-rOnly one size reduction.-mnThe minimum point-size isn.eqndoes not reduce the size of subscripts or superscripts to a smaller size thann.-TnameThe output is for devicename. Normally, the only effect of this is to define a macronamewith a value of1;eqnrcuses 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, andeqnrcis not loaded at all. The default output device isps.-MdirSearchdirforeqnrcbefore the default directories.-RDon't loadeqnrc.-fFThis is equivalent to agfontFcommand.-snThis is equivalent to agsizencommand. This option is deprecated.eqnnormally sets equations at whatever the current point size is when the equation is encountered.-pnThis says that subscripts and superscripts should benpoints smaller than the surrounding text. This option is deprecated. Normallyeqnsets subscripts and superscripts at 70% of the size of the surrounding text.

**USAGE**

Only the differences between GNUeqnand Unix eqn are described here. GNUeqnemits Presentation MathML output when invoked with the-TMathMLoption. GNU eqn sets the input token"..."as three periods or low dots, rather than the three centered dots of classic eqn. To get three centered dots, writecdotsorcdotcdotcdot. Most of the new features of the GNUeqninput language are based on TeX. There are some references to the differences between TeX and GNUeqnbelow; these may safely be ignored if you do not know TeX.ControllingdelimitersIf not in compatibility mode,eqnrecognizesdelimonto restore the delimiters which have been previously disabled with a call to `delimoff'. If delimiters haven't been specified, the call has no effect.Automaticspacingeqngives each component of an equation a type, and adjusts the spacing between components using that type. Possible types are: 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 spacing that suppresses automatic spacing adjustment. Components of an equation get a type in one of two ways.typeteThis yields an equation component that containsebut that has typet, wheretis one of the types mentioned above. For example,timesis defined astype"binary"\(muThe name of the type doesn't have to be quoted, but quoting protects from macro expansion.chartypettextUnquoted 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 intextfrom now on have typet. For example,chartype"punctuation".,;:would make the characters `.,;:' have type punctuation whenever they subsequently appeared in an equation. The typetcan also beletterordigit; in these caseschartypechanges the font type of the characters. See theFontssubsection.NewprimitivesbigeEnlarges 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'>e1smallovere2This is similar toover;smalloverreduces the size ofe1ande2; it also puts less vertical space betweene1ore2and the fraction bar. Theoverprimitive corresponds to the TeX\overprimitive in display styles;smallovercorresponds to\overin non-display styles.vcentereThis vertically centerseabout the math axis. The math axis is the vertical position about which characters such as `+' and `−' are centered; also it is the vertical position used for the bar of fractions. For example,sumis defined as{type"operator"vcentersize+5\(*S}(Note that vcenter is silently ignored when generating MathML.)e1accente2This setse2as an accent overe1.e2is assumed to be at the correct height for a lowercase letter;e2is moved down according to whethere1is taller or shorter than a lowercase letter. For example,hatis defined asaccent{"^"}dotdot,dot,tilde,vec, anddyadare also defined using theaccentprimitive.e1uaccente2This setse2as an accent undere1.e2is assumed to be at the correct height for a character without a descender;e2is moved down ife1has a descender.utildeis pre-defined usinguaccentas a tilde accent below the baseline.split"text"This has the same effect as simplytextbuttextis not subject to macro expansion because it is quoted;textis split up and the spacing between individual characters is adjusted.nosplittextThis has the same effect as"text"but becausetextis not quoted it is subject to macro expansion;textis not split up and the spacing between individual characters is not adjusted.eopprimeThis is a variant ofprimethat acts as an operator one. It produces a different result fromprimein a case such asAopprimesub1: withopprimethe1is tucked under the prime as a subscript to theA(as is conventional in mathematical typesetting), whereas withprimethe1is a subscript to the prime character. The precedence ofopprimeis the same as that ofbarandunder, which is higher than that of everything exceptaccentanduaccent. In unquoted text a'that is not the first character is treated likeopprime.specialtexteThis constructs a new object fromeusing atroff(1) macro namedtext. When the macro is called, the string0scontains the output fore, and the number registers0w,0h,0d,0skern, and0skewcontain the width, height, depth, subscript kern, and skew ofe. (Thesubscriptkernof an object says how much a subscript on that object should be tucked in; theskewof 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 modify0sso that it outputs 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..EQdefinecancel'specialCa'.EN.deCa.ds0s\\Z'\\*(0s'\\v'\\n(0du'\\D'l\\n(0wu-\\n(0hu-\\n(0du'\\v'\\n(0hu'..Then you could cancel an expressionewithcancel{e}Here's a more complicated construct that draws a box round an expression:.EQdefinebox'specialBx'.EN.deBx.ds0s\\Z'\h'1n'\\*(0s'\\Z'\\v'\\n(0du+1n'\\D'l\\n(0wu+2n0'\\D'l0-\\n(0hu-\\n(0du-2n'\\D'l-\\n(0wu-2n0'\\D'l0\\n(0hu+\\n(0du+2n'\'\\h'\\n(0wu+2n'.nr0w+2n.nr0d+1n.nr0h+1n..spacenA positive value of the integern(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 togroff's\xescape (but with opposite sign). This keyword has no effect if the equation is part of apicpicture.Extendedprimitivescoln{...}ccoln{...}lcoln{...}rcoln{...}pilen{...}cpilen{...}lpilen{...}rpilen{...}The integer valuen(in hundredths of an em) increases the vertical spacing between rows, usinggroff's\xescape (the value has no effect in MathML mode). Negative values are possible but have no effect. If there is more than a single value given in a matrix, the biggest one is used.CustomizationWheneqnis 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 typesetting and fine motions downstream to a MathML rendering engine. These parameters can be set using thesetcommand.setpnThis sets parameterpto valuen;nis an integer. For example,setx_height45says thateqnshould 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 definitive.minimum_sizeeqndoesn't set anything at a smaller point-size than this. The value is in points.fat_offsetThefatprimitive emboldens an equation by overprinting two copies of the equation horizontally offset by this amount. This parameter is not used in MathML mode; instead, fat text uses <mstyle mathvariant='double-struck'>over_hangA 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_widthWhenbarorunderis applied to a single character, the line is this long. Normally,barorunderproduces 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_factorExtensible delimiters produced with theleftandrightprimitives have a combined 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_shortfallExtensible delimiters produced with theleftandrightprimitives have a combined 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_spaceThis much horizontal space is inserted on each side of a fraction.script_spaceThe width of subscripts and superscripts is increased by this amount.thin_spaceThis amount of space is automatically inserted after punctuation characters.medium_spaceThis amount of space is automatically inserted on either side of binary operators.thick_spaceThis amount of space is automatically inserted on either side of relations.x_heightThe height of lowercase letters without ascenders such as `x'.axis_heightThe 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_thicknessThis should set to the thickness of the\(rucharacter, or the thickness of horizontal lines produced with the\Descape sequence.num1Theovercommand shifts up the numerator by at least this amount.num2Thesmallovercommand shifts up the numerator by at least this amount.denom1Theovercommand shifts down the denominator by at least this amount.denom2Thesmallovercommand shifts down the denominator by at least this amount.sup1Normally superscripts are shifted up by at least this amount.sup2Superscripts within superscripts or upper limits or numerators ofsmalloverfractions are shifted up by at least this amount. This is usually less than sup1.sup3Superscripts within denominators or square roots or subscripts or lower limits are shifted up by at least this amount. This is usually less than sup2.sub1Subscripts are normally shifted down by at least this amount.sub2When there is both a subscript and a superscript, the subscript is shifted down by at least this amount.sup_dropThe baseline of a superscript is no more than this much amount below the top of the object on which the superscript is set.sub_dropThe baseline of a subscript is at least this much below the bottom of the object on which the subscript is set.big_op_spacing1The baseline of an upper limit is at least this much above the top of the object on which the limit is set.big_op_spacing2The baseline of a lower limit is at least this much below the bottom of the object on which the limit is set.big_op_spacing3The bottom of an upper limit is at least this much above the top of the object on which the limit is set.big_op_spacing4The top of a lower limit is at least this much below the bottom of the object on which the limit is set.big_op_spacing5This much vertical space is added above and below limits.baseline_sepThe baselines of the rows in a pile or matrix are normally this far apart. In most cases this should be equal to the sum ofnum1anddenom1.shift_downThe 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 toaxis_height.column_sepThis much space is added between columns in a matrix.matrix_side_sepThis much space is added at each side of a matrix.draw_linesIf this is non-zero, lines are drawn using the\Descape sequence, rather than with the\lescape sequence and the\(rucharacter.body_heightThe 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_depthThe 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.nroffIf this is non-zero, thenndefinebehaves likedefineandtdefineis ignored, otherwisetdefinebehaves likedefineandndefineis ignored. The default value is 0 (This is typically changed to 1 by theeqnrcfile for theascii,latin1,utf8, andcp1047devices.) A more precise description of the role of many of these parameters can be found in Appendix H ofTheTeXbook.MacrosMacros can take arguments. In a macro body,$nwherenis between 1 and 9, is replaced by then-thargument if the macro is called with arguments; if there are fewer thannarguments, 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 thedefinecommand 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.sdefinenameXanythingXThis is like thedefinecommand, butnameis not recognized if called with arguments.include"file"copy"file"Include the contents offile(includeandcopyare synonyms). Lines offilebeginning with.EQor.ENare ignored.ifdefnameXanythingXIfnamehas been defined bydefine(or has been automatically defined becausenameis the output device) processanything; otherwise ignoreanything.Xcan be any character not appearing inanything.undefnameRemove definition ofname, making it undefined. Besides the macros mentioned above, the following definitions are available:Alpha,Beta, ...,Omega(this is the same asALPHA,BETA, ...,OMEGA),ldots(three dots on the base line), anddollar.Fontseqnnormally uses at least two fonts to set an equation: an italic font for letters, and a roman font for everything else. The existinggfontcommand changes the font that is used as the italic font. By default this isI. The font that is used as the roman font can be changed using the newgrfontcommand.grfontfSet the roman font tof. Theitalicprimitive uses the current italic font set bygfont; theromanprimitive uses the current roman font set bygrfont. There is also a newgbfontcommand, which changes the font used by theboldprimitive. If you only use theroman,italicandboldprimitives to changes fonts within an equation, you can change all the fonts used by your equations just by usinggfont,grfontandgbfontcommands. You can control which characters are treated as letters (and therefore set in italics) by using thechartypecommand described above. A type oflettercauses a character to be set in italic type. A type ofdigitcauses a character to be set in roman type.

**FILES**

/usr/share/groff/1.22.2/tmac/eqnrcInitialization 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: *eqnparameters have no effect on the generated MathML. * Thespecial,up,down,fwd, andbackoperations cannot be implemented, and yield a MathML `<merror>' message instead. * Thevcenterkeyword is silently ignored, as centering on the math axis is the MathML default. * Characters thateqnover troff sets extra large – notably the integral sign – may appear too small and need to have their `<mstyle>' wrappers adjusted by hand. As in its troff mode,eqnin MathML mode leaves the.EQand.ENdelimiters in place for displayed equations, but emits no explicit delimiters around inline equations. They can, however, be recognized as strings that begin with `<math>' and end with `</math>' and do not cross line boundaries. See theBUGSsection for translation limits specific toeqn.

**BUGS**

Inline equations are set at the point size that is current at the beginning of the input line. In MathML mode, themarkandlineupfeatures don't work. These could, in theory, be implemented 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),troff(1),pic(1),groff_font(5),TheTeXbook