home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / doc / trofftut / tt06 < prev    next >
Encoding:
Text File  |  1979-01-10  |  6.6 KB  |  309 lines

  1. .NH
  2. Local Motions: Drawing lines and characters
  3. .PP
  4. Remember `Area = \(*pr\u2\d' and the big `P'
  5. in the Paternoster.
  6. How are they done?
  7. .UL troff
  8. provides a host of commands for placing characters of any size
  9. at any place.
  10. You can use them to draw special characters 
  11. or to tune your output for a particular appearance.
  12. Most of these commands are straightforward, but messy to read
  13. and tough to type correctly.
  14. .PP
  15. If you won't use 
  16. .UL eqn ,
  17. subscripts and superscripts are most easily done with
  18. the half-line local motions
  19. .BD \eu
  20. and
  21. .BD \ed .
  22. To go back up the page half a point-size, insert a
  23. .BD \eu
  24. at the desired place;
  25. to go down, insert a
  26. .BD \ed .
  27. .BD \eu \& (
  28. and
  29. .BD \ed
  30. should always
  31. be used in pairs, as explained below.)
  32. Thus
  33. .P1
  34. Area = \e(*pr\eu2\ed
  35. .P2
  36. produces
  37. .P1
  38. Area = \(*pr\u2\d
  39. .P2
  40. To make the `2' smaller, bracket it with
  41. .BD \es\-2...\es0 .
  42. Since
  43. .BD \eu
  44. and
  45. .BD \ed
  46. refer to the current point size,
  47. be sure to put them either both inside or both outside
  48. the size changes,
  49. or you will get an unbalanced vertical motion.
  50. .PP
  51. Sometimes the space given by
  52. .BD \eu
  53. and
  54. .BD \ed
  55. isn't the right amount.
  56. The 
  57. .BD \ev
  58. command can be used to request an arbitrary amount of vertical motion.
  59. The in-line command
  60. .P1
  61. \ev'(amount)'
  62. .P2
  63. causes motion up or down the page by the amount specified in
  64. `(amount)'.
  65. For example, to move the `P' down, we used
  66. .P1 2
  67. .ta 1i
  68. ^in +0.6i    (move paragraph in)
  69. ^ll \-0.3i    (shorten lines)
  70. ^ti \-0.3i    (move P back)
  71. \ev'2'\es36P\es0\ev'\-2'ater noster qui est
  72. in caelis ...
  73. .P2
  74. A minus sign causes upward motion, while
  75. no sign or a plus sign means down the page.
  76. Thus
  77. .BD \ev\(fm\-2\(fm
  78. causes an upward vertical motion 
  79. of two line spaces.
  80. .PP
  81. There are many other ways to specify the amount of motion _
  82. .P1
  83. \ev'0.1i'
  84. \ev'3p'
  85. \ev'\-0.5m'
  86. .P2
  87. and so on are all legal.
  88. Notice that the scale specifier
  89. .BD i
  90. or
  91. .BD p
  92. or
  93. .BD m
  94. goes inside the quotes.
  95. Any character can be used in place of the quotes;
  96. this is also true of all other
  97. .UL troff
  98. commands described in this section.
  99. .PP
  100. Since
  101. .UL troff
  102. does not take within-the-line vertical motions into account
  103. when figuring out where it is on the page,
  104. output lines can have unexpected positions
  105. if the left and right ends aren't at the same
  106. vertical position.
  107. Thus
  108. .BD \ev ,
  109. like
  110. .BD \eu
  111. and
  112. .BD \ed ,
  113. should always balance upward vertical motion in a line with
  114. the same amount in the downward direction.
  115. .PP
  116. Arbitrary horizontal motions are also available _
  117. .BD \eh
  118. is quite analogous to
  119. .BD \ev ,
  120. except that the default scale factor is ems instead of line spaces.
  121. As an example,
  122. .P1
  123. \eh'\-0.1i'
  124. .P2
  125. causes a backwards motion of a tenth of an inch.
  126. As a practical matter, consider printing the mathematical symbol
  127. `>>'.
  128. The default spacing is too wide, so
  129. .UL eqn
  130. replaces this by
  131. .P1
  132. >\eh'\-0.3m'>
  133. .P2
  134. to produce >\h'-.3m'>.
  135. .PP
  136. Frequently
  137. .BD \eh
  138. is used with the `width function'
  139. .BD \ew
  140. to generate motions equal to the width
  141. of some character string.
  142. The construction
  143. .P1
  144. \ew'thing'
  145. .P2
  146. is a number equal to the width of `thing' in machine units
  147. (1/432 inch).
  148. All
  149. .UL troff
  150. computations are ultimately done in these units.
  151. To move horizontally the width of an `x',
  152. we can say
  153. .P1
  154. \eh'\ew'x'u'
  155. .P2
  156. As we mentioned above,
  157. the default scale factor for
  158. all horizontal dimensions is
  159. .BD m ,
  160. ems, so here we must have the
  161. .BD u
  162. for machine units,
  163. or the motion produced will be far too large.
  164. .UL troff
  165. is quite happy with the nested quotes, by the way,
  166. so long as you don't leave any out.
  167. .PP
  168. As a live example of this kind of construction,
  169. all of the command names in the text, like
  170. .BD .sp ,
  171. were done by overstriking with a slight offset.
  172. The commands for
  173. .BD .sp
  174. are
  175. .P1
  176. ^sp\eh'\-\ew'.sp'u'\eh'1u'.sp
  177. .P2
  178. That is, put out `.sp', move left by the width of `.sp',
  179. move right 1 unit, and print
  180. `.sp' again.
  181. (Of course there is a way to avoid typing that much input
  182. for each command name, which we will discuss in Section 11.)
  183. .WS
  184. .PP
  185. There are also several special-purpose
  186. .UL troff
  187. commands for local motion.
  188. We have already seen
  189. .BD \e0 ,
  190. which is an unpaddable white space
  191. of the same width as a digit.
  192. `Unpaddable' means that it will never be widened
  193. or split across a line by line justification and filling.
  194. There is also
  195. .BD \e (blank),
  196. .tr ^^
  197. which is an unpaddable character the width of a space,
  198. .BD \e| ,
  199. which is half that width,
  200. .BD \e^ ,
  201. which is one quarter of the width of a space,
  202. and
  203. .BD \e& ,
  204. which has zero width.
  205. .tr ^.
  206. (This last one is useful, for example, in entering
  207. a text line which would otherwise begin with a `.'.)
  208. .PP
  209. The command
  210. .BD \eo ,
  211. used like
  212. .P1
  213. \eo'set of characters'
  214. .P2
  215. causes (up to 9)
  216. characters to be overstruck,
  217. centered on the widest.
  218. This is nice for accents, as in
  219. .P1 2
  220. syst\eo"e\e(ga"me t\eo"e\e(aa"l\eo"e\e(aa"phonique
  221. .P2
  222. which makes
  223. .P1
  224. syst\o"e\(ga"me t\o"e\(aa"l\o"e\(aa"phonique
  225. .P2
  226. The accents are
  227. .BD \e(ga
  228. and
  229. .BD \e(aa ,
  230. or
  231. .BD \e\` 
  232. and
  233. .BD \e\' ;
  234. remember that each is just one character to
  235. .UL troff .
  236. .PP
  237. You can make your own overstrikes with another special convention,
  238. .BD \ez ,
  239. the zero-motion command.
  240. .BD \ezx
  241. suppresses the normal horizontal motion
  242. after printing the single character
  243. .BD x ,
  244. so another character can be laid on top of it.
  245. Although sizes can be changed within
  246. .BD \eo ,
  247. it centers the characters on the widest,
  248. and
  249. there can be no horizontal or vertical motions,
  250. so
  251. .BD \ez
  252. may be the only way to get what you want:
  253. .P1
  254. .sp 2
  255. \s8\z\(sq\s14\z\(sq\s22\z\(sq\s36\(sq
  256. .P2
  257. is produced by
  258. .P1
  259. ^sp 2
  260. \es8\ez\e(sq\es14\ez\e(sq\es22\ez\e(sq\es36\e(sq
  261. .P2
  262. The
  263. .BD .sp
  264. is needed to leave room for the result.
  265. .PP
  266. As another example, an extra-heavy semicolon
  267. that looks like
  268. .P1
  269. \s+6\z,\v'-0.25m'.\v'0.25m'\s0  instead of  ;  or  \s+6;\s0
  270. .P2
  271. can be constructed with a big comma and a big period above it:
  272. .P1
  273. \es+6\ez,\ev'\(mi0.25m'.\ev'0.25m'\es0 
  274. .P2
  275. `0.25m' is an empirical constant.
  276. .PP
  277. A more ornate overstrike is given by the bracketing function
  278. .BD \eb ,
  279. which piles up characters vertically,
  280. centered on the current baseline.
  281. Thus we can get big brackets,
  282. constructing them with piled-up smaller pieces:
  283. .P1
  284. .sp
  285. .ne 3
  286. \b'\(lt\(lk\(lb' \b'\(lc\(lf' x \b'\(rc\(rf' \b'\(rt\(rk\(rb'
  287. .sp
  288. .P2
  289. by typing in only this:
  290. .P1 0
  291. \&^sp
  292. \eb\(fm\e(lt\e(lk\e(lb\(fm \eb\(fm\e(lc\e(lf\(fm x \eb\(fm\e(rc\e(rf\(fm \eb\(fm\e(rt\e(rk\e(rb\(fm
  293. .P2
  294. .PP
  295. .UL troff
  296. also provides a convenient facility for drawing horizontal and vertical
  297. lines of arbitrary length with arbitrary characters.
  298. .BD \el\(fm1i\(fm
  299. draws a line one inch long, like this:
  300. \l'1i'\|.
  301. The length can be followed by
  302. the character to use if the \(ru isn't appropriate;
  303. .BD \el\(fm0.5i.\(fm
  304. draws a half-inch line of dots: \l'.5i.'.
  305. The construction
  306. .BD \eL
  307. is entirely analogous,
  308. except that it draws a vertical line instead of horizontal.
  309.