27.  Definitions

      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 x sub i sub 1 + y sub i sub 1
appears repeatedly throughout a paper, you can save re-typing it each time by defining it like this: define xy 'x sub i sub 1 + y sub i sub 1'
This makes 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.

      Now you can use xy like this: ^EQ
f(x) = xy ...
^EN
and so on. Each occurrence of 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 EQN will be able to identify it as special.

      There are several things to watch out for. First, although definitions can use previous definitions, as in .EQ
define xi ' x sub i '
define xi1 ' xi sub 1 '
.EN
don't define something in terms of itself' A favorite error is to say define X ' roman X '
This is a guaranteed disaster, since X is now defined in terms of itself. If you say define X ' roman "X" '
however, the quotes protect the second X, and everything works fine.

      EQN keywords can be redefined. You can make / mean over by saying define / ' over '
or redefine over as / with define over ' / '

      If you need different things to print on a terminal and on the typesetter, it is sometimes worth defining a symbol differently in NEQN and EQN. This can be done with ndefine and tdefine. A definition made with ndefine only takes effect if you are running NEQN; if you use tdefine, the definition only applies for EQN. Names defined with plain define apply to both EQN and NEQN.