Escolar Documentos
Profissional Documentos
Cultura Documentos
tion to TEX
Mi
hael Doob
Department of Mathemati
s
The University of Manitoba
Winnipeg, Manitoba, Canada R3T 2N2
MDOOBUOFMCC.BITNET
MDOOBCCU.UMANITOBA.CA
Introdu tion
First the bad news: TEX is a large and
ompli
ated program that goes to extraordinary
lengths to produ
e attra
tive typeset material. This very
ompli
ation
an
ause unexpe
ted
things to happen at times. Now the good news: straightforward text is very easy to typeset
using TEX. So it's possible to start with easier text and work up to more
ompli
ated
situations.
The purpose of this manual is to start from the very beginning and to move towards
these more
ompli
ated situations. No previous knowledge of TEX is assumed. By pro
eeding a se
tion at a time, greater varieties of text
an be produ
ed.
Here are a few suggestions: there are some exer
ises in ea
h se
tion. Be sure and do
them! The only way to learn TEX is by using it. Better yet, experiment on your own;
try to make some variations on the exer
ises. There is no way that you
an damage the
TEX program with your experiments. You
an nd a
omplete answer to most exer
ises by
looking at the TEX sour
e le that was used to produ
e this do
ument. You'll noti
e that
there are referen
es in the right margin to The TEXbook1 . When you feel that you want
more information on a topi
, that's where to look.
In
identally, there are a few bs that appear in this manual; they are used to hide
ompli
ations (I look at this as something like poeti
li
ense). As you be
ome more experien
ed
at using TEX, you'll be able to nd them.
TEX is a publi
domain program that is available for no li
ense fee. It was developed
by Donald Knuth at Stanford University as a major proje
t. In the prot-oriented market
pla
e, the program would
ertainly
ost many thousands of dollars. The TEX Users Group
(TUG) is a nonprot organization whi
h distributes
opies of TEX, this manual, updates
software, and gives information about new developments in both hardware and software in
its publi
ations TUGboat and TEXniques. Joining this users group is inexpensive; please
onsider doing so. The address is:
TEX Users Group
P.O. Box 869
Santa Barbara, CA 93102
U.S.A.
1 Addison-Wesley, Reading,Massa
husetts, 1984, ISBN 0-201-13488-9
Introdu tion
This manual would not have
ome into being without the aid of others. In parti
ular the proofreading and suggestions of the following people have been invaluable: Waleed
A. Al-Salam (University of Alberta), Debbie L. Alspaugh (University of California), Nelson H. F. Beebe (University of Utah), Barbara Beeton (Ameri
an Mathemati
al So
iety),
Anne Bruggemann-Klein (University of Freiburg), Bart Childs (Texas A. & M. University),
Mary Coventry (University of Washington), Dimitrios Diamantaras (Temple University),
Roberto Dominimanni (Naval Underwater Systems Center), Lin
oln Durst (Providen
e,
RI), Vi
tor Eijkhout (University of Nijmegen), Moshe Feder (St. Lawren
e University),
Josep M. Font (Universidad Bar
elona), Jonas de Miranda Gomes (Instituto de Matemati
a
Pura e Apli
ada - Brazil), Rob Gross (Boston College), Klaus Hahn (University of Marburg), Anita Hoover (University of Delaware), Jurgen Koslowski (Ma
alester College), Kees
van der Laan (Rijksuniversiteit Groningen), John Lee (Northrop Corporation), Silvio Levy
(Prin
eton University), Robert Messer (Albion College), Emily H. Moore (Grinnell College),
Young Park (University of Maryland), Craig Platt (University of Manitoba), Kauko Saarinen (University of Jyvaskyla), Jim Wright (Iowa State University), and Dominik Wujastyk
(Well
ome Institute for the History of Medi
ine).
In addition several people have sent me parts or all of their lo
al manuals. I have
re
eived a few others on the rebound. In parti
ular Elizabeth Barnhart (TV Guide),
Stephan v. Be
htolsheim (Purdue University), Nelson H. F. Beebe (University of Utah)
and Leslie Lamport (Digital Equipment Corporation), Marie M
Partland-Conn and Laurie Mann (Stratus Computer), Robert Messer (Albion College), Noel Peterson (Library of
Congress), Craig Platt (University of Manitoba), Alan Spragens (Stanford Linear A
elerator Center, now of Apple Computers), Christina Thiele (Carleton University), and Daniel
M. Zirin (California Institute of Te
hnology) have written various types of le
ture notes that
have been most helpful.
ii
Contents
Introdu
tion : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : i
Contents : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : iii
1. Getting Started : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1
1.1 What TEX is and what TEX isn't : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1
1.2 From TEX le to readable output, the big set up : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2
1.3 Let's do it! : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4
1.4 TEX has everything under
ontrol : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 7
1.5 What TEX won't do : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 8
2. All
hara
ters great and small : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 9
2.1 Some
hara
ters are more spe
ial than others : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 9
2.2 Typesetting with an a
ent : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 10
2.3 Dots, dashes, quotes, : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 13
2.4 Dierent fonts : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 15
3. The shape of things to
ome : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 19
3.1 Units, units, units : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 19
3.2 Page shape : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 20
3.3 Paragraph shape : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 22
3.4 Line shape : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 26
3.5 Footnotes : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 27
3.6 Headlines and footlines : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 28
3.7
Overfull and underfull boxes : : : : : : o
: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 29
n
4. Groups, Groups, fand More Groupsg : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 31
5. No math anxiety here! : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 33
5.1 Lots of new symbols : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 33
5.2 Fra
tions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 37
5.3 Subs
ripts and supers
ripts : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 38
5.4 Roots, square and otherwise : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 39
5.5 Lines, above and below : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 39
5.6 Delimiters large and small : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 40
5.7 Those spe
ial fun
tions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 41
5.8 Hear ye, hear ye! : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 42
5.9 Matri
es : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 43
5.10 Displayed equations : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 45
6. All in a row : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 48
6.1 Pi
king up the tab : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 48
6.2 Horizontal alignment with more sophisti
ated patterns : : : : : : : : : : : : : : : : : : : : : : : 51
7. Rolling your own : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 55
iii
Contents
iv
55
57
60
62
62
62
64
64
65
68
68
69
70
72
77
80
Se
tion 1
Getting Started
TEX
input
le
DVI
le
TEX program
devi e driver
readable
output
This means that we don't see our output in its nal form when it is being typed at
the terminal. But in this
ase a little patien
e is amply rewarded, for a large number of
symbols not available in most word pro
essing programs be
ome available. In addition, the
typesetting is done with more pre
ision, and the input les are easily sent between dierent
omputers by ele
troni
mail or on a magneti
medium.
Our fo
us will be on the rst step, that is,
reating the TEX input le and then running
the TEX program to produ
e appropriate results. There are two ways of running the TEX
program; it
an be run in bat
h mode or intera
tively. In bat
h mode you submit your
TEX input le to your
omputer; it then runs the TEX program without further intervention
and gives you the result when it is nished. In intera
tive mode the program
an stop and
get further input from the user, that is, the user
an intera
t with the program. Using
1
TEXbook: 23
TEX intera
tively allows some errors to be
orre
ted by the user, while the TEX program
makes the
orre
tions in bat
h mode as best it
an. Intera
tive is the preferred mode, of
ourse. All personal
omputer and many mainframe implementations are intera
tive. On
some mainframes, however, the only pra
ti
al method of running TEX is in bat
h mode.
The name <userid> is repla
ed by your own user id, of
ourse. The use of upper
ase
and the spa
es must be followed exa
tly.
(3) Create a le
alled PRINTTEX in your MANTES aggregate
ontaining the following
JCL:
// JOB ,'PRINT TEX'
// EXEC TEXP
//DVIFILE DD DSN=<userid>.DVI,DISP=SHR
On
e you have
ompleted these three steps, you are ready to run a TEX job. The les
you have
reated will allow you to produ
e about ten pages of ordinary text.
Here are the steps you use ea
h time you run a job.
(1)
reate a MANTES le
ontaining your TEX input.
(2) save and submit your le using the
ommands
C: save f/l to da=sour
e.tex noseq
C: submit runtex
(3) when you get a message saying that your job is nished, enter the
ommand
C: out <jobname>; list ttyout
In this
ommand, <jobname> is repla
ed by your user id with a dollar sign appended.
This le listing will tell you of any errors that might have o
urred. It is an abbreviated
version of what is
alled the \log le"; we will use the term \log le" to refer to the ttyout
le produ
ed by TEX.
If you want, you
an
he
k on the status of your job while it is exe
uting by using the
ommand
C: q <jobname>
When you are nished looking at the log le, the
ommand end s
rat
h will throw
away the log le while the
ommand end release will send the log le to the printer, and
it
an then be pi
ked up with your TEX output.
(4) when your output from RUNTEX program is error free, TEX will have
reated a legal
DVI le. To print it, use the
ommand
C: submit printtex nohold
As in (3), you
an
he
k on the status of your job while it is exe
uting.
(5) Pi
k up your output at the I/O window, sixth
oor Engineering building. It usually
takes about twenty minutes for the output to be ready. Ask for it by \<jobname>".
The les
reated are large enough for running TEX jobs of about 10 pages. A job of
that size will take about one se
ond of CPU time to run through TEX. It will take about 15
se
onds of CPU time to print 10 pages on the Xerox 8600 using the
urrent devi
e driver.
You
an print your own
opy of this manual using the
ommand %do
u tex. You
an
also nd lots of other useful online information about TEX by using %texinfo.
First note that the
hara
ters in this example look like typewriter type. We use these
hara
ters with all examples that are meant to be typed from the
omputer terminal. Se
ond, note that the ba
kslash appears three times in the text. We'll soon see that this is one
of the spe
ial symbols mentioned previously, and it is used very frequently when making
TEX do
uments. Make a le
ontaining this example. Use the TEX program to make a DVI
le and a devi
e driver to see what you have produ
ed. If all goes well, you'll have a single
page with the following single senten
e:
Here is my rst TEX senten
e.
4
There will also be a page number at the bottom of the page. If you've gotten this far,
ongratulations! On
e you
an produ
e one TEX do
ument, it's just a matter of time before
you
an do more
ompli
ated ones. Now let's
ompare what we typed in with what we got
out. The straightforward words were just typed in normally, and TEX set them in ordinary
type. But the word \TEX", whi
h
an't be typed in on a terminal be
ause the letters aren't
on the same line, is entered by using a word starting with a ba
kslash, and TEX made the
proper interpretation. Most symbols that are not ordinary letters, numbers, or pun
tuation
are typeset by entering a word starting with a ba
kslash. If we look a little
loser, we'll note
that the word \rst" is also
hanged. The rst two letters have been joined together and
there isn't a separate dot over the letter \i". This is standard typesetting pra
ti
e:
ertain
letter
ombinations are joined up to form what are
alled ligatures. There is a
tually a
good stheti
reason for this. Compare the rst two letters of \rst" and \first" to see the
dieren
e. We note that \bye appears in the input le with no
orresponding word in the
nal
opy. This a typesetting instru
tion that tells TEX that the input is nished. We'll
learn about lots of dierent typesetting instru
tions as we go along.
Let's look at the log le that was
reated when we ran TEX. It may vary slightly at
your site, but should look something like this:
1.
2.
3.
4.
5.
6.
7.
8.
This is the le that will
ontain any error messages. On line 6, (sr
.tex indi
ated
that TEX has started reading that le. The appearan
e of [1 indi
ates that page 1 has
been pro
essed. If there were errors on page 1, they would be listed at that point.
. Exer
ise 1.1 Add a se
ond senten
e to your original TEX le to get:
Here is my first \TeX\ senten
e.
I was the one who typeset it!
\bye
Use TEX and look at your output. Is the se
ond senten
e on a new line?
5
TEXbook: 4
. Exer
ise 1.2 Now add this line to the beginning of your le:
\nopagenumbers
Guess what will happen when you run the new le through TEX. Now try it and see what
happens.
. Exer
ise 1.3 Add three or four more senten
es to your le. Use letters, numbers, periods,
ommas, question marks, and ex
lamation points, but don't use any other symbols.
. Exer
ise 1.4 Leave a blank line and add some more senten
es. You
an now get new
paragraphs.
We have now seen a major prin
iple
on
erning the preparation of TEX input les. The
pla
ement of the text on your
omputer terminal does not ne
essarily
orrespond to the
pla
ement of the text on your output. You
an not, for example, add spa
e between words
in your output by adding spa
es in your input le. Several
onse
utive spa
es and one spa
e
will produ
e exa
tly the same output. As would be expe
ted, a word at the end of one line
will be separated from the rst word of the following line. In fa
t, sometimes when working
on a le that will be heavily edited, it is
onvenient to start ea
h senten
e on a separate
line. Spa
es at the beginning of a line, however, are always ignored.
. Exer
ise 1.5 Add the following senten
e as a new paragraph, and then typeset it:
Congratulations! You re
eived a grade of 100% on your latest
examination.
The % sign is used for
omments in your input le. Everything on a line following this
symbol is ignored. Noti
e that even the spa
e that normally separates the last word on one
line from the rst word on the next line is lost. Now put a ba
kslash in front of the % sign
to
orre
t the senten
e.
This will produ
e an error in your log le (if your implementation of TEX is intera
tive, that
is, sends you messages and waits for answers, just hit the
arriage return or enter key when
you get the error message). You will get output, but not what you might expe
t. Look
at the log le and see where the error messages are listed. Don't worry about the a
tual
messages. We'll have a lot more to say about errors (in
luding this one) later. Now x the
error by putting a ba
kslash in front of the $ sign, and typeset the result (there are a small
number of
hara
ters like the per
ent and dollar signs that TEX uses for its own purposes.
A table of these
hara
ters will be provided shortly).
the
ontrol word \TeX is terminated by the ex
lamation point. But this presents a problem
if you want to have a spa
e after a
ontrol word. If you have, for example, the senten
e
I like \TeX and use it all the time.
in your input le, the
ontrol word \TeX is terminated by the spa
e (whi
h is, of
ourse,
a nonletter). But then you won't have a spa
e between the words \TEX" and \and";
inserting more spa
es won't help, sin
e TEX doesn't distinguish between one spa
e and
several
onse
utive spa
es. But if you put the
ontrol symbol \ after a
ontrol word, you
will both terminate the
ontrol word and insert a spa
e. It's really easy to forget to put in
7
TEXbook: 7{8
something like \ after a
ontrol word. I promise you that you will do it at least on
e while
you're learning to use TEX.
. Exer
ise 1.7 Make an input le that will produ
e the following paragraph:
I like TEX! On
e you get the hang of it, TEX is really easy to use. You just have to
master the TEXni
al aspe
ts.
Most
ontrol words are named so as to give a hint of their uses. You
an use \par to
make a new paragraph, for example, instead of putting in a blank line.
Se
tion 2
All
hara
ters great and small
2.1 Some
hara
ters are more spe
ial than others
We saw in the last se
tion that most text is entered at the terminal as senten
es of
ordinary words just as when typing with a typewriter. But we also saw that, in parti
ular,
the ba
kslash
ould be used for at least two dierent purposes. It
an be used for symbols
(or
ombinations of symbols) that don't appear on the keyboard su
h as typing \TeX to get
TEX. It
an also be used to give TEX spe
ial instru
tions su
h as typing \bye to indi
ate
the end of the input le. In general, a word starting with a ba
kslash will be interpreted by
TEX as one requiring spe
ial attention. There are several hundred words that TEX knows,
and you
an dene more yourself, and so the ba
kslash is very important. We'll spend a
lot of time as we pro
eed learning some of these words; fortunately we'll only need to use a
small number of them most of the time.
There are ten
hara
ters whi
h, like the ba
kslash, are used by TEX for spe
ial purposes,
and we now want to give the
omplete list. What if we want to use a senten
e with one of
these spe
ial
hara
ters in it? With this in mind we'll ask the following questions:
(1) What are the dierent spe
ial
hara
ters?
(2) How do we use a spe
ial
hara
ter if we really want to typeset it in our text?
Here is a table of ea
h spe
ial
hara
ter, its purpose, and the method of typesetting
the spe
ial
hara
ter itself if you need it:
TEXbook: 37{38
n
f
g
%
&
~
$
^
#
Purpose
10
TEX input
TEX output
a la mode
resume
soup
on
Noel
nave
\`a la mode
r\'esum\'e
soup\
on
No\"el
na\"\i ve
We see several prin
iples illustrated by these examples. Most a
ents are produ
ed by
using a
ontrol symbol with a similar shape. A few of them are produ
ed by
ontrol words
ontaining a single letter. Some
are must be used in this
ase, for a spa
e must be used to
terminate the
ontrol word. If you have soup\
on in your le, for example, TEX will look
for the
ontrol word \
on3.
Noti
e that there is a
ontrol word \i also. This produ
es the letter \i" without the
dot over it; this allows an a
ent to be put over the lower part of the letter. There is an
analogous
ontrol word \j that produ
es a dotless \j" for a
enting purposes.
grave
a
ute
ir
um
ex
umlaut/dieresis/tremat
tilde
ma
ron
dot
TEX input
\`o
\'o
\^o
\"o
\~o
\=o
\.o
TEX output
o
o
^o
o
~o
o
o_
3 We'll see that there is another method when we look at the grouping on ept in Se tion 4.
11
TEXbook: 52{53
edilla
underdot
underbar
ha
ek
breve
tie
Hungarian umlaut
TEX input
\
o
\d o
\b o
\v o
\u o
\t oo
\H o
TEX output
o
o.
o
o
o
oo
}o
TEX also allows some letters from languages other than English to be typeset.
gean, stheti
s
uvres, hors d'uvre
Angstrom
re, Kbenhavn
Lodz, lodka
Nu
>Si?
<Si!
Se~nor
TEX input
\AE, \ae
\OE \oe
\AA, \aa
\O, \o
\L, \l
\ss
?`
!`
\~
{\it\$}
TEX output
,
,
A, a
,
L, l
>
<
~
13
TEXbook: 3{5
hyphen
en-dash
em-dash
minus sign
TEX input
---$-$
TEX output
{
|
Example
. Exer
ise 2.12 I entered the room and|horrors|I saw both my father-in-law and my
mother-in-law.
. Exer
ise 2.13 The winter of 1484{1485 was one of dis
ontent.
Another dieren
e between typing and using TEX is the use of quotation marks. Opening and
losing quotation marks are the same on a typewriter. They are produ
ed in TEX
by using the apostrophe or prime key ' and ba
kprime key `. An open quote is produ
ed
by `` and the
lose quote by ''. Similarly the opening single quote is produ
ed by ` and
the
losing single quote by '. Noti
e that there is no need to use the usual typing quotation
mark (it normally gives a
lose quote, but don't
ount on it).
TEXbook: 3
. Exer
ise 2.16 He thought, \: : : and this goes on forever, perhaps to the last re
orded
syllable."
Another problem with dots is that the period after an abbreviation normally has less
spa
e after it than does the period at the end of a senten
e. There are two ways to solve
14
TEXbook: 173
this problem: the dot
an be followed by either \ or ~ to
hange the spa
ing. The se
ond
alternative will give an unbreakable spa
e; when su
h a spa
e is between two words, these
words must typeset on the same line. The input Prof.~Knuth would
ause those two words
to be typeset on one line. This is desirable for names like Van
ouver, B. C. and Mr. Jones
so that \Mr." and \Jones" do not end up on separate lines. Noti
e that no ba
kslash is
used with the unbreakable spa
e.
TEXbook: 91{92
Noti
e that the
omma and this footnote are in itali
type, and this looks a little funny.
We'll see that there is another method for
hanging fonts when we talk about grouping in
Se
tion 4.
15
TEXbook: 427{432
Font Samples
Font name
Roman
Boldfa
e
Itali
Slanted
Typewriter
Math symbol5
Sample of typefa
e
This is roman type.
The slanted and itali
fonts seem quite similar at rst. It is easy to see the dieren
e
between the letter \a" in ea
h sample. When
hanging from a slanted or itali
font to a
roman font, the last letter in the rst font will lean towards the rst letter of the roman
font; this looks
ramped, and to
ompensate there is a little extra spa
e that
an be added
alled the itali
orre
tion. This is done using the
ontrol symbol \/. In the following
senten
e, there is no itali
orre
tion after the rst sequen
e of itali
letters but there is
after the se
ond sequen
e; see the dieren
e: If the itali
orre
tion is not used the letters
are too
lose together, but if the
orre
tion is used, the spa
ing is better. There is no need
for the itali
orre
tion when the itali
hara
ters are followed by a
omma or a period, but
your text will denitely look better if you use it before quotation marks or parentheses.
It is possible to use fonts other than those initially dened in TEX when desired (assuming that they are available on your
omputer system, of
ourse). Dierent sizes
an be used
with the aid of the
ontrol word \magstep. To dene your new font you will have to know
its name on your
omputer system. For example, the roman typefa
e is
alled \
mr10" on
most systems. If you use \font\bigrm =
mr10 s
aled \magstep 1, you
an then use
\bigrm in exa
tly the same way as you use \it or \rm.
Swit
hing via \bigrm will give roman type that is larger than the usual by 20%.
\font\bigbigrm =
mr10 s
aled \magstep 2 will dene a font that is about 44% larger
than the usual roman typefa
e. The sizes \magstep 0 to \magstep 5 are available. On
most
omputers \magstephalf is also available; this represents an enlargement of about
9.5%. Here are some samples at various sizes:
5 This example is
heating sin
e you need to know a little about mathemati
s input to
use it, but I wanted to in
lude it anyway. You'll be able to use these letters after you study
the use of mathemati
al symbols.
16
TEXbook: 13{17
Sample
\magstep 0
\magstephalf
\magstep 1
\magstep 2
\magstep 3
\magstep 4
\magstep 5
It's also possible to use
ompletely new typefa
es. These are dependent on system availability, of
ourse. Many systems have a le
alled CMSS10 whi
h is a font that
ontains sans
serif letters. Using \font\sf =
mss10 will allow the
ontrol word \sf to be used in the
same manner as \bf. Having made this denition, the input
\sf Here is a sample of our new Sans Serif font.
will produ
e
Here is a sample of our new Sans Serif font.
. Exer
ise 2.19 What problem might have arisen if we had used \ss instead of \sf to turn
on the Sans Serif font? Hint: if the answer doesn't o
ur to you at rst, think about the
German alphabet and it will nally
ome to you.
. Exer
ise 2.20 Typeset a paragraph of magnied sans serif text.
The extra fonts available may vary from site to site. The ones in the following table
are available at most pla
es.
17
CMBXSL10
CMBX7
CMEX10
CMMI10
CMMI9
CMR7
CMSL8
CMSSI17
CMSS12
CMSY6
CMTEX8
CMTI9
CMVTT10
CMBXTI10
CMBX8
CMFF10
CMMI12
CMR10
CMR8
CMSL9
CMSSI8
CMSS17
CMSY7
CMTEX9
CMTT10
CMBX10
CMBX9
CMFIB8
CMMI5
CMR12
CMR9
CMSSBX10
CMSSI9
CMSS8
CMSY8
CMTI10
CMTT12
CMBX12
CMB10
CMFI10
CMMI6
CMR17
CMSLTT10
CMSSDC10
CMSSQI8
CMSS9
CMSY9
CMTI12
CMTT8
CMBX5
CMCSC10
CMITT10
CMMI7
CMR5
CMSL10
CMSSI10
CMSSQ8
CMSY10
CMTCSC10
CMTI7
CMTT9
Here's a little ba
kground about these names. The rst two letters CM stands for Computer
Modern, the name given to this font family by the designer. The number at the end is the
point size: 10 point type is the normal size, 7 point is the normal size for subs
ripts, and 5
point is the normal size for subs
ripts of subs
ripts, 12 point is 20% larger than 10 point,
et
. If the letters CM are followed by B, it is a boldfa
e type. Similarly R indi
ates roman, I
is for itali
s, CSC is for small
aps, SL is for slanted, SS is for sans serif, SY is for symbols,
and TT is for typewriter type.
. Exer
ise 2.21 Find the fonts available on your system, and print out all the letters and
numbers in several of them.
. Exer
ise 2.22 The font CMR12 is 20% larger than CMR10. Also \magstep 1 magnies
the type by 20%. Take some text and print it using CMR12 then using CMR10 s
aled by
\magstep 1. The results are quite dierent!
18
Se
tion 3
The shape of things to
ome
In this se
tion we want to see how to make text have dierent shapes or sizes. One
may use TEX with the default sizes, of
ourse, just as we have been doing so far. We'll now
be
ome more
reative with our output. In dis
ussing the size of various parts of a page of
text, there are several units of measure we
an use.
TEXbook: 57
1 in
h:
1
entimetre:
20 points:
1 pi
a:
Thus points are used to make ne
hanges; a pi
a is about the distan
e between the
baselines of two
onse
utive lines of (unmagnied) normal text. TEX is quite exa
t about
dimensions; internally its smallest unit is less than one four-millionth of an in
h. Hen
e it
is the resolution of the output devi
e that will determine the a
ura
y of the output.
There are two other units that are sometimes useful that have dierent sizes in dierent
fonts. The ex is about the height of a small \x" and the em is a little smaller than the width
of a
apital \M".
The shape of the output is generally determined by
ontrol words. There are many
su
h words; these allow very ne
ontrol of the resulting text. But most of the time only a
small number of them are ne
essary.
19
TEXbook: 60
The
urrent horizontal width of the text on the page is des
ribed by the
ontrol word \hsize. It
an be
hanged, say to
4 in
hes, by \hsize = 4 in at any desired time using methods
to be des
ribed in the next few se
tions. The value of \hsize in
ee
t when the paragraph is
ompleted determines the width of
the paragraph. As
an be seen in this paragraph, the text width
an be
hanged (in this
ase to 4 in
hes) for a single paragraph.
Be
ause it represents the
urrent value of the horizontal width,
expressions su
h as \hsize = 0.75\hsize
an make a new value
that is relative to the old one.
The verti
al analogue of \hsize is \vsize, whi
h is the
urrent height of the main text.
It
an be reset, just like \hsize. Thus, \vsize = 8 in
an be used to
hange the verti
al
height of the main text. Note that \vsize is the size of the text ex
lusive of any headline
or footline material.
Text
an also be shifted a
ross the page. The upper left
orner of the text is one in
h
down and one in
h in from the upper left
orner of the page. The
ontrol words \hoffset
and \voffset are used to shift the text horizontally and verti
ally. Thus \hoffset = .75
in and \voffset = -.5 in would shift the text an additional .75 in
hes to the right and
.5 in
hes up. Most of the time you'll need to set \hoffset, \voffset, and \vsize at the
beginning of your do
ument only.
20
TEXbook: 251
horizontal width
verti
al width
horizontal oset6
verti
al oset6
. Exer
ise 3.1 Enter a paragraph of text that is a few lines long. Take several
opies of
your paragraph and put \hsize = 5 in before one and \hsize = 10
m in front of a
se
ond one. Try a few other values for \hsize.
. Exer
ise 3.2 Put \hoffset = .5 in and \voffset = 1 in before the rst paragraph
of your previous exer
ise.
. Exer
ise 3.3 Take your previous exer
ise and put \vsize = 2 in before the rst paragraph.
In the previous se
tion we saw that it is possible to use fonts of larger size by using
the \magstep
ontrol word. It's also possible to magnify the entire do
ument at on
e.
If \magnifi
ation = \magstep 1 appears at the top of your do
ument, then all of your
output is magnied by 20%. The other values of \magstep
an be used, too. It should be
emphasized that \magnifi
ation
an only be used before even a single
hara
ter
is typeset. This magni
ation
reates a problem in units; if the do
ument is to be magnied
by 20% and \hsize = 5 in appears in the TEX input le, should the nal output have an
\hsize of 5 in
hes or should it be magnied by 20% to 6 in
hes? Unless told otherwise, all
the dimensions will be magnied so that, in this
ase, \hsize would be 6 in
hes in the nal
output. This means that all the dimensions will in
rease uniformly when \magnifi
ation
is used. But for some spe
ial situations it might not be desirable for this to happen; for
example, you might want to leave a spa
e of exa
tly 3 in
hes to insert a gure. In this
ase any unit
an be modied by true so that \hsize = 5 true in will always set the line
width to 5 in
hes, regardless of magni
ation.
6 The text is initially 1 in
h down and 1 in
h in from upper left
orner of the page.
21
TEXbook: 59{60
. Exer
ise 3.4 Put \magnifi
ation = \magstep 1 as the rst line in one of your input
les and see how the output
hanges.
:::
What is the width of the paragraph? The \hsize was
hanged at the start of the
paragraph and again at the end. Sin
e the paragraph was not
ompleted (by putting in a
blank line or \par) until after the se
ond
hange, the paragraph would be typeset with a
width of 6.5 in
hes. However, if a blank line were inserted before \hsize = 6.5 in, then
the paragraph would be typeset with a width of 5 in
hes. So, in general, when a paragraph
is set, the values of the parameters that are in ee
t when the paragraph is
ompleted are
the ones that are used.
Here is a table with some paragraph parameters:
width
indentation on rst line
distan
e between lines
distan
e between paragraphs
TEX default
6.5 in
hes
20 points
12 points
0 points
The
ontrol word \noindent may be used at the beginning of a paragraph to avoid the
automati
indentation on the rst line. This
ontrol word will only ae
t the paragraph
22
being set when it is invoked (of
ourse \parindent = 0 pt will
ause no indentation for all
paragraphs).
A more
exible way to
ontrol the width of a paragraph is to use \rightskip
and \leftskip. Setting \leftskip = 20 pt
auses the left margin of the paragraph to be moved in an extra twenty points. Negative values may be assigned
to \leftskip to move the left margin out. The
ontrol word \rightskip does
the same to the right side of the paragraph. The single
ontrol word \narrower is
the equivalent of setting both \leftskip and \rightskip equal to \parindent.
This is quite useful for long quotations, and this paragraph is an example of its
use. As with \hsize, the value of \leftskip and \rightskip in ee
t when the
paragraph is
ompleted is the one whi
h will apply to the whole paragraph.
TEXbook: 100
. Exer
ise 3.5 Make two paragraphs with the following spe
i
ations: the left margin of
both paragraphs is indented by 1.5 in
hes, the right margin of the rst paragraph is indented
by 0.75 in
hes, and the right margin of the se
ond paragraph is indented by 1.75 in
hes.
Lines
an be made with dierent lengths within one paragraph by using \hangindent
and \hangafter. The amount of the indentation is determined by value of \hangindent.
If \hangindent is positive, the indentation is made from the left, and if it is negative it is
made from the right. The lines on whi
h the indentation o
urs is
ontrolled by \hangafter.
If \hangafter is positive then it determines the number of lines at full width before the
indentation starts. Thus if \hangindent = 1.75 in and \hangafter = 6, then the rst
six lines will be at full width and the rest will be indented by
1.75 in
hes from the left. On the other hand if \hangindent =
-1.75 in and \hangafter = -6, then the rst six lines will be
indented by 1.75 in
hes from the right and the rest will be at
full width. TEX resets to the default values \hangindent = 0
pt and \hangafter = 1 after ea
h paragraph. These
ontrol
words are useful for paragraphs with \hanging indents" and
for
owing a paragraph around spa
e reserved for a gure.
The
ontrol word \hang at the beginning of the paragraph will
ause the rst line to be of full width (\hangafter=1) and the
rest of the paragraph to be indented by the
urrent value of
\parindent. But you do have to use \noindent if you want
the rst line to extend all the way to the left margin.
Here is the previous paragraph repeated with \hangafter = -6 and \hangindent =
-1.75 in.
23
TEXbook: 355
TEXbook: 102
Lines
an be made with dierent lengths within one paragraph by using \hangindent and \hangafter. The amount
of the indentation is determined by value of \hangindent. If
\hangindent is positive, the indentation is made from the left,
and if it is negative it is made from the right. The lines on
whi
h the indentation o
urs is
ontrolled by \hangafter. If
\hangafter is positive then it determines the number of lines at full width before the indentation starts. Thus if \hangindent = 1.75 in and \hangafter = 6, then the rst six
lines will be at full width and the rest will be indented by 1.75 in
hes from the left. On
the other hand if \hangindent = -1.75 in and \hangafter = -6, then the rst six lines
will be indented by 1.75 in
hes from the right and the rest will be at full width. TEX resets to the default values \hangindent = 0 pt and \hangafter = 1 after ea
h paragraph.
These
ontrol words are useful for paragraphs with \hanging indents" and for
owing a
paragraph around spa
e reserved for a gure. The
ontrol word \hang at the beginning of
the paragraph will
ause the rst line to be of full width (\hangafter=1) and the rest of
the paragraph to be indented by the
urrent value of \parindent. But you do have to use
\noindent if you want the rst line to extend all the way to the left margin.
TEXbook: 355
TEXbook: 102
The
ontrol word \parshape
an be used to make paragraphs with a greater variety of
shapes.
TEXbook: 101
Another useful
ontrol word for setting paragraphs is \item. It
an be used to make
various types of itemized lists, and is invoked using the pattern \item{: : :}. This
auses
the next paragraph to be formed with every line indented by \parindent and, in addition,
the rst line labeled on the left by whatever is between the bra
es. It is usually used with
\parskip = 0 pt, sin
e that
ontrol word determines the verti
al spa
e between the dierent items. The
ontrol word \itemitem is the same as \item ex
ept that the indentation is
twi
e as far, that is, twi
e the value of \parindent. Here is an example:
TEXbook: 102
will produ e
24
. Exer
ise 3.6 Make a paragraph several lines long and use it with the \item
ontrol word
to see the \hanging indent." Now take the same paragraph and use it with dierent values
of \parindent and \hsize.
Now let's see how to put spa
e between paragraphs. The
ontrol word \parskip is used
to determine how mu
h spa
e is normally left between paragraphs. So if you put \parskip
= 12 pt at the beginning of your TEX sour
e le, there will be 12 points between paragraphs
unless other instru
tions are given. The
ontrol word \vskip
an be used to insert extra
verti
al spa
e between paragraphs. If \vskip 1 in or \vskip 20 pt appears between two
paragraphs, then the extra spa
e is inserted.
There are a
ouple of pe
uliarities of \vskip that seem quite strange at rst. If you
have \vskip 3 in and the skip starts two in
hes from the bottom of the page, the rest of the
page is skipped, but the extra one in
h is not skipped at the top of the next page. In other
words, \vskip will not insert spa
e a
ross page boundaries. In fa
t, \vskip 1 in
will have no ee
t at all if it happens to appear at the top of a page! For many types of
verti
al spa
ing this is quite appropriate. The spa
e before a se
tion heading, for example,
should not
ontinue a
ross page boundaries.
A similar phenomenon o
urs at the beginning of your do
ument. If, for example, you
want a title page with the title about half way down the page, you
an not insert the spa
e
at the top of the page using \vskip.
But what if you really want some blank spa
e at the top of a page? You
ould start the
page with \ but this in ee
t typesets a one line paragraph
ontaining a blank. So while
nothing is typeset, the extra spa
e due to the values of \baselineskip and \parskip will
add extra spa
e. An easier method is to use \vglue instead of \vskip to get the desired
result. Thus \vglue 1 in will leave one in
h of blank spa
e at the top of the page.
We
an note in passing that there is another more general method to put material at
the top of a page using the
ontrol words \topinsert and \endinsert. If \topinsert : : :
\endinsert is used within a page, the material between \topinsert and \endinsert will
appear at the top of the page, if possible. For example:
25
TEXbook: 352
\topinsert
\vskip 1 in
\
enterline{Figure 1}
\endinsert
TEXbook: 115
\smallskip:
\bigskip:
just
seem
be
spread
out
all
over
Other types of spa
ing
an be obtained by using the
ontrol word \hfil. This
auses
all the extra spa
e in the line to be a
umulated at the position where \hfil appears. Thus
if we alter our last example to \line{I just seem to be spread out \hfil all over
the pla
e.} we will get
26
If we have more than one \hfil, they will divide any extra spa
e among themselves
equally. Hen
e \line{left text \hfil
entre text \hfil right text.} will produ
e
left text
entre text
right text.
right guard
right ta kle
right end
. Exer
ise 3.8 Typeset the following line with twi
e as mu
h spa
e between \left" and
\right-
entre" as between \right-
entre" and \right":
left
right-
entre
right
It's possible to move horizontally using \hskip in a manner analogous with \vskip.
The right justi ation an be an eled by using the ontrol word \raggedright.
3.5 Footnotes
The general pattern to make footnotes using TEX is \footnote{: : :}{: : :}.
The footnote mark goes in between the rst set of bra
es. Some available marks are
\dag (y), \ddag (z), \S (x), and \P ({). The text of the footnote goes between the
se
ond set of bra
es. The use of numbers as marks is a little less straightforward. The
footnote21 at the bottom of the page was produ
ed by using \footnote{${}^{21}$}{This
is the footnote at the bottom of the page.} after the word \footnote" in the text.
This
onstru
tion is somewhat
ompli
ated; we'll see why it's this way when we know a
little more about typesetting mathemati
s. But for the moment we
an look at it as a way
of getting the job done. You may want to use \rm within the footnote to ensure that the
right font appears. Usually you will not want a spa
e between the text and the
ontrol word
footnote.
21 This is the footnote at the bottom of the page.
27
TEXbook: 117
Page 28
. Exer
ise 3.10 Make up a page with a relatively long footnote spanning several lines.
. Exer
ise 3.11 Make up a page with two dierent footnotes on it.
TEXbook: 252{253
The prin
iple is the same as using the
ontrol word \line{: : :} within the usual text on
the page. A helpful
ontrol word is \pageno whi
h represents the
urrent page number. Thus
\headline={\hfil \tenrm Page \the\pageno} would
ause the page number to appear
in the upper right
orner pre
eded by the word \Page" (now look at the upper right
orner
of this page). It is safer to expli
itly name the font that you want to use (in this
ase \tenrm
to use the 10 point roman font), sin
e you are never guaranteed that a parti
ular font will
be in use when the headline or footline is set. The
ontrol word \the takes the internal
value of the next word if it is an appropriate
ontrol word and prints it as text. You
an
also use the
ontrol word \folio instead of \the \pageno. The dieren
e is that \folio
will give roman numerals when \pageno is negative.
You
an also assign values to \pageno if you want your do
ument to use a dierent
sequen
e of page numbers from the usual. Roman numerals
an be produ
ed by using
negative numbers; \pageno=-1 at the beginning of a do
ument will
ause page numbers to
be in roman numerals.
Dierent headlines
an be produ
ed for even and odd pages in the following manner:
\headline={\ifodd \pageno {: : :}\else {: : :}\fi}
where the material between the rst set of bra
es is for the right-hand pages and the material
between the se
ond set of bra
es is for the left-hand pages.
. Exer
ise 3.12 Change the footline so that the page number is
entred with an en-dash
on either side.
28
TEXbook: 252
29
TEXbook: 29
The width of the slug is determined by the
ontrol word \overfullrule. In
luding
\overfullrule = 0 pt in your le will delete any further printing of the slugs. The overfull
boxes will still be there, of
ourse, and they will probably be harder to spot.
So we see why overfull boxes and underfull boxes are reported; we
an also
hange the
reporting by
hanging the values of \badness, \hfuzz, and \toleran
e. In addition, a
small value of \hsize obviously makes it more di
ult to set lines and
auses more overfull
and underfull hboxes to be reported. These are warnings that you ignore at your own peril!
Adding new possibilities of hyphenation will sometimes eliminate an overfull box. TEX
has automati
hyphenation and usually nds good pla
es to hyphenate a word; however, it's
possible to add hyphenations to let lines break at new pla
es. For example, the automati
hyphenation will never put a hyphen in the word \database". If you type in data\-base, it
will allow a hyphen to be inserted after the se
ond letter \a" in the word. More generally, if
you put \hyphenation{data-base} in the beginning of your input le, then all o
urren
es
of the word \database" will allow hyphenation after the letter \a". The log le will show
the possible hyphenations on the line
ontaining the overfull or underfull box. Sometimes
the best solution to an overfull or underfull hbox is a little judi
ious editing of the original
do
ument.
Our dis
ussion has involved the setting of type into lines, that is, the horizontal page
stru
ture. There are several verti
al analogues. Overfull and underfull hboxes indi
ate how
well words are gathered into lines. Similarly, overfull and underfull vboxes are reported
when paragraphs are gathered to form pages. A large table that
an't be broken in the
middle, for example,
an produ
e an underfull vbox that is reported in the log le when
the page being typeset is
ompleted. The
ontrol word \vbadness works for the verti
al
pla
ement of text in the same way as \hbadness works for horizontal text.
. Exer ise 3.13 Take a few paragraphs and print them using various (small) values of
\hsize to see what kind of overfull boxes result. Repeat with various values of \hbadness,
\hfuzz, and \toleran
e.
30
TEXbook: 28
Se
tion
4
n
Groups, Groups,
fand
More Groupsg
The
on
ept of gathering text into groups allows TEX input les to be greatly simplied.
A new group is started by the
hara
ter { and terminated by the
hara
ter }. Changes made
within a group will lose their ee
t when the group terminates. So, for example if {\bf
three boldfa
e words} appears in your text, the opening bra
e starts the group, the \bf
ontrol word
hanges to a boldfa
e font, and the
losing bra
e nishes up the group. Upon
ompletion of the group the font being used is the one in ee
t before the group started.
This is the (easier) way of having a few words in a dierent font. It's also possible to have
groups nested within groups.
As another example, size
hanges
an be made in the text that are only temporary. For
example
{
\hsize = 4 in
\parindent = 0 pt
\leftskip = 1 in
will produ
e a paragraph that is four
.
.
.
(this is an easy mistake to make).
\par
}
31
A TEX intro (Canadian spelling) Se tion 4: Groups, Groups, fand More Groupsg
When line-spa
ing
ontrol words (like \
enterline) a
t on text following it in bra
es,
that text is impli
itly in a group. Thus \
enterline{\bf A bold title} will produ
e a
entred boldfa
e line, and the text following that line will be in whatever font was in ee
t
before the \
enterline was invoked.
The empty group {} is useful. One use allows a
ents to be typeset with no a
ompanying letter. For example, \~{} will print a tilde with no letter under it. It
an also be
used to stop TEX from eating up
onse
utive spa
es. Hen
e I use \TeX{} all the time
will leave a spa
e after \TEX" in the output. This is an alternative to using \ as we did in
Se
tion 1.
Grouping
an also be used to avoid spa
es in the middle of a word when in
luding
a
ents. Either soup\
on or soup\
{
}on will produ
e the word soup
on.
. Exer
ise 4.1 Change the dimensions of one paragraph on a page using the grouping idea.
. Exer
ise 4.2 Mathemati
ians sometime use the word \iff" as an abbreviation for \if and
only if". In this
ase it looks better if the rst and se
ond letter \f" are not joined as a
ligature. How do you do this (there are several solutions)?
It's really easy to forget to mat
h bra
es properly. The ee
t
an be dramati
; if you get
output that suddenly
hanges to an itali
font for the rest of the do
ument, a mismat
hed
bra
e is probably the
ause. If you have an extra { TEX will give a message in the log le:
(\end o
urred inside a group at level 1). An extra } will result in the message
! Too many }'s.
Here's a little hint to help you keep tra
k of the bra
es in more
ompli
ated groups:
put the opening bra
e on a line by itself and do the same for the
losing bra
e. If there are
bra
es nested within the original ones, put them on separate lines also, but indent them a
few spa
es. The text within the nested bra
es
an also be indented sin
e TEX ignores all
spa
es at the beginning of a line. The mat
hing bra
es will then stand out when you look
at your TEX sour
e le. In fa
t, if your editor is smart enough, you
an
reate the two lines
with the bra
es rst and then insert the appropriate material within them with automati
indenting.
. Exer
ise 4.3 In se
tion 2 we
hanged fonts the following method: I started with
roman type, \it swit
hed to itali
type, \rm and returned to roman type. Get
the same result using the idea of grouping.
32
TEXbook: 19{21
Se
tion 5
No math anxiety here!
TEX is at its best when typesetting mathemati
s. The
onventions for doing this are
many and
omplex, and the ability of TEX to take them into a
ount makes the produ
tion
of high quality, attra
tive mathemati
al output possible. If you plan to produ
e papers with
mathemati
al symbols in them, this se
tion will give you all the basi
s ne
essary for
reating
beautiful output in almost all
ir
umstan
es; TEX may be used without any mathemati
s,
of
ourse, and if this is your goal, then the following two subse
tions are probably su
ient
for your needs.
x = y + 1:
The spa
ing for both in-line and displayed mathemati
s is
ompletely
ontrolled by
TEX. Adding spa
es to your input has no ee
t at all. What if you need a spa
e or some
text in the middle of some mathemati
s? You
an insert text by inserting it into an hbox
(don't worry about the denition of an hbox for now): \hbox{: : :}. This is parti
ularly
33
Control Sequen
e
\qquad
\quad
\
\;
\>
\,
\!
Size!
If you look
losely at the negative thin spa
e, you'll noti
e that, unlike the other entries,
the two arms overlap. This is be
ause the negative spa
e is one in the opposite dire
tion,
that is, while the other
ontrol sequen
es in
rease the amount of spa
e between two symbols
being typeset, the negative thin spa
e de
reases the spa
e between them, even if it
auses
them to overlap.
You shouldn't have any blank lines between the dollar signs delimiting the mathemati
al
text. TEX assumes that all the mathemati
al text being typeset is in one paragraph, and a
blank line starts a new paragraph;
onsequently, this will generate an error message. This
turns out to be useful, for one of the easiest errors to make is to forget to put in the trailing
dollar sign(s) after the mathemati
al input (I promise that you'll do it at least on
e while
learning TEX); if TEX allowed more than one paragraph to be between the dollars signs,
then one omitted trailing dollar sign might
ause the rest of the do
ument to be typeset as
mathemati
s.
Most mathemati
al text is entered in exa
tly the same way for in-line typesetting as for
displayed typesetting (ex
ept for the surrounding dollar signs, of
ourse). The ex
eptions,
su
h as aligning multiline displays and pla
ing equation numbers at the left or right margin
will be dis
ussed in the last part of this se
tion.
34
TEXbook: 167
Many new symbols
an appear when typesetting mathemati
s. Most of the ones that
a
tually appear on the keyboard
an be used dire
tly. The symbols + - / * = ' | < > (
and ) are all entered dire
tly. Here they are as mathemati
s: + = = 0 j < > ( ).
. Exer
ise 5.3 Typeset the equation (fg)0 = f 0 g +fg0 as in-line and displayed mathemati
al
text.
Many other symbols, as you would expe
t, are predened
ontrol words. All Greek
letters are available. Here is a table of them:
TEXbook: 434
Greek letters
o
!
\alpha
\epsilon
\theta
\lambda
o
\sigma
\phi
\omega
\Lambda
\Upsilon
"
#
&
'
\beta
\varepsilon
\vartheta
\mu
\pi
\varsigma
\varphi
\Gamma
\Xi
\Phi
\gamma
\zeta
\iota
\nu
\rho
\tau
\
hi
\Delta
\Pi
\Psi
%
\delta
\eta
\kappa
\xi
\varrho
\upsilon
\psi
\Theta
\Sigma
\Omega
TEXbook: 135{136
Mathemati
al a
ents
o^
o
o
~o
\hat o
\a
ute o
\ddot o
\ve
o
o
o
o
ab
\
he
k o
\grave o
\breve o
\widehat {ab
}
o~
o_
o
f
ab
\tilde o
\dot o
\bar o
\widetilde {ab
}
Binary operators
ombine two mathemati
al obje
ts to get another obje
t. Ordinary
addition and multipli
ation, for example,
ombine two numbers to get another number, and
so they are binary operators. When a binary operator su
h as + or is typeset, a little
extra spa
e is put around it. Here is a list of some of the available binary operators:
TEXbook: 436
Binary operators
\
\
dot
\
ir
\
ap
\oplus
[
_
\times
\bullet
\
up
\ominus
\ast
\div
\vee
\otimes
^
\star
\diamond
\wedge
\odot
Ellipses are
ommonly used with binary operators. The
ontrol word \
dots will raise
the dots so that they are level with the binary operator. Thus $a + \
dots + z$ will
produ
e a + + z . The
ontrol word \ldots will put the dots on the baseline, and so
$1\ldots n$ produ
es 1 : : : n.
TEXbook: 436
Relations
'
2
\leq
\equiv
\simeq
\subset
\in
6
6
6'
3
\not \leq
\not \equiv
\not \simeq
\subseteq
\ni
k
\geq
\sim
\approx
\supset
\parallel
6
6
6
?
\not \geq
\not \sim
\not \approx
\supseteq
\perp
r
:
\aleph
\partial
\nabla
\neg
1
n
[
<
k
8
\ell
\infty
\ba
kslash
\flat
\Re
\|
\forall
\sharp
=
6
9
\
\Im
\angle
\exists
\natural
TEXbook: 139{140
TEXbook: 128{130
To use both subs
ripts and supers
ripts on one symbol, you use both the and ^ in
either order. Thus either $x 2^1$ or $x^1 2$ will give x12 .
x
. Exer
ise 5.13 Typeset ea
h of the following: ex e x ei + 1 = 0 x0 x20 x0 2 2x .
A similar P
method is used for summations and integrals.R The input of $\sum {k=1}^n
n k 2 , and $\int 0^x f(t) dt$ will give x f (t)dt.
k=1
0
Another use of this type of input is for expressions involving limits. You an use
n
$\lim {n\to \infty}({n+1 \over n})^n = e$ to get limn!1 ( n+1
n ) = e.
1
. Exer
ise 5.15 Typeset the following expression: limx!0 (1 + x) x = e.
1; 1) is 1 .
TEXbook: 144{145
Rx
R
. Exer
ise 5.18 Typeset the following integral: 01 3x2 dx = 1.
TEXbook: 130{131
A possible
alternative is to use the
ontrol word \surd; the input $\surd 2$ will
p
produ
e 2.
x+y
x y
p3
10
p
e x.
TEXbook: 130{131
a (b +
) (a b) +
:
To make larger left delimiters the
ontrol words \bigl, \Bigl, \biggl, and \Biggl are used
in front of the delimiter; similarly, \bigr, \Bigr, \biggr,h and \Biggr
are used for the right
i
delimiters. Hen
e $\Bigl[$ and $\Bigr$ will produ
e and .
TEXbook: 145{147
n
\{
\bigl\{
\Bigl\{
\biggl\{
(
\}
\bigr\}
\Bigr\}
\biggr\}
(
\bigl(
\Bigl(
\biggl(
\Biggl\{
)
\bigr)
\Bigr)
\biggr)
\Biggr\}
\Biggl(
\Biggr)
If you want, you an let TEX hoose the size of delimiter by using the ontrol words
\left and \right before your delimiters. Thus \left[: : :\right will
ause the material
to be en
losed by bra
kets that are appropriately big. Note well: ea
h use of a \left
delimiter must have a mat
hing \right delimiter (although the delimiters themselves may
be dierent). Hen
e $$\left|{a+b \over
+d}\right|.$$ gives
a + b
+ d :
40
TEXbook: 148
Mathemati
al delimiters
(
b
e
k
#
m
\lfloor
\r
eil
/
\|
\downarrow
\Updownarrow
)
\{
\rfloor
\langle
\ba
kslash
\uparrow
\Downarrow
f
h
n
"
+
dxe
g
d
i
j
*
l
[
\}
\l
eil
\rangle
|
\Uparrow
\updownarrow
\
os
\sinh
\liminf
\hom
\tan
\
osh
\log
\ker
\
ot
\tanh
\ln
\max
\se
\
oth
\lg
\min
\
s
\lim
\exp
\arg
\ar
sin
\sup
\det
\g
d
\ar
os
\inf
\deg
\Pr
TEXbook: 162
s 2 x dx = ot x + C
sin
lim
=1
!0
sin
lim
= 0:
!1
2 tan
:
1 tan2
gives
Theorem 1 (H. G. Wells). In the
ountry of the blind, the one-eyed man is king.
The statement of the theorem may
ontain mathemati
al expressions, of
ourse.
42
TEXbook: 202{203
Proposition 1.
p Qn
n
i=1 Xi
5.9 Matri
es
Matri
es are typeset using
ombinations of the alignment
hara
ter & and the
ontrol
word \
r to indi
ate the end of the line. Start with $$\pmatrix{: : :}$$. Into the spa
e
between the bra
es go the rows of the matrix, ea
h one ended by \
r. The entries are
separated by the &. For example the input
$$\pmatrix{
a & b &
& d \
r
b & a &
+d &
-d \
r
0 & 0 & a+b & a-b \
r
0 & 0 & ab &
d \
r
}.$$
a
Bb
0
0
b
d 1
a
+ d
dC:
0 a+b a bA
0 ab
d
The matrix entries in our examples have all been
entred within their
olumns with a
little spa
e on ea
h side. They
an be made
ush right or
ush left by inserting \hfill
before or after the entry. Noti
e the dieren
es between the following example and the
previous one.
$$\pmatrix{
a & b &
\hfill & \hfill d \
r
b & a &
+d &
-d \
r
0 & 0 & a+b & a-b \
r
43
TEXbook: 176{178
a
Bb
0
0
. Exer
ise 5.29 Typeset
b
a
0
0
d1
+d
dC
a + b a bA:
ab
d
1
B0
I4 = 0
0
0
1
0
0
0
0
1
0
01
0C
0A
1
It's possible to have matri
es that use other delimiters. Using \matrix instead of
\pmatrix will leave o the parentheses, so the delimiters must be expli
itly in
luded using
\left and \right. Here is how we
an
hange the matrix of our rst example.
$$ \left |
\matrix{
a & b &
& d \
r
b & a &
+d &
-d \
r
0 & 0 & a+b & a-b \
r
0 & 0 & ab &
d \
r
}
\right | $$
b
d
a
+ d
d
0 a + b a b
0 0 ab
d
a
b
0
It's even possible to use \left. and \right. to indi
ate that the opening or
losing
delimiter is deleted (note the use of the period).
44
jxj =
x x0
x x0
This exer ise and more general onstru tions of this type may also be typeset using the
\ ases ma ro.
Sometimes ellipses are used within matri es. The ontrol words \ dots, \vdots, and
Thus we
an use
$$ \left [
\matrix{
aa & \
dots & az \
r
\vdots & \ddots & \vdots \
r
za & \
dots & zz \
r
}
\right $$
aa az 3
. . . .. 5
4 ...
.
za zz
2
Matri
es may also be typeset in-line, but they are pretty ugly unless they have a small
number of rows.
& and the
ontrol words \
r and \eqalign. Starting with $$\eqalign{: : :}$$, the equations
to be aligned are entered with ea
h one terminated by \
r. In ea
h equation there should be
45
TEXbook: 175
one alignment symbol & to indi
ate where the alignment should take pla
e. This is usually
done at the equal signs, although it is not ne
essary to do so. For example
TEXbook: 190{192
$$\eqalign{
a+b &=
+d \
r
x &= w + y + z \
r
m + n + o + p &= q \
r
}$$
yields
a+b=
+d
x=w+y+z
m+n+o+p=q
Displayed equations
an be numbered at either the right or left margin. When the
ontrol word \eqno appears in a displayed equation, everything after the
ontrol word is
put at the right margin. Hen
e $$ x+y=z. \eqno (1)$$ yields
x + y = z:
(1)
yields
a+b=
+d
x=w+y+z
m+n+o+p=q
Use \leqalignno to put the equation numbers on the left.
46
(1)
TEXbook: 192{193
Finally, suppose some text needs to appear in the middle of a displayed equation. This
an be done by putting it in an hbox. We will des
ribe hboxes in more detail in the next
se
tion. For now we want to use them to temporarily resume using ordinary roman type
and to also allow the insertion of spa
e between words (remember that all spa
es are ignored
when typesetting mathemati
s). Hen
e $$X=Y \hbox{ if and only if }x=y.$$ will give
X = Y if and only if x = y:
Note
arefully the spa
es in the hbox.
. Exer ise 5.31 Do some of the hallenge problems on pages 180{181 of The TEXbook.
47
Se
tion 6
All in a row
It's not un
ommon to want to put a table in the middle of some text. Fortunately TEX
makes it easy to do this. In fa
t there are two separate methods of aligning text. The rst is
by using the tabbing environment. This is similar to setting the tab stops on a typewriter.
Ea
h line is handled individually, a
ording to set tab
olumns, but with greater
exibility
than that provided by a typewriter. The se
ond is the horizontal alignment environment
whi
h typesets the whole table at on
e using a pres
ribed pattern.
Alberta
Saskat
hewan
Quebe
New Brunswi
k
Prin
e Edward Island Newfoundland
Manitoba
Nova S
otia
Noti
e that it is possible to skip over some tab positions, and it is not ne
essary to
use all of the tabs in a given line. To make the same table using ve
olumns, it is only
ne
essary to use \settabs 5 \
olumns to reset the tab stops; then the same three lines
from the last example will produ
e:
48
TEXbook: 231
will produ
e a table with the rst
olumn
entred, the se
ond
olumn
ush right with
a \qquad of padding, and the third
olumn boldfa
e. The
ontrol words \dotfill and
\hrulefill give alternative
olumn entries.
British Columbia
Ontario
|
::::::::::::::::::::::
Alberta
Quebe
*
Saskat
hewan
New Brunswi
k
Newfoundland
Manitoba
Nova S
otia
Prin
e Edward Island
. Exer
ise 6.1 Take the table of Canadian provin
es above and
entre ea
h entry within
its
olumn.
49
The tab positions
an be set with mu
h more
exibility than just in equal
olumns.
The general pattern is to use a sample line of the form \settabs \+ : : : & : : : & : : : \
r.
The spa
ing between the alignment
hara
ters & determines the position of the tabs. For
example, \settabs \+ \hskip 1 in & \hskip 2 in & \hskip 1.5 in & \
r would set
the rst tab one in
h from the left margin, the next another two in
hes further in, and the
third 1.5 in
hes more. It's also possible to use text to determine the distan
e between tabs.
So, for example, another possible sample line is \settabs \+ \quad Provin
e \quad &
\quad Population \quad & \quad Area \quad & \
r. The tab
olumn would then be
just wide enough to a
ept the headings with a quad of spa
e on ea
h side. Here's a more
omplete example:
\settabs \+ \quad Year
& \quad Dividend & \
r
\+ \hfill Year \quad &
\+ \hfill 1971 \quad &
\+ \hfill 2
\quad &
\+ \hfill 3
\quad &
\+ \hfill 4
\quad &
\+ \hfill 5
\quad &
Pri
e
41--54
41--54
46--55
40--53
45--52
\quad
\quad
\quad
\quad
\quad
\quad
&
&
&
&
&
&
\quad Dividend \
r
\qquad \$2.60 \
r
\qquad \$2.70 \
r
\qquad \$2.87 \
r
\qquad \$3.24 \
r
\qquad \$3.40 \
r
TEXbook: 247
gives
Year
1971
2
3
4
5
Pri
e
41{54
41{54
46{55
40{53
45{52
Dividend
$2.60
$2.70
$2.87
$3.24
$3.40
. Exer
ise 6.2 Take the table given above and move it
loser to the
entre of the page.
. Exer
ise 6.3 One way to
entre a blo
k of text, possibly several lines long, is to use:
$$\vbox{: : :}$$. Use this to
entre the table given above. Does the \settabs line need to
be in
luded in the \vbox?
. Exer
ise 6.4 Improve your last result by putting a line under the
olumn heads. The
ontrol word \hrule will insert a horizontal line if introdu
ed between two rows of a table.
Now repeat with the
ontrol word \strut after the \+ of the line
ontaining the
olumn
50
heads. (A \strut ee
tively makes the spa
ing between lines a little greater. The size
an
be altered from the default.) Note the extra spa
e that results.
TEXbook: 82
. Exer
ise 6.5 Make the following table with de
imal alignment, that is, with the de
imal
points above ea
h other (think of the dollar gure as being right aligned and the
ents gure
as being left aligned against the de
imal point):
Plums
$1.22
Coee
1.78
Granola
1.98
Mushrooms
.63
Kiwi fruit
.39
Orange jui
e
1.09
Tuna
1.29
Zu
hini
.64
Grapes
1.69
Smoked beef
.75
Bro
oli
1.09
Total
$12.55
. Exer
ise 6.6 Devise a method to make a rough table of
ontents by using \settabs and
having entries looking something like:
Getting Started \dotfill & \hfill 1
All Chara
ters Great and Small \dotfill & \hfill 9.
51
TEXbook: 235{238
.
.
.
<last display line> \
r
}
Both the template line and the display lines are divided into se
tions by the alignment
symbol &. In the template line ea
h se
tion uses
ontrol words in the same manner as does
\line{}. The
ontrol word \hfil, for example,
an be used to display
ush left,
ush
right, or
entred. Fonts
an be
hanged using \bf, \it, et
. Text may also be entered in
the template line. In addition the spe
ial symbol # must appear on
e in ea
h se
tion. Ea
h
display line is then set by substituting ea
h se
tion of the display line into its
orresponding
se
tion of the template line at the o
urren
e of the #.
Consider the following example:
\halign{\hskip 2 in $#$& \hfil \quad # \hfil & \qquad $#$
& \hfil \quad # \hfil \
r
\alpha & alpha & \beta & beta \
r
\gamma & gamma & \delta & delta \
r
\epsilon & epsilon & \zeta & zeta \
r
}
The template line indi
ates that the rst se
tion of the typeset text will always be set two
in
hes in from the left and also be set as mathemati
s. The se
ond se
tion will be
entred
after adding a quad of spa
e on the left. The third and fourth se
tions are handled similarly.
Here is the result:
alpha
gamma
epsilon
beta
delta
zeta
In this
ase the rst display line is formed by substituting \alpha for the rst # in the
template line, alpha for the se
ond #, \beta for the third and beta for the fourth. The
whole line is then saved for setting. This
ontinues until all the lines are a
umulated, and
then they are set with ea
h
olumn being as wide as ne
essary to a
ept all of its entries (an
impli
ation of this a
umulation pro
ess is that a table with too many entries
ould
ause
TEX to run out of memory; it's better not to set tables that are more than a page or so
long).
Hen
e the template line establishes the pattern for the table entries and the display
lines insert the individual entries.
52
Sometimes horizontal and verti
al lines are used to delimit entries in a table. To put
in horizontal lines, we use \hrule, just as we did in the \settabs environment. However,
we don't want the rule to be aligned a
ording to the template, so we use the
ontrol word
\noalign. Hen
e horizontal lines are inserted by putting \noalign{\hrule}; verti
al lines
are inserted by putting \vrule in either the template or the display line. But still all is not
ompletely straightforward. Suppose we take our last example and
hange the template to
get verti
al lines and also insert horizontal lines.
\halign{\hskip 2in\vrule\quad $#$\quad & \vrule \hfil\quad # \hfil
& \quad \vrule \quad $#$\quad
& \vrule\hfil \quad # \quad \hfil \vrule \
r
\noalign{\hrule}
\alpha & alpha & \beta & beta \
r
\noalign{\hrule}
\gamma & gamma & \delta & delta \
r
\noalign{\hrule}
\epsilon & epsilon & \zeta & zeta \
r
\noalign{\hrule}
}
alpha
gamma
epsilon
beta
delta
zeta
There are several de
ien
ies: the most obvious is the extended horizontal lines, but
also the text looks somewhat squashed into the boxes. In addition, the text has a little extra
spa
e on the right rather than being perfe
tly
entred. As in the \settabs environment,
lines
an be made taller by in
luding the
ontrol word \strut in the template. A further
problem
an o
ur when the page is set sin
e TEX may spread lines apart slightly to improve
the appearan
e of the page. This would leave a gap between the verti
al lines, so we use the
ontrol word \offinterlineskip within the \halign to avoid this. Finally we
an get rid
of the lines sti
king out on the left by deleting the \hskip 2 in from the template line. To
move the table to the same position we use \moveright. Finally, we
an see how to
entre
the text by noting that the extra spa
e o
urs in the template line after the # where the
text is inserted. Hen
e we
an improve our result by using
\moveright 2 in
\vbox{\offinterlineskip
\halign{\strut \vrule \quad $#$\quad &\vrule \hfil \quad #\quad \hfil
&\vrule \quad $#$\quad &\vrule \hfil \quad #\quad \hfil \vrule \
r
\noalign{\hrule}
53
TEXbook: 82
to get
alpha
gamma
epsilon
beta
delta
zeta
In general, if we want to
onstru
t a table with boxed entries that is
entred on the page,
we
an do so by putting the \vbox within a \
enterline{}. But here is a tri
k that will
produ
e a ni
er result. If the \vbox is put in between double dollar signs, it will be typeset
as displayed mathemati
s. Of
ourse, there is no a
tual mathemati
s being displayed, but
TEX will put in a little extra spa
e above and below the table as is appropriate for a display.
Hen
e a
entred table with this ni
e spa
ing may be formed using the following four steps:
(1) put a \vbox between double dollar signs, (2) put an \offinterlineskip and an \halign
within the \vbox, (3) in the \halign put a template line with a \strut in the beginning,
and a \vrule surrounding ea
h entry, (4) ea
h row of the table should be pre
eded and
followed by \noalign{\hrule}.
Here is the pattern to be followed:
$$\vbox{
\offinterlineskip
\halign{
\strut \vrule # & \vrule # & : : : & \vrule # \vrule \
r
\noalign{\hrule}
<first
olumn entry> & <se
ond
olumn entry> & : : : & <last
olumn entry> \
r
\noalign{\hrule}
:::
\noalign{\hrule}
<first
olumn entry> & <se
ond
olumn entry> &
\noalign{\hrule}
}
}$$
54
Se
tion 7
Rolling your own
In this se
tion we'll
reate new
ontrol words. The making of these new denitions, also
alled ma
ros, is one of the most powerful te
hniques available in TEX. For the rst appli
ation of this fa
ility, we'll see how a new denition
an save a lot of typing by substituting
short strings for long ones.
gives
I took my rst
ourse at the University of Manitoba. Then I took my next
ourse at
the Universite de Montreal. Finally I took my last
ourse at the University of Manitoba.
55
Remember that all spa
es after a
ontrol word are absorbed; this in
ludes the
ontrol
words that you dene. In the previous example, any spa
e after \um would be ignored.
However, the spa
e after the rst period and the spa
e after the rst opening bra
e are
dierent; if you look
losely at the end of the rst senten
e typeset using the example, you'll
see some extra spa
e. This
an be eliminated by putting a % after the opening bra
e to
make the rest of the line a
omment. The same holds for the line with the last
losing bra
e.
Careful
ontrol of spa
es often
alls for the \
ommenting out" of the end of lines in this
manner.
On
e a new
ontrol sequen
e has been dened, it may be used in new denitions. This
is one way of making simple form letters. First let's dene a simple letter.
\def\letter{
\par \noindent
Dear \name,
This is a little note to let you know that your name is \name.
\hskip 2 in Sin
erely yours,
\vskip 2\baselineskip
\hskip 2 in The NameNoter
\smallskip \hrule
}
Now this letter uses the
ontrol word \name, whi
h is undened at this point. When
\letter is used, the
urrent value of \name will appear in the body of the letter. Hen
e
\def\name{Mi
hael Bishop}
\letter
\def\name{Mi
helle L\'ev\^eque}
\letter
will produ
e two
opies of the letter, ea
h with the
orre
t name, followed by a horizontal
rule:
Dear Mi
hael Bishop,
This is a little note to let you know that your name is Mi
hael Bishop.
Sin
erely yours,
The NameNoter
56
The NameNoter
We
ould have put anything between the bra
es in \def\name{: : :}; it
ould be several
paragraphs long and use other
ontrol sequen
es (although in this
ontext it would be a
little strange). Of
ourse it is possible to use \vfill \eje
t as part of the denition of
\letter to eje
t the page when the letter is
ompleted.
. Exer
ise 7.1 Make a form letter that uses the
ontrol words \name, \address, \
ity,
\provin
e, and \postal
ode.
. Exer
ise 7.2 An unnumbered list of items is often made using \item{$\bullet$}. Dene
a ma
ro \bitem that does this, and use it for several paragraphs. Now
hange ea
h bullet
to a dash (note that a simple
hange in the ma
ro propagates all the ne
essary
hanges in
all of the paragraphs).
. Exer
ise 7.3 Suppose that you are going to have to format several paragraphs in a paper
using \hangindent = 30 pt, \hangafter = 4, and \filbreak (don't worry about what
these
ontrol sequen
es a
tually do; the only important thing for now is that on
e they are
set, they remain in ee
t for only one paragraph). Dene a single
ontrol sequen
e \setpar
whi
h
an then be put in front of ea
h paragraph that needs to be so formatted.
material between the bra
es inserted into the template at every o
urren
e of #1 in the
original denition. The spa
ing in the original denition is
ru
ial here; there
must be no spa
es before the opening bra
e.
As an example, we
ould use the form letter of the last se
tion in the following way:
\def\letter#1{
\par \noindent
Dear #1,
This is a little note to let you know that your name is #1.
\hskip 2 in Sin
erely yours,
\vskip 2\baselineskip
\hskip 2 in The NameNoter
\smallskip \hrule
}
Now we
an use
\letter{Mi
hael Bishop}
\letter{Mi
helle L\'ev\^eque}
to get
Dear Mi
hael Bishop,
This is a little note to let you know that your name is Mi
hael Bishop.
Sin
erely yours,
The NameNoter
58
The NameNoter
Now let's dene \def\displaytext#1{$$\vbox{\hsize = 12
m #1}$$}
as a new ma
ro to display text. Then \displaytext{: : :} will
ause the material between the bra
es to be put in a paragraph with width 12
entimetres
and then
entred with some spa
e added above and below as is appropriate for
a display. This paragraph was set using this \displaytext ma
ro.
The parameter of a ma
ro
an be no more than one paragraph long. If a new paragraph
is en
ountered as part of a parameter, an error will be generated. This is a safety feature,
for otherwise the a
idental omission of a
losing bra
e would
ause TEX to eat up the rest
of the le as the parameter.
. Exer
ise 7.4 Dene a ma
ro \yourgrade so that \yourgrade{89} will
ause the following
senten
e to be typeset: The grade you re
eived is 89%. It should be able to work with any
other per
entage, of
ourse.
It's not really any harder to use more than one parameter. The form used to dene a new
ontrol word with two parameters is \def\newword#1#2{: : :}. The denition between the
bra
es may have #1 and #2 o
urring in it, perhaps several times. When \newword{: : :}{: : :}
appears in the text, the material between the rst set of bra
es repla
es #1 in the denition
and the material between the se
ond set of bra
es repla
es #2 in the denition. Here is an
example followed by its result:
\def\talks#1#2{#1 talks to #2.}
\talks{John}{Jane}
\talks{Jane}{John}
\talks{John}{me}
\talks{She}{Jane}
59
John talks to Jane. Jane talks to John. John talks to me. She talks to Jane.
. Exer
ise 7.5 In a manner similar to the previous exer
ise, dene a ma
ro \yourgrade
so that \yourgrade{89}{85}
auses the following senten
e to be typeset: You re
eived a
grade of 89% on your rst exam and a grade of 85% on your se
ond exam.
. Exer
ise 7.6 Write a ma
ro \fra
so that \fra
{a}{b} will typeset the fra
tion ab .
It's important not to put any spa
es before the rst bra
e in the denition. If you do,
TEX will interpret the denition dierently from the way des
ribed here. For more than
two parameters, the method of denition is similar. To dene a
ontrol word with three
parameters, start with \def\newword#1#2#3{: : :}. Then #1, #2 and #3 may o
ur between
the bra
es. When \newword{: : :}{: : :}{: : :} appears in the text, the material between ea
h
set of bra
es repla
es its
orresponding symbol in the denition of the
ontrol word. The
parameters may go up to #9.
to get
(A
B )(C
D) = AC
BD:
. Exer
ise 7.7 Dene
ontrol sequen
es \ll, \
l, and \rl that are equivalent to \leftline,
\
enterline, and \rightline.
60
TEXbook: 206{207
The \let
ontrol word allows users to name their own
ontrol sequen
es. This allows
a personalized set of
ontrol sequen
es that may be used in pla
e of the ones provided by
TEX when desired.
61
Se
tion 8
To err is human
In some ways TEX is not
ompletely divine. TEX will respond to invalid input by giving
an error message to the s
reen if you are using it intera
tively and also to the log le.
Be
ause TEX is very
ompli
ated, the a
tual point where the error is dete
ted may be deep
within the program, so a full report of the error may be rather long and involved. Not only
that, TEX will try to re
over from errors, and will report what was done in that pro
ess. For
this reason the reading of error messages may be a little di
ult for the uninitiated. The
key is to know what is important from your perspe
tive and what
an be safely ignored. So
let's look at some typi
al errors and the messages that they generate.
will be printed on the s
reen and nothing will happen sin
e, having not been told to nish
up, TEX is waiting for input (from your keyboard). Whatever you type in will be appended
to whatever has been input from your les. The usual response is to type \bye<CR>7 sin
e
that will nish things up.
7 <CR> is the key used to end a line of input. It might be
alled the
arriage return, enter,
or simply the return key on your terminal. Sometimes it is indi
ated by a large left arrow.
62
The
ontrol word should be \hfil, of
ourse. Here is the message that would be sent
to your terminal:
! Undefined
ontrol sequen
e.
l.1 \line{ The left side \hfli
the right side}
?
The rst line starts with ! and gives the error message. Next
omes the line number
on whi
h the error o
urred and the part of the line that was read su
essfully. The next
line gives the
ontinuation of the line after the error. At this point the question mark means
that TEX is waiting for a response. There are several legal ones:
Input to TEX
h<CR>
i<CR>
x<CR>
s<CR>
r<CR>
q<CR>
<CR>
Result
In our last example a reasonable response might be to enter h<CR> to get a help message,
then i<CR> to insert more text, (at whi
h point TEX responds with insert> and nally
\hfil as the
orre
t
ontrol word. Here is the result:
? h <CR>
The
ontrol sequen
e at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the
orre
t
spelling (e.g., `I\hbox'). Otherwise just
ontinue,
and I'll forget about whatever was undefined.
? i <CR>
insert>\hfil
[1
The nal [1 means that the rst (and only) page has been
ompleted and sent to the
DVI le. The original input le still needs to be xed, of
ourse.
63
It should be
mss10, that is, the numbers have been transposed. Here are the error
and help messages:
! Font \sf=
mss01 not loadable: Metri
(TFM) file not found.
<to be read again>
\par
\bye ->\par
\vfill \supereje
t \end
l.2 \bye
? h <CR>
I wasn't able to read the size data for this font,
so I will ignore the font spe
ifi
ation.
[Wizards
an fix TFM files using TFtoPL/PLtoTF.
You might try inserting a different font spe
;
e.g., type `I\font<same font id>=<substitute font name>'.
The TFM (TEX font metri
) le is an auxiliary le that is used by TEX. So this strange
message is just telling you that the font you dened doesn't exist on your
omputer system.
64
R
Sin
e f (x) > 0, a < b, and f (x) is
ontinuous, we know that ab f (x) dx > 0.
If we now leave out the se
ond dollar sign in $f(x)$ we then get the following error
and help messages:
! Missing $ inserted.
<inserted text>
$
<to be read again>
\intop
\int ->\intop
\nolimits
l.2 $\int
a^b f(x)\,dx >0$.
? h <CR>
I've inserted a begin-math/end-math symbol sin
e I think
you left one out. Pro
eed, with fingers
rossed.
?
The line starting with ! tells us what has been done. The line starting with l.2 shows
us where we were in the input le when the error o
urred. As in our other examples,
the part of the line su
essfully read, that is, through \int, appears on one line, and
the
ontinuation appears on the next line. The remaining material may seem somewhat
obs
ure. These intermediate messages show what was happening further in the guts of the
TEX program when the error o
urred. The newer user may ignore them.
Here is what you get as output after TEX tries to re
over from the error.
R
Sin
e f (x) > 0, a < b, and f (x)is
ontinuous; weknowthat ab f (x) dx > 0.
There is a stret
h of text that is itali
with no spa
ing. This is typi
al for normal text
being pro
essed as mathemati
s; if you see this in your output, you have almost
ertainly
left out a $ or $$.
the same as if no opening bra
e were there; that is, the rest of the paper will be boldfa
e if
no other font
hanges are made. You will get the following message at the end of the le:
(\end o
urred inside a group at level 1)
If you had made the same mistake twi
e, then there would be two more opening bra
es
than
losing bra
es, and you would get the message:
(\end o
urred inside a group at level 2)
TEX doesn't know that the
losing bra
e is missing until it rea
hes the end of the
input le. Hen
e the message doesn't tell you where you went wrong. If the lo
ation of
the missing bra
e isn't obvious, it's always possible to insert \bye halfway through your
do
ument. Running TEX again will
ause only the rst half to be pro
essed, and if the
error message persists, you will know that the error is in the rst half of the do
ument. By
moving the \bye to dierent pla
es, the error
an be lo
alized. Also, looking at the output
often reveals what has gone wrong.
Missing opening bra
es are mu
h easier to spot. Here is a two line input le and the
resulting error and help messages:
\bf Here is the start}, but there is the finish.
\bye
! Too many }'s.
l.1 \bf Here is the start}
, but there is the finish.
? h <CR>
You've
losed more groups than you opened.
Su
h booboos are generally harmless, so keep going.
It's quite possible, of
ourse, that the line that is supposed to have the missing left
bra
e will not be on the line where TEX
at
hes the error.
A mismat
hed bra
e in the denition of a new
ontrol sequen
e
an
ause a major error.
Sin
e su
h a denition may in
lude several paragraphs, it may not be
aught by the end
of a paragraph, but, rather will just keep piling more and more text into the unnished
denition. It's even possible for TEX to run out of memory as it keeps eating up more
text! This is
alled a \runaway denition". Here is a two line input le with a runaway
denition:
66
TEXbook: 206
\def\newword{the def
\newword
\bye
This is obviously a serious error. If it o
urs at the beginning of a le (as in the previous
example), there will be no output at all!
If a
losing bra
e is left out while using a ma
ro with parameters, the runaway denition
will be terminated at the end of the paragraph. So if \def\newword#1{: : :} has been dened
and you use \newword{: : : without the
losing bra
e, then at most one paragraph will be
ruined.
In short, when an error o
urs, make a note of the line number to see how mu
h of
the input le has been read, and also the line starting with an ex
lamation point to get a
short des
ription of the error. If the error is still not
lear, ask TEX for more information
by typing h<CR>. For small errors, TEX
an
arry on quite a way if you just keep hitting
the <CR>.
67
TEXbook: 205
Se
tion 9
Digging a little deeper
In this se
tion we look at a few topi
s that allow TEX to be used with greater
exibility
or e
ien
y. As the do
uments being produ
ed get longer, dierent te
hniques
an help
make their
reation easier.
ma
ros
intro
se
1
se
2
se
3
se
4
se
5
se
6
se
7
se
8
se
9
se
10
While the text is still being heavily edited, it's possible to pro
ess only some of the
les by putting a % at the beginning of ea
h line that
ontains a le to be skipped (this is
sometimes
alled \
ommenting out" the unwanted les).
68
The \input
ontrol word also allows the use of predesigned ma
ros. The ma
ros for a
memorandum, for example, might be put in a le
alled memo.tex. These ma
ros might set
up the right \hsize, \vsize and other parameters, and might stamp the time and date.
On
e this has been set up, all memoranda may be started with \input memo to make them
ome out with a
ommon format.
Be sure that you don't have the
ontrol word \bye in your input le or the TEX program
will stop at that point.
. Exer
ise 9.1 Make a TEX input le that reads in a se
ond le. Try reading in the se
ond
le twi
e using the \input
ontrol word twi
e.
on the s
reen and in the log le. You
an use \show with your own ma
ros, too. If you
end up using several ma
ro pa
kages, you
an use the \show
ommand to see if a parti
ular
ma
ro is dened.
69
Many
omputer
entres have the LaTEX ma
ro pa
kage. This pa
kage allows the user to
reate an index, a table of
ontents, and a bibliography automati
ally. It also has the ability
to insert some elementary graphi
gures su
h as
ir
les, ovals, lines, and arrows. LaTEX
also uses spe
ial predened les
alled style les to set up spe
i
page parameters. Many
dierent style les are available; some journals will a
ept papers on a magneti
medium
for dire
t pro
essing if they are prepared using LaTEX and a designated style le. It is not
di
ult to shift from TEX to LaTEX. A user's guide by the author of the ma
ro pa
kage,
Leslie Lamport, is available: LaTEX: A do
ument preparation system8.
The Ameri
an Mathemati
al So
iety uses the AMS -TEX ma
ro pa
kage for its journals.
It is readily available from that So
iety, and papers may be submitted to their journals on
a magneti
medium using AMS -TEX. A manual by Mi
hael Spivak, The Joy of TEX9 , is
available from the Ameri
an Mathemati
al So
iety.
Other ma
ro pa
kages exist, and undoubtedly more will be developed. They are usually
of modest
ost and
an be very ee
tive in some
ir
umstan
es. The TEX Users Group
announ
es the existen
e of new ma
ro pa
kages in its publi
ations.
that produ es
70
will give
Here is some text before the vrule and this follows the vrule.
. Exer
ise 9.2 Make three horizontal lines that are 15 points apart, 3 in
hes in length, and
one in
h in from the left margin.
Although we usually think of hrules and vrules as horizontal and verti
al lines, they
need not ne
essarily be used that way. For example:
\noindent
Name: \vrule height 0 pt depth 0.4 pt width 3 in
71
TEXbook: 221{222
TEXbook: 221{222
will give
Name:
. Exer ise 9.3 Make the following grid (ea h box is 1 entimetre square):
72
TEXbook: 64{66
gives
Contents of box 1
Contents of box 2
Contents of box 3
Now suppose we take another vbox:
\vbox{
\hbox{Contents of box 4}
\hbox{Contents of box 5}
}
These two vboxes
an be put into an hbox; this will
ause them to be pla
ed side by
side. In other words
\hbox{
\vbox{
\hbox{Contents
\hbox{Contents
\hbox{Contents
}
\vbox{
\hbox{Contents
\hbox{Contents
}
}
of box 1}
of box 2}
of box 3}
of box 4}
of box 5}
gives
Contents of box 1
Contents of box 2 Contents of box 4
Contents of box 3 Contents of box 5
Noti
e that the two vboxes are aligned so that the bottoms are level; also there is a
little spa
e at the beginning of ea
h line and also between the vboxes. A
tually, the reason
these spa
es appear is rather subtle. Unless a line ends in a
ontrol word, there is always a
spa
e between the last entry in one line and the rst one in the next line. For this reason
the spa
e between the vboxes
omes from the end of the line
ontaining the
losing bra
e
of the rst vbox. Similarly, the spa
e at the beginning of the line is
aused by the spa
e
73
after the opening bra
e of the hbox. These spa
es
an be avoided by \
ommenting out" the
end of the line, that is, by putting a % immediately after the
losing bra
e of the rst vbox
or the opening bra
e of the hbox. If you try to put some vboxes together and a
identally
get extra spa
e by forgetting to
omment out the end of the line, you're in good
ompany.
Some very able and experien
ed TEX users have done the same thing!
Extra spa
e, say one
entimetre,
an be added by putting an \hskip 1
m between
the vboxes. They
an be aligned so that the tops are level by using \vtop instead of \vbox.
Making these two
hanges results in:
Contents of box 1
Contents of box 2
Contents of box 3
Contents of box 4
Contents of box 5
We
an
ombine vboxes, hboxes, vrules, and hrules to get boxed text. How might we
onstru
t su
h a box? One way is to take the material to be boxed and put it in an hbox
pre
eded and followed by a vrule. Then put this in a vbox with hrules above and below it.
This gives us:
\vbox{
\hrule
\hbox{\vrule{} The text to be boxed \vrule}
\hrule
}
whi
h results in
The text to be boxed
This produ
es boxed material, but there is no margin around it and so it looks very
ramped (of
ourse TEX is just giving us what we asked for). We
an improve the spa
ing
by putting a \strut at the beginning of the hbox to make it a little taller and deeper. This
gives us:
The text to be boxed
. Exer
ise 9.4 Why is it that we were for
ed to add extra spa
e above and below the text
but not before and after it?
74
. Exer
ise 9.5 Use the method of boxing material to put text
entred in a box whi
h
extends from the left to the right margin.
. Exer
ise 9.6 By sta
king nine little boxes, make the following magi
square:
6 1 8
7 5 3
2 9 4
. Exer
ise 9.7 Noti
e that the magi
square in the previous exer
ise has internal lines that
are twi
e as thi
k as the outside ones. Also, there is a tiny spa
e at the interse
tion of the
internal lines. Fix up the magi
square so this doesn't happen.
. Exer
ise 9.8 Write a ma
ro \boxtext#1{: : :} whi
h will take the text between the bra
es
and put a box around it. Test your ma
ro by making up a senten
e with every other word
boxed. I'm not quite sure why someone would do this sin
e the result is pretty strange.
Note how the baseline and the bottom of the surrounding boxes align.
It's easy to move boxes up, down, left, or right on the page. A \vbox
an be moved
to the right one in
h by using \moveright 1 in \vbox{: : : }. To move it to the left, use
\moveleft. Similarly, an \hbox
an be moved up or down using \raise or \lower.
. Exer
ise 9.9 Rewrite the \boxtext ma
ro from the previous exer
ise so that all of the
text is aligned (hint: by default the depth of a strut is 3.5 points). This would give a senten
e like the following: I'm not quite sure why someone would do this sin
e the result is
pretty strange.
It's possible to ll a box with either an hrule or with dots. The idea is to use \hrulefill
or \dotfill in the hbox.
\hbox
\hbox
\hbox
\hbox
to
to
to
to
5
5
5
5
in{Getting Started\hrulefill 1}
in{All Chara
ters Great and Small\hrulefill 9}
in{The Shape of Things to
ome\hrulefill 17}
in{No Math Anxiety Here!\hrulefill 30}
gives
75
Getting Started
All Chara
ters Great and Small
The Shape of Things to
ome
No Math Anxiety Here!
1
9
17
30
. Exer
ise 9.10 Make a boxed headline appear at the top of the page that is like the one
used in this manual.
76
Se
tion 10
Control word list
Here is a list of the
ontrol words given in this manual. If you want more detail about
these words than is given here,
he
k the index of The TEXbook.
Control symbols
\
\,
\=
\%
\
\|
4
34
11
6
10
40
\!
\.
\>
\&
\`
34
11
34
10
11
\"
\/
\#
\{
\~
11
16
10
10
10
\'
\;
\$
\}
\^
11
34
6
10
10
Control words
\AA 12
\ae 12
\approx 37
\arg 41
\bar 36
\biggl 40
\bigl 40
\bigskip 26
\bye 4
\
enterline 26
\
ir
35
\
ot 41
\d 12
\deg 41
\diamond 36
\dotfill 49
\eje
t 20
\eqalign 45
\eta 35
\folio 28
\aa 12
\aleph 37
\ar
os 41
\ast 36
\baselineskip 22
\Biggl 40
\Bigl 40
\break 26
\
12
\
entreline 60
\
olumns 48
\
oth 41
\ddag 27
\delta 35
\dim 41
\dots 14
\ell 37
\eqalignno 46
\exists 37
\font 16
\a
ute 36
\alpha 35
\ar
sin 41
\b 12
\beta 35
\biggr 40
\bigr 40
\breve 36
\
ap 36
\
he
k 36
\
os 41
\
s
41
\ddot 36
\Delta 35
\div 36
\downarrow 41
\endinsert 26
\eqno 46
\exp 41
\footline 28
77
\AE 12
\angle 37
\ar
tan 41
\ba
kslash 37
\bf 16
\Biggr 40
\Bigr 40
\bullet 36
\
dot 36
\
hi 35
\
osh 41
\
up 36
\def 55
\det 41
\dot 36
\Downarrow 41
\epsilon 35
\equiv 37
\flat 37
\footnote 27
\gamma 35
\grave 36
\hangafter 23
\hbox 72
\hfuzz 29
\hrulefill 49
\i 11
\infty 37
\it 16
\kappa 35
\lambda 35
\left 44
\leqalignno 46
\lg 41
\line 26
\magnifi
ation 21
\medskip 26
\mu 35
\neg 37
\nopagenumbers 5
\o 12
\offinterlineskip 53
\oplus 36
\overline 39
\parallel 37
\partial 37
\pi 35
\pro
laim 42
\quad 34
\r
eil 41
\right 44
\root 39
\settabs 48
\sim 37
\sl 16
\star 36
\sum 38
\surd 39
\tau 35
\the 28
\times 36
\u 12
78
\Gamma 35
\H 12
\hangindent 23
\headline 28
\hoffset 20
\hsize 20
\Im 37
\input 68
\item 24
\ker 41
\Lambda 35
\leftline 26
\leqno 46
\lim 38
\ln 41
\magstep 16
\min 41
\nabla 37
\ni 37
\not 36
\odot 36
\omega 35
\otimes 36
\P 27
\parindent 23
\perp 37
\Pi 35
\psi 35
\raggedright 27
\Re 37
\rightline 26
\S 27
\sharp 37
\simeq 37
\smallskip 26
\strut 50
\sup 41
\t 12
\tensor 60
\theta 35
\toleran
e 29
\underbar 39
\g
d 41
\halign 51
\hat 36
\hfil 27
\hom 41
\hskip 27
\in 37
\int 38
\itemitem 24
\L 12
\langle 41
\leftskip 23
\let 61
\liminf 41
\log 41
\matrix 44
\moveleft 75
\narrower 23
\noalign 52
\nu 35
\OE 12
\Omega 35
\over 37
\pageno 28
\parshape 24
\phi 35
\pmatrix 43
\Psi 35
\raise 75
\rfloor 41
\rightskip 23
s
aled 16
\sigma 35
\sin 41
\sqroot 39
\subset 37
\supset 37
\tan 41
\TeX 5
\Theta 35
\topinsert 26
\underline 39
\Uparrow 41
\Upsilon 35
\varrho 35
\vbox 71
\vglue 25
\vtop 74
\xi 35
\updownarrow 41
\v 12
\varsigma 35
\ve
36
\voffset 20
\wedge 36
\Xi 35
79
\Updownarrow 41
\varepsilon 35
\vartheta 35
\vee 36
\vrule 71
\widehat 36
\zeta 35
Se
tion 11
I get by with a little help
Many of the exer
ises
an be answered in several ways. If you like your way better than
the way given below, by all means use it!
I like \TeX!
On
e you get the hang of it, \TeX\ is really easy to use.
You just have to master the \TeX ni
al aspe
ts.
I like TEX! On
e you get the hang of it, TEX is really easy to use. You just have to master the TEXni
al aspe
ts.
Does \AE s
hylus understand \OE dipus?
80
Can you take a ferry from Oland
to
Aland?
81
He thought, \: : : and this goes on forever, perhaps to the last re
orded syllable."
Have you seen Ms.~Jones?
Prof. Smith and Dr. Gold
ew from Halifax N. S. to Montreal, P. Q. via Mon
ton, N. B.
\line{left end \hfil left ta
kle \hfil left guard \hfil
entre\hfil
right guard \hfil right ta
kle \hfil right end}
left end
left ta kle
left guard
entre
82
right guard
right ta kle
right end
left
right- entre
right
ONE
TWO
I started with roman type swit
hed to itali
type, and returned to roman type.
$C(n,r) = n!/(r!\,(n-r)!)$
a + b = d = xy = w=z
a + b = d = xy = w=z
(fg)0 = f 0 g + fg0
(fg)0 = f 0 g + fg0
83
THREE
$\alpha\beta=\gamma+\delta$
$$\alpha\beta=\gamma+\delta$$
= +
= +
$\Gamma(n) = (n-1)!$
$$\Gamma(n) = (n-1)!$$
(n) = (n 1)!
(n) = (n 1)!
x ^ (y _ z ) = (x ^ y) _ (x ^ z )
2 + 4 + 6 + + 2n = n(n + 1)
$\ve x\ dot \ve y \not= 0$ if and only if $\ve x \not\perp \ve y$.
84
The ardinality of (
1; 1) is 1 .
85
R1
2
0 3x dx = 1.
$\sqrt2 \quad \sqrt {x+y\over x-y} \quad \root 3 \of {10}$ \quad $e^{\sqrt x}$.
p3
x+y
x y
10
p
e x.
kxk = px x.
x y x + y.
$\bigl \l
eil \lfloor x \rfloor \bigr \r
eil \leq \bigl \lfloor \l
eil x \r
eil
\bigr \rfloor$.
bx dxe
1.
86
$$\int \
s
^2x\, dx = -\
ot x+ C
\qquad \lim_{\alpha\to 0} {\sin\alpha \over \alpha} = 1
\qquad \lim_{\alpha\to \infty} {\sin\alpha \over \alpha} = 0.$$
Z
sin
=1
lim
!0
s 2 x dx = ot x + C
sin
lim
= 0:
!1
tan(2) =
2 tan
:
1 tan2
\pro laim Theorem (Eu lid). There exist an infinite number of primes.
$$ I_4 = \pmatrix{
1 &0 &0 &0 \
r
0 &1 &0 &0 \
r
0 &0 &1 &0 \
r
0 &0 &0 &1 \
r}$$
0
1
B0
I4 = 0
0
0
1
0
0
87
0
0
1
0
01
0C
0A
1
jxj =
x x0
x x0
Plums
$1.22
Coee
1.78
Granola
1.98
Mushrooms
.63
Kiwi fruit
.39
Orange jui
e
1.09
Tuna
1.29
Zu
hini
.64
Grapes
1.69
Smoked beef
.75
Bro
oli
1.09
Total
$12.55
88
Getting Started : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1
All Chara
ters Great and Small : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 9
\settabs \+ \hskip 1
m&\hskip 1
m&\hskip 1
m& \
r
\moveright 2 in
\vbox{
\hrule width 3
m
\+ \vrule height 1
m & \vrule height 1
m & \vrule height 1
m
& \vrule height 1
m \
r
\hrule width 3
m
\+ \vrule height 1
m & \vrule height 1
m & \vrule height 1
m
& \vrule height 1
m \
r
\hrule width 3
m
\+ \vrule height 1
m & \vrule height 1
m & \vrule height 1
m
& \vrule height 1
m \
r
\hrule width 3
m
}
\def\boxtext#1{%
\vbox{%
\hrule
\hbox{\strut \vrule{} #1 \vrule}%
\hrule
}%
}
\moveright 2 in \vbox{\offinterlineskip
89
\hbox{\boxtext{6}\boxtext{1}\boxtext {8}}
\hbox{\boxtext{7}\boxtext{5}\boxtext{3}}
\hbox{\boxtext{2}\boxtext{9}\boxtext{4}}
}
6 1 8
7 5 3
2 9 4
Gentle Intro 1.03 run through TEX on February 14, 1994 at 12:10 P.M.
90