0% found this document useful (0 votes)
109 views70 pages

A Brief Introduction To L TEX For Bard Students

This document provides an introduction to using LaTeX for typesetting documents. It discusses LaTeX basics like document structure, formatting text, and inserting mathematical equations. It also covers more advanced LaTeX topics such as creating tables, figures, and bibliographies. The document is intended as a guide for Bard students on how to use LaTeX to write their senior projects.

Uploaded by

rrc8u
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views70 pages

A Brief Introduction To L TEX For Bard Students

This document provides an introduction to using LaTeX for typesetting documents. It discusses LaTeX basics like document structure, formatting text, and inserting mathematical equations. It also covers more advanced LaTeX topics such as creating tables, figures, and bibliographies. The document is intended as a guide for Bard students on how to use LaTeX to write their senior projects.

Uploaded by

rrc8u
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

A Brief Introduction to LATEX

for Bard Students

Mostly Gavin Maltby, updated and revised by Ethan Bloch

December 2002
Contents

1 Introduction 1
1.1 This Document . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 What is TEX . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Bard Senior Project Style . . . . . . . . . . . . . . . . . . . . 2
1.4 The basic idea of using TEX . . . . . . . . . . . . . . . . . . . 2
1.5 Sample document . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 LATEX Basics 6
2.1 Document classes . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Inputting AMS-LATEX & the Bard Senior Project Style . . . . 7
2.3 Sentences and paragraphs . . . . . . . . . . . . . . . . . . . . 8
2.4 Punctuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 Ties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Specially reserved symbols . . . . . . . . . . . . . . . . . . . . 13
2.7 Control words and symbols . . . . . . . . . . . . . . . . . . . . 14
2.8 Commands to change text font and size . . . . . . . . . . . . . 17
2.9 Accents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.10 Over-ruling some of TEX’s choices . . . . . . . . . . . . . . . . 19
2.11 Commenting your document . . . . . . . . . . . . . . . . . . . 20
2.12 Footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.13 Topmatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.14 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.15 Sectioning commands . . . . . . . . . . . . . . . . . . . . . . . 22
2.16 LATEX environments . . . . . . . . . . . . . . . . . . . . . . . . 23
2.16.1 quote and quotation environments . . . . . . . . . . . 23
2.16.2 center environment . . . . . . . . . . . . . . . . . . . 24
2.16.3 verbatim environment . . . . . . . . . . . . . . . . . . 25
2.16.4 itemize, enumerate, description environments . . . 26

i
2.16.5 tabbing environment . . . . . . . . . . . . . . . . . . . 29
2.16.6 tabular environment . . . . . . . . . . . . . . . . . . . 30
2.16.7 figure and table environments . . . . . . . . . . . . . 32
2.17 The letter document class . . . . . . . . . . . . . . . . . . . 34
2.18 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.19 Common pitfalls; Error messages . . . . . . . . . . . . . . . . 36

3 Mathematical Typesetting with LATEX 40


3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2 Displaying a formula . . . . . . . . . . . . . . . . . . . . . . . 43
3.3 Using mathematical symbols . . . . . . . . . . . . . . . . . . . 45
3.3.1 Symbols available from the keyboard . . . . . . . . . . 45
3.3.2 Greek letters . . . . . . . . . . . . . . . . . . . . . . . 46
3.3.3 Changing math fonts . . . . . . . . . . . . . . . . . . . 46
3.3.4 Binary operators . . . . . . . . . . . . . . . . . . . . . 47
3.3.5 Binary relations . . . . . . . . . . . . . . . . . . . . . . 47
3.3.6 Miscellaneous symbols . . . . . . . . . . . . . . . . . . 48
3.3.7 Arrow symbols . . . . . . . . . . . . . . . . . . . . . . 48
3.3.8 Expression delimiters
 . . . . . . . . . . . . . . . . . . . 49

3.3.9 Operators like and . . . . . . . . . . . . . . . . 50
3.3.10 Accents in math mode . . . . . . . . . . . . . . . . . . 50
3.4 Some common mathematical structures . . . . . . . . . . . . . 51
3.4.1 Subscripts and superscripts . . . . . . . . . . . . . . . 51
3.4.2 Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.4.3 Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.4.4 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.4.5 Ellipsis . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.4.6 Text within an expression . . . . . . . . . . . . . . . . 55
3.4.7 Log-like functions . . . . . . . . . . . . . . . . . . . . . 55
3.4.8 Over- and Underlining and bracing . . . . . . . . . . . 57
3.4.9 Stacking symbols . . . . . . . . . . . . . . . . . . . . . 57
3.4.10 Operators; Sums, Integrals, etc. . . . . . . . . . . . . . 58
3.4.11 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.4.12 Alignment . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.4.13 Other Multiline Environments . . . . . . . . . . . . . . 61
3.4.14 Changes to spacing . . . . . . . . . . . . . . . . . . . . 62
3.5 Macros: Defining your own LATEX commands . . . . . . . . . . 63

ii
3.6 Some Standard TEX Mistakes . . . . . . . . . . . . . . . . . . 64
3.7 Theorems, Propositions, Lemmas, . . . . . . . . . . . . . . . . . 65

iii
Chapter 1

Introduction

1.1 This Document


This introduction to LATEX is a modified version of the widely used “An intro-
duction to TEX and friends” by Gavin Maltby, dated in November 1992. That
manual was designed to be used with the then current version of LATEX(known
as LATEX2.09), as opposed to the version of LATEX used in 2002 (known as
LATEX 2ε ). Maltby’s original manual has some commands that are not cur-
rently useable; also, it did not incorporate some of the useful mathematical
commands of AMS-LATEX that are currently available. The manual you are
reading is mostly based on Maltby’s manual, but includes some updated
commands and a few things that Maltby did not have; we have also deleted
a few non-essential parts of Maltby in order to keep this manual as brief as
possible.
For a more full introduction to LATEX, a widely available document is
“The Not So Short Introduction to LATEX 2ε ” by Tobias Oetiker, Hubert
Partl, Irene Hyna and Elisabeth Schlegl. This document, which was origi-
nally in German but exists in English translation, is available on the web at
http://www.ctan.org/search/, along with other LATEX references.

1.2 What is TEX


The TEX typesetting system was designed by the eminent Stanford computer
scientist Donald Knuth, on commission from the American Mathematical
Society. It was designed with enormous care, to be ultimately powerful and

1
maximally flexible. The enormous success of Knuth’s design is apparent from
the vast number of diverse applications TEX has found.
To make the raw power of TEX more manageable and user friendly, some
macros (discussed below) must be defined. The most widely use set of macros
for TEX is called LATEX. We recommend that everyone use LATEX; we will be
referring to LATEX in this manual. It is necessary to use the latest version of
LATEX, which is called LATEX 2ε . Do not use earlier versions of LATEX, such as
LATEX2.09.
LATEX does not have all the mathematical abilities one might want, and so
we will add to it a set of macro packages and mathematical fonts and symbols
known as AMS-LATEX, which was commissioned by the American Mathemat-
ical Society. We will explain below how to input these packages. Unless oth-
erwise noted, all the commands described below are standard LATEX. In the
few situation where we use commands that require the AMS-LATEX packages,
we will state the need for these packages.
The common American way to pronounce TEX is “tek.” If you want to
be really fancy, you can say “tech,” where the “ch” is pronounced as in the
German “Bach” or the Scottish “Loch.” Do NOT say “tex.” Some people
pronounce LATEX as “lay-tek,” and others say “lah-tek.”

1.3 Bard Senior Project Style


The Bard Senior Project style is a collection of macros for such useful things
as the senior project title page, acknowledgements and dedication; theorems,
lemmas and the like; proper margins; and miscellaneous other matters use-
ful for senior projects. This style file, called bardproj.sty, together with
a brief manual for using this style file, is available from Ethan Bloch at
http://math.bard.edu/bloch/bardtex.htm. We will describe below how to
input this style file.

1.4 The basic idea of using TEX


TEX is not a WYSISYG word processor. Rather, it is more like a computer
program, in that you enter various commands (which in TEX usually start
with a backslash) along with your text, and then run the document through
a compiler. If there are errors, you are given error messages. If there are

2
no errors, then the program outputs something that can then be viewed.
The file with your input, known as the “TEX file,” is a text file that has
the suffix .tex. The file that TEX produces if there are no errors in the
TEX file is called the “DVI file,” and it has the same name as your TEX file,
except that it has the suffix .dvi (which is short for “device independent”).
This last file can viewed, printed, etc. The particular implementation of TEX
varies from system to system, but the basic ideas of TEX are the same in
all implementations. The portability of a TEX document between systems is
one of the advantages of TEX.
The basic idea underlying TEX is that the author should be concerned
with content, and with the logical structure of the document, but should
not have to worry about nuisance-value formatting details. We inform TEX
of the logical structure of our document by telling it when to begin a new
paragraph, subsection, section, chapter, theorem, definition, remark, poem,
list etc. When typing a particular element of the logical structure, we need
pay little attention to how we lay our source file out. Starting a new line, for
instance, entails more than just pressing Return because TEX will just regard
the next word you type as exactly that—the next word in the paragraph.
You have to specifically ask for a line to be terminated. Things like this may
seem to be a bit of a nuisance, but it is a small price to pay for the automatic
formatting that necessitated it. Further, such small inconveniences have been
localized to rare events.

1.5 Sample document


To obtain a feel for how LATEX works, look at the following sample LATEX
document:

3
\documentclass[12pt]{report}
\usepackage{amssymb, amsmath, amsthm, amsfonts}

