document distributed with 4.2BSD
[unix-history] / usr / src / old / roff / USD.doc / troff.tutorial / tt03
CommitLineData
5ac647f8 1.\" @(#)tt03 5.1 (Berkeley) %G%
85108656
KD
2.\"
3.NH
4Fonts and Special Characters
5.PP
6.UL troff
7and the typesetter allow four different fonts at any one time.
8Normally three fonts (Times roman, italic and bold) and one collection of special characters
9are permanently
10mounted.
11.P1 2
12.ft R
13abcdefghijklmnopqrstuvwxyz 0123456789
14ABCDEFGHIJKLMNOPQRSTUVWXYZ
15.ft I
16abcdefghijklmnopqrstuvwxyz 0123456789
17ABCDEFGHIJKLMNOPQRSTUVWXYZ
18.ft B
19abcdefghijklmnopqrstuvwxyz 0123456789
20ABCDEFGHIJKLMNOPQRSTUVWXYZ
21.ft R
22.P2
23The
24greek, mathematical symbols and miscellany
25of the special font are
26listed in Appendix A.
27.PP
28.UL troff
29prints in roman unless told otherwise.
30To switch into bold, use
31the
32.BD .ft
33command
34.P1
35^ft B
36.P2
37and for italics,
38.P1
39^ft I
40.P2
41To return to roman, use
42.BD .ft\ R ;
43to return to the previous font,
44whatever it was,
45use either
46.BD .ft\ P
47or just
48.BD .ft .
49The `underline' command
50.P1
51^ul
52.P2
53causes the next input line to print in italics.
54.BD .ul
55can be followed by a count to
56indicate that more than one line is to be italicized.
57.PP
58Fonts can also be changed within a line or word
59with the in-line command
60.BD \ef :
61.P1
62\fBbold\fIface\fR text
63.P2
64is produced by
65.P1
66\efBbold\efIface\efR text
67.P2
68If you want to do this so the previous font, whatever it was,
69is left undisturbed, insert extra
70.BD \efP
71commands, like this:
72.P1
73\efBbold\efP\efIface\efP\efR text\efP
74.P2
75Because only the immediately previous font is remembered,
76you have to restore the previous font after each change
77or you can lose it.
78The same is true of
79.BD .ps
80and
81.BD .vs
82when used without an argument.
83.PP
84There are other fonts available besides the standard set,
85although you can still use only four at any given time.
86The command
87.BD .fp
88tells
89.UL troff
90what fonts are physically mounted on the typesetter:
91.P1
92^fp 3 H
93.P2
94says that the Helvetica font is mounted on position 3.
95(For a complete list of fonts and what they look like,
96see the
97.UL troff
98manual.)
99Appropriate
100.BD .fp
101commands should appear at the beginning of your document
102if you do not use the standard fonts.
103.PP
104It is possible to make a document relatively independent
105of the actual fonts used to print it
106by using font numbers instead of names;
107for example,
108.BD \ef3
109and
110.BD .ft~3
111mean `whatever font is mounted at position 3',
112and thus work for any setting.
113Normal settings are roman font on 1, italic on 2,
114bold on 3,
115and special on 4.
116.PP
117There is also a way to get `synthetic' bold fonts
118by overstriking letters with a slight offset.
119Look at the
120.BD .bd
121command in [1].
122.WS
123.PP
124Special characters have four-character names beginning with
125.BD \e( ,
126and they may be inserted anywhere.
127For example,
128.P1
129\(14 + \(12 = \(34
130.P2
131is produced by
132.P1
133\e(14 + \e(12 = \e(34
134.P2
135In particular,
136greek letters are all of the form
137.BD \e(*\- ,
138where
139.BD \-
140is an upper or lower case roman letter
141reminiscent of the greek.
142Thus
143to get
144.P1
145\(*S(\(*a\(mu\(*b) \(-> \(if
146.P2
147in bare
148.UL troff
149we have to type
150.P1
151\e(*S(\e(*a\e(mu\e(*b) \e(\(mi> \e(if
152.P2
153That line is unscrambled as follows:
154.P1
155.ta 1i 2i 3i
156\e(*S \(*S
157( (
158\e(*a \(*a
159\e(mu \(mu
160\e(*b \(*b
161) )
162\e(\(mi> \(->
163\e(if \(if
164.P2
165A complete list of these special names occurs in Appendix A.
166.PP
167In
168.UL eqn
169[2]
170the same effect can be achieved with the input
171.P1
172SIGMA ( alpha times beta ) \-> inf
173.P2
174which is less concise, but clearer to the uninitiated.
175.PP
176Notice that
177each
178four-character name is a single character
179as far as
180.UL troff
181is concerned _
182the
183`translate' command
184.P1
185^tr \e(mi\e(em
186.P2
187is perfectly clear, meaning
188.P1
189^tr \(mi\(em
190.P2
191that is, to translate \(mi into \(em.
192.PP
193Some characters are automatically translated into others:
194grave \(ga and acute \(aa accents (apostrophes) become open and close single quotes
195`~';
196the combination of ``...'' is generally preferable to the double quotes "...".
197Similarly a typed minus sign becomes a hyphen -.
198To print an explicit \- sign, use
199.BD \e- .
200To get a backslash printed, use
201.BD \ee .