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

  1. .NH
  2. Introduction
  3. .tr ^.
  4. .PP
  5. .UL troff
  6. [1]
  7. is a text-formatting program,
  8. written by J. F. Ossanna,
  9. for producing
  10. high-quality printed output from the phototypesetter
  11. on the
  12. .UC UNIX
  13. and
  14. .UC GCOS
  15. operating systems.
  16. This document is an example of
  17. .UL troff
  18. output.
  19. .PP
  20. The single most important rule
  21. of using
  22. .UL troff
  23. is
  24. not to use it directly, but through some intermediary.
  25. In many ways,
  26. .UL troff
  27. resembles an assembly language _
  28. a remarkably powerful and flexible one _
  29. but nonetheless such that many operations must be specified
  30. at a level of detail and in a form that is too hard 
  31. for most people to use effectively.
  32. .PP
  33. For two special applications, there are programs that provide
  34. an interface to
  35. .UL troff
  36. for the majority of users.
  37. .UL eqn 
  38. [2]
  39. provides an easy to learn language for typesetting mathematics;
  40. the 
  41. .UL eqn
  42. user
  43. need know no 
  44. .UL troff
  45. whatsoever
  46. to typeset mathematics.
  47. .UL tbl
  48. [3]
  49. provides the same convenience for producing tables of arbitrary
  50. complexity.
  51. .PP
  52. For producing straight text (which may well contain mathematics or tables), there are a number of `macro packages'
  53. that define formatting rules and operations for specific styles
  54. of documents,
  55. and reduce the amount of
  56. direct contact with 
  57. .UL troff .
  58. In particular, the `\-ms'
  59. [4]
  60. and PWB/MM [5]
  61. packages
  62. for Bell Labs internal memoranda and external papers
  63. provide most of the facilities needed
  64. for a wide range of document preparation.
  65. (This memo was prepared with `\-ms'.)
  66. There are also packages for viewgraphs,
  67. for simulating the older
  68. .UL roff
  69. formatters on
  70. .UC UNIX
  71. and
  72. .UC GCOS ,
  73. and for other special applications.
  74. Typically you will find these packages easier to use
  75. than
  76. .UL troff
  77. once you get beyond the most trivial operations;
  78. you should always consider them first.
  79. .PP
  80. In the few cases where existing packages don't do the whole job,
  81. the solution is
  82. .ul
  83. not
  84. to write an entirely new set of
  85. .UL troff
  86. instructions from scratch, but to make small changes
  87. to adapt packages that already exist.
  88. .WS
  89. .PP
  90. In accordance with this philosophy of letting someone else
  91. do the work,
  92. the part of
  93. .UL troff
  94. described here is only a small part of the whole,
  95. although it tries to concentrate on the more useful parts.
  96. In any case, there is no attempt to be complete.
  97. Rather, the emphasis is on showing how to do simple things,
  98. and how to make incremental changes to what already exists.
  99. The contents of the remaining sections are:
  100. .sp
  101. .nf
  102. .in .1i
  103. .ta .3i
  104. \02.    Point sizes and line spacing
  105. \03.    Fonts and special characters
  106. \04.    Indents and line length
  107. \05.    Tabs
  108. \06.    Local motions: Drawing lines and characters
  109. \07.    Strings
  110. \08.    Introduction to macros
  111. \09.    Titles, pages and numbering
  112. 10.    Number registers and arithmetic
  113. 11.    Macros with arguments
  114. 12.    Conditionals
  115. 13.    Environments
  116. 14.    Diversions
  117.     Appendix: Typesetter character set
  118. .sp
  119. .in 0
  120. .fi
  121. The
  122. .UL troff
  123. described here is the C-language version running on
  124. .UC UNIX
  125. at
  126. Murray Hill,
  127. as documented in [1].
  128. .WS
  129. .PP
  130. To use
  131. .UL troff
  132. you have to prepare not only the actual text you want printed,
  133. but some information that tells
  134. .ul
  135. how
  136. you want it printed.
  137. (Readers who use
  138. .UL roff
  139. will find the approach familiar.)
  140. For
  141. .UL troff
  142. the text
  143. and
  144. the formatting information are often intertwined quite intimately.
  145. Most commands to
  146. .UL troff
  147. are placed on a line separate from the text itself,
  148. beginning with a period (one command per line).
  149. For example,
  150. .P1
  151. Some text.
  152. ^ps 14
  153. Some more text.
  154. .P2
  155. will change the `point size',
  156. that is,
  157. the size of the letters being printed,
  158. to `14 point' (one point is 1/72 inch) like this:
  159. .P1
  160. .fi
  161. Some text.
  162. .ps 14
  163. Some more text.
  164. .ps 10
  165. .P2
  166. .PP
  167. Occasionally, though,
  168. something special occurs in the middle of a line _
  169. to produce
  170. .P1
  171. Area = \(*p\fIr\fR\|\s8\u2\d\s0
  172. .P2
  173. you have to type
  174. .P1
  175. Area = \e(*p\efIr\efR\e\^|\^\es8\eu2\ed\es0
  176. .P2
  177. (which we will explain shortly).
  178. The backslash character
  179. .BD  \e 
  180. is used 
  181. to introduce
  182. .UL troff
  183. commands and special characters within a line of text.
  184.