from small one page howto to huge articles all in one place
Last additions:
May 25th. 2007:
April, 26th. 2006:
|
You are here: manpages
%eqn
Section: User Commands (1) Updated: 202-0-28 Index
Return to Main Contents
Name
eqn - format mathematics (equations) for
groff
or MathML
.nr d-fallback 1
.nr d-fallback 1
Synopsis
[ -CNrR]
[ -d~ xy]
[ -f~globa-itali-font]
[ -m~minimu-typ-size]
[ -M~eqnr-directory]
[ -p~super/subscrip-siz-reduction]
[ -s~globa-typ-size]
[ -T~device]
[ file~...]
--help
-v
--version
Description
The GNU implementation of
eqn is part of the
document formatting system.
eqn
is a
preprocessor that translates expressions in its own language,
embedded in
input,
into mathematical notation typeset by
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 use-specified delimiters.
Normally,
eqn
is not executed directly by the user,
but invoked by specifying the
-e
option to
While GNU
eqn's
input syntax 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 present,
or if
file
is
[lq] -[rq],
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.24.2/:tmac.
If it exists and is readable,
eqn
processes it before any input.
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 tx].
There are some references to the differences between tx] and GNU
eqn below;
these may safely be ignored if you do not know tx].
Four points are worth note.
- [bu]
-
GNU
eqn emits Presentation MathML output when invoked with the
[lq]-T~MathML[rq]
option.
- [bu]
-
GNU
eqn does not support terminal devices well,
though it may suffice for simple inputs.
- [bu]
-
GNU
eqn sets the input token
[lq]...[rq]
as an ellipsis on the text baseline,
not the three centered dots of AT&T
eqn.
Set an ellipsis on the math axis with the GNU extension macro
cdots.
- [bu]
-
GNU
eqn's
delim
primitive does not treat an
[lq]on[rq]
argument as a pair of equation delimiters.
Anatomy of an equation
eqn
input consists of tokens.
Consider a form of Newton's second law of motion for constant mass.
The input
-
.EQ
F =
m a
.EN
becomes
F =
m a.
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.
Beyond their primary functions,
the following input characters separate tokens as well.
- { }
-
Braces perform grouping.
Whereas
[lq]e sup a b[rq]
expresses
[lq](e~to the~a)~times~b[rq],
[lq]e sup { a b }[rq]
means
[lq]e~to the~(a~times~b)[rq].
When immediately preceded by a
[lq]left[rq]
or
[lq]right[rq]
primitive,
a brace loses its special meaning.
- [ha] [ti]
-
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 subsection [lq]Macros[rq] 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 [lq]global[rq] font selection or type size
(gifont
and
gsize),
or declaring or deleting macros
([lq]define[rq]
and
undef);
these are termed
commands.
Other primitives perform formatting operations on the tokens around them
(as with
fat,
over,
sqrt,
or
up).
Equation
components
include mathematical variables,
constants,
numeric literals,
and operators.
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
-
| + | [rs][pl] | | [aq] | [rs][fm] | | | |
|
| - | [rs][mi] | | <= | [rs][<=] | | | |
|
| = | [rs][eq] | | >= | [rs][>=] | | | |
|
Macros
permit primitives,
components,
and other macros to be collected and used together as a single token.
Predefined macros make convenient the preparation of
eqn
input in a form resembling its spoken expression;
for example,
consider
cos,
hat,
inf,
and
lim.
Spacing and typeface
GNU
eqn
imputes a type to each equation component,
adjusting the space around it accordingly.
Recognized types follow;
most affect spacing only,
whereas the
[lq] letter[rq]
subtype of
[lq] ordinary[rq]
also assigns a style.
-
" we need quite a bit of horizontal space for this table
| ordinary |
character such as [lq]1[rq],
[lq]a[rq],
or
[lq]![rq]
|
|
| letter | character to be italicized by default |
|
| digit | I]n/a] |
|
| operator |
large operator such as
Su]
|
|
| binary | binary operator such as [lq][pl][rq] |
|
| relation | relational operator such as [lq]=[rq] |
|
| opening | opening bracket such as [lq]([rq] |
|
| closing | closing bracket such as [lq])[rq] |
|
| punctuation | punctuation character such as [lq],[rq] |
|
| inner | su-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 [dq]letter[dq] | abcdefghiklmnopqrstuvwxyz | |
|
| chartype [dq]letter[dq] | ABCDEFGHIKLMNOPQRSTUVWXYZ | |
|
| chartype [dq]letter[dq] | [rs][*a][rs][*b][rs][*g][rs][*d][rs][*e][rs][*z] | |
|
| chartype [dq]letter[dq] | [rs][*y][rs][*h][rs][*i][rs][*k][rs][*l][rs][*m] | |
|
| chartype [dq]letter[dq] | [rs][*n][rs][*c][rs][*o][rs][*p][rs][*r][rs][*s] | |
|
| chartype [dq]letter[dq] | [rs][*t][rs][*u][rs][*f][rs][*x][rs][*q][rs][*w] | |
|
| chartype [dq]binary[dq] | *[rs][pl][rs][mi] | |
|
| chartype [dq]relation[dq] | <>[rs][eq][rs][<=][rs][>=] | |
|
| chartype [dq]opening[dq] | {([ | |
|
| chartype [dq]closing[dq] | })] | |
|
| chartype [dq]punctuation[dq] | ,;:. | |
|
| chartype [dq]suppress[dq] | [ha][ti] | |
|
eqn
assigns all other ordinary and special
roff
characters,
including numerals 0[en]9,
the
[lq]ordinary[rq]
type.
(The
[lq]digit[rq]
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
[lq]letter[rq]
type to style them in italics.
The macros for producing ellipses,
[lq]...[rq],
cdots,
and
ldots,
use the
[lq]inner[rq]
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
We describe the GNU extension primitives
[lq] type[rq]
and
chartype
in subsection [lq]Spacing and typeface[rq] above;
[lq] set[rq]
and
[lq] reset[rq]
in subsection [lq]Customization[rq] below;
and
gbfont,
gifont,
and
grfont
in subsection [lq]Fonts[rq] 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.
eqn
assumes that
e2
is at the appropriate height for a lowercase letter without an ascender,
and shifts it vertically based on
e1's
height.
For example,
eqn
defines
hat
as follows.
-
-
accent { roman "[ha]" }
-
dotdot,
dot,
tilde,
vec,
and
dyad
are also defined using the
accent
primitive.
- big~e
-
Enlarge the expression
e;
semantics like those of CSS [lq]large[rq] are intended.
In
troff
output,
the type size is increased by~5 scaled points.
MathML output emits the following.
-
-
<mstyle mathsize=[aq]big[aq]>
- copy~file
-
include~file
Interpolate the contents of
file,
omitting lines
beginning with
.EQ
or
.EN.
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
[dq]text[dq],
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 [lq]Spacing and typeface[rq] above.
- e~opprime
-
As
prime,
but set the prime symbol as an operator
on~e.
In the input
[lq]A opprime sub 1[rq],
the~[lq]1[rq] is tucked under the prime as a subscript to
the~[lq]A[rq]
(as is conventional in mathematical typesetting),
whereas when
prime
is used,
the~[lq]1[rq] is a subscript to the prime character.
The precedence of
opprime
is the same as that of
bar
and
[lq]under[rq],
and higher than that of other primitives except
accent
and
uaccent.
In unquoted text,
a neutral apostrophe
([aq])
that is not the first character on the input line is treated like
opprime.
- sdefine~name X anything X
-
As
[lq]define[rq],
but
name
is not recognized as a macro if called with arguments.
- e1~smallover~e2
-
As
over,
but reduce the type size of
e1
and
e2,
and put less vertical space between
e1
and
e2
and the fraction bar.
The
over
primitive corresponds to the tx]
[rs]over
primitive in displayed equation styles;
smallover
corresponds to
[rs]over
in no-display ([lq]inline[rq]) 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 before the equation;
if negative,
it does so after the equation.
This primitive provides an interface to
groff's
[rs]x
escape sequence,
but with the opposite sign convention.
It has no effect if the equation is part of a
picture.
- special~trof-macro e
-
Construct an object by calling
trof-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
[lq]tucked in[rq],
or placed to the left relative to a no-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 registers to correspond to the new dimensions
of the result.
-
Suppose you want a construct that [lq]cancels[rq] an expression by
drawing a diagonal line through it.
-
-
.de Ca
. ds 0s [rs]
[rs]Z[aq][rs][rs]*(0s[aq][rs]
[rs]v[aq][rs][rs]n(0du[aq][rs]
[rs]D[aq]l [rs][rs]n(0wu -[rs][rs]n(0hu-[rs][rs]n(0du[aq][rs]
[rs]v[aq][rs][rs]n(0hu[aq]
..
.EQ
special Ca "x [rs][mi] 3 [rs][pl] x" [ti] 3
.EN
-
We use the
[rs][mi]
and
[rs][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
expression;
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 [rs]
[rs]Z[aq][rs][rs]h[aq]1n[aq][rs][rs]*[0s][aq][rs]
[rs]v[aq][rs][rs]n(0du+1n[aq][rs]
[rs]D[aq]l [rs][rs]n(0wu+2n 0[aq][rs]
[rs]D[aq]l 0 -[rs][rs]n(0hu-[rs][rs]n(0du-2n[aq][rs]
[rs]D[aq]l -[rs][rs]n(0wu-2n 0[aq][rs]
[rs]D[aq]l 0 [rs][rs]n(0hu+[rs][rs]n(0du+2n[aq][rs]
[rs]h[aq][rs][rs]n(0wu+2n[aq]
.nr 0w +2n
.nr 0d +1n
.nr 0h +1n
..
.EQ
define box [aq] special Bx $1 [aq]
box(foo) [ti] "bar"
.EN
- split [dq]text[dq]
-
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 [lq]Spacing and typeface[rq] 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
[lq][pl][rq] and [lq][mi][rq] are aligned.
MathML already behaves this way,
so
eqn
ignores this primitive when producing that output format.
The buil-in
sum
macro is defined as if by the following.
-
-
define sum ! { type "operator" vcenter size +5 [rs](*S } !
Extended primitives
GNU
eqn extends the syntax of some AT&T
eqn primitives,
introducing one deliberate incompatibility.
- delim on
-
GNU
eqn recognizes an
[lq]on[rq]
argument to the
delim
primitive specially,
restoring any delimiters previously disabled with
[lq]delim off[rq].
If delimiters haven't been specified,
neither command has effect.
Few
eqn documents are expected to use [lq]o[rq] and [lq]n[rq] as left and
right delimiters,
respectively.
If yours does,
swap 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,
uses the formatter's
[rs]x
escape sequence to increase the vertical spacing between rows;
eqn
ignores it when producing MathML.
Negative 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
[lq] set[rq]
and
[lq] reset[rq]
primitives.
- 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 -height is 0.45~ems.
- reset~p
-
restores the default value of
parameter~p.
Available parameters
p
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).
When producing MathML output,
components to which
fat_offset
applies instead use the following.
-
-
<mstyle mathvariant=[aq]double-struck[aq]>
- 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 su-equation that
the delimiters 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 su-equation that
the delimiters 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
(17).
- medium_space
-
This amount of space is automatically inserted on either side of
binary operators
(22).
- thick_space
-
This amount of space is automatically inserted on either side of
relations
(28).
- half_space
-
configures the width of the space produced by the
[ha]
token
(17).
- full_space
-
configures the width of the space produced by the
[ti]
token
(28).
- x_height
-
The height of lowercase letters without ascenders such as [lq]x[rq]
(45).
- axis_height
-
The height above the baseline of the center of characters such as
[lq][pl][rq] and [lq][mi][rq]
(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
[rs][ru]
character,
or the thickness of horizontal lines produced with the
[rs]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).
Conventionally,
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).
Usually 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 no-zero,
eqn
draws lines using the
troff [rs]D
escape sequence,
rather than the
[rs]l
escape sequence and the
[rs][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 pr-vertical line spacing with
troff's
[rs]x
escape sequence
(85).
- body_depth
-
is the presumed depth of an equation below the text baseline;
eqn
adds any excess as extra pos-vertical line spacing with
troff's
[rs]x
escape sequence
(35).
- nroff
-
If no-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,
and
utf8
devices,
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
comm-separated arguments.
In this context only,
commas and parentheses also serve as token separators.
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
nth
argument;
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
[lq] ...[rq].
The lowercase classical Greek letters are available 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 (heavy).
Assign each a
groff
typeface with the GNU extension primitives
grfont,
gifont,
and
gbfont.
The defaults are the styles
R,
I,
and
B
(applied to the current font family).
The
chartype
primitive
(see above)
sets a character's type,
which determines the face used to set it.
The
[lq] letter[rq]
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.
- gifont~f
-
Select~f
as the italic font.
GNU
eqn recognizes
gfont
as a synonym for
AT&T compatibility.
- grfont~f
-
Select~f
as the roman font.
I]roff] interface
The string
10
stores the most recently formatted equation.
The register
MK
stores the horizontal drawing position of the most recently assigned
mark.
Avoid using these names for any other purpose.
GNU
eqn internally employs register,
string,
macro,
and diversion names beginning with the
numeral~ 0.
(AT&T
eqn used identifiers starting with the
numeral~ 1.)
A document to be preprocessed with GNU
eqn should not use any such identifiers.
Options
--help
displays a usage message,
while
-v
and
--version
show version information;
all exit afterward.
- -C
-
Recognize
.EQ
and
.EN
even when followed by a character other than space or newline.
- -d~xy
-
Specify delimiters
x
for left
and~y
for right ends
of equations not bracketed by
.EQ/.EN.
x
and
y
need not be distinct.
Any
[lq]delim
xy[rq]
statements in the source file override this option.
- -f~F
-
is equivalent to
[lq]gifont
F[rq].
- -m~n
-
is equivalent to
[lq]set minimum_size
n[rq].
- -M~dir
-
Search
dir
for
eqnrc
before those listed in section [lq]Description[rq] above.
- -N
-
Prohibit newlines within delimiters,
allowing
eqn
to recover better from missing closing delimiters.
- -p~n
-
Set su- and superscripts
n~points
smaller than the surrounding text.
This option is deprecated.
eqn
normally sets su- and superscripts at 70% of the type size of the
surrounding text.
- -r
-
Reduce the type size of supe- and subscripts at most once relative to
the base type size.
- -R
-
Don't load
eqnrc.
- -s~n
-
is equivalent to
[lq]gsize
n[rq].
This option is deprecated.
- -T~dev
-
Prepare output for the device
dev.
This option
defines a macro
dev
with the
value~1;
eqnrc
thereby provides definitions appropriate to the device.
However,
if
dev
is
[lq]MathML[rq],
eqn
produces output in that language rather than
roff,
and does not load
eqnrc.
The default device is
ps.
Exit status
eqn
exits with
status~ 0
on successful operation,
status~ 2
if the program cannot interpret its comman-line arguments,
and
status~ 1
if it encounters an error during operation.
Files
- /usr/:share/:groff/:1.24.2/:tmac/:eqnrc
-
initializes the preprocessor for
troff
output.
Any valid
eqn
input is accepted.
MathML output limitations
MathML's design assumes 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 motions and sizes to the same
degree
troff
does.
- [bu]
-
GNU
eqn's
rendering parameters
(see section [lq]Customization[rq] above)
have no effect on generated MathML.
- [bu]
-
The
special,
up,
down,
fwd,
and
back
primitives cannot be implemented,
and yield a MathML [lq]<merror>[rq] message instead.
- [bu]
-
The
vcenter
primitive is silently ignored,
as centering on the math axis is the MathML default.
- [bu]
-
Characters that
eqn
sets extra large in
troff output[em]notably the integral sign[em]may appear too small
and need to have their [lq]<mstyle>[rq] wrappers adjusted by hand.
As when producing
troff output,
eqn
generates MathML that leaves the
.EQ
and
.EN
tokens in place,
but emits nothing corresponding to
delim
delimiters.
They can,
however,
be recognized as character sequences that begin with [lq]<math>[rq],
end with [lq]</math>[rq],
and do not cross line boundaries.
Caveats
Tokens must be doubl-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
[lq] pi[rq]
and
[lq] PI[rq],
can collide with
troff identifiers.
For instance,
the
eqn command
[lq] gifont PI[rq]
does not select the
or
device's Palatino italic font as the global italic face;
you must use
[lq] gifont [dq]PI[dq][rq]
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 tx],
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[em]its
[lq]equations[rq]
can be inequalities,
bare expressions,
or unintelligible gibberish.
But there's no changing it now.
When producing terminal output,
GNU
eqn renders lowercase Greek letters in roman instead of italic style.
When producing MathML output,
the
mark
and
lineup
features don't work.
These could,
in theory,
be implemented with [lq]<maligngroup>[rq] elements.
When producing MathML output,
each digit of a numeric literal gets a separate [lq]<mn>:</mn>[rq]
pair,
and decimal points are tagged with [lq]<mo>:</mo>[rq].
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 affords an opportunity to use fractions,
radicals,
and the full space token
[ti].
-
.EQ
x = { - b [ti] [rs][+-] [ti] sqrt { b sup 2 - 4 a c } } over { 2 a }
.EN
Alternatively,
we could define the plu-minus sign as a binary operator.
Automatic spacing puts 0.06~em less space on either side of the
plu-minus than [ti] does,
this being the difference between the widths of the
medium_space
parameter used by binary operators and that of the full space.
Independently,
we can define a macro [lq]frac[rq] for setting fractions.
-
.EQ
chartype "binary" [rs][+-]
define frac ! { $1 } over { $2 } !
x = frac(- b [rs][+-] sqrt { b sup 2 - 4 a c }, 2 a)
.EN
See also
[lq]Typesetting Mathematics[em]User's Guide[rq]
(2nd edition),
by Brian W. Kernighan
and Lorinda L. Cherry,
1978,
AT&T Bell Laboratories Computing Science Technical Report No. 17.
The~tx]book,
by Donald E. Knuth,
1984,
Addiso-Wesley Professional.
Appendix~G
discusses many of the parameters from section [lq]Customization[rq]
above in greater detail.
documents a variety of special character escape sequences useful in
mathematical typesetting.
See subsections [lq]Logical symbols[rq],
[lq]Mathematical symbols[rq],
and [lq]Greek glyphs[rq] in particular.
Index
- Name
-
- Synopsis
-
- Description
-
- Anatomy of an equation
-
- Spacing and typeface
-
- Primitives
-
- New primitives
-
- Extended primitives
-
- Customization
-
- Macros
-
- Predefined macros
-
- Fonts
-
- I]roff] interface
-
- Options
-
- Exit status
-
- Files
-
- MathML output limitations
-
- Caveats
-
- Bugs
-
- Examples
-
- See also
-
|
|