eqn (1) Linux Manual Page
NAME
eqn – format equations for troff or MathML
SYNOPSIS
[ -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 formatting 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 option 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 directory /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, typewriter-like devices (although it may work adequately for very simple input).
OPTIONS
Whitespace is permitted between a command-line option and its argument.
-dxy- Specify delimiters x and~y for the left and right end, respectively, of in-line equations. Any
delimstatements in the source file overrides this. -C- Recognize
.EQand.ENeven when followed by a character other than space or newline. Also, the statement ‘delim on‘ is not handled specially. -N- Don’t allow newlines within delimiters. This option allows
eqnto recover better from missing closing delimiters. -v- Print the version number.
-r- Only one size reduction.
-mn- The minimum point-size is~n.
eqndoes not reduce the size of subscripts or superscripts to a smaller size than~n. -Tname- The output is for device name. Normally, the only effect of this is to define a macro 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 isps. -Mdir- Search dir for eqnrc before the default directories.
-R- Don’t load eqnrc.
-fF- This is equivalent to a
gfontF command. -sn- This is equivalent to a
gsizen command. This option is deprecated.eqnnormally sets equations at whatever the current point size is when the equation is encountered. -pn- This says that subscripts and superscripts should be n~points smaller than the surrounding text. This option is deprecated. Normally
eqnsets subscripts and superscripts 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 centered 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 references 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.
typet 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,
timesis defined as-
-
type "binary" \(mu
- The name of the type doesn’t have to be quoted, but quoting protects from macro expansion.
chartypet 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 appeared in an equation. The type~t can also be
letterordigit; in these caseschartypechanges the font type of the characters. See subsection “Fonts” below.
New primitives
bige- 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
smallovere2 - This is similar to
over;smalloverreduces the size of e1 and e2; it also puts less vertical space between e1 or e2 and the fraction bar. Theoverprimitive corresponds to the TeX\overprimitive in display styles;smallovercorresponds to\overin non-display styles. vcentere- 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 position used for the bar of fractions. For example,
sumis defined as-
-
{ type "operator" vcenter size +5 \(*S }
- (Note that vcenter is silently ignored when generating MathML.)
- e1
accente2 - 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,
hatis defined as-
-
accent { "^" }
-
dotdot,dot,tilde,vec, anddyadare also defined using theaccentprimitive. - e1
uaccente2 - 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.
utildeis pre-defined usinguaccentas 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.
nosplittext- 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
primethat acts as an operator on~e. It produces a different result fromprimein a case such asA opprime sub 1: withopprimethe~1is tucked under the prime as a subscript to the~A(as is conventional in mathematical typesetting), whereas withprimethe~1is 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. specialtext e- This constructs a new object from~e using a
troff(1) macro named text. When the macro is called, the string0scontains the output for~e, and the number registers0w,0h,0d,0skern, and0skewcontain 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 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.
-
-
.EQ
define cancel ‘special Ca’
.EN
.de Ca
.ds 0s \
\Z’\*(0s’\
’\n(0du’\
\D’l \n(0wu -\n(0hu-\n(0du’\
’\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’\
’\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
..
spacen- 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