\newcommand{\func}[3]{{#1} \colon {#2} \to {#3}}

\begin{document}

Let $\func p{[0, \infty)}{\mathbb{R}}$ be given by $p(x) = x^2$


for all $x \in [0, \infty)$. Then $p$ has no right inverse, but
many left inverses, of which we show two. Let
$\func {q, r}{\mathbb{R}}{[0, \infty)}$ be given by
$$
q(x) =
\begin{cases}
\sqrt x,&\text{if $x \ge 0$}\\
1,&\text{if $x < 0$,}
\end{cases}
\qquad \text{and}\qquad
r(x) =
\begin{cases}
\sqrt x,&\text{if $x \ge 0$}\\
\sin x,&\text{if $x < 0$.}
\end{cases}
$$
Both $q$ and $r$ are left inverses for $p$, because $(q \circ p)(x)
= q(p(x)) = \sqrt {x^2} = x$ for all $x \in [0, \infty)$, and
$(r \circ p)(x) = r(p(x)) = \sqrt {x^2} = x$ for all $x \in
[0, \infty)$. We leave it to the reader to show that $p$ has no right inverse.
\end{document}

The above file, which would have a name such as filename.tex, is what
you type in a word processor (and which must be saved as a text file). The
completed TEX file is then run through LATEX, and it produces the following
output:

4
Let p : [0, ∞) → R be given by p(x) = x2 for all x ∈ [0, ∞). Then p
has no right inverse, but many left inverses, of which we show two. Let
q, r : R → [0, ∞) be given by
√ √
x, if x ≥ 0 x, if x ≥ 0
q(x) = and r(x) =
1, if x < 0, sin x, if x < 0.

Both q and r are left inverses for p, because (q ◦ p)(x)


√ √ = q(p(x)) =
x = x for all x ∈ [0, ∞), and (r ◦ p)(x) = r(p(x)) = x2 = x for all
2

x ∈ [0, ∞). We leave it to the reader to show that p has no right inverse.
Among other things to notice in the TEX file are the first two lines (which
declare the type of document, and inputs some extra mathematical packages);
the third line (which defines a new LATEX command); the many entries that
begin with \ (which are LATEX commands); the many $ signs (which denote
math mode); the \begin{ } and \end{ } commands (which denote special
environments). All these features will be described in this manual.

5
Chapter 2

LATEX Basics

There are various implementations of TEX available on Windows, Mac and


LINUX operating systems. Some of these implementations are free, and
others are commercially available. All implementations work essentially the
same way, in that you start by producing a LATEX source file (known as the
“TEX file”), and you then run the file through the TEX compiler, debug the
file as necessary, and view (or print) the result when you have gotten all
the bugs out. How you run the file through the TEX compiler (known as
“TEX-ing” the file) depends upon the particular implementation you use. In
this manual we discuss the ingredients that go into the TEX file.

2.1 Document classes


Every TEX file begins with a declaration of the document class. The most
commonly used document classes in LATEX are letter, article, report,
and book; there are also some useful AMS-LATEX document classes, such
as amsart and amsbook, which make things look a little differently from
the corresponding regular document classes. The article class is used for
documents that are to have the appearance of a journal or magazine article.
The report class is usually used for larger documents than the article
class. These classess really only differ in their choice of default page size,
font, placement of title and author, sectional units, etc. and on how they
format certain LATEX constructs. You use the same LATEX commands in
each.
There are a number of possible options with each document class, such

6
as font size, columns, etc. The syntax for declaring a document class is as
follows:
\documentclass[options]{class}

where class is the main document class (e.g. report) and the optional ar-
gument options is a list of document class options. Note thatan argument
in square brackets is optional, and can omitted altogether (including the
brackets).
Some of the more common options are the following:

11pt chooses 11-point as the default font size for the document, instead of
the default 10-point.

12pt chooses 12-point as the default font size.

twoside formats output as left and right pages, as in a book.

twocolumn produces two-column magazine like output.

titlepage applies to the article class only, causing the title and abstract to
appear on a page each.

For example, this document starts with the declaration:


\documentclass[12pt]{report}

2.2 Inputting AMS-LATEX & the Bard Senior


Project Style
Immediately after declaring the document class, add the line:
\usepackage{amssymb, amsmath, amsthm, amsfonts}

which will allow the user to make use of various AMS-LATEX fonts, symbols
and other mathematical constructs.
To make use of the Bard Senior Project style, you first need to download
the file bardproj.sty from the website given in Section 1.3, and then put
the file in the same folder on your computer as your TEX file. Then, add

7
the following line to your TEX file immediately after declaring the document
class:
\usepackage{bardproj}

2.3 Sentences and paragraphs


Paragraph input in LATEX is free-form. You type the words and separate
them by spaces so that LATEX can distinguish between words. For these
purposes, pressing Return is equivalent to inserting a space—it does not
indicate the end of a line, but the end of a word. You tell LATEX that a
sentence has ended by typing a period followed by a space. LATEX ignores
extra spaces; typing three or three thousand will get you no more space
between the words that these spaces separate than typing just one space.
Finally, you tell LATEX that a paragraph has ended by leaving one or more
blank lines. In summary: LATEX concerns itself only with the logical concepts
end-of-word, end-of-sentence, and end-of-paragraph. Here is an example:
\documentclass{article}
\usepackage{amssymb, amsmath, amsthm, amsfonts}
\begin{document}
Words within a sentence are ended by spaces. One space
between words is equivalent to any number.
Pressing Return
at the end of a line
and starting a new word on the next line
just serves to separate
words, not to cut a line short.
The end of a sentence is indicated by a period
followed by one or more spaces.

The end of a paragraph is indicated by leaving a blank line.


All this
means that we can type without too much regard for layout, and
the typesetter will sort things out for us.
\end{document}

produces the result

8
Words within a sentence are ended by spaces. One space between
words is equivalent to any number. Pressing Return at the end of a line
and starting a new word on the next line just serves to separate words,
not to cut a line short. The end of a sentence is indicated by a period
followed by one or more spaces.
The end of a paragraph is indicated by leaving a blank line. All this
means that we can type without too much regard for layout, and the
typesetter will sort things out for us.
Note that we have learned more than just how LATEX recognizes words,
sentences and paragraphs. We’ve also seen how to specify our choice of docu-
ment class and how to tell LATEX where our document begins and ends. Any
material that is to be printed must lie somewhere between the declaration
of \begin{document} and that of \end{document}. Definitions that are to
apply to the entire document can be made before the declaration of the doc-
ument beginning. The specification of document class must precede all other
material.
In future examples we won’t explicitly display the commands that select
document class, input the AMS-LATEX packages, and delimit the start and
end of the document. But if you wish to try any of the examples, don’t
forget to include those commands. The article document class will do for
most of our examples. Of course, the preceding example looks not at all like
an article because it is so short and because we specified no title or author
information.
LATEX automatically makes ligatures. These are combinations of letters
within words which should be typeset as a single special symbol because they
will “clash” with each if this is not done. Have a look at these words

flight, flagstaff, chaff, fixation

and compare them with these

flight, flagstaff, chaff, fixation

In the first set I let LATEX run as it usually does. In the second I overruled
it somewhat, and stopped it from creating ligatures. Notice how the ‘fl’, ‘ff’,
and ‘fi’ combinations are different in the two sets—in the former they form a
single symbol (a ligature) and in the latter they are comprised of two disjoint
symbols. There are other combinations that yields ligatures as well.
LATEX has been taught how to hyphenate the majority of words. It will
hyphenate a word if it feels that the overall quality of the paragraph will be

9
improved. For long words it has been taught several potential hyphenation
positions.
LATEX also goes to a lot of trouble to try to choose pleasing page breaks.
It avoids “widows”, which are single lines of a paragraph occurring by them-
selves at either the bottom of a page (where it would have to be the first line
of a paragraph) or at the top of a page (where it would have to be the last).
It also “vertically justifies” your page so that all pages have exactly the same
height, no matter what appears on them.

2.4 Punctuation
Typists have a convention whereby a single space is left after a mid-sentence
comma, and two spaces are left after a sentence-ending period. How do we
enforce this if LATEX treats a string of spaces just like a single one? The
answer, unsurprisingly, is that we don’t.
To have a comma followed by the appropriate space, we simply
type a comma follows by at least one space. To end a sentence
we type a period with at least one following space. No space will
be inserted if we type a comma or period followed straight away
by something other than a space, because there are times when
we won’t require any space, i.e., we do what comes narurally.

will produce
To have a comma followed by the appropriate space, we simply type
a comma follows by at least one space. To end a sentence we type a
period with at least one following space. No space will be inserted if we
type a comma or period followed straight away by something other than
a space, because there are times when we won’t require any space, i.e.,
we do what comes naturally.
LATEX will produce suitable space after commas, periods, semi-colons and
colons, exclamation marks, question marks etc. if they are followed by a
space. In stretching a line to justify to the right margin, it also knows
that space after a punctuation character should be more “stretchable” than
normal inter-word space and that space after a sentence-ending period should
be stretched more than space after a mid-sentence comma. TEX knows the
nature of punctuation if you stick to the simple rules outlined here. As we’ve
already said, those rules tell LATEX how to distinguish consecutive words,
sentences, phrases, etc.

10
Actually, there is more to ending sentences than mentioned above. Since
LAT EX cannot speak English, it works on the assumption that a period followed
by a space ends a sentence unless the period follows a capital letter. This
works most of the time, but can fail. To get a normal inter-word space after
a period that doesn’t end a sentence, follow the period by a control space—a
\ (a \ character followed by a space or return). Very rarely, you will have to
force a sentence to end after a period that follows a capital letter (remember
that LATEX assumes this doesn’t end a sentence). This is done by preceding
the period with a \@ command (you can guess from the odd syntax that this
is rarely needed).
It’s time we saw some examples of this. After all, this is our first experi-
ence of control symbols (don’t worry, there are many more to come).
We must be careful not to confuse intra-sentence periods
with periods that end a sentence, i.e.\ we must remember
that our task is to describe the sentence structure. Periods
that the typesetter requires a little help with typically result
from abbreviations, as in etc.\ and others. We have to work
somewhat harder to break a sentence after a capital letter,
but that shouldn’t bother us to much if we keep up our intake
of vitamin E\@. All this goes for other sentence-ending
punctuation characters, so I could have said vitamin E\@!
Fortunately, these are rare occurrences.

results in
We must be careful not to confuse intra-sentence periods with pe-
riods that end a sentence, i.e. we must remember that our task is to
describe the sentence structure. Periods that the typesetter requires a
little help with typically result from abbreviations, as in etc. and oth-
ers. We have to work somewhat harder to break a sentence after a
capital letter, but that shouldn’t bother us to much if we keep up our
intake of vitamin E. All this goes for other sentence-ending punctuation
characters, so I could have said vitamin E! Fortunately, these are rare
occurrences.
Quotation marks is another area where LATEX will do some work for us.
Keyboards have the characters ‘, ‘, and " but we want to to have access to
each of ‘, ’, “, and ”. So we proceed like this:

11
‘\LaTeX’ is no conventional word-processor, and
to to get quotes, like ‘‘this’’, we type repeated
‘ and ’ characters. Note that modern
convention is that ‘‘punctuation comes after
the closing quote character’’.

which gives just what we want


‘LATEX’ is no conventional word-processor, and to to get quotes,
like “this”, we type repeated ‘ and ’ characters. Note that modern
convention is that “punctuation comes after the closing quote character”.
Very rarely, you have three quote characters together. Merely typing
those three quote characters one-after-the-other is ambiguous—how should
they be grouped? You tell LATEX how you want them grouped by inserting a
very small space called \,.
‘‘\,‘Green ham’ or ‘Eggs?’\,’’ is the question.

gives the desired result


“ ‘Green ham’ or ‘Eggs?’ ” is the question.
Since we have a typesetter at our disposal, we might as well use the correct
dashes where we need them. There are three types of dash: the hyphen, the
endash, and the emdash. A minus sign is not a dash.
Hyphens are typed as you’d hope, just by typing a - at the point in
the word that you want a hyphen. Don’t forget that LATEX takes care of
hyphenation that is required to produce pretty linebreaks. You only type
a hyphen when you explicitly want one to appear, as in a combination like
“inter-college”.
An endash is the correct dash to use in indicating number ranges, as in
“questions 1–3”. To specify an endash you type two consecutive dashes on
the keyboard, as in 1--3.
An emdash is a punctuation dash, used at the end of a sentence—I tend
to use them too much. To specify an emdash you type three consecutive
dashes on the keyboard, as in “. . . a sentence---I tend to. . . ”.
Theorems 1--3 concern the semi-completeness
of our new construct---in the case that it
satisfies the first axiom.

yields

12
Theorems 1–3 concern the semi-completeness of our new construct—
in the case that it satisfies the first axiom.

2.5 Ties
When you always remember to use ties, you know that you are becoming
TEXnically inclined. Ties are used to prevent LATEX from breaking lines at
certain places. LATEX will always choose line breaks that result in the most
aesthetically pleasing paragraph as judged by its stringent rules. But because
LATEX does not actually understand the material it is setting so beautifully,
it can make some poor choices.
A tie is the character ~. It behaves as a normal interword space in all
respects except that the line-breaking algorithm will never break a line at
that point. Thus
Dr. Seuss should be typed as Dr.~Seuss

for this makes sure that LATEX will never leave the ‘Dr’ at the end of one line
and put the ‘Seuss’ at the beginning of the next.
One should try to get in to the habit of typing ties first-time, not after
waiting to see if LATEX will make a poor choice This will allow you to make
all sorts of changes to your text without ever having to go back and insert
a tie at a point that has migrated to the end of a line from the middle of a
line as a result of those changes. Remember, of course, that the line-breaks
Here are some more examples of places where you should remember to
place ties.

Chapter~10 Donald~E. Knuth


Appendix~C width~2
Figure~1 function~f
Theorem~2 1,~2, or~3
Lemmas 3 and~4 equals~5

2.6 Specially reserved symbols


In the sequel we will see that the the ten characters

13
# $ % & ~ _ ^ \ { }
are reserved for special use. Indeed, we have seen already that \ and ~ are
non-printing characters that perform special services (and we’ll have a lot
more to say about the use of \).
But what if we need one of these special symbols to appear in our doc-
ument? The answer for seven of the symbols is to precede them by a \
character, so forming another control symbol (remember that \ followed by
a space was also a control symbol).
It is not 100\% straightforward to typeset the
characters \$ \& \% \_ \{ \}, but given the
enormous convenience of the use they are normally
reserved for this is a small price to pay.

produces
It is not 100% straightforward to typeset the characters $ & %
{ }, but given the enormous convenience of the use they are normally
reserved for this is a small price to pay.

2.7 Control words and symbols


In typing a document, we can think of ourselves as being in one of two
distinct modes. We are either typing literal text (which will just be set into
neat paragraphs for us) or we are typing text that will be interpreted by
LATEX as an instruction to insert a special symbol or to perform some action.
Thus we are either typing material that will go straight into the document
(with some beautification), or we are giving commands to LATEX.
Some commands are implicit, in that we don’t have to do anything much
extra. For instance, we command LATEX to end the present sentence by
typing a period (that doesn’t follow a capital letter). These are no so much
commands as part of having to describe the logical structure of a document.
A control word is something of the form \commandname, where the com-
mand name is a word made up only of the letters a to z and A to Z. A control
symbol consists of a \ followed by single symbol that is not a letter.
Here are some examples:

• we have met the control space symbol \ before,

• the commands to set symbols like % and $ are control symbols

14
• \@ was a control symbol that told told LATEX that the very next period
did really end the sentence,

• \LaTeX is a control word that tell LATEX to insert its own name at the
current point,

• \pounds inserts a £ symbol,

• \S inserts a ¶ symbol,

• \emph{ } makes the text in braces be emphasised,


These examples show that control sequences can be used to
access symbols not available from the keyboard, do some typesetting
tricks like setting the word LATEX the way it does, and change the appearance
of whole chunks of text as with \emph{ }. We’ll be meeting many more of
these type of control sequences.
Another enormously powerful class of control sequences is those that ac-
cept arguments. They tell LATEX to take the parts of text you supply and do
something with them—like make a fraction by setting the first argument over
the second and drawing a line of the appropriate length between them. These
are part of what makes LATEX so powerful, and here are some examples.

• \chapter{The beginning} causes LATEX to start a new chapter with


name “The Beginning”, number it in sequence, typeset the chapter
heading in a suitable font, and make an entry in the table of contents,

• \overline{words} causes words to be overlined,

• \frac{a+b}{c+d} sets the given two argument as a fraction, doing


most of the dirty work for us: a+bc+d
,

• \sqrt[5]{a+b} typesets the fifth-root of a+b, like this: 5 a + b. The 5
is in square brackets instead of braces because it is an optional argument
and could be ommited all together (giving the default of square root),

Mandatory arguments are given enclosed by braces, and optional argu-


ments enclosed by square brackets. Each command knows how many argu-
ments to expect, so you don’t have to provide any indication of that. (The
last three of the above examples include examples of mathematical typeset-
ting, which we will discuss in Chapter 3.)

15
We need to dwell on a TEXnicality for a moment. How does LATEX
know where the name of a control sequence ends? Will it accept both
\pounds3 and \pounds 3 in order to set £3? What about \poundsthree
vs. \pounds three? The answer is easy when you remember that a control
word consists only of alphabetic characters, and a control symbol consists of
exactly one nonalphabetic character.
So to determine which control sequence you typed, LATEX does the fol-
lowing:

1. when a \ character is encountered, LATEX knows that either a control


symbol or a control word will follow.

2. If the \ is followed by a nonalphabetic character, then LATEX knows


that it is a control symbol that you have typed. It then recognizes
which one it was, typesets it, and goes on to read the character which
follows the symbol you typed.

3. If the \ is followed by an alphabetic character, then LATEX knows that


it is a control word that you have typed. But it has to work out where
the name of the control word ends and where the ensuing text takes
over again. Since only alphabetic characters are allowed, LATEX reads
everything up to just before that first nonalphabetic character as the
control sequence name. Since it is common to delimit the end of a
control word by a space, LATEX will ignore any space that follows a
control word, since you want that space treated as end-of-control-word
space rather than interword space.

This has one important consequence: The character in the input file
immediately after a control symbol will be “seen” by LATEX, but any space
following a control word will be discarded and never processed. This does not
affect one much if you adopt the convention of always typing a space after a
control sequence name.
There is a rare circumstance where this necessitates a little extra work
and thought, which we illustrate by example:
If we type a control word like \LaTeX in the running text
then we must be cautious, because the string of spaces that
come after it will be discarded by the \LaTeX\ system.

which produces the output

16
If we type a control word like LATEXin the running text then we
must be cautious, because the string of spaces that come after it will be
discarded by the LATEX system.

2.8 Commands to change text font and size


The most commonly used LATEX commands for changing type style are given
below. For each of these commands, only the text within the braces will
change appearance.

\textrm{ } Roman \textit{ } italic \textsc{ } Capitals


\emph{ } Emphasised \textsl{ } slanted \texttt{ } typewriter
\textbf{ } boldface \textsf{ } sans serif

Each of the type style selection commands selects the specified style but
does not change the size of font being used. The default type style is roman
(you are reading a roman style font now).
Commands for changing type size work differently than commands for
changing type style. The commands for changing type size apply to any text
that follows the command. To limit the area of text over which one of these
commands has effect (its scope) we make that text into what is called a group
by using braces. Groups are used extensively in LATEX to keep effects local
to an area, rather than affecting the whole document. Apart from enhancing
usability, this also in a sense protects distinct parts of a document from each
other. To change type size you issue one of the type size changing commands
shown below, which will select the indicated size in the currently active style.

size default (10pt) 11pt option 12pt option


\tiny 5pt 6pt 6pt
\scriptsize 7pt 8pt 8pt
\footnotesize 8pt 9pt 10pt
\small 9pt 10pt 11pt
\normalsize 10pt 11pt 12pt
\large 12pt 12pt 14pt
\Large 14pt 14pt 17pt
\LARGE 17pt 17pt 20pt
\huge 20pt 20pt 25pt
\Huge 25pt 25pt 25pt

17
The point-size option referred to above is that specified in the \documentclass
command issued at the beginning of the input file. Through it you select that
base (or default) font for your document to be 10, 11, or 12 point Roman. If
no options are specified, the default is 10-point Roman. The table shows, for
instance, that if I issue a \large in this document for which I chose the 12pt
document class option the result will be a 14-point Roman typeface.
Here is an example of text style and size changes:
We \emph{emphasize} by putting the emphasized text
in the braces following the control word, and the same
goes for \textbf{emboldened} and other style changes.
For changing sizes, for example {\LARGE large} and
{\scriptsize scriptsize}, we put the control word and the
text inside braces.

We emphasize by putting the emphasized text in the braces following


the control word, and the same goes for emboldened and other style
changes. For changing sizes, for example large and scriptsize, we put
the control word and the text inside braces.

2.9 Accents
LATEX provides many accents, which are accessed through a variety of control
symbols and single-letter control worlds which accept a single argument—the
letter to be accented. These control sequences are:

\‘{o} ò (grave accent) \’{o} ó (acute accent)


\^{o} ô (circumflex or “hat”) \"{o} ö (umlaut or dieresis)
\~{o} õ (tilde or “squiggle”) \={o} ō (macron or “bar”)
\.{o} ȯ (dot accent) \u{o} ŏ (breve accent)
\v{o} ǒ (háček or “check”) \H{o} ő (long Hungarian umlaut)
\t{oo} oo (tie-after accent) \c{o} o̧ (cedilla accent)
\d{o} o. (dot-under accent) \b{o} o (bar-under accent)
¯
Thus we can produce ó by typing \’{o}, ǎ by typing \v{a}, and Pál
Erdös by typing P\’{a}l Erd\"{o}s. Take special care when accenting an i
or a j, for they should lose their dots when accented. Use the control words
\i and \j to produce dotless versions of these letters. Thus the best way to
type to type ĕxı̆gent is \u{e}x\u{\i}gent.

18
2.10 Over-ruling some of TEX’s choices
We’ve seen that ties can be used to stop linebreaks occurring between words.
But how can we stop LATEX from hyphenating a particular word? More
generally, how can we stop it from splitting any given group of characters
across two lines. The answer is to make that group of characters appears as
one solid box, through use of an \mbox command.
For instance, if we wanted to be sure that the word

\emph{currentitem} is not split across lines


then we should type it as \mbox\emph{currentitem}.

If for some reason we wish to break a line


in the middle of nowhere, preventing LATEX from justifying that line to the
prevailing right margin, the we use the \newline command. One can also
use the abbreviated form \\.
We start with a short line.\newline
And now we continue with the normal
text, remembering that where we press
Return in the input file probably won’t

correspond to a line break in the final


document. More short lines\\
are easy, too.

will produce the line breaks we want


We start with a short line.
And now we continue with the normal text, remembering that where we
press Return in the input file probably won’t correspond to a line break
in the final document. More short lines
are easy, too.
A warning is in order: \newline must only end part of a line that is “al-
ready set”. It cannot be used to add additional space between paragraphs,
nor to leave space for a picture you want to paste in. This is not to be awk-
ward, but is just part of LATEX holding up its end of the deal by making you
have to specially request additional vertical space. This prevents unwanted
extra space from entering your document.
If you wish to force a page break, use the \newpage command.

19
2.11 Commenting your document
It is handy to be able to make comments to yourself in the source file for a
document. Things like “I must rewrite this section” and “This is version 3
of the document” are likely. It would also be useful to be able to make the
compiler ignore certain parts of the document at times. For this purpose we
can use the % character, for all text on an input line that is after a % which
is not part of an occurrence of the control symbol \% is discarded by the
compiler. Here is an example:
There was a 100\% turnout today,
an all-time record. %perhaps I should check this claim!
%Indeed, there are lots of unsubstantiated claims here!
This made for an extremely productive session.

will yields
There was a 100% turnout today, an all-time record. This made for
an extremely productive session.

2.12 Footnotes
Footnotes are considered bad form in mathematical writing. If you want to
use them nonetheless, inserting footnotes is easy in LATEX, because they will
be positioned and numbered automatically. You just indicate exactly where
the footnote marker should go, and provide the text of the footnote. The
footnote text will be placed at the bottom of the present page in a somewhat
smaller font, and be separated from the main text by a short horizontal rule1
to conform with convention. The footnote in the last line was typed like this:
...rule\footnote{See for yourself! It’s easy ...work.} to conform

No space was typed between the rule and the \footnote, because we
want the footnote marker to appear right next to the last letter of the word.
Multiple footnotes2 are obtained just by using the \footnote command
again and again.
1
See for yourself! It’s easy when you don’t have to do any work.
2
Here is another footnote

20
2.13 Topmatter
We declare the title and author information using the \title and \author
commands, each of which accept a single argument. Multiple authors are all
listed in the argument of \title, separated by \and’s. The \date command
can be used to date a document. After we have declared each of these, we
issue a \maketitle command to have them typeset for us. In the book and
article document styles this will result in a separate page; in the article
style the “top matter” will be placed at the top of the first page. The style
files determine the placement and the choice of font.
\title{A Thought for the Day}
\author{Fred Basset \and Horace Hosepipe}
\date{November 1992}
\maketitle

will produce something along the lines of

A Thought for the Day


Fred Basset Horace Hosepipe
November 1992

This topmatter must appear after the \begin{document} and before any
other printing material.

2.14 Labels
One of the great features of LaTEX is that chapters, sections, theorems, equa-
tions and the like are numbered automatically. Thus, if you decide to insert a
new section in the middle of an existing chapter, everything after that is au-
tomatically renumbered. The way automatic numbering works is that every-
thing that is numbered is given a label, usually written \label{labelname},
where labelname can be any character string starting made of numbers, let-
ters and punctuation, starting with a letter. Of course, each labeled item
must have a unique label. Because the label does not appear in the printed
version of the text, you can choose anything you want for the label; some-
thing mnemonic is always a good idea. For example, the label used for the
current section of this manual is \label{sec:labels}.

21
To refer to the labeled item, for example this section, we would write
Section~\ref{sec:labels}, which would produce Section 2.14. The \ref{ }
command works with chapters, sections, theorems, equations, etc. Such a
reference could be anywhere in the text, even before the item being refered
to.

2.15 Sectioning commands


As part of our task of describing the logical structure of the document, we
must indicate to LATEX where to start sectional units. To do this we make
use of the sectioning commands, which are:

\part \subsection \paragraph


\chapter \subsubsection \subparagraph
\section

Each sectioning command accepts a single argument—the section heading


that is to be used. LATEX will provide the section numbering (and numbering
of subsections within sections, etc.) so there is no need to include any number
in the argument. LATEX will also take care of whatever spacing is required
to set the new logical unit off from the others, perhaps through a little extra
space and using a larger font. It will also start a new page in the case that
a new chapter is begun.
The \part command is used for major subdivisions of substantial docu-
ments. The \paragraph and \subparagraph commands are, unfortunately
confusing. They are used to section off a modest number of paragraphs of
text—they don’t start new paragraphs (remember that that was done by
leaving a blank line in our input file). The names were retained for historical
reasons.
The sectioning command that began the present sectional unit of this
document was
\section{Sectioning commands}
\label{sec:sectioning}

Notice that no section number was given in the above command, and that
is because LATEX numbers the sections automatically!

22
There are occasions when you want a heading to have all the appearance
of a particular sectioning command, but shouldn’t be numbered as a section
in its own right or produce a table of contents entry. This can be achieved
through using the *-form of the command, as in \section*{...}. We’ll see
that many LATEX commands have such a *-form which modify their behaviour
slightly.
LATEX can automatically make a table of contents. Just include the com-
mand \tableofcontents after the \begin{document} command.

2.16 LATEX environments


A very useful concept in the LATEX syntax is that of an environment. Some
environments are used to display a portion of text, i.e. to set it off from the
surrounding text by indenting it, for example the quote environment. The
center environment allows us to centre portions of text.
All the environments are begun by a \begin{name } command and ended
by an \end{name}, where name is the environment name. These commands
also serve as begin-group and end-group markers (see Section 2.8), so that
all commands are local to the present environment—they cannot affect text
outside the environment.
We can also have environment embedded within environment within en-
vironment and so on, limited only by memory available on the computer. We
must, however, be careful to check that each of these nested environments is
indeed contained within the one just outside of it.
Although LATEX doesn’t care too much for how we format our source file,
it is obviously a good idea to lay it out logically and readably anyway. This
helps minimize errors as well as aids in finding them. For this reason I have
adopted the convention of always placing the environment \begin and \end
commands on lines by themselves.

2.16.1 quote and quotation environments


This environment can be used to display a part of a sentence or paragraph,
or even several paragraphs, in such a manner that the material stands out
from the rest of the text. This can be used to enhance readability, or to
simply emphasise something. Its syntax is simple:

23
Horace smiled and retaliated:
\begin{quote}
You can mock the non-WYSIWYG nature of \TeX\
all you like. You don’t understand that that is
precisely what makes \TeX\ enormously more powerful
than that lame excuse for a typesetter you use.
In your case, what you see
is \emph{all} you get!
\end{quote}
and then continued with composing his masterpiece of the
typesetting art.

produces the following typeset material:


Horace smiled and retaliated:
You can mock the non-WYSIWYG nature of TEX all you like. You don’t
understand that that is precisely what makes TEX enormously more powerful
than that lame excuse for a typesetter you use. In your case, what you see
is all you get!
and then continued with composing his masterpiece of the typesetting
art.
That is a much more readable manner of presenting Horace’s piece of mind
than embedding it within a regular paragraph. The quote environment was
responsible for the margins being indented on both sides during the quote.
The quotation environment is used in just the same way as the quote
environment above, but it is intended for setting long quotations of several
paragraphs. It would be suitable for quoting a few paragraphs from the text
of some speech, for instance. LATEX treats the given text just like normal
text that it has to set into paragraphs, except that it indents the margins a
little.

2.16.2 center environment


This environment allows the centring of consecutive lines of text, new lines
being indicated by a \\. If you don’t separate lines with the \\ command
then you’ll get a centred paragraph the width of the page, which won’t look
any different to normal. If only one line is to be centred, then no \\ is
necessary.

24
The \texttt{center} environment takes care of the vertical
spacing before and after it, so we don’t need to leave any.
\begin{center}
If we leave no blank line after the\\
\texttt{center} environment\\
then the ensuing text will not\\
be regarded as part of a new\\
paragraph, and so will not be indented.\\
\end{center}

In this case we left a blank line after the environment,


so the new text was regarded as starting a new paragraph.

gives the following text


The center environment takes care of the vertical spacing before
and after it, so we don’t need to leave any.

If we leave no blank line after the


center environment
then the ensuing text will not
be regarded as part of a new
paragraph, and so will not be indented.

In this case we left a blank line after the environment, so the new
text was regarded as starting a new paragraph.

2.16.3 verbatim environment


We can simulate typed text using the verbatim environment. The \texttt{ }
(typewriter text) type style can be used for simulating typed words, but runs
into trouble if one of the characters in the simulated typed text is a specially
reserved LATEX character. For instance, \texttt{type \newline} would
not have the desired effect because LATEX would interpret the \newline is an
instruction to start a new line.
The verbatim environment allows the simulation of multiple typed lines.
Everything within the environment is typeset in typewriter font exactly as it
appears in our source file—obeying spaces and line breaks as in the source
file and not recognising the existence of any special symbols.

25
\begin{verbatim}
In the verbatim environment we can type anything
we like.
So we don’t need to look out for uses of %, $, & etc,
nor will control sequences like \newline have any
effect.
\end{verbatim}

will produce the simulated input text


In the verbatim environment we can type anything
we like.
So we don’t need to look out for uses of %, $, & etc,
nor will control sequences like \newline have any
effect.

The only thing that cannot be typed in the verbatim environment is


the sequence \end{verbatim}. You might notice that I still managed to
simulate that control sequence above. One can always get what you want in
TEX, perhaps with a little creativity.
If we want only to simulate a few typed words, such as when I say to
use \newline to start a new line, then the \verb command is used. This
command has a slightly odd syntax, pressed upon it by the use for which
it was intended. It cannot accept an argument, because we may want to
simulate typed text that is enclosed by {braces}. What one does is to choose
any character that is not in the text to be simulated, and use a pair of these
characters as “argument delimiters”. I usually use the @ or " characters, as
I rarely have any other uses for them. Thus
use \% to obtain a % sign
is typed as

use \verb"\%" to obtain a \% sign

2.16.4 itemize, enumerate, description environments


LATEX provides three predefined list-making environment, and a “primitive”
list environment for designing new list environments of your own. We shall
just describe the predefined ones here.

26
There is delightfully little to learn in order to be able to create lists.
The only new command is \item which indicates the beginning of a new
list item (and the end of the last one if this is not the first item). This
command accepts an optional argument (which means you’d enclose it in
square brackets) that can be used to provide an item label. If no optional
argument is given, then LATEX will provide the item label for you; in an
itemize list it will bullet the items, in an enumerate list it will number the
items, and in a list of descriptions the default is to have no label (which
would look a bit odd, so you’re expected to use the optional argument there).
Remember that \item is used to separate list items; it does not accept
the list item as an argument.
\begin{itemize}
\item an item is begun with \verb@\item@
\item if we don’t specify labels, then
\LaTeX\ will bullet the items for us
\item I indent lines after the first in the
input file, but that is just to keep things
readable. As always, \LaTeX\ ignores additional
spaces.

\item a blank line between items is ignored, for


\LaTeX\ is responsible for spacing items.
\item \LaTeX\ is in paragraph-setting mode when
it reads the text of an item, and so will
perform all the usual functions
\end{itemize}

produces the following itemised list:


• an item is begun with \item
• if we don’t specify labels, then LATEX will bullet the items for us
• I indent lines after the first in the input file, but that is just to keep things readable.
As always, LATEX ignores additional spaces.
• a blank line between items is ignored, for LATEX is responsible for spacing items.
• LATEX is in paragraph-setting mode when it reads the text of an item, and so will
perform all the usual functions

Lists can also be embedded within one another, for they are just environ-
ments and we said that environments have this property. Remember that we

27
must nest them in the correct order. We demonstrate with the following list,
which also shows how to use the enumerate environment.
\noindent I still have to do the following things:
\begin{enumerate}
\item Sort out LAN accounts for people on the course
\begin{itemize}
\item Have new accounts created for those not already
registered on the LAN
\item Make sure all users have a personal directory
on the data drive
\end{itemize}
\item Have a \TeX\ batch file added to a directory that
is on a public search path
\end{enumerate}

will give the following list


I still have to do the following things:
1. Sort out LAN accounts for people on the course
• Have new accounts created for those not already registered on the LAN
• Make sure all users have a personal directory on the data drive
2. Have a TEX batch file added to a directory that is on a public search path

See how I lay the source file out in a readable fashion. This is to assist
myself, not LATEX.
The description environment is, unsurprisingly, for making lists of de-
scriptions.
\begin{description}
\item[\texttt{itemize}] an environment for setting itemised lists.
\item[\texttt{enumerate}] an environment for setting numbered lists.
\item[\texttt{description}] an environment for listing descriptions.
\end{description}

will typeset the following descriptions:


itemize an environment for setting itemised lists.
enumerate an environment for setting numbered lists.
description an environment for listing descriptions.

28
2.16.5 tabbing environment
This environment simulates tabbing on typewriters. There one chose the tab
stops in advance (analysing the material to be typed for the longest item in
each column) and typed entries consecutively, hitting the tab key to move to
the next tab stop and return to move to the next line.
In the tabbing environment, we proceed similarly. We look for the worst-
case line (that which will determine the desired tab stops) and use it to set
the tabs by inserting \= control symbols at the points where we want tab
stops. We then discard that line using \kill, since the worst-case line might
not be the first line in the material we have to type. We then type each line,
using \> to move to the next tab stop and \\ to end a line.
\begin{tabbing}
Cheddar cheese \= Recommended \= \$2.00 \kill
Green Ham \> Recommended \> \$2.00
Eggs \> 1 a week \> \$1.50
Cheddar cheese \> Hmmm \> \$0.80
Yak cheese \> Avoid \> \$0.05
\end{tabbing}

gives the following uniformly-tabbed table

Green Ham Recommended $2.00


Eggs 1 a week $1.50
Cheddar cheese Hmmm $0.80
Yak cheese Avoid $0.05

In the format line I chose the longest entry from each of the prospective
columns. I lined some of the \> commands up in the source just to keep
things readable.
Remember that excess spaces are ignored. LATEX sets the \killed line
normally and sees where the tab stops requested will be needed in the typeset
text. Note also that commands given within the tabbing environment are
local to the current item.
Actually, we use the above approach in the case that we require uniformly
tabbed columns. The format line is not compulsory, and we can define tab
stops dynamically. See if you can make sense of the following.

29
\begin{tabbing}
Entry in position 1,1 \= Entry 1,2 \= Entry 1,3\\
Entry in position 2,1 \> Entry 2,2 \> Entry 2,3\\
Entry 3,1 \= Entry 3,2 \> Entry 3,3\\
Entry 4,1 \> Entry 4,2 \> Entry 4,3
\end{tabbing}

which produces

Entry in position 1,1 Entry 1,2 Entry 1,3


Entry in position 2,1 Entry 2,2 Entry 2,3
Entry 3,1 Entry 3,2 Entry 3,3
Entry 4,1 Entry 4,2 Entry 4,3

The are additional commands that can be used within the tabbing envi-
ronment to achieve special effects, but we won’t be discussing them here.

2.16.6 tabular environment


The tabular environment is used to produce tables of items, particularly
when the table is predominantly rectangular and when line drawing is re-
quired. LATEX will make most decisions for us; for instance it will align
everything for us without having to be told which are the longest entries in
each column.
This environment is the first of many that use the TEX “tabbing char-
acter” &. This character is used to separate consecutive entries in a row of
a table, array, etc. The end of a row is indicated in the usual manner, by
using \\. In this way the individual cells of the table, or array, are clearly
described to LATEX, and it can analyse them to make typesetting decisions.
Commands issued within a cell so defined are, again, local to that cell.
The tabular environment is also our first example of an environment
with arguments. The arguments are given, in braces as usual, just after the
closing brace after the environments name. In the case of tabular there is
a single mandatory argument giving the justification of the entries in each
column: l for left justified, r for right justified, and c for centred. There
must be an entry for each column of the table, and there is no default. Let’s
start with a simple table.

30
\begin{tabular}{llrrl}
\texbf{Student name} & \textbf{Number} & \textbf{Test 1}
& \textbf{Test 2} & \textbf{Comment}\\
F. Basset & 865432 & 78 & 85 & Pleasing\\
H. Hosepipe & 829134 & 5 & 10 & Improving\\
I.N. Middle & 853931 & 48 & 47 & Can make it
\end{tabular}

will produce the following no-frills table


Student name Number Test 1 Test 2 Comment
F. Basset 865432 78 85 Pleasing
H. Hosepipe 829134 5 10 Improving
I.N. Middle 853931 48 47 Can make it
Note that a \\ was not necessary at the end of the last row. Also note
that, once again, the alignment of the & characters was for human readability.
It is conventional to set columns of numbers with right justification.
A | typed in the tabular environment’s argument causes a vertical line
to be drawn at the indicated position and extending for the height of the
entire table. An \hline given in the environment draws a horizontal line
extending the width of the table to be drawn at the vertical position at
which the command is given. A \cline{i-j} draws a line spanning columns
i to j, at the vertical position at which the command is given. A repeated
line-drawing command causes a double line to be drawn. We illustrate line
drawing in tables by putting some lines into our first table. We will type this
example in a somewhat expanded form, trying to make it clear why the lines
appear where they do.
\begin{tabular}{|l|l|r|r|l|}
\hline
\textbf{Student name} & \textbf{Number} & \textbf{Test 1}
& \textbf{Test 2} & \textbf{Comment}\\
\hline
F. Basset & 865432 & 78 & 85 & Pleasing\\
\hline
H. Hosepipe & 829134 & 5 & 10 & Improving\\
\hline
I.N. Middle & 853931 & 48 & 47 & Can make it\\
\hline
\end{tabular}

which will give

31
Student name Number Test 1 Test 2 Comment
F. Basset 865432 78 85 Pleasing
H. Hosepipe 829134 5 10 Improving
I.N. Middle 853931 48 47 Can make it
That way of laying out the source file makes it clear where the lines will
go. As we (by now) well know, the returns that we pressed after the \\s in
typing this table might as well have been spaces as far as LATEX is concerned.
Thus it is common to have the \hline commands following the \\s on the
input lines. We will do this in future examples.
The \multicolumn column can be used to overrule the overall format of
the table for a few columns. The syntax of this command is
\multicolumn {n }{pos }{item }
where n is the number of columns of the original format that item is to span,
and pos specifies the justification of the new argument.
\begin{tabular}{||l|c|c|c||} \hline
\multicolumn{4}{|c|}{\LaTeX\ size changing commands}\\ \hline
Style option & 10pt (default) & \tt 11pt & \tt 12pt\\ \hline
\tt\bs footnotesize & 8pt & 9pt & 10pt\\ \hline
\tt\bs small & 9pt & 10pt & 11pt\\ \hline
\tt\bs large & 12pt & 12pt & 14pt\\ \hline
\end{tabular}

produces the following table:


LATEX size changing commands
Style option 10pt (default) 11pt 12pt
\footnotesize 8pt 9pt 10pt
\small 9pt 10pt 11pt
\large 12pt 12pt 14pt

2.16.7 figure and table environments


Figures (diagrams, pictures, etc.) and tables (perhaps created with the tabular
environment) cannot be split across pages. So LATEX provides a mechanism
for “floating” them to a nearby place where there is room for them. This may
mean that your figure or table may appear a little later in the document than
its declaration in the source file might suggest. You can suggest to LATEX
that it try to place the figure or table at the present position if there is room
or, failing that, at the top or bottom of the present or following page. You
can also ask for it to be presented by itself on a “page of floats”.

32
You suggest these options to LATEX through an optional argument to the
environment. One lists a combination of the letters h, t, b, and p where

ht means that the object should be placed here if there is room, so that
things will appear in the same order as in the source file,

t means that the object can be placed at the top of the of a text page, but
no earlier than the present page.

b means that the object can be placed at the bottom of a text page, but no
earlier than the present page.

p means that the object should be set on a page of floats that consists only
of tables and figures.

A combination of these indicates decreasing order of preference. The


default is tbp.
LATEX will also number and caption a figure or table for you, and com-
pile a list of tables and a list of figures. Just include \listoffigures and
\listoftables next to your \tableofcontents command at the beginning
of the document. To caption a table of figure, include \caption{caption
text} just before the \end{table} or \end{figure} command. Here’s a
sample source file.
\begin{table}[ht]
\begin{tabular}{lrll}
...
\end{tabular}
\caption{Mark analysis}
\end{table}

To leave space for a figure that will inserted by some other means at a
later date, we can use the \vspace command:
\begin{figure}[ht]
\vspace{9.5cm}
\caption{An artists impression}
\end{figure}

Including graphics files prepared with drawing packages is possible, but


beyond the scope of this introduction.

33
2.17 The letter document class
To write a letter, we can make use of the letter document class. We give
here a sample letter:
\documentclass[12pt]{letter}
\usepackage{amssymb, amsmath, amsthm, amsfonts}
\begin{document}
\begin{Letter}{Director of Public Parks\\
Pietermaritzburg Municipality\\
Pietermaritzburg}

\address{(Underneath) Lion Bridge\\


Midway down Commercial Road\\
Pietermaritzburg\\
3200}

\signature{F. Basset}

\opening{Kind Sir/Madam,}

I wish to complain about the shocking practice of


fencing off the base of trees. I notice with grave
concern that this has occurred in the park bordering
my stately residence, and I demand that
you take these obscene obstructions away without
delay.

\closing{Yours anxiously,}
\end{letter}
\end{document}

2.18 Bibliography
LATEX has a very convenient system of making a bibliography, in that it
automatically numbers bibliographic entries. Below is an example of a bib-
liography; such a bibliography is usually put at the very end of a document
(right before \end{document}), though in principle it could be put anywhere.
(Note that the bibliographic style used below corresponds to the style of the
American Mathematical Society, and is somewhat different than other bibli-
ographics styles, such as in the humanities.)

34
\begin{thebibliography}{99}

\bibitem{MARK}
Markov, A. A.,
\emph{Unsolvability of the problem of homeomorphism},
Proc. Int. Cong. Math.,
1958,
pp.~300--306
(Russian).

\bibitem{MU1}
Munkres, James R.,
\emph{Topology, A First Course},
Prentice-Hall,
Englewood Cliffs, NJ,
1975.

\bibitem{ir63}
Richards, Ian,
\emph{On the classification of noncompact surfaces},
Trans. Amer. Math. Soc.,
\textbf{106}~(1963),
259--269.

\end{thebibliography}

The above produces:

35
Bibliography

[1] Markov, A. A., Unsolvability of the problem of homeomorphism, Proc. Int. Cong.
Math., 1958, pp. 300–306 (Russian).
[2] Munkres, James R., Topology, A First Course, Prentice-Hall, Englewood Cliffs, NJ,
1975.
[3] Richards, Ian, On the classification of noncompact surfaces, Trans. Amer. Math. Soc.,
106 (1963), 259–269.

Observe that each new bibiographic item starts with \bibitem{labelname},


where labelname is used to refer to the bibliographic entry in the text of
the document. As is the case with other labels, these bibliographic labels
do not appear in the printed version of the text, and you can choose any-
thing you want for the label, preferably something mnemonic. To refer to
a bibliographic item, we would write \cite{labelname}. Optional addi-
tional information, such as chapter or page numbers, can be put in square
brackets. For example, if we write \cite{MU1} we would have [2], whereas
\cite[Section 3.1]{MU1} yields [2, Section 3.1].
Note that unlike regular text, in the bibliographic items TEX is not both-
ered by a period that is not at the end of a sentence, and you do not need
to do anything about such periods.

2.19 Common pitfalls; Error messages


By now it should be clear that we have to work quite accurately when prepar-
ing a document. Typing errors in the running text can be absorbed, but
messing up a control sequence name will halt the compiler with an error
message. Before we look at some common errors and some ways to avoid
them, let’s have a look at a sample error message.
You’ll have noticed by now that when you run LATEX on a source file,
the transcript of the compiler session is written on a log file. When errors

36
have accumulated to the point that LATEX is hopelessly confused, it is time
to debug your source file. The log file contains a reference to the line, or
lines, of your source file that generated the error together with a description
of the error.
TEX and LATEX error messages appear frightening at first sight, to say
the least. They are actually very informative, but they can take some get-
ting used to. Mistyped control sequences cause little pain, but a missing
\end{environment} can cause a good deal of confusion because it has the
effect of making LATEX try to set material into that environment that was
never intended/designed to fit in such a place. Also, ommiting a mandatory
argument can cause great confusion.
Suppose we type \textbold instead of \textbf in the following line:
this is going to be \textbold{very} messy.

This produces the following error message:


! Undefined control sequence.
1.683 this is going to be {\textbold
very} messy.
?

That’s not so bad! The line beginning with ! tells us that we have tried
to used a control sequence that was not known to LATEX; the 1.683 tells us
that the error occurred on line 683 of the source file; and the error message
is split over two lines with the break occurring at the point where LATEX
detected a problem.
But suppose we try the following
\begin{tabular}{llrrl}
Student name & Number & Test 1 & Test 2 & Comment\\
F. Basset & 865432 & 78 & 85 & Pleasing\\
H. Hosepipe & 829134 & 5 & 10 & Improving\\
I.N. Middle & 853931 & 48 & 47 & Can make it

This shows that H.~Hosepipe’s newfound concentration has...

i.e., we omit to provide the \end{tabular} that delimits the end of the
environment. Not having been told that the environment is supposed to be
concluded, LATEX will try to set the text of the next paragraph as a table

37
item—and will scream blue murder when it finds that it doesn’t conform to
the syntax demanded.
LaTeX error. See LaTeX manual for explanation.
Type H <return> for immediate help.
! \begin{tabular} ended by \end{document}.
\@latexerr ...diate help.}\errmessage {#1}

\@checkend ...urrenvir \else \@badend {#1}


\fi
\enddocument ->\@checkend {document}
\clearpage \begingroup \if@filesw...
\end #1->\csname end#1\endcsname
\@checkend {#1}\expandafter \endgrou...
l.58 \end{document}

Now that’s informative! Actually it is if we agree to ignore all but the


the error indication line (the one beginning with the !) and the line telling
us where LATEX noticed that all was not well (the one beginning 1.58 in this
case). The rest of the error message you can regard as being for your local
TEX wizard to sort your problem out if you are unable to after consulting the
manuals. Tough as it looks, we can decipher this message straight away: the
error indicator line tell us that a tabular environment was ended incorrectly
(in this case by an \end{document}).
TEX error messages aren’t all that bad once you’ve made enough errors
to get used to a few! Most can be avoided through careful preparation of
the source file. Typing accurately and knowledge of the command syntax is
a good start, but there are some other precautions that make good sense:
1. Even if LATEX is happy with free-form input, try to lay your input file
out as regularly and logically as possible—you will make fewer errors
that way.
2. It is important that all group delimiters be properly matched, i.e.,
braces and \begin{}. . . \end{} must come in pairs. A good habit to
fall in to is to always type such things in pairs and then move the cursor
back between them and type the intervening material.
3. Don’t forget command arguments when they are mandatory. Always
ask yourself what a particular commands needs from you in order to

38
make the decisions that are required of it.

4. Remember the 10 characters that are specially reserved for comment-


ing, table item separation, etc.

5. When we look at mathematical typesetting in the next chapter, we will


see that the same principles apply there.

6. Try to use a text editor that has a TEX mode, or at least one that will
match brackets for you.

39
Chapter 3

Mathematical Typesetting with


LATEX

3.1 Introduction
In text-only documents we saw that our task was to describe the logical
components of each sentence, paragraph, section, table, etc. When we tell
LATEX to go into mathematical mode, we have to describe the logical parts of
a formula, matrix, operator, special symbol, etc. LATEX has been taught to
recognize a binary operation, a binary relation, a variable, an operator that
expects limits, and so on. We just need to supply the parts that make up
each of these, and LATEX will automatically leave appropriate space around
operators, italicise variables, set an operator name in roman type, leave the
correct space after colons, place sub- and superscripts in the correct positions
(based on what it is you’re working with), choose the correct typesizes, and
more. When you want to revert to setting normal text again, you tell LATEX
too leave math mode and go back into the mode it was in (paragraphing
mode).
LATEX cannot be expected to perform these mode shifts itself, for it is not
always clear just when it is mathematics that has been typed. For example,
should an isolated letter a in the input file be regarded as a word (as in the
definite article) or a mathematical variable (as in the variable a). There are
no reliable rules for LATEX to make such decisions by, so the begin-math and
end-math mode switching is left entirely to you.
The symbol $ is specially reserved by LATEX as the “math shift” symbol

40
(see Section 2.6). When LATEX starts setting a document it is in paragraphing
mode, ready to set lines of the input file into paragraphs. It remains in this
mode until it encounters a $ symbol, which shifts LATEX into mathematical
mode. It reads everything up to the next $ sign in this mathemtical mode,
and then shifts back to the mode it was in before we took it in to math mode.
You must be careful to balance your begin-math and end-math symbols.
It is often a good idea to type two $ symbols and then move back between
them and type the mathematical expression. If the math-shift symbols in a
document are not matched, then LATEX will become confused because it will
be trying to set non-mathematical material as mathematics.
For those who find having the same symbol for both math-begin and
math-end confusing or dangerous, there are two control symbols that perform
the same operations: the control symbol \( is a begin-math instruction, and
the control symbol \) is an end-math instruction. Because it is easy to
“lose” a $ sign when typing a long formula, a math environment is provided
for such occasions: you can use \begin{math} and \end{math} as the math-
shift instructions. However, most often the $ sign suffices.
Let’s have a look at some mathematics.
\LaTeX\ is normally in paragraphing mode, where
it expects to find the usual paragraph material. Including
a mathematical expression, like $2x+3y - 4z= -1$, in the
paragraph text is easy.
Typing the above expression without entering math
mode produces the incorrect result: 2x+3y - 4z= -1

will produce the following paragraph


LATEX is normally in paragraphing mode, where it expects to find
the usual paragraph material. Including a mathematical expression, like
2x + 3y − 4z = −1, in the paragraph text is easy. Typing the above
expression without entering math mode produces the incorrect result:
2x+3y - 4z= -1
Notice that LATEX sets space around the binary relation = and space
around the binary operators + and − on the left hand side of the equation,
ignoring the spacing we typed in the input. It was also able to recognize that
the −1 on the right hand side of the equation was a unary minus—negating
the 1 rather than being used to indicate subtraction—and so did not put
space around it. It also italicised the variables x, y, and z. However, it did
not italicise the number 1.
In typing a mathematical expression we must remember to keep the fol-

41
lowing in mind:

1. All letters that are not part of an argument to some control sequence
will be italicised. So typing $f(x)>0 for x > 1$ will produce

f (x) > 0f orx > 1

instead of the expression

f (x) > 0 for x > 1

that we intended. Numerals and punctuation marks are set in normal


roman type but LATEX will take care of the spacing around punctuation
symbols, as in

$f(x,y) \geq 0$

which produces
f (x, y) ≥ 0 .

2. Even a single letter can constitute a formula, as in “the constant a”.


To type this you enter $a$ in your source file. If you do not go in to
math mode to type the symbol, you’ll get things like “the constant a”.

3. Some symbols have a different meaning when typed in math mode. Not
only do ordinary letters become variables, but symbols such as - and
+ are now interpreted as mathematical symbols. Thus in math mode -
is no longer considered a hyphen, but as a minus sign.

4. LATEX ignores all spaces and carriage returns when in math mode,
without exception. So typing something like the constant$ a$ will
produce “the constanta”. You should have typed the constant $a$.
LATEX is responsible for all spacing when in math mode, and (as in
paragraphing mode) you have to specially ask to have spacing changed.
Even if LATEX does ignore all spaces when in math mode you should (as
always in TEX) still employ spaces to keep your source file readable.

One could type either

42
$f(x, y) = 2 (x+ y)y/(5xy - 3 )$

or

$f(x,y) = 2(x+y)y / (5xy-3)$

and you’d still get the correct result

f (x, y) = 2(x + y)y/(5xy − 3) .

There are some places where LATEX’s automatic spacing can go wrong.
For instance, if we wish to speak of the x–y plane then one has to know that
it is an endash that is supposed to be placed between the x and the y, not a
minus sign (as $x-y$ would produce). But typing $x--y$ will produce x−−y
since both dashes are interpreted as minus signs. To avoid speaking of the
x − y plane or the x − −y plane, we should type it as the $x$--$y$ plane.
Fortunately, LATEX can recognize and cope with by far the majority of our
mathematical typesetting needs.
Another thing to look out for is the use of braces in an expression. Typing
${x : f(x)>0}$

will not produce any braces. This is because, as we well know, braces are
reserved for delimiting groups in the input file. Looking back to Section 2.6,
we see how it should be done:
$ \{ x: f(x)>0 \} $

Math shift commands also behave as scope delimiters, so that commands


issued in an expression cannot affect anything else in a document.

3.2 Displaying a formula


LATEX considers an expression $ ... $ to be word-like in the sense that it
considers it to be eligible for splitting across lines of a paragraph (but with-
out hyphenation, of course). LATEX tries to avoid it splitting mathematical
formulas across lines, , but when there is no other way, it will split a for-
mula at a suitable place. But there are some expressions which are just too

43
long to fit into the running text without looking awkward. These are best
“displayed” on a line by themselves. Also, some expressions are sufficiently
important that they should be made to stand out. These, too, should be
displayed on a line of their own.
The mechanism for displaying an expression is the display math mode,
which is begun by typing $$ and ended by typing the same sequence (which
again means that we’d better be sure to type them in pairs). Corresponding
to the alternatives \( and \) that we had for the math shift character $, we
may use \[ and \] as the display-math shift sequences. One can also use the
environment
\begin{displaymath} ... \end{displaymath}

which is equivalent to $$ ... $$ and is suitable for use with long displayed
expressions. If you wish LATEX to number your equations for you you can use
the environment
\begin{equation}\label{labelname} ... \end{equation}

which is the same as the displaymath environment, except that an equa-


tion number will be generated. You do not write an equation number—
LATEX takes care of that. As discussed in Section 2.14, the name labelname
does not appear in the printed version of the text, and you can choose any-
thing you want for the label. To refer to the numbered equation, write
Equation~\ref{labelname}.
It is poor style to have a displayed expression either begin a paragraph
or be a paragraph by itself. This can be avoided if you agree never to leave
a blank line in your input file before a math display.
We will see later how to typeset an expression that is to span multiple
lines. For now, let’s look at an example of displaying an expression:
For each $a$ for which the Lebesgue-set $L_a(f) \neq \emptyset$ we define
$$
{\cal B}_a(f) = \{ L_{a+r}(f) : r > 0 \},
$$
and these are easily seen to be completely regular.

which produces

44
For each a for which the Lebesgue-set La (f ) = ∅ we define

Ba (f ) = {La+r (f ) : r > 0},

and these are easily seen to be completely regular.


We have not yet seen all the commands in the above formula, but we will
see them later in this chapter.

3.3 Using mathematical symbols


Mathematical symbols in LATEX are obtained by control words, most of which
are quite mnemonic. None of the control words for mathematical symbols
accepts an argument, but we’ll soon see that some of them prepare LATEX
for
 something that might follow. For instance, when you ask for the symbol
‘ ’ LATEX is warned that any sub- or superscripts that follow should be
positioned appropriately as limits to a summation.
Some of the symbols behavedifferently depending on where they are used.
For instance, when I ask for ni=1 ai within the running text, the limits are
places differently to when I ask for that expression to be displayed:

n
ai .
i=1

I typed nothing different here—just asked for display math mode.


It is important to note that almost all of the special math symbols are
unavailable in ordinary paragraphing mode. If you need to use one there,
then use an in-line math expression $...$.

3.3.1 Symbols available from the keyboard


A small percentage of the available symbols can be obtained from just a
single key press. They are + − = < > | / ( ) [ ] and ∗. Note that these must
be typed within math mode to be interpreted as math symbols.
Of course, all of a–z, A–Z, the numerals 0, 1, 2, . . . , 9 and the punctua-
tion characters , ; and : are available directly from the keyboard. Alphabetic
letters will be assumed to be variables that are to be italicised, unless told
otherwise (see Section 3.4.6). The numerals receive no special attention, ap-
pearing precisely as in normal paragraphing mode. The punctuation symbols
are still set in standard roman type when read in math mode, but a little

45
space is left after them so that expressions like {xi : i = 1, 2, . . . , 10} look like
they should. Note that this means that normal sentence punctuation should
not migrate into an expression.

3.3.2 Greek letters


Each lowercase Greek letter is accessed by typing the control word of the
same name as the symbol, using all lowercase letters.
α \alpha β \beta γ \gamma δ \delta
 \epsilon ε \varepsilon ζ \zeta η \eta
θ \theta ϑ \vartheta ι \iota κ \kappa
λ \lambda µ \mu ν \nu ξ \xi
π \pi  \varpi ρ \rho  \varrho
σ \sigma ς \varsigma τ \tau υ \upsilon
φ \phi ϕ \varphi χ \chi ψ \psi
ω \omega

To obtain an uppercase Greek letter, simply capitalize the first letter of


its name:
Γ \Gamma ∆ \Delta Θ \Theta Λ \Lambda
Ξ \Xi Π \Pi Σ \Sigma Υ \Upsilon
Φ \Phi Ψ \Psi Ω \Omega

3.3.3 Changing math fonts


Suppose that we want to write the sentence
For every x ∈ R, we have a set Fx .
We would obtain the blackboard bold and calligraphic uppercase letters
in the above sentence by writing
For every $x \in \mathbb{R}$, we have a set $\mathcal{F}_x$.

These two font change command, which work only in math mode, and
only for uppercase letters, are \mathbb{ } and \mathcal{ }.
We list here all the blackboard bold and calligraphic letters, so that we
can see, for reference purposes, what they all look like:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEF GHIJ KLMN OPQRST UVWX YZ

46
There are other change of text style commands that work specifically in
math mode, including \mathbf{ } (bold), \mathsf{ } (sans serif) and
\mathit{ } (italic). Use these commands only in math mode, and don’t
use the regular change of text style commands (for example \textbf{ } in
math mode).

3.3.4 Binary operators


LATEX has been taught to recognize binary operators and set the appropriate
space either side of one—i.e., it sets the first argument followed by a little
space, then the operator followed by the same little space and finally the
second argument. The binary operators that are available are the follow-
ing (recall that the binary operators +, −, and ∗ can be typed from the
keyboard):

± \pm ∩ \cap \diamond ⊕ \oplus


∓ \mp ∪ \cup  \bigtriangleup  \ominus
× \times  \uplus  \bigtriangledown ⊗ \otimes
÷ \div  \sqcap  \triangleleft  \oslash
∗ \ast  \sqcup  \triangleright  \odot
 \star ∨ \vee ∧ \wedge  \bigcirc
† \dagger \ \setminus  \amalg ◦ \circ
‡ \ddagger · \cdot  \wr • \bullet

Here are some examples:

Type To produce
$a+b$ a+b
$(a+b) \ otimes c$ (a + b) ⊗ c
$(a \vee b) \wedge c$ (a ∨ b) ∧ c
$X - (A \cap B) = (X-A) \cup (X-B)$ X − (A ∩ B) = (X − A) ∪ (X − B)

3.3.5 Binary relations


LATEX has been taught to recognize the use of binary relations, too. The
binary relations that are available are the following (recall that the binary
relations <, >, =, and | can be typed from the keyboard):

47
≤ \leq ≥ \geq ≡ \equiv |= \models
≺ \prec \succ ∼ \sim ⊥ \perp
# \preceq $ \succeq % \simeq | \mid
& \ll ' \gg ( \asymp ) \parallel
⊂ \subset ⊃ \supset ≈ \approx  \bowtie
⊆ \subseteq ⊇ \supseteq ∼
= \cong  \Join
 \sqsubset  \sqsupset = \neq \smile
.
/ \sqsubseteq 0 \sqsupseteq = \doteq ! \frown
∈ \in 1 \ni ∝ \propto
3 \vdash 4 \dashv

To negate a symbol you can precede the control word that gives the
symbol by a \not. Some symbols come with ready-made negations, which
should be used above the \not’ing method because the slope of the negating
line is just slightly changed to look more pleasing. Thus \notin should be
used above \not\in, and \neq should be used above \not =.
If negating a symbol produces a slash whose horizontal positioning is
not to your liking, then use the math spacing characters described in Sec-
tion 3.4.14 to adjust it.

3.3.6 Miscellaneous symbols


There are various miscellaneous symbols that these are available only in math
mode:
ℵ \aleph 6 \prime ∀ \forall ∞ \infty
 \hbar ∅ \emptyset ∃ \exists  \Box
ı \imath ∇
√ \nabla ¬ \neg  \triangle
 \jmath \surd # \flat  \triangle
$ \ell : \top % \natural ♣ \clubsuit
℘ \wp ⊥ \bot ' \sharp ♦ \diamondsuit
= \Re ) \| \ \backslash ♥ \heartsuit
? \Im ∠ \angle ∂ \partial ♠ \spadesuit
 \mho

Note that \imath and \jmath should be used when you need to accent
an i or a j in math mode (see Section 3.3.10)—you cannot use \i or \j that
were available in paragraphing mode.

3.3.7 Arrow symbols


LATEX has a multitude of arrow symbols, around which it will set the correct
space around. Note that vertical arrows can all be used as delimiters—see

48
Section 3.3.8. The available arrow symbols are:

← \leftarrow ←− \longleftarrow ↑ \uparrow


⇐ \Leftarrow ⇐= \Longleftarrow ⇑ \Uparrow
→ \rightarrow −→ \longrightarrow ↓ \downarrow
⇒ \Rightarrow =⇒ \Longrightarrow ⇓ \Downarrow
↔ \leftrightarrow ←→ \longleftrightarrow d \updownarrow
⇔ \Leftrightarrow ⇐⇒ \Longleftrightarrow f \Updownarrow
g → \mapsto g−→ \longmapsto h \nearrow
←) \hookleftarrow *→ \hookrightarrow i \searrow
+ \leftharpoonup - \rightharpoonup j \swarrow
/ \leftharpoondown 0 \rightharpoondown k \nwarrow
 \rightleftharpoons  \leadsto

3.3.8 Expression delimiters


A pair of delimters often enclose an expression, as in
  
a11 a12 x if x < 1
and f (x) = .
a21 a22 x2 if x ≥ 1

LATEX will scale delimiters to the correct size (determined by what they en-
close) for you, if you ask it to. There are times when you don’t want a
delimiter to be scaled, so it is left up to you to ask for scaling.
To ask that a delimter be scaleable, you precede it by \left or \right
according as it is the left or right member of the pair. Scaled delimiters must
be balanced correctly. It sometimes occurs, as in the right-hand example
above, that only one member of a delimiting pair is to be visible. For this
purpose, use the commands \left. and \right. which will produce no
visible delimiter but can be used to correctly balance the delimiters in an
expression. For examples of the use of delimiters, see Section 3.4.11, where
we learn about arrays. The available delimiters are:

( ( ) ) ↑ \uparrow
[ ] ] ] ↓ \downarrow
{ \{ } \} d \updownarrow
l \lfloor m \rfloor ⇑ \Uparrow
n \lceil o \rceil ⇓ \Downarrow
p \langle q \rangle f \Updownarrow
/ / \ \backslash
| — ) \|

