home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / 1_1_contri / usd / 25_trofftu / tt06 < prev    next >
Encoding:
Text File  |  1986-05-23  |  6.7 KB  |  311 lines

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