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