49
 
3.3.9 Operators like and

These behave differently when used in display-math mode as compared with


in-text math mode. When used in text, they will appear in their small form
and any limits provided will be set so as to reduce the overall height of the
operator, as in N i=1 fi . When used in display-math mode, L TEX will choose
A

to use the larger form and will not try to reduce the height of the operator,
as in
N
fi .
i=1

If you want one of these operators to be used in text, but you want it to
look as it does when it is in display-math mode, simply insert the com-
mand \displaystyle at the start of the in-text math mode. For example, if

N
we write $\displaystyle \sum_{i=1}^{N}f_i$, we will obtain fi even
i=1
though it is in text. (The \displaystyle command should be used with
caution, because the resulting changes to line spacing often looks rather un-
pleasant, as in the previous sentence.
The available operators of this type are:
 

\sum \bigcap \bigodot
 
\prod \bigcup \bigotimes
  
\coprod \bigsqcup \bigoplus

  
\int \bigvee \biguplus

 
\oint \bigwedge

In Section 3.4.1 we will learn how to place limits on these operators.

3.3.10 Accents in math mode


The accenting commands that we learned for paragraphing mode do not
apply in math mode. Instead, we use the following command:

û \hat{u} ú \acute{u} ū \bar{u} u̇ \dot{u}


ǔ \check{u} ù \grave{u} 2u \vec{u} ü \ddot{u}
ŭ \breve{u} ũ \tilde{u}

50
Remember that i and j should lose their dots when accented, so \imath
and \jmath should be used. There also exist commands that give a “wide
hat” or a “wide tilde” to their argument, \widehat and \widetilde.

3.4 Some common mathematical structures


In this section we shall begin to learn how to manipulate all the symbols
listed in section 3.3. Indeed, by the end of this section we’ll be able to typeset
some quite large expressions. In the section following this we will learn how
use various alignment environments that allow us to prepare material like
multi-line expressions and arrays.

3.4.1 Subscripts and superscripts


Specifying a sub- or superscript is as easy as you’d hope—you just give
an indication that you want a sub- or superscript to the last expression
and provide the material to be placed there, and LATEX will position things
correctly. So sub- and superscripting a single symbol, an operator, or a big
array all involve the same input, and LATEX places the material according to
what the expression is that is being sub- or superscripted:
 2
N a11 a12 a 13
x2 , Xi ,  a21 a22 a23  .
i=1 a31 a32 a33
To tell LATEX that you want a single character set as a superscript to
the last expression, you just type a ^ before it. The “last expression” is the
preceding group or, if there is no preceding group, the single character or
symbol that the ^ follows:

Type To produce
$x^2$ x2
$\gamma^b$ γb
$(A+B)^2$ (A + B)2
% 2 &n
x +1
$\left[ \frac{x^2+1}{x^2 + y^2} \right]^n$ x2 +y 2

Subscripts of a single character are equally easy—you just use the under-
score character _ where you used ^ for superscripting:

51
Type To produce
$x_2$ x2
$x_i$ xi
$\Gamma_1(x)$ Γ1 (x)

Now let’s see how to set a sub- or superscript that consists of more than
just one character. This is no more difficult than before if we remember the
following rule: The symbols _ and ^ set the group that follows them as a
sub- and superscripts to the group that precedes the sub- and superscript
symbols. We see now now that our initial examples worked by considering a
single character to be a group by itself. Here are some examples:

Type To produce
$a^2b^3$ a2 b 3
$2^{21}$ 221
$2^21$ 22 1
$a^{x+1}$ ax+1
2
+1
$a^{x^2+1}$ ax
$(x+1)^3$ (x + 1)3
$\Gamma_{\alpha\beta\gamma}$ Γαβγ
${}_1A_2$ 1 A2

In the very last example we see a case of setting a subscript to an empty


group, which resulted in a kind of “pre-subscript”.
In all of the above examples the sub- and superscripts were set to single-
character groups. Nowhere did we group an expression before sub- or super-
scripting it. Even in setting the expression (x + 1)3 , the superscript 3 was
really only set to the character ). If we had wanted to group the (x + 1) be-
fore setting the superscript, we would have typed ${(x+1)}^3$ which gives
(x + 1)3 , with the superscript slightly raised. One has to go to this trouble
because, to most people, something like (xa )b is just as acceptable and as
readable as (xa )b . It also has the advantage of aligning the base lines in
expressions such as
(ab)−2 = [(ab)−1 ]2 = [b−1 a−1 ]2 = b−1 a−1 b−1 a−1
which looks more pleasing than if we use additional grouping to force
2
(ab)−2 = [(ab)−1 ] = [b−1 a−1 ] = b−1 a−1 b−1 a−1
2
,

