home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / 1_1_contri / usd / 27_eqnguid / g3 < prev    next >
Encoding:
Text File  |  1986-05-22  |  4.2 KB  |  225 lines

  1. .\"    @(#)g3    6.1 (Berkeley) 5/22/86
  2. .\"
  3. .SC "Shorthand for In-line Equations"
  4. .PP
  5. In a mathematical document,
  6. it is necessary to follow mathematical conventions
  7. not just in display equations,
  8. but also in the body of the text,
  9. for example by making variable names like $x$ italic.
  10. Although this could be done by surrounding the appropriate parts
  11. with
  12. .UC .EQ
  13. and
  14. .UC .EN ,
  15. the continual repetition of
  16. .UC .EQ
  17. and
  18. .UC .EN
  19. is a nuisance.
  20. Furthermore, with `\(mims',
  21. .UC .EQ
  22. and
  23. .UC .EN
  24. imply a displayed equation.
  25. .PP
  26. .UC EQN
  27. provides a shorthand for short in-line expressions.
  28. You can define two characters to mark the left and right ends
  29. of an in-line equation, and then type expressions right in the middle of text
  30. lines.
  31. To set both the left and right characters to dollar signs, for example,
  32. add to the beginning of your document the three lines
  33. .P1
  34.  .EQ
  35.  delim %%
  36.  .EN
  37. .P2
  38. Having done this, you can then say things like
  39. .P1
  40. .fi
  41. Let %alpha sub i% be the primary variable,
  42. and let %beta% be zero.
  43. Then we can show that %x sub 1% is %>=0%.
  44. .P2
  45. This works as
  46. you might expect _
  47. spaces, newlines, and so on are significant
  48. in the text, but not in the equation part itself.
  49. Multiple equations can occur in a single input line.
  50. .PP
  51. Enough room is left before and after a line that contains
  52. in-line expressions
  53. that something like
  54. $sum from i=1 to n x sub i$
  55. does not interfere with the lines surrounding it.
  56. .PP
  57. To turn off the delimiters,
  58. .P1
  59.  .EQ
  60.  delim off
  61.  .EN
  62. .P2
  63. Warning: don't use braces, tildes, circumflexes, or double quotes as delimiters _
  64. chaos will result.
  65. .SC "Definitions"
  66. .PP
  67. .UC EQN
  68. provides a facility so you can give
  69. a frequently-used string of characters a name,
  70. and thereafter just type the name instead of the
  71. whole string.
  72. For example, if the sequence
  73. .P1
  74. x sub i sub 1 + y sub i sub 1
  75. .P2
  76. appears repeatedly throughout a paper,
  77. you can save re-typing it each time by defining it like this:
  78. .P1 2
  79. define  xy  'x sub i sub 1 + y sub i sub 1'
  80. .P2
  81. This makes
  82. .ul
  83. xy
  84. a shorthand for whatever characters occur between the single quotes
  85. in the definition.
  86. You can use any character instead of quote to mark the ends of the definition,
  87. so long as it doesn't appear inside the definition.
  88. .PP
  89. Now you can use
  90. .ul
  91. xy
  92. like this:
  93. .P1
  94. ^EQ
  95. f(x) = xy ...
  96. ^EN
  97. .P2
  98. and so on.
  99. Each occurrence of
  100. .ul
  101. xy
  102. will expand into what it was defined as.
  103. Be careful to leave spaces or their equivalent
  104. around the name
  105. when you actually use it, so
  106. .UC EQN
  107. will be able to identify it as special.
  108. .PP
  109. There are several things to watch out for.
  110. First, although definitions can use previous definitions,
  111. as in
  112. .P1
  113.  .EQ
  114.  define  xi  ' x sub i '
  115.  define  xi1  ' xi sub 1 '
  116.  .EN
  117. .P2
  118. .ul
  119. don't define something in terms of itself'
  120. A favorite error is to say
  121. .P1
  122. define  X  ' roman X '
  123. .P2
  124. This is a guaranteed disaster,
  125. since X
  126. .ul
  127. is
  128. now defined in terms of itself.
  129. If you say
  130. .P1
  131. define  X  ' roman "X" '
  132. .P2
  133. however, the quotes
  134. protect the second X,
  135. and everything works fine.
  136. .PP
  137. .UC EQN
  138. keywords can be redefined.
  139. You can make
  140. / mean
  141. .ul
  142. over
  143. by saying
  144. .P1
  145. define  /  ' over '
  146. .P2
  147. or redefine
  148. .ul
  149. over
  150. as /
  151. with
  152. .P1
  153. define  over  ' / '
  154. .P2
  155. .PP
  156. If you need different things
  157. to print on a terminal and on the typesetter, it is sometimes worth
  158. defining a symbol differently in
  159. .UC NEQN
  160. and
  161. .UC EQN .
  162. This can be done with
  163. .ul
  164. ndefine
  165. and
  166. .ul
  167. tdefine.
  168. A definition made with
  169. .ul
  170. ndefine
  171. only takes effect if you are running
  172. .UC NEQN ;
  173. if you use
  174. .ul
  175. tdefine,
  176. the definition only applies for
  177. .UC EQN .
  178. Names defined with plain
  179. .ul
  180. define
  181. apply to both
  182. .UC EQN 
  183. and
  184. .UC NEQN .
  185. .SC "Local Motions"
  186. .PP
  187. Although
  188. .UC EQN
  189. tries to get most things at the right place on the paper,
  190. it isn't perfect, and occasionally you will need to tune
  191. the output to make it just right.
  192. Small extra horizontal spaces can be obtained with
  193. tilde and circumflex.
  194. You can also say
  195. .ul
  196. back n
  197. and
  198. .ul
  199. fwd n
  200. to move small amounts horizontally.
  201. .ul
  202. n
  203. is how far to move in 1/100's of an em (an em is about the width
  204. of the letter
  205. `m'.)
  206. Thus
  207. .ul
  208. back 50
  209. moves back about half the width of an m.
  210. Similarly you can move things up or down with
  211. .ul
  212. up n
  213. and
  214. .ul
  215. down n.
  216. As with 
  217. .ul
  218. sub
  219. or
  220. .ul
  221. sup,
  222. the local motions affect the next thing in the input,
  223. and this can be something arbitrarily complicated if it is enclosed
  224. in braces.
  225.