V7M/doc/eqn/g3

.SC "Shorthand for In-line Equations"
.PP
In a mathematical document,
it is necessary to follow mathematical conventions
not just in display equations,
but also in the body of the text,
for example by making variable names like $x$ italic.
Although this could be done by surrounding the appropriate parts
with
.UC .EQ
and
.UC .EN ,
the continual repetition of
.UC .EQ
and
.UC .EN
is a nuisance.
Furthermore, with `\(mims',
.UC .EQ
and
.UC .EN
imply a displayed equation.
.PP
.UC EQN
provides a shorthand for short in-line expressions.
You can define two characters to mark the left and right ends
of an in-line equation, and then type expressions right in the middle of text
lines.
To set both the left and right characters to dollar signs, for example,
add to the beginning of your document the three lines
.P1
 .EQ
 delim %%
 .EN
.P2
Having done this, you can then say things like
.P1
.fi
Let %alpha sub i% be the primary variable,
and let %beta% be zero.
Then we can show that %x sub 1% is %>=0%.
.P2
This works as
you might expect _
spaces, newlines, and so on are significant
in the text, but not in the equation part itself.
Multiple equations can occur in a single input line.
.PP
Enough room is left before and after a line that contains
in-line expressions
that something like
$sum from i=1 to n x sub i$
does not interfere with the lines surrounding it.
.PP
To turn off the delimiters,
.P1
 .EQ
 delim off
 .EN
.P2
Warning: don't use braces, tildes, circumflexes, or double quotes as delimiters _
chaos will result.
.SC "Definitions"
.PP
.UC EQN
provides a facility so you can give
a frequently-used string of characters a name,
and thereafter just type the name instead of the
whole string.
For example, if the sequence
.P1
x sub i sub 1 + y sub i sub 1
.P2
appears repeatedly throughout a paper,
you can save re-typing it each time by defining it like this:
.P1 2
define  xy  'x sub i sub 1 + y sub i sub 1'
.P2
This makes
.ul
xy
a shorthand for whatever characters occur between the single quotes
in the definition.
You can use any character instead of quote to mark the ends of the definition,
so long as it doesn't appear inside the definition.
.PP
Now you can use
.ul
xy
like this:
.P1
^EQ
f(x) = xy ...
^EN
.P2
and so on.
Each occurrence of
.ul
xy
will expand into what it was defined as.
Be careful to leave spaces or their equivalent
around the name
when you actually use it, so
.UC EQN
will be able to identify it as special.
.PP
There are several things to watch out for.
First, although definitions can use previous definitions,
as in
.P1
 .EQ
 define  xi  ' x sub i '
 define  xi1  ' xi sub 1 '
 .EN
.P2
.ul
don't define something in terms of itself'
A favorite error is to say
.P1
define  X  ' roman X '
.P2
This is a guaranteed disaster,
since X
.ul
is
now defined in terms of itself.
If you say
.P1
define  X  ' roman "X" '
.P2
however, the quotes
protect the second X,
and everything works fine.
.PP
.UC EQN
keywords can be redefined.
You can make
/ mean
.ul
over
by saying
.P1
define  /  ' over '
.P2
or redefine
.ul
over
as /
with
.P1
define  over  ' / '
.P2
.PP
If you need different things
to print on a terminal and on the typesetter, it is sometimes worth
defining a symbol differently in
.UC NEQN
and
.UC EQN .
This can be done with
.ul
ndefine
and
.ul
tdefine.
A definition made with
.ul
ndefine
only takes effect if you are running
.UC NEQN ;
if you use
.ul
tdefine,
the definition only applies for
.UC EQN .
Names defined with plain
.ul
define
apply to both
.UC EQN 
and
.UC NEQN .
.SC "Local Motions"
.PP
Although
.UC EQN
tries to get most things at the right place on the paper,
it isn't perfect, and occasionally you will need to tune
the output to make it just right.
Small extra horizontal spaces can be obtained with
tilde and circumflex.
You can also say
.ul
back n
and
.ul
fwd n
to move small amounts horizontally.
.ul
n
is how far to move in 1/100's of an em (an em is about the width
of the letter
`m'.)
Thus
.ul
back 50
moves back about half the width of an m.
Similarly you can move things up or down with
.ul
up n
and
.ul
down n.
As with 
.ul
sub
or
.ul
sup,
the local motions affect the next thing in the input,
and this can be something arbitrarily complicated if it is enclosed
in braces.