52
and the latter has rather more braces in it that require balancing.
Here are some more examples, showing how LATEX will set things just as
we want without any further work on our part:

Type To produce
z
$x^{y^z}$ xy
2
$2^{(2^2)}$ 2(2 )
2ℵ0
$2^{2^{2^{\aleph_0}}}$ 22
d
$\Gamma^{z_c^d}$ Γz c

We can also make use of empty groups in order to stagger sub- and
superscripts to an expression, as in
$\Gamma_{\alpha\beta}{}^{\gamma}{}_\delta$

which will yield


Γαβ γ δ
One can specify the sub- and superscripts to a group in any order, but it is
best to be consistent. The most natural order seems to be to have subscripts
first, but you may think otherwise.

3.4.2 Primes
LATEX provides the control word \prime (6) for priming symbols. Note that
it is not automatically at the superscript height, so that to get f  you would
have to type
$f^\prime$ .

To make lighter work of this, LATEX will interpret a right-quote character as


a prime if used in math mode. Thus we can type
$f’(g(x)) g’(x) h’’(x)$

in order to get
f  (g(x))g  (x)h (x) .

53
3.4.3 Fractions
LATEX provides the \frac command that accepts two arguments: the numer-
ator and the denominator (in that order). Before we look at examples of its
use, let us just note that many simple in-text fractions are often better writ-
ten in the form num/den, as with 3/8 which can be typed as $3/8$. This is
also often the better form for a fraction that occurs within some expression.

