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