Eqn
is a
troff(1)
preprocessor for typesetting mathematics
on a Graphic Systems phototypesetter,
neqn()
on terminals.
Usage is almost always
eqn file ... | troffneqn file ... | nroff
If no files are specified, these programs read from the standard input.
A line beginning with `.EQ' marks the start of an equation;
the end of an equation is marked by a line beginning with `.EN'.
Neither of these lines is altered, so they may be defined
in macro packages to get centering, numbering, etc.
It is also possible to set two characters as `delimiters';
subsequent text between delimiters is also treated as
eqn
input.
Delimiters may be set to characters
x
and
y
with the command-line argument
-d xy
or (more commonly) with
`delim
xy' '
between .EQ and .EN.
The left and right delimiters may be identical.
Delimiters are turned off by `delim off'.
All text that is neither between delimiters nor between .EQ and .EN
is passed through untouched.
The program
checkeq
reports missing or unbalanced delimiters and .EQ/.EN pairs.
Tokens within
eqn
are separated by
spaces, tabs, newlines, braces, double quotes, tildes or circumflexes.
Braces {} are used for grouping;
generally speaking, anywhere a single character like
x
could appear, a complicated construction enclosed in braces may be used instead.
Tilde ~ represents a full space in the output, circumflex ^ half as much.
.vs 13p
Subscripts and superscripts are produced with the keywords
sub
and
sup.
Thus
"xsub i"
makes
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "x
.ds 13 "i
.as 12 \v'12u'\s-3\*(13\s+3\|\v'-12u'
.ds 12 \x'0'\f2\s10\*(12\s\n(99\f\n(98
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ",
.ps \n(99
.ft \n(98
\*(11
"asub i sup 2"
produces
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "a
.ds 13 "i
.ds 14 "\f12\fP
.as 13 \|
.nr 13 \w'\s7\*(13'
.ds 14 \|\|\*(14
.nr 14 \w'\s7\*(14'
.nr 15 \n(14
.if \n(13>\n(15 .nr 15 \n(13
.as 12 \v'12u'\s7\*(13\h'-\n(13u'\v'-36u'\
\s7\*(14\h'-\n(14u+\n(15u'\s10\v'24u'
.ds 12 \x'0'\f2\s10\*(12\s\n(99\f\n(98
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ",
.ps \n(99
.ft \n(98
\*(11
and
"esup {x sup 2 +
ysup 2}"
gives
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "e
.ds 13 "x
.ds 14 "\f12\fP
.as 13 \v'-15u'\s-3\|\*(14\s+3\v'15u'
.ds 14 "\(pl
.as 13 "\*(14
.ds 14 "y
.ds 15 "\f12\fP
.as 14 \v'-15u'\s-3\|\*(15\s+3\v'15u'
.as 13 "\*(14
.as 12 \v'-24u'\s-3\|\*(13\s+3\v'24u'
.ds 12 \x'0'\x'0-6u'\f2\s10\*(12\s\n(99\f\n(98
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ".
.ps \n(99
.ft \n(98
\*(11
Fractions are made with
over:
"aover b"
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.as 11 "yields
.ps 10
.ft 2
.ds 12 "a
.ds 13 "b
.nr 12 \w'\s10\*(12'
.nr 13 \w'\s10\*(13'
.nr 14 \n(12
.if \n(13>\n(14 .nr 14 \n(13
.nr 14 \n(14+\s10.5m\s0
.ds 12 \v'42u'\h'\n(14u-\n(13u/2u'\*(13\
\h'-\n(13u-\n(12u/2u'\v'-78u'\*(12\
\h'-\n(14u-\n(12u/2u+.1m'\v'18u'\l'\n(14u-.2m'\h'.1m'\v'18u'
.ds 12 \x'0'\x'0-24u'\f2\s10\*(12\s\n(99\f\n(98\x'30u'
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ".
.ps \n(99
.ft \n(98
\*(11
sqrt
makes square roots:
"1over sqrt
{axsup 2 +bx+c}"
results in
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "\f11\fP
.ds 13 "ax
.ds 14 "\f12\fP
.as 13 \v'-24u'\s-3\|\*(14\s+3\v'24u'
.ds 14 "\(plbx\|\(plc
.as 13 "\*(14
.as 13 \|
.nr 13 \w'\s10\*(13'
.ds 13 \v'0u'\s10\v'-.2m'\(sr\l'\n(13u\(rn'\v'.2m'\s10\v'0u'\h'-\n(13u'\*(13
.nr 12 \w'\s10\*(12'
.nr 13 \w'\s10\*(13'
.nr 14 \n(12
.if \n(13>\n(14 .nr 14 \n(13
.nr 14 \n(14+\s10.5m\s0
.ds 12 \v'54u'\h'\n(14u-\n(13u/2u'\*(13\
\h'-\n(13u-\n(12u/2u'\v'-90u'\*(12\
\h'-\n(14u-\n(12u/2u+.1m'\v'18u'\l'\n(14u-.2m'\h'.1m'\v'18u'
.ds 12 \x'0'\x'0-24u'\f2\s10\*(12\s\n(99\f\n(98\x'42u'
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 " .
.ps \n(99
.ft \n(98
\*(11
The keywords
from
and
to
introduce lower and upper limits on arbitrary things:
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "\f1lim\fP
.ds 13 "n\|\(->
.ds 14 "\(if
.as 13 "\*(14
.nr 12 \w'\s10\*(12'
.nr 14 \n(12
.nr 13 \w'\s7\*(13'
.if \n(13>\n(14 .nr 14 \n(13
.ds 14 \v'42u'\h'\n(14u-\n(13u/2u'\s7\*(13\s10\h'-\n(14u-\n(13u/2u'\v'-42u'\
\h'\n(14u-\n(12u/2u'\*(12\h'\n(14u-\n(12u/2u'\
.ds 12 \s10\v'.3m'\s+5\(*S\s-5\v'-.3m'\s10
.ds 13 "\f10\fP
.ds 15 "n
.nr 12 \w'\s10\*(12'
.nr 16 \n(12
.nr 13 \w'\s7\*(13'
.if \n(13>\n(16 .nr 16 \n(13
.nr 15 \w'\s7\*(15'
.if \n(15>\n(16 .nr 16 \n(15
.ds 16 \v'60u'\h'\n(16u-\n(13u/2u'\s7\*(13\s10\h'-\n(16u-\n(13u/2u'\v'-60u'\
\h'\n(16u-\n(12u/2u'\*(12\h'\n(16u-\n(12u/2u'\
\v'-60u'\h'-\n(16u-\n(15u/2u'\s7\*(15\s10\h'\n(16u-\n(15u/2u'\v'60u'\
.as 14 "\*(16
.ds 12 "x
.ds 13 "i
.as 12 \v'12u'\s-3\*(13\s+3\|\v'-12u'
.as 14 "\*(12
.ds 14 \x'0'\x'0-30u'\f2\s10\*(14\s\n(99\f\n(98\x'48u'
.as 11 \*(14
.ps \n(99
.ft \n(98
.as 11 "
.ps \n(99
.ft \n(98
\*(11
is made with
"limfrom {n\-> inf }
sumfrom 0 to n x
subi."
Left and right brackets, braces, etc., of the right height are made with
left
and
right:
["left]
xx sup 2 + y sup 2
.AR over alpha right
\&~=~1"
produces
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "x
.ds 13 "\f12\fP
.as 12 \v'-24u'\s-3\|\*(13\s+3\v'24u'
.ds 13 "\(pl
.as 12 "\*(13
.ds 13 "y
.ds 14 "\f12\fP
.as 13 \v'-24u'\s-3\|\*(14\s+3\v'24u'
.ds 14 "\(*a
.nr 13 \w'\s10\*(13'
.nr 14 \w'\s10\*(14'
.nr 15 \n(13
.if \n(14>\n(15 .nr 15 \n(14
.nr 15 \n(15+\s10.5m\s0
.ds 13 \v'42u'\h'\n(15u-\n(14u/2u'\*(14\
\h'-\n(14u-\n(13u/2u'\v'-78u'\*(13\
\h'-\n(15u-\n(13u/2u+.1m'\v'18u'\l'\n(15u-.2m'\h'.1m'\v'18u'
.as 12 "\*(13
.ds 12 \|\v'-6u'\b'\(lc\(bv\(lf'\v'6u'\*(12\|\v'-6u'\b'\(rc\(bv\(rf'\v'6u'
.ds 13 "\
.as 12 "\*(13
.ds 13 "\(eq
.as 12 "\*(13
.ds 13 "\
.as 12 "\*(13
.ds 13 "\f11\fP
.as 12 "\*(13
.ds 12 \x'0'\x'0-48u'\f2\s10\*(12\s\n(99\f\n(98\x'48u'
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ".
.ps \n(99
.ft \n(98
\*(11
The
right
clause is optional.
Legal characters after
left
and
right
are braces, brackets, bars,
c
and
f
for ceiling and floor,
and "" for nothing at all (useful for a right-side-only bracket).
Vertical piles of things are made with
pile,
lpile,
cpile,
and
rpile:
"pile{a above b above c}"
produces
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "a
.ds 13 "b
.ds 14 "c
.nr 12 \w'\s10\*(12'
.nr 15 \n(12
.nr 13 \w'\s10\*(13'
.if \n(13>\n(15 .nr 15 \n(13
.nr 14 \w'\s10\*(14'
.if \n(14>\n(15 .nr 15 \n(14
.ds 15 \v'60u'\h'0u*\n(15u'\
\v'0u'\h'\n(15u-\n(14u/2u'\*(14\h'-\n(15u-\n(14u/2u'\v'0-60u'\
\v'0u'\h'\n(15u-\n(13u/2u'\*(13\h'-\n(15u-\n(13u/2u'\v'0-60u'\
\v'0u'\h'\n(15u-\n(12u/2u'\*(12\h'-\n(15u-\n(12u/2u'\v'0-60u'\
\v'120u'\h'1u*\n(15u'
.ds 15 \x'0'\x'0-48u'\f2\s10\*(15\s\n(99\f\n(98\x'48u'
.as 11 \*(15
.ps \n(99
.ft \n(98
.as 11 ".
.ps \n(99
.ft \n(98
\*(11
There can be an arbitrary number of elements in a pile.
lpile
left-justifies,
pile
and
cpile
center, with different vertical spacing, and
rpile
right justifies.
Matrices are made with
matrix:
"matrix{ lcol { x sub i
abovey sub 2 } ccol {
1above 2 } }"
produces
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "x
.ds 13 "i
.as 12 \v'12u'\s-3\*(13\s+3\|\v'-12u'
.ds 13 "y
.ds 14 "\f12\fP
.as 13 \v'12u'\s-3\|\*(14\s+3\v'-12u'
.ds 14 "\f11\fP
.ds 15 "\f12\fP
.nr 12 \w'\s10\*(12'
.nr 16 \n(12
.nr 13 \w'\s10\*(13'
.if \n(13>\n(16 .nr 16 \n(13
.ds 16 \v'42u'\h'0u*\n(16u'\
\v'-12u'\*(13\h'-\n(13u'\v'0-84u'\
\v'-12u'\*(12\h'-\n(12u'\v'0-84u'\
\v'150u'\h'1u*\n(16u'
.nr 14 \w'\s10\*(14'
.nr 12 \n(14
.nr 15 \w'\s10\*(15'
.if \n(15>\n(12 .nr 12 \n(15
.ds 12 \v'42u'\h'0u*\n(12u'\
\v'-12u'\h'\n(12u-\n(15u/2u'\*(15\h'-\n(12u-\n(15u/2u'\v'0-84u'\
\v'-12u'\h'\n(12u-\n(14u/2u'\*(14\h'-\n(12u-\n(14u/2u'\v'0-84u'\
\v'150u'\h'1u*\n(12u'
.ds 13 "\*(16\ \ \*(12
.ds 13 \x'0'\x'0-54u'\f2\s10\*(13\s\n(99\f\n(98\x'30u'
.as 11 \*(13
.ps \n(99
.ft \n(98
.as 11 ".
.ps \n(99
.ft \n(98
\*(11
In addition, there is
rcol
for a right-justified column.
.vs 12p
Diacritical marks are made with
dot,
dotdot,
hat,
tilde,
bar,
vec,
dyad,
and
under:
"xdot \&= f(t) bar"
is
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "x
.nr 12 \w'\s10\*(12'
.nr 10 0u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 14 \s10.1m\s0
.if \n(ct>1 .nr 14 \s10.15m\s0
.ds 13 \s10\v'-.67m'.\v'.67m'\s0
.nr 13 \w'\s10\*(13'
.as 12 \h'-\n(12u-\n(13u/2u+\n(14u'\v'0-\n(10u'\*(13\v'\n(10u'\h'-\n(13u+\n(12u/2u-\n(14u'
.ds 13 "\(eq
.as 12 "\|\*(13
.ds 13 "\^f\|\|\f1(\fPt\|\f1)\fP
.nr 13 \w'\s10\*(13'
.nr 10 0u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 15 \s10.1m\s0
.if \n(ct>1 .nr 15 \s10.15m\s0
.ds 14 \s10\v'.18m'\h'.05m'\l'\n(13u-.1m\(rn'\h'.05m'\v'-.18m'\s0
.nr 14 \w'\s10\*(14'
.as 13 \h'-\n(13u-\n(14u/2u+\n(15u'\v'0-\n(10u'\*(14\v'\n(10u'\h'-\n(14u+\n(13u/2u-\n(15u'
.as 12 "\*(13
.ds 12 \x'0'\f2\s10\*(12\s\n(99\f\n(98
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ",
.ps \n(99
.ft \n(98
\*(11
"ydotdot bar \&~=~
nunder"
is
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "y
.nr 12 \w'\s10\*(12'
.nr 10 0u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 14 \s10.1m\s0
.if \n(ct>1 .nr 14 \s10.15m\s0
.ds 13 \s10\v'-.67m'..\v'.67m\s0'
.nr 13 \w'\s10\*(13'
.as 12 \h'-\n(12u-\n(13u/2u+\n(14u'\v'0-\n(10u'\*(13\v'\n(10u'\h'-\n(13u+\n(12u/2u-\n(14u'
.nr 12 \w'\s10\*(12'
.nr 10 9u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 14 \s10.1m\s0
.if \n(ct>1 .nr 14 \s10.15m\s0
.ds 13 \s10\v'.18m'\h'.05m'\l'\n(12u-.1m\(rn'\h'.05m'\v'-.18m'\s0
.nr 13 \w'\s10\*(13'
.as 12 \h'-\n(12u-\n(13u/2u+\n(14u'\v'0-\n(10u'\*(13\v'\n(10u'\h'-\n(13u+\n(12u/2u-\n(14u'
.ds 13 "\
.as 12 "\|\*(13
.ds 13 "\(eq
.as 12 "\*(13
.ds 13 "\
.as 12 "\*(13
.ds 13 "n
.nr 13 \w'\s10\*(13'
.nr 10 0u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 15 \s10.1m\s0
.if \n(ct>1 .nr 15 \s10.15m\s0
.ds 14 \l'\n(13u\(ul'
.nr 15 0
.nr 10 0-0
.nr 14 \w'\s10\*(14'
.as 13 \h'-\n(13u-\n(14u/2u+\n(15u'\v'0-\n(10u'\*(14\v'\n(10u'\h'-\n(14u+\n(13u/2u-\n(15u'
.as 12 "\*(13
.ds 12 \x'0'\x'0-6u'\f2\s10\*(12\|\s\n(99\f\n(98
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ",
.ps \n(99
.ft \n(98
\*(11
and
"xvec \&~=~ y dyad"
is
.nr 99 \n(.s
.nr 98 \n(.f
.rm 11
.ps 10
.ft 2
.ds 12 "x
.nr 12 \w'\s10\*(12'
.nr 10 0u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 14 \s10.1m\s0
.if \n(ct>1 .nr 14 \s10.15m\s0
.ds 13 \v'-.4m'\s7\(->\s0\v'.4m'
.nr 13 \w'\s10\*(13'
.as 12 \h'-\n(12u-\n(13u/2u+\n(14u'\v'0-\n(10u'\*(13\v'\n(10u'\h'-\n(13u+\n(12u/2u-\n(14u'
.ds 13 "\
.as 12 "\|\*(13
.ds 13 "\(eq
.as 12 "\*(13
.ds 13 "\
.as 12 "\*(13
.ds 13 "y
.nr 13 \w'\s10\*(13'
.nr 10 0u
.if \n(ct>1 .nr 10 \n(10+\s10.25m\s0
.nr 15 \s10.1m\s0
.if \n(ct>1 .nr 15 \s10.15m\s0
.ds 14 \v'-.4m'\s7\z\(<-\(->\s0\v'.4m'
.nr 14 \w'\s10\*(14'
.as 13 \h'-\n(13u-\n(14u/2u+\n(15u'\v'0-\n(10u'\*(14\v'\n(10u'\h'-\n(14u+\n(13u/2u-\n(15u'
.as 12 "\*(13
.ds 12 \x'0'\f2\s10\*(12\|\s\n(99\f\n(98
.as 11 \*(12
.ps \n(99
.ft \n(98
.as 11 ".
.ps \n(99
.ft \n(98
\*(11
Sizes and font can be changed with
size
[n]
or
sizeroman,
italic,
bold,
and
fontn.
Size and fonts can be changed globally in a document by
gsizen
and
gfontn,
or by the command-line arguments
.Cx Fl s
n
.Cx
and
.Cx Fl f
n
.Cx .
.Cx
Normally subscripts and superscripts are reduced by
3 point sizes from the previous size;
this may be changed by the command-line argument
.Cx Fl p
n.
.Cx
Successive display arguments can be lined up.
Place
mark
before the desired lineup point in the first equation;
place
lineup
at the place that is to line up vertically in subsequent equations.
Shorthands may be defined or existing keywords redefined with
define:
"definething \&% replacement \&%"
defines a new token called
thing
which will be replaced by
replacement
whenever it appears thereafter.
The
\&%
may be any character that does not occur in
replacement.
Keywords like
sum
.EQ
.nr 99 \n(.s
.nr 98 \n(.f
.ps 10
.ft 2
.ds 11 "\f1(\fP
.ds 12 \s10\v'.3m'\s+5\(*S\s-5\v'-.3m'\s10
.as 11 "\*(12
.ds 12 "\f1)\fP
.as 11 "\*(12
.ds 11 \x'0'\f2\s10\*(11\s\n(99\f\n(98\x'6u'
.nr 11 \w'\*(11'
.nr MK 0
.if 78>\n(.v .ne 78u
.rn 11 10
\*(10
.ps \n(99
.ft \n(98
.EN
int
.EQ
.nr 99 \n(.s
.nr 98 \n(.f
.ps 10
.ft 2
.ds 11 "\f1(\fP
.ds 12 \s10\v'.1m'\s+4\(is\s-4\v'-.1m'\s10
.as 11 "\*(12
.ds 12 "\f1)\fP
.as 11 "\*(12
.ds 11 \x'0'\x'0-6u'\f2\s10\*(11\s\n(99\f\n(98\x'6u'
.nr 11 \w'\*(11'
.nr MK 0
.if 96>\n(.v .ne 96u
.rn 11 10
\*(10
.ps \n(99
.ft \n(98
.EN
inf
.EQ
.nr 99 \n(.s
.nr 98 \n(.f
.ps 10
.ft 2
.ds 11 "\f1(\fP
.ds 12 "\(if
.as 11 "\*(12
.ds 12 "\f1)\fP
.as 11 "\*(12
.ds 11 \x'0'\f2\s10\*(11\s\n(99\f\n(98
.nr 11 \w'\*(11'
.nr MK 0
.if 60>\n(.v .ne 60u
.rn 11 10
\*(10
.ps \n(99
.ft \n(98
.EN
and shorthands like
>=
.EQ
.nr 99 \n(.s
.nr 98 \n(.f
.ps 10
.ft 2
.ds 11 "\f1(\fP\(>=\f1)\fP
.ds 11 \x'0'\f2\s10\*(11\s\n(99\f\n(98
.nr 11 \w'\*(11'
.nr MK 0
.if 60>\n(.v .ne 60u
.rn 11 10
\*(10
.ps \n(99
.ft \n(98
.EN
\->
.EQ
.nr 99 \n(.s
.nr 98 \n(.f
.ps 10
.ft 2
.ds 11 "\f1(\fP\(->\f1)\fP\f1,\fP
.ds 11 \x'0'\f2\s10\*(11\s\n(99\f\n(98
.nr 11 \w'\*(11'
.nr MK 0
.if 60>\n(.v .ne 60u
.rn 11 10
\*(10
.ps \n(99
.ft \n(98
.EN
and
!=
.EQ
.nr 99 \n(.s
.nr 98 \n(.f
.ps 10
.ft 2
.ds 11 "\f1(\fP
.ds 12 "\(!=
.as 11 "\*(12
.ds 12 "\f1)\fP
.as 11 "\*(12
.ds 11 \x'0'\f2\s10\*(11\s\n(99\f\n(98
.nr 11 \w'\*(11'
.nr MK 0
.if 60>\n(.v .ne 60u
.rn 11 10
\*(10
.ps \n(99
.ft \n(98
.EN
are recognized.
Greek letters are spelled out in the desired case, as in
alpha
or
GAMMA.
Mathematical words like sin, cos, log are made Roman automatically.
Troff(1/1)
four-character escapes like \e(bs (\(bs)
can be used anywhere.
Strings enclosed in double quotes "..." are passed through untouched;
this permits keywords to be entered as text,
and can be used to communicate with
troff(1)
when all else fails.
SEE ALSO
troff(1),
tbl(1),
ms(7),
eqnchar(7)
.br
B. W. Kernighan and L. L. Cherry,
Typesetting Mathematics\-User's Guide
.Br
J. F. Ossanna,
NROFF/TROFF User's Manual
HISTORY
Eqn
first appeared in
Version 6 AT&T UNIX.
BUGS
To embolden digits, parens, etc., it is necessary to quote them,
as in `bold "12.3"'.