Type To produce
x+1
$\frac{x+1}{x+2}$
x+2
1
$\frac{1}{x^2+1}$ 2
x +1
1 + x2
$\frac{1+x^2}{x^2+y^2} + x^2 y$ + x2 y
x2 + y 2
1
$\frac{1}{1 + \frac{x}{2}}$
1 + x2
1
$\frac{1}{1+x/2}$
1 + x/2

3.4.4 Roots
The \sqrt command accepts two arguments. The first, and optional, argu-
ment specifies what order of root you desire if it is anything other than the
square root. The second, and mandatory, argument specifies the expression
that the root sign should enclose:

Type To produce

$\sqrt{a+b}$ a+b

5
$\sqrt[5]{a+b}$ a+b
'
n 1+x
$\sqrt[n]{\frac{1+x}{1+x^2}}$ 2
√ +x
1
x+1
$\frac{\sqrt{x+1}} {\sqrt[3]{x^3+1}}$ √3
x3 + 1

54
3.4.5 Ellipsis
Simply typing three periods in a row will not give the correct spacing of the
periods if it is an ellipsis that is desired. So LATEX provides the commands
\ldots and \cdots. Centered ellipsis should be used between symbols like
+, −, ∗, ×, and =. Here are some examples:

Type To produce
$a_1+ \cdots + a_n$ a1 + · · · + an
$x_1 \times x_2 \times \cdots \times x_n$ x1 × x2 × · · · × xn
$v_1 = v_2 = \cdots = v_n = 0$ v1 = v2 = · · · = vn = 0
$f(x_1,\ldots,x_n) = 0$ f (x1 , . . . , xn ) = 0

