-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg3
222 lines (222 loc) · 4.14 KB
/
g3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
.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.