3.4.6 Text within an expression


One can use the \text{ } command to insert normal text into an expres-
sion. This command forces LATEX temporarily out of math mode, so that its
argument will be treated as normal text. It’s use is simple, but we must be
wary on one count: remember that LATEX ignores all space characters when
in math mode; so to surround words in an expression that were placed by an
\text command by space you must include the space in the \text argument.

Type To produce
$f_i(x) \leq 0 \text{ for } x \in I$ fi (x) ≤ 0 for x ∈ I
$\Gamma(n)=(n-1)! \text{ when $n$ is an integer}$ Γ(n) = (n − 1)! when n is an integer

In section 3.4.14 we’ll learn of some special spacing commands that can
be used in math mode. These are often very useful in positioning text within
an expression, enhancing readability and logical layout.

3.4.7 Log-like functions


There are a number of function names and operation symbols that should be
set in normal (roman) type in an expression, such as in

f (θ) = sin θ + log(θ + 1) − sinh(θ2 + 1)

55
and
sin h
lim =1 .
h→0 h

We know that simply typing $log\theta$ would produce the incorrect


result
logθ
and that using $\mbox{log}\theta$ would leave us having to insert a little
extra space between the log and the θ

logθ .

So LATEX provides a collection of “log-like functions” defined as control se-


quences. The following table shows those that are available.

\arccos \cos \csc \exp \ker \limsup \min \sinh


\arcsin \cosh \deg \gcd \lg \ln \Pr \sup
\arctan \cot \det \hom \lim \log \sec \tan
\arg \coth \dim \inf \liminf \max \sin \tanh

Here are some examples of log-like functions:

Type To produce
$f(x)=\sin x + \log(x^2)$ f (x) = sin x + log(x2 )
$\delta = \min \{ \delta_1, \delta_2 \}$ δ = min{δ1 , δ2 }
$\chi(X) = \sup_{x\in X} \chi(x)$ χ(X) = supx∈X χ(x)
$\lim_{n \rightarrow \infty} S_n = \gamma$ limn→∞ Sn = γ

Notice how LATEX does more than just set an operation like sup in roman
type. It also knew where a subscript to that operator should go.
As is the case with operators, when a log-like function takes a sub-
script, it looks different when in text and when in display, though that
difference can be overridden with the \displaystyle command. Compare
$\lim_{x \rightarrow 0} f(x)$, which produces limx→0 f (x), with
$$\lim_{x \rightarrow 0} f(x)$$, which produces

lim f (x),
x→0

with $\displaystyle \lim_{x \rightarrow 0} f(x)$, which produces lim f (x).


x→0

56
3.4.8 Over- and Underlining and bracing
The \underline command will place an unbroken line under its argument,
and the \overline command will place an unbroken line over its argument.
These two commands can also be used in normal paragraphing mode (but be
careful: LATEX will not break the line within an under- or overlined phrase,
so don’t go operating on large phrases).
You can place horizontal braces above or below an expression by making
that expression the argument of \overbrace or \underbrace. You can place
a label on an overbrace (resp. underbrace) by superscripting (resp. subscript-
ing) the group defined by the bracing command.

Type To produce
$\overline{a+bi} = a- bi$ a + bi = a − bi
$\overline{\overline{a+bi}} = a+bi$ a + bi = a + bi

And some examples of horizontal bracing:


$A^n=\overbrace{A \times A \times \ldots \times A}^{\mbox{$n$ terms}}$

$\forall x \underbrace{\exists y (y \succ x)}_{\mbox{scope of $\forall$}}$

will produce
n terms
( )* +
A = A× A× ...× A
n

and
∀x ∃y(y x)
* +( )
scope of ∀

3.4.9 Stacking symbols


LATEX allows you to set one symbol above another through the \stackrel
command. This command accepts two arguments, and sets the first centrally
above the second.
Type To produce
f∗
$X \stackrel{f^*}{\rightarrow}Y$ X→Y

$f(x) \stackrel{\triangle}{=} x^2 + 1$ f (x) = x2 + 1

57
3.4.10 Operators; Sums, Integrals, etc.
Each of the operation symbols listed in Section 3.3.9 can occur with limits.
They are specified as sub- and superscripts to the operator, and LATEX will
position them appropriately. In an in-text formula they will appear in more-
or-less the usual scripting positions; but in a displayed formula they will be
set below and above the symbol (which will also be a little larger). The
following should give you an idea of how to use them:

Type To produce
N
$\sum_{i=1}^{N} a_i$ ai
 b i=1
$\int_a^b f$ f
a
$\oint_{\cal C}f(x)\,dx$ f (x) dx
C
$\prod_{\alpha \in A} X_\alpha$ α∈A Xα

$\lim_{N\rightarrow\infty}\sum_{i=1}^{N}f(x_i)\Delta x_i$ limN →∞ N i=1 f (xi )∆xi

We’ll have more to say about the use of \, in section 3.4.14. Let’s have
a look at each of those expressions when displayed:


N  b  
N
ai , f , f (x) dx , Xα , lim f (xi )∆xi
a C N →∞
i=1 α∈A i=1

3.4.11 Arrays
The array environment is provided for typesetting arrays and array-like ma-
terial. It accepts two arguments, one optional and one mandatory. The
optional argument specifies the vertical alignment of the array—use t, b, or
c to align the top, bottom, or centre of the array with the centreline of the
line it occurs on (the default being c). The second argument is as for the
tabular environment: a series of l, r, and c’s that specify the number of
columns and the justification of these columns. The body of the array en-
vironment uses the same syntax as the tabular environment to specify the
individual entries of the array.
For instance the input

58
let $A = \left[\begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}\right] $

will produce the output


 
12 3 4
let A =  −2 1 0 
3 7 9
Note that we had to choose and supply the enclosing brackets ourselves
(they are not placed for us so that we can use the array environment for
array-like material; also, we get to choose what type of brackets we want this
way). As in the tabular environment, the scope of a command given inside
a matrix entry is restricted to that entry.
We can use ellipsis within arrays as in the following example:
\det A = \left| \begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array} \right|

which produces
, ,
, a11 a12 ··· a1n ,
, ,
, a21 a22 ··· a2n ,
, ,
det A = , . .. .. .. ,
, .. . . . ,
, ,
, am1 am2 ··· amn ,
A special case of an array is the cases environment, which is as follows:
f(x) = \begin{cases}
x & \text{for $x<1$}\\
x^2 & \text{for $x \geq 1$}
\end{cases}.

which will yield



x for x < 1
f (x) = .
x2 for x ≥ 1

59
3.4.12 Alignment
Recall that the equation environment can be used to display and automati-
cally number a single-line equation (see Section 3.2). The align environment
is used for displaying and automatically numbering either a single expression
that spreads over several lines or multiple expressions, while taking care of
alignment for us. The align* environment does this without numbering any
equations. It is necessary to input the amsmath package to use the align
and align* environments. Do NOT use $$ ... $$ symbols when using the
align environment.
\begin{align}
(a+b)(a+b) & = a^2 + 2ab + b^2\\
(a+b)(a-b) & = a^2 - b^2
\end{align}

will give

(a + b)(a + b) = a2 + 2ab + b2 (3.1)


(a + b)(a − b) = a2 − b2 (3.2)

Observe that the & sign is used to mark the place in each line that is
aligned. We can also leave entries empty, to obtain effect like the following:
\begin{align*}
\frac{d}{dx} \sin x & = \lim_{h\rightarrow0}\frac{\sin(x+h)-\sin x}{h}\\
& = \lim_{h\rightarrow0}\frac{\sin x\cos h + \cos x\sinh - \sin x}{h}\\
& = \lim_{h\rightarrow0}\frac{\sin x(\cos h-1)}{h} + \cos x\frac{\sin h}{h}\\
& = \cos x
\end{align*}

which produces

60
d sin(x + h) − sin x
sin x = lim
dx h→0 h
sin x cos h + cos x sinh − sin x
= lim
h→0
 h -
sin x(cos h − 1) sin h
= lim + cos x
h→0 h h
= cos x

3.4.13 Other Multiline Environments


The gather environment is used for displaying consecutive displayed equa-
tions, but keeps the equations close to each other, rather than having them
spread out, which is what would happen is each equation were put in its
own $$ . . . $$ environment. The syntax is similar to that of the align
environment, except that no & signs are used, because there is no alignment.
The gather* environment does the same thing without numbering any equa-
tions. It is necessary to input the amsmath package to use the gather and
gather* environments. Do NOT use $$ ... $$ symbols when using the
gather environment. Here is an example:
\begin{gather*}
(a+b)^2 = a^2 + 2ab + b^2\\
(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3
\end{gather*}

will give

(a + b)2 = a2 + 2ab + b2
(a + b)3 = a3 + 3a2 b + 3ab2 + b3

By comparison,
$$(a+b)^2 = a^2 + 2ab + b^2$$
$$(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3$$

will give

61
(a + b)2 = a2 + 2ab + b2
(a + b)3 = a3 + 3a2 b + 3ab2 + b3
which has extra space between the two equations.
Another useful environment is multline, which is used for breaking up a
long equation. (Note: it does NOT say multiline.) The syntax is similar to
that of the align environment, but again there are no & signs, because there
is no alignment. The multline* environment does the same thing without
numbering any equations. It is necessary to input the amsmath package to
use the multline and multline* environments. For example:
\begin{multline}
\sum_{\sigma^n \in K} \frac{(-1)^n(n-1)}2 =
- \sum_{\sigma^{n-1} \in K} T_n({\sigma^{n-1}}) (-1)^{\dim \sigma^{n-1}}\\
- \sum_{\sigma^n \in K} T_n({\sigma^n}) (-1)^{\dim \sigma^n}.
\end{multline}

will give

 (−1)n (n − 1)  n−1
=− Tn (σ n−1 )(−1)dim σ
σn ∈K
2
σn−1 ∈K
 n
− Tn (σ n )(−1)dim σ . (3.3)
σn ∈K

3.4.14 Changes to spacing


Sometimes the default LATEX spacing needs adjusting. For these purposes we
have the following spacing commands:

\, thin space \: medium space


\! negative thin space \; thick space
\quad a quad of space \qquad two quads of space

The spacing commands \,, \quad, and \qquad can be used in paragraph-
ing mode, too. Here are some examples of these spacing commands used to
make subtle modifications to some expressions.

62
Type To produce

$\sqrt{2} \, x$ 2x
b
$\int_a^b f(x)\,dx$ a
f (x) dx
$\Gamma_{\!2}$ Γ2
 b d
$\int_a^b \! \int_c^d f(x,y)\,dx\,dy$ a c
f (x, y) dx dy
$x / \! \sin x$ x/sin x

$\sqrt{\,\sin x}$ sin x

3.5 Macros: Defining your own LATEX com-


mands
One of the most useful TEX features for saving effort when typing mathe-
matical formulas is the use of macros. For example, suppose that you need
to write the formula (x1 , . . . , xn ) repeatedly. It would be tedious to type
$(x_1, \ldots, x_n)$ over and over. Instead, we create a macro for this
formula. To do so, insert the following line after the declaration of document
class and insertion of packages, and before \begin{document}:
\newcommand{\vec}{(x_1, \ldots, x_n)}

Then, every time you want to write (x1 , . . . , xn ), all you need to do is write
$\vec$.
There are three important points to keep in mind when defining macros:
(1) Do not include the $ signs in the formula given in \newcommand; including
the $ signs in the macro would cause problems. (2) Use a mnemonic name
when defining a macro, but do not use a name that TEX already uses. (3)
TEX is case sensitive; that is, the name \vec is not the same as \Vec.
Next, suppose that in some places you want to write (x1 , . . . , xn ), and
other places you want to write (x1 , . . . , xk ). It would be silly to make a
different macro for each of these two formulas. Rather, we use a variable in
the macro. For example, we could use:
\newcommand{\vecn}[1]{(x_1, \ldots, x_{#1})}

Then, if we want the formula (x1 , . . . , xk ) we would write $\vecn k$, or


equivalently $\vecn{k}$. (Do not write $\vecnk$ to try to obtain (x1 , . . . , xk ),

63
because TEX will then look for a macro called \vecnk, which is not what you
defined, and so you will receive an error message.) If we want the formula
(x1 , . . . , xk+1 ) we would simply write $\vecn{k+1}$.
It is possible to have more than one variable in a macro. For example,
suppose that in some places you want to write (x1 , . . . , xn ), and other places
you want to write (y1 , . . . , yk ). We could then use the macro:
\newcommand{\vecxn}[2]{({#1}_1, \ldots, {#1}_{#2})}

Then, if we want the formula (x1 , . . . , xk ) we would write $\vecxn xn$, and
if we want the formula (w1 , . . . , wr−3) we would write $\vecxn w{r-3}$.
As a rule of thumb, if you use any built up mathematical formula more
than a few times, it is worth making a macro for it.
Finally, we point out that LATEX, AMS-LATEX, and the Bard Senior
Project style are themselves just lengthy collections of TEX macros.

3.6 Some Standard TEX Mistakes


To write a set such as
{x ∈ R | x2 < π}
we write
\{x \in \mathbb{R} \mid x^2 < \pi\}
Observe that the curly brackets are written \{ and \}, and that the ver-
tical line is written \mid, NOT | (which would produce the wrong spacing).
To write an inner product such as
px, yq
we write
\langle x, y \rangle
Observe that the brackets are written \langle and \rangle, NOT < and
> (which would produce the wrong spacing).
To write a function such as
f: A→B
we write

64
f\colon A \to B

Observe that the colon is written \colon, NOT : (which would produce
the wrong spacing).

3.7 Theorems, Propositions, Lemmas, . . .


Mathematical documents often contain theorem-like structures such as “the-
orems”, “propositions” and “conjectures”. If you use the Bard Senior Project
style, as discussed in Section 1.3, then everything concerning the formatting
and numbering of theorems, definitions, end of proof symbol, and the like is
automatically taken care of—so you can skip this section. For that reason,
the Bard Senior Project style is very much recommended.
If, for some reason, you want to do your own theorem formatting, then
near the beginning of the document you should have something like the
following:
\newtheorem{thm}{Theorem}
\newtheorem{prop}{Proposition}
\newtheorm{conjec}{Conjecture}
\newtheorem{wildshot}{Hypothesis} % make it sound good!

The first argument to \newtheorem defines a new theorem-like environ-


ment name of your own choosing. The second argument contains the text
that you want inserted when your theorem is proclaimed:
\begin{thm}\label{thm:normal} $X$ is normal if, and only if,
each pair of disjoint closed sets in $X$ is completely separated.
\end{thm}

\begin{wildshot} % remember, we chose the name ’wildshot’


The property of Moore extends to all objects of the class $\Sigma$.
\end{wildshot}

which will produce the following:

Theorem 1. X is normal if, and only if, each pair of disjoint closed sets in
X is completely separated.

Hypothesis 1. The property of Moore extends to all objects of the class Σ.

65
Notice that LATEX italicises the theorem statement, and that you still
have to shift in to math mode when you want to set symbols and expression.
Typically, it is the style file that determines what a theorem will appear like—
so don’t go changing this if you are preparing for submission for publication
(because the journal staff want to substitute their production style for your
document class choice, and not be over-ridden by other commands).
LATEX automatically numbers theorems and the like. To refer to a theo-
rem or similar structure, use the theorem’s label in the say way that you refer
to chapter and section names. For example, to refer to the theorem written
above, simply write Theorem~\ref{thm:normal}, which will produce The-
orem 1. It is possible to have different structures, such as theorems and
lemmas, be numbered consecutively, but we will not discuss that here; please
see other LATEX manuals.

66

You might also like