This action might not be possible to undo. Are you sure you want to continue?

# A Sample Thesis Report, Showing the Reader

**the Wonder of Formatting Documents Using
**

L

A

T

E

X

Claire Connelly

Melissa O’Neill, Advisor

Second Reader, Reader

May, 2006

Department of Mathematics

Copyright © 2006 Claire Connelly.

The author grants Harvey Mudd College the nonexclusive right to make this work

available for noncommercial, educational purposes, provided that this copyright

statement appears on the reproduced materials and notice is given that the copy-

ing is by permission of the author. To disseminate otherwise or to republish re-

quires written permission from the author.

Abstract

This document is a sample of what can be done with L

A

T

E

X. In addition to

demonstrating the features of the hmcclinic and hmcthesis classes, we hope

to provide useful and clear examples of not only what can be done, but

how best to do it.

Acknowledgments

To Melissa O’Neill, Lesley Ward, Michael Raugh, Barbara Schade, and Jeremy

Rouse, without whom this document would not exist in its present form.

Contents

Abstract iii

Acknowledgments v

1 Introduction 1

1.1 What Is L

A

T

E

X? . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 This Document . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Structured Writing 3

2.1 Document Classes . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Structural Commands . . . . . . . . . . . . . . . . . . . . . . 4

2.4 Labels and References . . . . . . . . . . . . . . . . . . . . . . 5

2.5 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.6 Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.7 Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.8 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Mathematical Notation 13

3.1 Sums and Products . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.4 More Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.5 Aligning Equations . . . . . . . . . . . . . . . . . . . . . . . . 16

3.6 Adjusting Spacing . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.7 Specifying Equation Numbers or Names . . . . . . . . . . . . 17

3.8 Sizing Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.9 Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.10 Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

viii Contents

4 Figures and Tables—L

A

T

E

X’s Float Environments 23

4.1 Captions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.2 Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4.3 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

5 Typesetting 31

5.1 Getting to Paper . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.2 PDF for the Web . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.3 General Comments . . . . . . . . . . . . . . . . . . . . . . . . 32

5.4 Additional Programs . . . . . . . . . . . . . . . . . . . . . . . 33

6 Tips and Tricks 35

6.1 Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . 35

6.2 Accents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

6.3 Comments and Spacing . . . . . . . . . . . . . . . . . . . . . 36

6.4 Quotes and Dashes . . . . . . . . . . . . . . . . . . . . . . . . 37

6.5 Controlling Pagination . . . . . . . . . . . . . . . . . . . . . . 38

6.6 Using Graphics with PDFT

E

X . . . . . . . . . . . . . . . . . . 38

6.7 Fonts Look Fuzzy in PostScript or PDF Files . . . . . . . . . . 39

6.8 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

7 Resources 43

7.1 Online Documentation . . . . . . . . . . . . . . . . . . . . . . 43

7.2 UK-TUG FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

7.3 comp.text.tex . . . . . . . . . . . . . . . . . . . . . . . . . . 44

8 Books 45

A Versions of the Sample Thesis/Clinic Report 47

A.1 Comments, Problems, and Updates . . . . . . . . . . . . . . . 47

Bibliography 49

List of Figures

3.1 Greek letters and some symbols . . . . . . . . . . . . . . . . . 14

4.1 Some shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.2 Small multiples . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.3 A step function . . . . . . . . . . . . . . . . . . . . . . . . . . 27

7.1 texdoctk main window . . . . . . . . . . . . . . . . . . . . . 44

List of Tables

2.1 Structural commands in L

A

T

E

X . . . . . . . . . . . . . . . . . . 4

2.2 Commonly used font commands . . . . . . . . . . . . . . . . 10

3.1 L

A

T

E

X math spacing commands . . . . . . . . . . . . . . . . . 18

4.1 Tableaus vs. tables . . . . . . . . . . . . . . . . . . . . . . . . 28

4.2 A sample table: Elections in G¨ otefrith province, 1900–1910 . 29

6.1 Special characters in L

A

T

E

X . . . . . . . . . . . . . . . . . . . . 35

Chapter 1

Introduction

1.1 What Is L

A

T

E

X?

L

A

T

E

X is a tool that allows you to concentrate on your writing while taking

advantage of the T

E

X typesetting system to produce high-quality typeset

documents.

L

A

T

E

X’s beneﬁts include

1. Standardized document classes

2. Structural frameworks for organizing documents

3. Automatic numbering and cross-referencing of structural elements

4. “Floating” ﬁgures and tables

5. A high-level programming interface for accessing T

E

X’s typesetting

capabilities

6. Access to L

A

T

E

X extensions through loading “packages”

1.2 This Document

This document serves a couple of functions. First, it is an introduction and

quick survey of the L

A

T

E

X world. Second, the source code of this document

is meant to be an exemplar of “best practice” L

A

T

E

X coding.

Chapter 2

Structured Writing

Like HTML,

1

L

A

T

E

X is a markup language rather than a WYSIWYG

2

system.

You write plain text ﬁles that use special commands and environments that

govern the appearance and function of parts of your text in your ﬁnal type-

set document.

2.1 Document Classes

The general appearance of your document is determined by your choice

of document class. Document classes also load L

A

T

E

X packages to provide

additional functionality and often deﬁne their own commands and envi-

ronments.

The standard L

A

T

E

X distribution provides a number of basic classes, in-

cluding article, letter, report, and book. There are also a large number of

other document classes available, including amsart and amsbook, created

by the American Mathematical Society and providing some additional math-

ematically useful structures and commands; foils, prosper, and seminar,

which allowyou to create “slides” for presentations; the math department’s

hmcthesis class, for formatting senior theses; Clinic’s hmcclinic class, for for-

matting Clinic reports; and many journal- or company-speciﬁc classes that

format your document to match the “house style” of a particular periodical

or publisher.

1

HyperText Markup Language

2

What You See Is What You Get.

4 Structured Writing

Command Notes

\part book & report only

\chapter book & report only

\section

\subsection

\subsubsection

\paragraph

\subparagraph

Table 2.1: Structural commands in L

A

T

E

X.

2.2 Packages

L

A

T

E

X packages, or style ﬁles, deﬁne additional commands and environ-

ments, or change the way that previously deﬁned commands and envi-

ronments work. By loading packages, you can change the fonts used in

your document, write your document in a non-English language with a

non-ASCII font encoding, include graphics, format program listings, add

custom headers and footers to your document, and much more.

A typical T

E

X installation includes hundreds of style ﬁles, and hundreds

more are available from the Comprehensive T

E

X Archive Network (CTAN),

at http://www.ctan.org/.

2.3 Structural Commands

L

A

T

E

X provides a set of structural commands for deﬁning sections of your

document, as shown in Table 2.1.

Note that the argument provided to structural commands is a moving

argument (see Section 4.1.1) because the argument may be reused in other

parts of the document, such as the table of contents or in page headers

or footers. Structural commands can take an optional argument (see Sec-

tion 2.5) in which you specify nonfragile commands or a shorter version

of the actual section title that ﬁts. You’ll generally know when you need

to provide an optional argument because T

E

X will generate errors or you’ll

see problems with your headers or in the table of contents.

Labels and References 5

2.4 Labels and References

Sections are numbered automatically by L

A

T

E

X during typesetting. If you

change your mind and decide that a subsection should be promoted to a

section, or moved to the end of your document, all affected sections will be

renumbered so that their numbering is consistent with where they appear

in the document.

Sections can also be \labeled with a tag such as

\chapter{Our Complicated Equations}%

\label{sec:complicated-eqs}

and referred to with a \ref or \pageref command, as in

In Section~\ref{sec:complicated-eqs}, we pointed out...

or

On page~\pageref{fig:gordian-knot}, we illustrated...

L

A

T

E

X substitutes the correct section number when typesetting your doc-

ument.

The same commands can be used with numbered environments such

as equation, theorem, and so forth.

Use meaningful labels—labeling a section as sec12 may seem useful, but

it will be confusing if you end up moving it to a different place in the doc-

ument and its number changes to 34. It’s also easier to remember what

reference you want if you use a meaningful name.

You may also want to impose some additional organization through

the use of namespaces, as I’ve done in this document. Rather than give

different types of objects undistinguished labels, I precede chapter labels

with ch:, section labels with sec:, equations with eq:, ﬁgures with fig:,

tables with tab:, and so forth.

Emacs with AucT

E

X and RefT

E

X will give you easy access to these la-

bels, as will many other editors with T

E

X-speciﬁc features. It’s much easier

to ﬁnd the particular label you’re looking for if you have some additional

information to help you. Adding the preﬁxes also reminds you of what text

should precede the \ref command.

2.5 Commands

L

A

T

E

X uses commands for changes that are very limited in scope (a few

words) or are unlimited in scope (the rest of a document). For example,

6 Structured Writing

the commands

\textbf{bold}

\emph{italic (emphasized)}

\textsf{sans serif}

produce the following output in a typeset document:

bold italic (emphasized) sans serif

These are “commands with arguments”—the command itself starts with

a backslash (\), and its argument appears inside braces { }). Some com-

mands may also have optional arguments, which are typed inside brackets

([ ]); more than one required argument (typed in braces); or some combi-

nation of required and optional arguments.

There are also commands that usually take no arguments, such as \noindent,

\raggedright, and \pagebreak.

You can deﬁne your own commands, as discussed in Section 2.8.

2.6 Environments

L

A

T

E

X provides a number of environments that affect the appearance of text,

and are generally used for more structurally signiﬁcant purposes. For ex-

ample, the command list in Section 2.3 was typeset inside a verbatim envi-

ronment that was, in turn, typed inside a quote environment. The typeset

results were typeset inside a quote environment.

Environments use special commands to start and close—\begin and

\end—followed by the name of the environment in braces, as in

\begin{quote}

‘‘This is disgusting---I can’t eat this. That

arugala is so bitter\ldots{} It’s like my

algebra teacher on bread.’’

\flushright -- Julia Roberts in \emph{Full Frontal}

\end{quote}

producing

“This is disgusting—I can’t eat this. That arugala is so bitter. . .

It’s like my algebra teacher on bread.”

– Julia Roberts in Full Frontal

Environments 7

Like commands, some environments may take one or more additional

arguments in braces (required) or brackets (optional).

Note that the order in which environments nest is extremely important.

If you type an environment inside another environment, the inner envi-

ronment must be \ended before the second environment is closed. It’s also

vitally important that you have an \end line for each \begin line, or T

E

X

will complain.

2.6.1 The document Environment and the Preamble

The most important environment in any document is the document envi-

ronment, which encloses the body of your document. The code before

the \begin {document} line is called the preamble, and includes the all-

powerful \documentclass command, which loads a particular document

class (see Section 2.1); optional \usepackage commands, which load addi-

tional L

A

T

E

X packages (see Section 2.2); and other setup commands, such as

user-deﬁned commands and environments, counter settings, and so forth.

I generally also include the commands deﬁning the title, author, and

date in my preambles, but other authors include them just after \begin

{document}, before the \maketitle command, which creates the title block

of your document.

2.6.2 Math Environments

One of the major features of T

E

X is its ability to typeset complex mathemat-

ical equations.

The two primary ways of doing so are with the use of inline and display

math environments. These environments are used so often that there are

shorthands provided for typing them. Inline math environments, such as

a

2

+ b

2

= c

2

, can be typed as

\begin{math}

a^{2} + b^{2} = c^{2}

\end{math}

or, more commonly,

$a^{2} + b^{2} = c^{2}$.

Display math environments set your equation apart from your running

text. They’re generally used for more complicated expressions, such as

f (x) =

∞

0

x

2

+ x

3

1

dx

8 Structured Writing

which can be typed as

\begin{displaymath}

f(x) = \int^{\infty}_{0} \left( \frac{x^2 + x^3}{1} \right)dx

\end{displaymath}

or

\[

f(x) = \int^{\infty}_{0} \left( \frac{x^2 + x^3}{1} \right)dx

\]

Generally, you’ll want to use the $ delimited form for inline math, and

the \[ \] form for display math environments. [Besides being easy to type,

these forms are also robust , which means that they can be used in moving

arguments: elements that T

E

X may need to typeset in more than one place

(such as a table of contents) or adjust (such as footnotes).]

The equation Environment

You’ll probably want to use the equation environment for any mathemati-

cal expression that you plan to refer to. L

A

T

E

X not only typesets the contents

of an equation environment in display mode, it also numbers it, as in

f (x) =

∞

0

x

2

+ x

3

1

dx (2.1)

written as

\begin{equation}

\label{eq:myequation}

f(x) = \int^{\infty}_{0} \left( \frac{x^2 + x^3}{1} \right)dx

\end{equation}

You can now refer to this formula in your text as “Equation 2.1” by

typing

\ref{eq:myequation}.

Fonts 9

2.7 Fonts

Generally you’ll want to let L

A

T

E

X handle the fonts for you—Knuth’s Com-

puter Modern fonts are used by default, and include a wide range of vari-

ations that can cover almost any use you can think of. Document classes

may also specify particular fonts (for example, many of the classes devel-

oped for Mudd specify Palatino as the roman font, and Helvetica as the

sans-serif font).

If you want to get fancy (and portable; see Section 6.7), you can use

Type 1 PostScript fonts, such as Times, Palatino, Utopia, and so forth. These

font sets are accessible with packages with names like times, palatino, and

utopia. There are others, as well—a command such as \locate psnfss |

grep sty will ﬁnd most of them.

If you have a T

E

X system installed on your own machine, you can also

get both bitmap and Type 1 fonts from CTAN (see Section 2.2). There’s even

support for TrueType fonts in some T

E

X systems.

If you’re using T

E

X on turing or the mathematics cluster, and you need

some special fonts, you should ask the systems staff about having those

fonts installed system wide.

2.7.1 Font Commands

Most of your concerns about fonts are probably related to what you’re writ-

ing. You might want some emphasized or bold text to stress a point or high-

light a key term. Filenames might be set in typewriter text (although you

should consider using the url package to help you out—by default, text set

in typewriter text isn’t hyphenated, which can lead to some unattractive

line breaks).

You can also set text in sans serif or SMALL CAPS. Table 2.2 shows you

some of the most commonly used font commands provided by L

A

T

E

X.

I strongly recommend that you use \emph in preference to \textit,

and use \textbf sparingly. \emph is a smarter command than \textit—it

switches back to the roman font when necessary. For example, compare

\emph{She loved \emph{Scooby Doo}.}

which produces

She loved Scooby Doo.

with

10 Structured Writing

Command Result

\emph emphasized text

\textsf sans-serif text

\texttt typewriter text

\textbf bold text

\textsc SMALL CAPS TEXT

\textsl slanted text

\textit italic text

Table 2.2: Commonly used font commands.

\textit{He loved \textit{Titanic}.}

which produces

He loved Titanic.

For complicated font changes, or for special font usages that you’re typ-

ing a lot, creating a macro (Section 2.8) is the way to go. I often just write,

tossing in custom commands as I go, and wait to deﬁne them until just be-

fore I compile the document. (L

A

T

E

X will stop each time it encounters an

undeﬁned command; you can use this feature to help you remember what

commands you made up. Deﬁning them in advance works ﬁne, too, of

course.)

2.8 Customization

The main advantage of using commands and environments is that they

allow you to organize your writing. A useful side-effect is that you can

later change your mind about the way a particular element is typeset, and

change the appearance of every use of that element in your document by

editing one piece of code. For example, in this document the names of

environments have been set in “typewriter text” using a command I created

called \env, which is deﬁned as

\newcommand{\env}[1]{\texttt{#1}\xspace}

All I have to do to make the names of environments in the document

appear in sans-serif type instead is to change that one line to

\newcommand{\env}[1]{\textsf{#1}\xspace}

Customization 11

You can do the same with almost anything you can conceptualize—

key terms, people’s names (especially names of people from non-English-

speaking countries), ﬁles, functions, and so on.

Chapter 3

Mathematical Notation

As we saw in Section 2.6.2, math is typed into one of several kinds of math

environments. Choose your environment based on the context and impor-

tance of the content. Any formula you plan to refer to should be typed in

an equation environment (or a similar environment that supports labels).

You should punctuate your mathematics as if the formulae were normal

parts of English sentences. Reading them aloud is often a useful method for

ensuring that you have all the commas in the right places. Where appro-

priate, you should also follow a displayed formula at the end of a sentence

with a period.

3.1 Sums and Products

It’s easy to typeset sums and products. For example,

f (n) =

n

n

∑

k=1

n

k

f (n −k),

∞

∏

n=2

n

3

−1

n

3

+ 1

=

2

3

. (3.1)

3.2 Matrices

It’s a little more difﬁcult to create matrices, but not too bad:

2 1 2

1 0 2

2 1 1

¸

¸

−2 1 2

3 −2 −2

1 0 −1

¸

¸

=

1 0 0

0 1 0

0 0 1

¸

¸

. (3.2)

14 Mathematical Notation

α β γ δ ζ

η θ ι κ λ µ

ν ξ o ρ π σ

τ υ φ χ ψ ω

Γ ∆ Θ Λ Ξ Π

Σ Υ Φ Ψ Ω ϕ

· · · . . .

.

.

.

.

.

. : ·

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

¸

.

Figure 3.1: Greek letters and some symbols.

3.3 Symbols

L

A

T

E

Xprovides an enormous number of symbols. Additional packages (loaded

with \usepackage) may provide additional symbols and fonts.

For example, N, Z, Q, R, and C require you to load the amsfonts pack-

age (which is automatically loaded by the icmmcm class). These symbols are

generated by \mathbb, which only works in math mode.

Subscripts and superscripts are easy—$a_{n}$ produces a

n

, and $x^{2}$

produces x

2

. Ordinal numbers, such as 3

rd

, n

th

, and so forth,

1

can be

produced with code like $3^{\textrm{rd}}$, $n^{\textrm{th}}$. Equa-

tion 3.3 shows a formula with a superscript.

π

0

cos

2n+1

x dx = 0 ∀ n ∈ N. (3.3)

Notice that \cos produces a nice roman cos in math mode. There are sim-

ilar commands for common functions like \log, \exp, and so forth. More

can be deﬁned with the \DeclareMathOperator command provided by the

amsmath package.

You can stack symbols over other symbols in math formulas:

m¨ x + γ ˙ x + kx = 0, (3.4)

L

A

T

E

X has lots of Greek letters and ellipses too, some of which are shown

in Figure 3.1.

1

Some fonts may include their own ordinals that can be accessed with special com-

mands.

More Math 15

See Gr¨ atzer (2000), pp. 455–474, or Kopka and Daly (1999), pp. 123–

127, for lists of the symbols available. Intext, you might see some of these

symbols used as

The Strong Induction Principle asserts that if a statement holds

for the integers 1, 2,. . . , n, and if whenever it holds for n = 1,

. . . , k then it also holds for n = k + 1, then the statement holds

for the integers 1, 2, 3, . . . Using this Principle, it can be shown

that 1 + 2 +· · · + n = n(n + 1)/2 for all positive integers n.

Notice that in the lists of integers, the ellipsis was made using the \ldots

command, and that the periods were nicely spaced between the commas.

In the sum, the dots were made with \cdots and were centered on the

line. The amsmath package provides a “smart” \dots command that can

generally get things right based on the context.

So, with \dots alone, the previous examples come out as

1, 2, . . . , n

n = 1, . . . , k

1, 2, 3, . . .

1 + 2 +· · · + n = n(n + 1)/2.

The general n ×n matrix can be typeset as follows:

a

11

a

12

. . . a

1n

a

21

a

22

. . . a

2n

.

.

.

.

.

.

.

.

.

.

.

.

a

n1

a

n2

. . . a

nn

¸

¸

¸

¸

¸

. (3.5)

A ﬁne point: lists of numbers that you’re using in a mathematical sense

(as opposed to dates, numbers of objects, etc.) should be typed in math

mode. For example, 341, 541, 561, and 641. The same numbers without

math mode are 341, 541, 561, and 641. Depending on the fonts and pack-

ages that you’re using, you may notice a little bit more space around the

ﬁrst set than the second. The lists may even appear in a different typeface.

With some packages, numbers intext may be set using old-style ﬁgures by

default, as in , , , and .

3.4 More Math

In Fourier analysis, we talk about the z-domain.

16 Mathematical Notation

If a is an even number, then

a + φ(a) <

3a

2

,

and

σ(a) >

2

α+1

−1

2

α

a ≥

3a

2

,

where α is the greatest power of 2 that divides a, φ(a) is the number of

integers less than a and relatively prime to a, and σ(a) is the sum of the

divisors of a (including 1 and a).

Typeset a piecewise function using the cases environment (from the

amsmath package) as follows:

|x| =

x, if x ≥ 0;

−x, otherwise.

In frosh physics, students come to know the true meaning of F = ma,

E = mc

2

, and −

¯ h

2

2m

∇

2

ψ + Vψ = i¯ h

∂ψ

∂t

.

3.5 Aligning Equations

In days gone by, people used the eqnarray environment to align equations.

eqnarray has generally been replaced by align and some variants such as

flalign, which places the leftmost column as far to the left as possible and

the rightmost column as far to the right as possible; alignat, which allows

you to specify the spacing; and more. See American Mathematical Society

(1999), Gr¨ atzer (2000), Lamport (1994), or Kopka and Daly (1999) for more

information about the alternatives.

In Equations 3.6–3.9, the = signs have been aligned using the eqnarray

environment.

3x

4

+

1

x

4

= x

4

+ 4x

2

+ 6 +

4

x

2

+

1

x

4

−4x

2

−6 −

4

x

2

(3.6)

=

x +

1

x

4

−4x

2

−6 −

4

x

4

(3.7)

=

x +

1

x

4

−4x

4

−8 −

4

x

4

+ 8 −6 (3.8)

=

x +

1

x

4

−4

x +

1

x

2

−6. (3.9)

Adjusting Spacing 17

Equations 3.10–3.13 show the same set of equations aligned with the

align environment.

3x

4

+

1

x

4

= x

4

+ 4x

2

+ 6 +

4

x

2

+

1

x

4

−4x

2

−6 −

4

x

2

(3.10)

=

x +

1

x

4

−4x

2

−6 −

4

x

4

(3.11)

=

x +

1

x

4

−4x

4

−8 −

4

x

4

+ 8 −6 (3.12)

=

x +

1

x

4

−4

x +

1

x

2

−6. (3.13)

3.6 Adjusting Spacing

Sometimes you need to adjust the spacing and fonts inside integrals. Typi-

cally, the “d” (as in dx) is set in Roman type. Rather than

1

1 − xy

dxdy. (3.14)

you want

1

1 − xy

dx dy. (3.15)

The integral signs have been moved closer together using the “negative

space” command \!. Extra space has been added between the elements of

integration, dx and dy, and between those elements and the integrand with

the “thin space” command, \,.

Table 3.1 shows the spacing commands available in math mode. There

are additional spacing commands provided by the amsmath package, not

shown here. See Tables A.9 and B.6 in Gr¨ atzer (2000) for all the spacing

commands provided by L

A

T

E

X and the amsmath package.

3.7 Specifying Equation Numbers or Names

All the equations you’ve seen so far have been numbered consecutively.

You can specify a number (or name) for a single equation by placing the

formula in a display math environment (but not an equation environment)

18 Mathematical Notation

L

A

T

E

X Command

Name Short Long

Positive Space

thinspace \, \thinspace

medspace \:

thickspace \;

1 em \quad

2 em \qquad

Negative Space

thinspace \! \negthinspace

Table 3.1: L

A

T

E

X math spacing commands.

and giving the desired number or name as the argument to an \eqno com-

mand. For example,

∞

0

e

−x

2

dx =

√

π

2

. (42),

or

∞

0

e

−x

2

dx =

√

π

2

. (cool formula),

Note that you have to specify the parentheses in the argument to the

\eqno command. If you name a formula, you will also have to enclose the

text within a command such as \mathrm, or it will be set as if it was a string

of variables (and without any spaces—for example, $a cool formula$ gives

you acool f ormula).

If you’d like to have many aligned equations without numbers, use the

starred form of the align environment, align*, as in

Specifying Equation Numbers or Names 19

The area K of ABC is given by

K =

ah

a

2

=

ab

2

sin C

= rs

=

s(s − a)(s −b)(s −c)

=

abc

4R

=

a

2

sin Bsin C

2 sin A

= 2R

2

sin Asin Bsin C,

where A, B, and C are the angles in ABC, r is the radius of

the inscribed circle, R is the radius of the circumscribed circle, s

is one-half of the perimeter, and h

a

is the length of the altitude

from the vertex A to the side BC.

If you wanted to number the ﬁnal derived equation, you could use the

normal (unstarred) form of align and precede each line you don’t want to

be numbered with a \notag command, as in

K =

ah

a

2

=

ab

2

sin C

= rs

=

s(s − a)(s −b)(s −c)

=

abc

4R

=

a

2

sin Bsin C

2 sin A

= 2R

2

sin Asin Bsin C, (3.16)

Note that the \notag command could appear after the linebreak com-

mand (\\) on all lines except the ﬁrst and the next-to-last. (Commands

following the linebreak apply to the following line.)

20 Mathematical Notation

3.8 Sizing Delimiters

The \left and \right commands, followed by a bracket, brace, or paren-

thesis, tell T

E

X to adjust the size of the delimiter to its contents.

f (x) =

1 + (1 + x)

2

n

. (3.17)

You can also use commands such as \big, \Big, \bigg, or \Bigg to specify

larger delimiters (useful if you have multiple levels of delimiters), as in

or

(a + b) + c

+ d

+ e

+ f

3.9 Theorems

The theorem environment provides you with an easy way to typeset the-

orems in your document. To use it, type a \newtheorem command in the

preamble of your document, such as

\newtheorem{Theo1}{Theorem}

You can then type a theorem using your theorem environment.

This document includes three such deﬁnitions,

\newtheorem{Theo1}{Theorem}

\newtheorem{Theo2}{Theorem}[section]

\newtheorem{Lemma}[Theo2]{Lemma}

which show you some of the possibilities available. Examples of each ap-

pear below.

3.9.1 A Theo1 Environment

Theorem 3.1 The equation x

4

+ y

4

= z

4

has no solutions where x, y, and z are

positive integers.

Proofs 21

3.9.2 A Theo2 Environment

Theorem 3.1 (Wilson) A positive integer p is prime if and only if

(p −1)! ≡ −1 (mod p).

3.9.3 A Lemma Environment

Lemma 3.1 Prof. Bernoff’s Putnam mug is a multiply connected 2-manifold of

genus 1.

3.10 Proofs

Adding a proof is even easier, courtesy of the proof environment. For ex-

ample,

Two positive integers a and b are amicable if σ(a) = σ(b) = a +

b, where σ(N) denotes the sum of the divisors of N, as above.

The following is a theorem with an associated proof.

Theorem 3.2 There do not exist two consecutive integers which are

amicable.

Proof: Since even numbers are annoying, no integers are ami-

cable with even numbers. Thus, if two consecutive integers are

amicable, they are both odd. However, two consecutive odd

numbers do not exist.

To create the end-of-proof marker shown here, use \hfill$\Box$. The

\hfill makes the box print ﬂush right at the end of the line, as here.

You can also use the proof environment provided by the amsthm pack-

age (not shown here). The main difference is that the AMS’s proof envi-

ronment is typeset differently, takes an optional argument that allows you

to rename the “title” (e.g., from “Proof” to “Proof of Theorem 5”), and au-

tomatically inserts the Q.E.D. symbol at the end of the environment.

Chapter 4

Figures and Tables—L

A

T

E

X’s

Float Environments

L

A

T

E

X provides two “ﬂoat” environments, figure and table. Float envi-

ronments are so called because they can be typeset on a later page in your

document than their location in the source code.

The table environment is generally used for—surprise!—tables. The

figure environment is often used for graphs or diagrams, but could also

be used for other illustrative graphics.

The basic ﬂoat environments don’t format their contents specially. If

you want an illustration or table to be centered, you will need to type

it inside a center environment or add a \centering command after the

\begin{float} command.

4.1 Captions

By adding a \caption command, you can specify a caption that will appear

with the ﬂoat. Its position in your typeset document depends on where in

the environment you type it—if the command is at the top of the environ-

ment, the caption will be typeset above its contents; if at the bottom, the

caption will appear beneath its contents. Captions should usually be set

at the bottom of a ﬂoat, but if a particular publisher or journal prefers the

captions on top, you can accommodate them.

Captions should generally be written as brief, complete sentences, end-

ing with a period. They should either be capitalized as normal sentences.

So

24 Figures and Tables—L

A

T

E

X’s Float Environments

Production Statistics from Soviet Russia, 1977–1987.

or

Production statistics from Soviet Russia, 1977–1987.

rather than

production statistics from Soviet Russia, 1977–1987

Whichever style you choose, be consistent! (See The Chicago Manual of Style

(2003: 12.8, 12.31–51) for more details.)

Avoid explaining the whole ﬂoat in the caption. Do your explanation in

the text that refers to the ﬂoat.

The \caption command takes an optional argument, which is typed

inside brackets ([ ]). This argument is used in the list of tables or list of

ﬁgures in place of your actual caption.

4.1.1 Fragile Commands and Moving Arguments

Both arguments to the \caption command are moving arguments (because

T

E

X can move them). Some commands are fragile, that is, they produce

output that can cause problems if the typeset text is moved somewhere

other than the place that T

E

X originally thought it would be typeset.

To prevent fragile commands from being expanded too early and caus-

ing problems, you can use the \protect command just before the com-

mand you want to keep unexpanded.

4.1.2 Labels

The \label command for a ﬂoat is generally typed immediately after the

\caption command.

4.2 Figures

4.2.1 Including Graphics

The figure environment is often used for including graphic images. The

state-of-the-art method requires you to load the graphics or graphicx pack-

age. Both packages provide the same functionality, but take arguments in

a slightly different format.

1

More information about the graphics package

1

The graphicx package deﬁnes commands that take their arguments in key–value pairs.

Figures 25

is available in its manual, grfguide (Carlisle, 1999), which is included in

DVI, PostScript, or PDF format with most T

E

X systems. See Section 7.1 for

ways to ﬁnd documentation.

The standard graphic format used with T

E

Xis called Encapsulated PostScript,

or EPS. EPS ﬁles are special PostScript ﬁles that deﬁne a tight “bounding

box”, may include a bitmap representation for use in previewers, and are

restricted from using some PostScript operators.

EPS ﬁles are generally created with a vector-graphics application such

as Adobe Illustrator, Dia, OmniGrafﬂe, or Visio. They can also be created

from T

E

X ﬁles by using the -E ﬂag with dvips.

With the development of PDFT

E

X, generating Portable Document For-

mat ﬁles has become much easier. PDFT

E

Xrequires you to have your graphic

ﬁles available in PDF (or PNG or JPEG, if the images are bitmaps). See Sec-

tion 6.6 for some hints on converting your EPS ﬁgures to PDF.

The following code tells T

E

X to include the graphic shown in Figure 4.1:

\begin{figure}[ht]

\begin{center}

\scalebox{.50}{\includegraphics{shapes}}

\end{center}

\caption[Some shapes]{Some shapes.}%

\label{fig:an-eps-graphic}

\end{figure}

Figure 4.1: Some shapes.

Notice that we didn’t specify the .eps extension in the ﬁlename ar-

gument to the \includegraphics command. By dropping the extension,

we can typeset this document with PDFL

A

T

E

X without making any other

changes, provided that we have the graphic available as a PDF ﬁle. The

\includegraphics command searches for different graphic formats de-

pending on the typeset document’s format.

26 Figures and Tables—L

A

T

E

X’s Float Environments

Small Multiples

Sometimes you need (or want) to include more than one image in a ﬁgure,

such as when you have several close variations on a single image, as shown

in Figure 4.2, which has subﬁgures a or (b). You could also refer to the

subﬁgures as Figure 4.2c or Figure 4.2(d).

(a) Original image.

(b) Turned 45°.

(c) Turned 90°.

(d) Turned 135°.

Figure 4.2: Small multiples.

4.2.2 L

A

T

E

X Diagrams

L

A

T

E

X can also be used to create both simple pictures and sophisticated dia-

grams. Figure 4.3 shows a graph created with the picture environment.

Chapter 6 of Kopka and Daly (1999) describes how you can create dia-

grams such as that shown in Figure 4.3. You may ﬁnd it easier to produce

such diagrams with a separate application.

Tables 27

t 0 1

1

2

F

0

F

1

F

2

F

3

Figure 4.3: A step function with a peak at t.

4.3 Tables

Tables are a complicated subject, not because they’re difﬁcult to do in L

A

T

E

X,

but because they’re difﬁcult to do right. Most books on L

A

T

E

X cover ta-

bles, but present what Simon Fear, author of the booktabs package, calls

“tableaux”. One such tableau is illustrated in Table 4.1a.

Simon argues that such a tableau would be better presented as the table

shown in Table 4.1b. The Chicago Manual of Style, (University of Chicago

Press, 2003), and Edward Tufte (1983) support his assertion, and provide

excellent references and inspiration.

The booktabs package, which is automatically loaded by the icmmcm

class, has some special commands for creating lines of different thicknesses

for use as top, bottom, and midrules. It also has some code that provides

28 Figures and Tables—L

A

T

E

X’s Float Environments

gnats gram $13.65

each .01

gnu stuffed 92.50

emu 33.33

armadillo frozen 8.99

(a) A tableau. (Taken from Lamport

(1994), pg. 64.)

Item

Animal Description Price ($)

Gnat per gram 13.65

each 0.01

Gnu stuffed 92.50

Emu stuffed 33.33

Armadillo frozen 8.99

(b) The tableau as a table.

Table 4.1: Tableaus vs. tables.

the \cmidrule command, for creating spanner rules for decked spanner

heads. The rest is up to you and your style guide.

As an example of a table to strive toward, Table 4.2 is taken from The

Chicago Manual of Style. Also, all of the tables (except for those in the section

describing tables, alas) in George Gr¨ atzer’s Math into L

A

T

E

X were prepared

with booktabs.

Tables 29

1900 1906 1910

Party % of Vote Seats Won % of Vote Seats Won % of Vote Seats Won

Provincial Assembly

Conservative 35.6 47 26.0 37 30.9 52

Socialist 12.4 18 27.1 44 24.8 39

Christian Democrat 49.2 85 41.2 68 39.2 59

Other 2.8 0 5.7 1 5.1 0

Total 100.0 150 100.0 150 100.0 150

National Assembly

Conservative 32.6 4 23.8 3 28.3 3

Socialist 13.5 1 27.3 3 24.1 2

Christian Democrat 52.0 7 42.8 6 46.4 8

Other 1.8 0 6.1 0 1.2 0

Total 100.0 12 100.0 12 100.0 13

Table 4.2: A sample table: Elections in G¨ otefrith province, 1900–1910.

(Taken from University of Chicago Press (2003), pg. 414.)

Chapter 5

Typesetting

So you’ve got a L

A

T

E

X source document. How do you get a typeset docu-

ment that you can print or put on the web?

The process of typesetting a document is referred to as “T

E

Xing”, “com-

piling”, or “typesetting”. Generally, your goal is to end up with a PostScript

ﬁle (for printing) or a PDF ﬁle (for printing or placing on the web). There

are multiple ways to do both tasks.

5.1 Getting to Paper

Starting with a L

A

T

E

X document, foo.tex, you can create a PostScript ﬁle by

running the following commands:

unix% latex foo

unix% dvips -o foo.ps foo

unix% lpr foo.ps

On some systems, dvips automatically prints your document to your

default printer. You need to specify the -o ﬂag to get a PostScript ﬁle on

such systems.

On our systems, you can achieve the same result with dvips foo—

dvips knows what extensions to append to the base name of the ﬁle. If

you want to print in one step, you can use -o’|lpr’ to pipe dvips’s output

to the printer.

5.2 PDF for the Web

Starting with foo.tex, you can create a PDF ﬁle by typing

32 Typesetting

unix% pdflatex foo

or with the following sequence of commands:

unix% latex foo

unix% dvips -Ppdf foo -o foo.ps

unix% ps2pdf foo.ps foo.pdf

(The last step in the second example (running ps2pdf) can be replaced by

running the PostScript ﬁle through Adobe’s Acrobat Distiller application.)

If possible, using PDFL

A

T

E

X directly is preferable to the longer, more

complicated route. However, you will need to have PDF, PNG, or JPEGver-

sions of any graphics ﬁles that you’re including to be able to use PDFL

A

T

E

X.

If all you have are EPS or GIF ﬁles, and you can’t convert them to formats

that are compatible with PDFL

A

T

E

X, then the latex →dvips →ps2pdf route

may be the only one available to you.

5.3 General Comments

L

A

T

E

X does its numbering (and some other functions) by writing informa-

tion to an auxiliary ﬁle. It then reads that information in on the next pass,

and uses it to typeset references. Thus you have to run latex or pdflatex

at least twice whenever you make a change that affects the numbering of

elements or the ﬂow of text across pages. It’s generally good practice to run

L

A

T

E

X three times, or until it stops warning you about possible changes.

You can make this process easier by creating a shell alias, such as

alias mylatex ’latex \!* && latex \!* && latex \!*’

(for the csh) used as

mylatex foo

or by writing a Perl script, shell script, or a Makeﬁle.

The mathematics department has the prv and prvps programs installed,

which automate much of this process. You can ﬁnd out more about how

these programs work and the arguments that they take by running the man

command with the name of one of the programs as an argument (e.g., man

prv).

Additional Programs 33

5.4 Additional Programs

There are some additional functions, such as indexing and bibliographies,

that use external programs to read auxiliary ﬁles and produce L

A

T

E

X code

for inclusion on later runs. We won’t cover those programs in this docu-

ment.

Chapter 6

Tips and Tricks

L

A

T

E

X is a very complicated and powerful language. As a result, there are

many sneaky aspects to it that will cause you problems if you don’t know

about them. This chapter covers some of these tricky bits.

6.1 Special Characters

T

E

X and L

A

T

E

X have a number of “special” characters that are reserved for

use by the language. Using these characters in your writing requires you

to do a bit of extra work, as shown in Table 6.1.

Character Function To Typeset

# octothorp Macro parameter character \#

$ dollar sign Start/end inline math mode \$

% percent sign Comment character \%

& ampersand Column separator \&

underscore Subscripts, as in x

2

\_

{, } braces Parameters \{, \}

˜ tilde Nonbreaking space \~{}

ˆ caret Superscripts, as in x

2

\^{}

\ backslash Starts commands \verb |\|

Table 6.1: Special characters in L

A

T

E

X.

36 Tips and Tricks

6.2 Accents

There are a variety of commands for producing diacritical accents, as in

Paul Erd˝ os s’est reveill´ e t ˆ ot pour enseigner le franc¸ais ` a son fr` ere

et sa sœur.

See Section 2.4.7 in Math into L

A

T

E

X (Gr¨ atzer, 2000) for information about

accents (and some handy charts!).

6.3 Comments and Spacing

You can add comments to your source ﬁle that won’t appear in your typeset

document by starting them with a %. Any line that starts with a % will be

“commented out”, and won’t be interpreted. You can also add a % at the

end of a line, with or without text, and it will make the end of the line

(including the linebreak!) disappear.

For example,

% This line is a comment line.

This line is not a comment line.

This line has a comment at the end%

% This line should be invisible.

of the line.

will typeset as

This line is not a comment line.

This line has a comment at the endof the line.

Notice the lack of a space in “endof” on the last line of the typeset out-

put. T

E

X expects to ﬁnd a carriage-return character at the end of a line, and

interprets that carriage return as an interword space. If you comment out

the end of a line, you also comment out the carriage return on that line, and

you’ll have words run into one another unless you have a space before the

%.

T

E

X collapses multiple spaces into one, and ignores whitespace at the

beginning of a line. Thus

No spaces.

Quotes and Dashes 37

Five spaces.

A tab.

typesets as

No spaces.

Five spaces.

A tab.

(The lines are indented because they are at the start of a paragraph. You

can suppress paragraph indentation with \noindent.)

Paragraphs are delimited by two carriage returns (with or without whites-

pace between them).

6.4 Quotes and Dashes

Because T

E

X was designed to do high-quality typesetting, it cares about

which quotation mark and dash you’re using, and requires you to specify

the correct punctuation (although most text editors with special T

E

X modes

will do the substitution for you).

Open and close double quotes—“ and ”—are created by typing ‘‘ and

’’, respectively. The double-quote mark, ", is typeset as ” (and is useful for

abbreviating “inches”, as in 36”).

Single-quotes, ‘ and ’, are typed with ‘ and ’.

There are three basic forms of dashes:

1. The hyphen, -, is typed as a single dash, -

2. The en dash, –, is typed as two dashes, --

3. The em dash, —, is typed as three dashes, ---

Hyphens are used in hyphenated words, as in “high-quality”. En dashes

are used to indicate ranges, as in “there are 35–50 of them”; balanced re-

lationships, as in “U.S.–European agreements”; and for extended hyphen-

ated phrases, such as “reddish-green–colored item”. Em dashes are used to

separate independent phrases, as in “John believed—honestly believed—

that he was right”; and to indicate interruptions in dialogue, as in

“I hear you—”

“No, you don’t!”

38 Tips and Tricks

Note that you shouldn’t type spaces around any of these dashes—they

run directly against the words on either side, as in 35--50.

6.5 Controlling Pagination

Sometimes you may need to override L

A

T

E

X’s choices for line or page breaks.

The \pagebreak command causes L

A

T

E

X to start a new page immediately

after the command appears. The \\ command can be used to tell L

A

T

E

X

where to break a line.

In general, you should let L

A

T

E

X have its way, especially if your docu-

ment is going to be published by someone else, as they will undoubtedly

have many changes that will have to be made before your document works

for them. If you do need to tinker with your document’s layout, you should

avoid doing so until you’re very nearly done. If you go back and add or re-

move text after forcing L

A

T

E

X to do your will, you may ﬁnd that new blank

spaces appear as a result of your changes.

George Gr¨ atzer’s Math into L

A

T

E

X (2000) includes a chapter on preparing

books that covers this topic in depth.

6.6 Using Graphics with PDFT

E

X

PDFT

E

X supports PDF and JPEG as native graphic ﬁle formats. EPS is not

directly supported—to use EPS ﬁgures with PDFT

E

X, you must ﬁrst con-

vert your EPS ﬁles to PDF.

If you’re using a graphics program such as Adobe Illustrator to prepare

your ﬁgures, just save them as PDF instead of (or in addition to) EPS.

If you don’t have access to the tool you used to create your images, but

you still need to convert them, you can use the program epstopdf.

epstopdf writes to standard output by default, so you’ll have to redirect

the output to a ﬁle, as in

unix% epstopdf foo.eps > foo.pdf

To convert a whole slew of ﬁles, you could use a command such as the

following (with the csh):

unix% foreach f ( ‘find . -type f -name ’*.eps’‘)

foreach? eps2pdf $f -o=$f:r.pdf

foreach? end

Fonts Look Fuzzy in PostScript or PDF Files 39

6.7 Fonts Look Fuzzy in PostScript or PDF Files

When Donald E. Knuth originally wrote T

E

X, most typesetting was done by

trained typesetters using expensive equipment to cast molten lead into runs

of type. Knuth created his own font family, Computer Modern, by writing

a tool called METAFONT. METAFONT reads in programs that deﬁne various

aspects of every character in a font, and generates bitmap representations

of those characters at a particular resolution, ready for printing.

Unfortunately, bitmaps with resolutions suited for printing look terrible

on screen. The solution is to use Type 1 PostScript fonts instead of bitmaps.

If you’re using PDFT

E

X (or PDFL

A

T

E

X), you get Type 1 fonts without having

to do anything special (but see Section 6.6).

If you’re using dvips to get PostScript as an intermediate step (using

ps2pdf or Acrobat Distiller to get PDF), you can force dvips to use Type 1

fonts by specifying the -Ppdf ﬂag, as in

unix% dvips -Ppdf foo.dvi -o foo.ps

6.8 Debugging

One of the trickiest things about using L

A

T

E

X is interpreting L

A

T

E

X’s some-

times cryptic error messages.

In particular, the line numbers that L

A

T

E

X reports are often not the line

numbers where the problem is, but the line numbers where L

A

T

E

X noticed

there was a problem.

One useful way of getting a bit more context to help you understand

the problem is to put the line

\setcounter{errorcontextlines}{1000}

in the preamble of your document, which will provide you with a (perhaps

excessive) amount of context for an error.

The most common errors are

• Using one of the special characters (see Section 6.1)

• Leaving off or mismatching a brace or bracket

• Leaving out or swapping arguments to a command or environment

If you’ve tried everything and you can’t ﬁnd the source of an error mes-

sage, try the following procedure:

40 Tips and Tricks

1. Create a new ﬁle, and copy your preamble into it, followed by an

empty document environment

2. Add a word to the document environment so that T

E

X will have some-

thing to typeset

3. Try typesetting the new document—if you have an error, the problem

is in your preamble

4. If the document typesets, get rid of the single word you’d put in the

document environment, copy half of your original document’s body

into the new ﬁle, and typeset that

5. If you see your error, then continue halving the document until you

narrow it down to the problem section

6. If you don’t see your error, try the other half

6.8.1 The comment Environment

If you don’t want to go through the process of copying your document,

you can also use the comment environment, which allows you to “comment

out” anything between the begin and end environment commands. The

comment environment is provided by the verbatim package, which also de-

ﬁnes new versions of the verbatim and verbatim* environments.

6.8.2 The \includeonly Command

If you’ve written your document in such a way that each chapter or other

signiﬁcant subdivision is stored in a separate ﬁle and included in your

master document with an \include command, then you can also use the

\includeonly command to limit the parts of your document that will be

typeset to some subset.

\includeonly takes as its argument a comma-separated list of ﬁles that

are \include d in your document. If you place each item on a separate

line, you can comment and comment those lines to control which ﬁles are

included in a L

A

T

E

X run. For example,

\includeonly{

a,

% b,

% c,

d}

Debugging 41

will allow you to typeset the contents of the ﬁles a and d, without typeset-

ting the contents of b and c. A nice side-effect is that the auxilliary ﬁles for

these ﬁles are not changed, so that references to labels in the ﬁles not being

typeset will still be expanded in the ﬁles that are typeset. (If the pagination

changes, of course, any \pageref commands will be incorrect; the same

applies if any additional structural commands are added at the same level

as the topmost level in the excluded ﬁles—that is, if you add a new chapter

in a ﬁle called aa between the line that includes a and b, the chapter num-

bers will be incremented for the typeset ﬁles but not for the ﬁles you’re not

typesetting.

Chapter 7

Resources

There are lots of great resources available for using T

E

X and L

A

T

E

X. Here are

a few (there are also links available online at

http://www.math.hmc.edu/computing/support/tex/).

7.1 Online Documentation

Much of the documentation for T

E

X and L

A

T

E

X is available online, as part

of the T

E

X system. teT

E

X, the T

E

X system installed on the mathematics de-

partment’s computers, includes a script called texdoc to access this doc-

umentation. All you have to do is type texdoc followed by a string that

you believe is the name of the document you’re looking for. For example,

texdoc booktabs will give you the documentation for the booktabs pack-

age that I used to create the tables in this document.

Unfortunately, texdoc only works for documentation that is sensibly

named. The authors of the graphics package, for instance, called their man-

ual grfguide. Still others decided that manual was a good name for their

manual (after all, it’s the only manual in their distribution).

Sometimes you can ﬁnd documentation using the locate command,

which lists all the ﬁles on your system that match a string that you pro-

vide. For example, you could ﬁnd grfguide by trying locate graphics

and grep ping out the results with texmf in them, and passing that list to

another grep for the string doc:

unix% locate graphics | grep texmf | grep doc

Another hard to ﬁnd, but very useful, document, is the “User’s Guide

for the amsmath Package” (1999), which is called amsldoc.

44 Resources

7.1.1 \texdoctk

Our current teT

E

X installation includes the texdoctk program, which gives

you a graphical window into the documentation installed on the system.

You start texdoctk by typing its name at a shell prompt. A window (Fig-

ure 7.1) will appear with buttons corresponding to broad categories of doc-

umentation; clicking on one will open another dialog box with the titles of

available documentation (with the names of the actual packages in paren-

theses).

Figure 7.1: texdoctk main window.

7.2 UK-TUG FAQ

The primary list of frequently asked questions in the T

E

X world is the UK

TUG FAQ, available at http://www.tex.ac.uk/cgi-bin/texfaq2html. If

you’re not sure how to do something, or you’ve got a problem that you’re

pretty sure isn’t being caused by a typo, check here ﬁrst.

7.3 comp.text.tex

If you can’t ﬁnd an answer in the UK-TUG FAQ, then your next step is

to check comp.text.tex, the Usenet newsgroup devoted to T

E

X and L

A

T

E

X.

Chances are, whatever your problem is, someone else already had it, asked

about it on c.t.t, and got an answer. Thanks to Google, Usenet’s past

is preserved in an easily searchable format. Go to Google Groups (http:

//groups.google.com/), type in some search terms, and check out the an-

swers. (If you specify group:comp.text.tex at the end of your search

terms, you’ll only see results from comp.text.tex.)

Chapter 8

Books

http://www.math.hmc.edu/computing/support/tex/ has some brief re-

views of a number of signiﬁcant books about T

E

X and L

A

T

E

X.

My pick for the best introductory/reference book is the third edition of

George Gr¨ atzer’s Math into L

A

T

E

X (2000).

1

It’s the only book I’m aware of

that discusses the latest version of AMSL

A

T

E

X in depth. It also has excellent

reference tables and a thorough index.

Another book I highly recommend is Lyn Dupr´ e’s BUGS in Writing

(1998). Dupr´ e is one of Addison Wesley’s senior editors, and has edited

many of the most signiﬁcant books published by Addison Wesley. BUGS is

an accessible guide to writing clearly and effectively. It’s the kind of book

you leave in the bathroom so you’ll always have something interesting and

amusing to read. Learning how to write better is almost a byproduct!

If you get serious about typesetting, and want to start doing some fancy

page design or want to be sure you’re using the right kind of type, Robert

Bringhurst’s The Elements of Typographic Style (1996) will show you the way.

1

Which I edited.

Appendix A

Versions of the Sample

Thesis/Clinic Report

This document is based, in part, on earlier versions of sample Clinic re-

ports and sample theses. Some material from those versions is included

nearly intact in this document, whereas other material has been written

from scratch or adapted from other sources.

The authors of the present work would like to acknowledge and thank

Professor Lesley Ward for her original sample thesis report, created in 1999.

She and Jeremy Rouse (HMC 2003) revised that document in the year 2000.

The current version of the document is based on the updated sample

thesis created in 2003 by Claire M. Connelly, the Department of Mathemat-

ics Systems Administrator. The original sample Clinic report was based on

this sample thesis document.

In 2005, Claire merged the sample thesis and sample Clinic reports,

making maintenance and distribution a bit easier.

A.1 Comments, Problems, and Updates

The department is eager to receive feedback from users of the sample doc-

ument so that we can improve it. We are especially interested in any prob-

lems that you may have in compiling the document, but advice, questions,

and updates to the content are also welcome.

Please send such comments and “bug reports” to us at latex@math.hmc.edu.

If possible, please tell us where you downloaded the document’s source

code, and what version and date are noted in the master ﬁle for the docu-

ment you’re working with.

Bibliography

American Mathematical Society. User’s Guide for the amsmath Package.

American Mathematical Society, Dec 1999.

Robert Bringhurst. The Elements of Typographic Style. Hartley & Marks,

Vancouver, BC, second edition, 1996.

David P. Carlisle. Packages in the ‘graphics’ Bundle, January 1999.

Lyn Dupr´ e. BUGS in Writing. Addison-Wesley, Reading, MA, second edi-

tion, 1998.

Editor. Hyphenation exception log. TUGboat, 7(3):145, 1986.

Simon Fear. Publication quality tables in L

A

T

E

X. July 1997.

Michel Goossens, Frank Mittelbach, and Alexander Samarin. The L

A

T

E

X

Companion. Addison-Wesley, 1994.

George Gr¨ atzer. Math into L

A

T

E

X. Birkh¨ auser, Boston, 2000.

Donald E. Knuth. The T

E

Xbook. Addison-Wesley, 1993.

Donald E. Knuth. Transcendental numbers based on the Fibonacci se-

quence. Fibonacci Quarterly, 2:43–44, 1964.

Donald E. Knuth, Tracy Larrabee, and Paul M. Roberts. Mathematical writ-

ing. Mathematics Association of America Notes, 14, 1989.

Helmut Kopka and Patrick W. Daly. A Guide to L

A

T

E

X. Addison-Wesley, 3rd

edition, 1999.

Stephen G. Krantz. A Primer of Mathematical Writing. American Mathemat-

ical Society, 1997.

50 Bibliography

Leslie Lamport. L

A

T

E

X: A Document Preparation System. Addison-Wesley,

2nd edition, 1994.

Edward R. Tufte. The Visual Display of Quantitative Information. Graphics

Press, Cheshire, CT, 1983. ISBN 0-9613921-0-X.

University of Chicago Press, editor. The Chicago Manual of Style. University

of Chicago Press, Chicago, IL, 15th edition, 2003. ISBN 0-226-104036.

Eric Weisstein. Eric Weisstein’s world of mathematics. Available online at

mathworld.wolfram.com, 2000. URL http://mathworld.wolfram.com/.

Copyright © 2006 Claire Connelly. The author grants Harvey Mudd College the nonexclusive right to make this work available for noncommercial, educational purposes, provided that this copyright statement appears on the reproduced materials and notice is given that the copying is by permission of the author. To disseminate otherwise or to republish requires written permission from the author.

Abstract

A This document is a sample of what can be done with L TEX. In addition to demonstrating the features of the hmcclinic and hmcthesis classes, we hope to provide useful and clear examples of not only what can be done, but how best to do it.

.

without whom this document would not exist in its present form. Lesley Ward. Barbara Schade. and Jeremy Rouse. Michael Raugh.Acknowledgments To Melissa O’Neill. .

.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Commands . . . . . . . . . . 3. . . . . . . . . . . . . . . . . . 3. . . . . . . . . Structured Writing 2. . . . . . . . . . . . . . .4 Labels and References 2. . . .Contents Abstract Acknowledgments 1 Introduction A 1. . . . . . . . . . . . . . . . . 3. . .7 Specifying Equation Numbers or Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 Proofs . . . . . . . . . . .2 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2. 3. . . . . . . . . . . . . .1 What Is L TEX? . . . . . . .6 Adjusting Spacing . . . . . . . . . . . . . 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Aligning Equations . 2. . . . . . . . . . . . . . . . . . . . 2. . . . . 3. . . . . . . . . . . . . . . . . . . 3. . 3. . . . . . . . . . . . . . . . . . . . iii v 1 1 1 3 3 4 4 5 5 6 9 10 13 13 13 14 15 16 17 17 20 20 21 2 3 Mathematical Notation 3. . . . . . . . .3 Structural Commands 2. . . . . . . . . 2. . . 1. . . . . . . .6 Environments . . . . . . .2 Matrices . . .9 Theorems . . . . . . . . . . 2. . . . . . . . . . . . 3. . . . . . . . . . . . . . . . . .8 Customization . . . . . . . . . . .8 Sizing Delimiters . . . . .4 More Math . . . . . . . . . . . . . . . . . . . . .7 Fonts . . . . . . . . . . . . . . . . . . .2 This Document . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Document Classes . . . .3 Symbols . . . . . . . . . . . . . . . . . .1 Sums and Products . . .

. . . . . . . . . . . . . . . Bibliography . . . . . . . . . . . . 6. . . . . . . . . . . . . . . . .4 Additional Programs . . . . . . 6. . . . . . . . . . . . . . . . .1 Online Documentation . . .2 UK-TUG FAQ . . . .3 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . .tex . . . . . . . . 6. . 4. 8 Books A Versions of the Sample Thesis/Clinic Report A. . . . . . . .3 General Comments . . . . . . 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 Figures . . . .1 Special Characters . . . . . . . . . . . . . . . . . . . . . . 7 Resources 7. . . . . . . . . . . . . . . . . 23 23 24 27 31 31 31 32 33 35 35 36 36 37 38 38 39 39 43 43 44 44 45 47 47 49 5 Typesetting 5. . . .3 comp. . . . . . . . . . . . . . Problems. . . . .1 Comments. . . . . .6 Using Graphics with PDFTEX . . . .4 Quotes and Dashes . . . . . . .1 Captions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . . . . . . . . . . . . . . .2 PDF for the Web . . . . . . . . . .2 Accents . . . . . . . . . . . . . . . . . . and Updates . . . . . . 6 Tips and Tricks 6. . . . . . . . . . . . . . .1 Getting to Paper . . . . . . 4. . .8 Debugging . . . . . . . . . . . 7. 6. . . . . . .text.5 Controlling Pagination . . .3 Comments and Spacing . . . . . . . . . 6. . .7 Fonts Look Fuzzy in PostScript or PDF Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . . . . . . . . 7. . . . . . . .viii Contents A 4 Figures and Tables—L TEX’s Float Environments 4. . . . . . . . . 6. . .

. . . . . . . . . .List of Figures 3. . . . . . . . . .1 4. . . . . . .1 Greek letters and some symbols . . . . . . . . . . . . . . . . . .2 4. . . . . . . . . . . . texdoctk main window . . . . . . . . . 14 25 26 27 44 . . . . . . .1 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A step function . . .3 7. . . . . Some shapes . Small multiples . . .

.

. Commonly used font commands . . . . 4 10 18 28 29 35 Tableaus vs. . . . . . . .List of Tables 2. . . . . . . . . . . . . . .1 2. . . . ¨ A sample table: Elections in Gotefrith province. . . . . . . . . . . . . 1900–1910 . . A Special characters in L TEX . . . . . . . . . . . . . . . . . . . .1 4. . . . A L TEX math spacing commands . . . . . . . . . . . . .1 A Structural commands in L TEX . . . . . . tables . . . . . . .1 4. . .2 6.2 3. . . .

.

A L TEX’s beneﬁts include 1. “Floating” ﬁgures and tables 5. the source code of this document A is meant to be an exemplar of “best practice” L TEX coding. Access to L TEX extensions through loading “packages” 1.1 A What Is L TEX? A L TEX is a tool that allows you to concentrate on your writing while taking advantage of the TEX typesetting system to produce high-quality typeset documents. Automatic numbering and cross-referencing of structural elements 4. Second. it is an introduction and A quick survey of the L TEX world. Structural frameworks for organizing documents 3. Standardized document classes 2.Chapter 1 Introduction 1. A high-level programming interface for accessing TEX’s typesetting capabilities A 6. . First.2 This Document This document serves a couple of functions.

.

which allow you to create “slides” for presentations. created by the American Mathematical Society and providing some additional mathematically useful structures and commands.1 L TEX is a markup language rather than a W YSIWYG2 system. foils. 2.1 Document Classes The general appearance of your document is determined by your choice A of document class.Chapter 2 Structured Writing A Like HTML. the math department’s hmcthesis class. report. and seminar. and book. Clinic’s hmcclinic class. . You write plain text ﬁles that use special commands and environments that govern the appearance and function of parts of your text in your ﬁnal typeset document. including article. and many journal. for formatting Clinic reports. Document classes also load L TEX packages to provide additional functionality and often deﬁne their own commands and environments. prosper. There are also a large number of other document classes available. 1 HyperText 2 What Markup Language You See Is What You Get. letter.or company-speciﬁc classes that format your document to match the “house style” of a particular periodical or publisher. for formatting senior theses. A The standard L TEX distribution provides a number of basic classes. including amsart and amsbook.

1: Structural commands in L TEX. By loading packages. Structural commands can take an optional argument (see Section 2. at http://www. you can change the fonts used in your document.4 Structured Writing Command \part \chapter \section \subsection \subsubsection \paragraph \subparagraph Notes book & report only book & report only A Table 2.org/. deﬁne additional commands and environments. add custom headers and footers to your document. Note that the argument provided to structural commands is a moving argument (see Section 4. as shown in Table 2. include graphics. or change the way that previously deﬁned commands and environments work. and hundreds more are available from the Comprehensive TEX Archive Network (CTAN).1. or style ﬁles. such as the table of contents or in page headers or footers. format program listings. A typical TEX installation includes hundreds of style ﬁles.2 Packages A L TEX packages. .5) in which you specify nonfragile commands or a shorter version of the actual section title that ﬁts.3 Structural Commands A L TEX provides a set of structural commands for deﬁning sections of your document. 2.1) because the argument may be reused in other parts of the document. write your document in a non-English language with a non-A SCII font encoding. You’ll generally know when you need to provide an optional argument because TEX will generate errors or you’ll see problems with your headers or in the table of contents.ctan. 2.1. and much more.

or moved to the end of your document. Sections can also be \labeled with a tag such as \chapter{Our Complicated Equations}% \label{sec:complicated-eqs} and referred to with a \ref or \pageref command.5 Commands A L TEX uses commands for changes that are very limited in scope (a few words) or are unlimited in scope (the rest of a document). tables with tab:. we pointed out.. as will many other editors with TEX-speciﬁc features. Rather than give different types of objects undistinguished labels.Labels and References 5 2... or On page~\pageref{fig:gordian-knot}. all affected sections will be renumbered so that their numbering is consistent with where they appear in the document. theorem. Adding the preﬁxes also reminds you of what text should precede the \ref command. I precede chapter labels with ch:. 2. we illustrated. It’s much easier to ﬁnd the particular label you’re looking for if you have some additional information to help you.4 Labels and References A Sections are numbered automatically by L TEX during typesetting. and so forth. as in In Section~\ref{sec:complicated-eqs}. section labels with sec:. as I’ve done in this document. The same commands can be used with numbered environments such as equation. Emacs with AucTEX and RefTEX will give you easy access to these labels. A L TEX substitutes the correct section number when typesetting your document. If you change your mind and decide that a subsection should be promoted to a section.. and so forth. You may also want to impose some additional organization through the use of namespaces. For example. . ﬁgures with fig:. Use meaningful labels—labeling a section as sec12 may seem useful. equations with eq:. but it will be confusing if you end up moving it to a different place in the document and its number changes to 34. It’s also easier to remember what reference you want if you use a meaningful name.

6 Structured Writing the commands \textbf{bold} \emph{italic (emphasized)} \textsf{sans serif} produce the following output in a typeset document: bold italic (emphasized) sans serif These are “commands with arguments”—the command itself starts with a backslash (\). and \pagebreak.” – Julia Roberts in Full Frontal . 2. \raggedright. That arugala is so bitter. There are also commands that usually take no arguments. typed inside a quote environment. which are typed inside brackets ([ ]). as in \begin{quote} ‘‘This is disgusting---I can’t eat this. Environments use special commands to start and close—\begin and \end—followed by the name of the environment in braces. The typeset results were typeset inside a quote environment. and are generally used for more structurally signiﬁcant purposes. and its argument appears inside braces { }). It’s like my algebra teacher on bread.6 Environments A L TEX provides a number of environments that affect the appearance of text. in turn. That arugala is so bitter\ldots{} It’s like my algebra teacher on bread. . as discussed in Section 2. the command list in Section 2. or some combination of required and optional arguments.Julia Roberts in \emph{Full Frontal} \end{quote} producing “This is disgusting—I can’t eat this. more than one required argument (typed in braces). Some commands may also have optional arguments.3 was typeset inside a verbatim environment that was. You can deﬁne your own commands.8. . such as \noindent. For example.’’ \flushright -.

2. and includes the allpowerful \documentclass command. and other setup commands.Environments 7 Like commands. The code before the \begin {document} line is called the preamble. the inner environment must be \ended before the second environment is closed.2 Math Environments One of the major features of TEX is its ability to typeset complex mathematical equations. The two primary ways of doing so are with the use of inline and display math environments. which encloses the body of your document. such as user-deﬁned commands and environments. before the \maketitle command. I generally also include the commands deﬁning the title. These environments are used so often that there are shorthands provided for typing them.6. can be typed as \begin{math} a^{2} + b^{2} = c^{2} \end{math} or. and so forth. which creates the title block of your document. and date in my preambles. Display math environments set your equation apart from your running text. which loads a particular document class (see Section 2. but other authors include them just after \begin {document}.2). They’re generally used for more complicated expressions. Inline math environments. $a^{2} + b^{2} = c^{2}$. 2. such as a2 + b2 = c2 . If you type an environment inside another environment. It’s also vitally important that you have an \end line for each \begin line. more commonly.1 The document Environment and the Preamble The most important environment in any document is the document environment.6. author. counter settings.1). such as ∞ f (x) = 0 x2 + x3 1 dx . or TEX will complain. Note that the order in which environments nest is extremely important. which load addiA tional L TEX packages (see Section 2. some environments may take one or more additional arguments in braces (required) or brackets (optional). optional \usepackage commands.

8 Structured Writing which can be typed as \begin{displaymath} f(x) = \int^{\infty}_{0} \left( \frac{x^2 + x^3}{1} \right)dx \end{displaymath} or \[ f(x) = \int^{\infty}_{0} \left( \frac{x^2 + x^3}{1} \right)dx \] Generally. it also numbers it. L TEX not only typesets the contents of an equation environment in display mode.] The equation Environment You’ll probably want to use the equation environment for any mathematiA cal expression that you plan to refer to.1” by typing \ref{eq:myequation}. and the \[ \] form for display math environments.1) written as \begin{equation} \label{eq:myequation} f(x) = \int^{\infty}_{0} \left( \frac{x^2 + x^3}{1} \right)dx \end{equation} You can now refer to this formula in your text as “Equation 2. you’ll want to use the $ delimited form for inline math. which means that they can be used in moving arguments: elements that TEX may need to typeset in more than one place (such as a table of contents) or adjust (such as footnotes). these forms are also robust . as in ∞ f (x) = 0 x2 + x3 1 dx (2. [Besides being easy to type. .

Filenames might be set in typewriter text (although you should consider using the url package to help you out—by default. You can also set text in sans serif or SMALL CAPS. see Section 6. and utopia. and include a wide range of variations that can cover almost any use you can think of. These font sets are accessible with packages with names like times. as well—a command such as \locate psnfss | grep sty will ﬁnd most of them. You might want some emphasized or bold text to stress a point or highlight a key term. you can use Type 1 PostScript fonts. compare \emph{She loved \emph{Scooby Doo}.1 Font Commands Most of your concerns about fonts are probably related to what you’re writing. and use \textbf sparingly. \emph is a smarter command than \textit—it switches back to the roman font when necessary. 2. you can also get both bitmap and Type 1 fonts from CTAN (see Section 2. Utopia. many of the classes developed for Mudd specify Palatino as the roman font. and so forth. There’s even support for TrueType fonts in some TEX systems. Palatino.7. Table 2.2).7 Fonts A Generally you’ll want to let L TEX handle the fonts for you—Knuth’s Computer Modern fonts are used by default. palatino.Fonts 9 2. I strongly recommend that you use \emph in preference to \textit.2 shows you A some of the most commonly used font commands provided by L TEX. and you need some special fonts.} which produces She loved Scooby Doo. such as Times. text set in typewriter text isn’t hyphenated. Document classes may also specify particular fonts (for example. There are others. you should ask the systems staff about having those fonts installed system wide.7). If you want to get fancy (and portable. If you’re using TEX on turing or the mathematics cluster. and Helvetica as the sans-serif font). with . If you have a TEX system installed on your own machine. For example. which can lead to some unattractive line breaks).

10

Structured Writing Command \emph \textsf \texttt \textbf \textsc \textsl \textit Result emphasized text sans-serif text typewriter text bold text

SMALL CAPS TEXT

slanted text italic text

Table 2.2: Commonly used font commands. \textit{He loved \textit{Titanic}.} which produces He loved Titanic. For complicated font changes, or for special font usages that you’re typing a lot, creating a macro (Section 2.8) is the way to go. I often just write, tossing in custom commands as I go, and wait to deﬁne them until just beA fore I compile the document. (L TEX will stop each time it encounters an undeﬁned command; you can use this feature to help you remember what commands you made up. Deﬁning them in advance works ﬁne, too, of course.)

2.8

Customization

The main advantage of using commands and environments is that they allow you to organize your writing. A useful side-effect is that you can later change your mind about the way a particular element is typeset, and change the appearance of every use of that element in your document by editing one piece of code. For example, in this document the names of environments have been set in “typewriter text” using a command I created called \env, which is deﬁned as \newcommand{\env}[1]{\texttt{#1}\xspace} All I have to do to make the names of environments in the document appear in sans-serif type instead is to change that one line to \newcommand{\env}[1]{\textsf{#1}\xspace}

Customization 11 You can do the same with almost anything you can conceptualize— key terms, people’s names (especially names of people from non-Englishspeaking countries), ﬁles, functions, and so on.

2. k n3 − 1 2 ∏ n3 + 1 = 3 .2 Matrices It’s a little more difﬁcult to create matrices. For example. math is typed into one of several kinds of math environments.6. Reading them aloud is often a useful method for ensuring that you have all the commas in the right places. Choose your environment based on the context and importance of the content. you should also follow a displayed formula at the end of a sentence with a period. n=2 ∞ (3. but not too bad: 2 1 2 −2 1 2 1 0 0 1 0 2 3 −2 −2 = 0 1 0 . 2 1 1 1 0 −1 0 0 1 (3. 3.1 Sums and Products It’s easy to typeset sums and products. f (n) = n k=1 ∑ n n f (n − k).1) 3. Where appropriate. Any formula you plan to refer to should be typed in an equation environment (or a similar environment that supports labels). You should punctuate your mathematics as if the formulae were normal parts of English sentences.Chapter 3 Mathematical Notation As we saw in Section 2.2) .

Θ Λ Ξ Π Φ Ψ Ω ϕ . such as 3rd .1: Greek letters and some symbols. (3.3 Symbols A L TEX provides an enormous number of symbols. \exp. π 0 cos2n+1 x dx = 0 ∀ n ∈ N. . Z. and $x^{2}$ produces x2 .3 shows a formula with a superscript.3) Notice that \cos produces a nice roman cos in math mode. . . and so forth. N.. More can be deﬁned with the \DeclareMathOperator command provided by the amsmath package. . (3.4) A L TEX has lots of Greek letters and ellipses too. Q. and so forth. some of which are shown in Figure 3. . Equation 3. and C require you to load the amsfonts package (which is automatically loaded by the icmmcm class).. You can stack symbols over other symbols in math formulas: ¨ ˙ m x + γ x + kx = 0. 1 Some fonts may include their own ordinals that can be accessed with special com- mands.1 can be produced with code like $3^{\textrm{rd}}$. $n^{\textrm{th}}$.. There are similar commands for common functions like \log.14 Mathematical Notation α η ν τ Γ Σ ··· γ δ ζ ι κ λ µ o ρ π σ φ χ ψ ω . Additional packages (loaded with \usepackage) may provide additional symbols and fonts. 3. · β θ ξ υ ∆ Υ Figure 3. Subscripts and superscripts are easy—$a_{n}$ produces an . nth . R. which only works in math mode.1. Ordinal numbers. : . These symbols are generated by \mathbb. For example.

541. . Depending on the fonts and packages that you’re using. The same numbers without math mode are 341. . . 1 + 2 + · · · + n = n(n + 1)/2. pp. . . . . . and that the periods were nicely spaced between the commas. . with \dots alone. .5) 3. 2. 561.. . 3. 341. Intext. or Kopka and Daly (1999). we talk about the z-domain. . . . k then it also holds for n = k + 1. you might see some of these symbols used as The Strong Induction Principle asserts that if a statement holds for the integers 1. n. 455–474. . . . . . k 1. n n = 1. and 641. For example. . ann A ﬁne point: lists of numbers that you’re using in a mathematical sense (as opposed to dates. 123– a 127. 3. numbers intext may be set using old-style ﬁgures by default. The lists may even appear in a different typeface. . . and . Using this Principle. . The amsmath package provides a “smart” \dots command that can generally get things right based on the context. numbers of objects. With some packages. In the sum. . the ellipsis was made using the \ldots command.4 More Math In Fourier analysis. . an1 an2 . a1n a21 a22 . . . and if whenever it holds for n = 1.More Math See Gr¨ tzer (2000). . as in . . the previous examples come out as 1.. So. . . the dots were made with \cdots and were centered on the line. you may notice a little bit more space around the ﬁrst set than the second.) should be typed in math mode. . The general n × n matrix can be typeset as follows: a11 a12 . . 541. . a2n . pp. . 2. etc. for lists of the symbols available. Notice that in the lists of integers. . 15 (3. 2. 561. 2. it can be shown that 1 + 2 + · · · + n = n(n + 1)/2 for all positive integers n. . . then the statement holds for the integers 1. . . . and 641.

h 3. 3x4 + 1 x4 = x4 + 4x2 + 6 + = = = 4 1 4 + 4 − 4x2 − 6 − 2 2 x x x 1 4 4 x+ − 4x2 − 6 − 4 x x x+ 1 x 4 (3. students come to know the true meaning of F = ma. φ(a) is the number of integers less than a and relatively prime to a. In frosh physics.6) (3. Lamport (1994). and − 2m 2 ψ + Vψ = i¯ ∂t . Typeset a piecewise function using the cases environment (from the amsmath package) as follows: σ(a) > |x| = x.8) (3. then a + φ(a) < and 3a . α 2 2 where α is the greatest power of 2 that divides a.7) (3. See American Mathematical Society (1999). the = signs have been aligned using the eqnarray environment.6–3. 2 3a 2α+1 − 1 a≥ . people used the eqnarray environment to align equations. which allows you to specify the spacing. alignat. and more. and σ(a) is the sum of the divisors of a (including 1 and a). or Kopka and Daly (1999) for more a information about the alternatives.5 Aligning Equations In days gone by. −x. which places the leftmost column as far to the left as possible and the rightmost column as far to the right as possible. . In Equations 3.16 Mathematical Notation If a is an even number. eqnarray has generally been replaced by align and some variants such as flalign.9. Gr¨ tzer (2000).9) − 4x4 − 8 − 4 4 +8−6 x4 2 1 x+ x 1 −4 x+ x − 6. if x ≥ 0. otherwise. ∂ψ h2 ¯ E = mc2 .

10) (3. Typically.12) (3. Rather than 1 dxdy. 1 − xy you want 1 dx dy. 3.6 Adjusting Spacing Sometimes you need to adjust the spacing and fonts inside integrals. There are additional spacing commands provided by the amsmath package. 3x4 + 1 1 4 4 = x4 + 4x2 + 6 + 2 + 4 − 4x2 − 6 − 2 x x x4 x 1 4 4 = x+ − 4x2 − 6 − 4 x x = = x+ x+ 1 x 1 x 4 17 (3.15) (3.. You can specify a number (or name) for a single equation by placing the formula in a display math environment (but not an equation environment) . dx and dy.7 Specifying Equation Numbers or Names All the equations you’ve seen so far have been numbered consecutively. the “d” (as in dx) is set in Roman type. 1 − xy (3. and between those elements and the integrand with the “thin space” command. Table 3. Extra space has been added between the elements of integration. See Tables A. not shown here.13) − 4x4 − 8 − 4 4 +8−6 x4 2 −4 x+ 1 x − 6.9 and B.Adjusting Spacing Equations 3. \.14) The integral signs have been moved closer together using the “negative space” command \!. commands provided by L TE 3.10–3.1 shows the spacing commands available in math mode.11) (3.13 show the same set of equations aligned with the align environment.6 in Gr¨ tzer (2000) for all the spacing a A X and the amsmath package.

If you name a formula. (42). (cool formula). $a cool formula$ gives you acool f ormula). √ ∞ π −x2 e dx = . or it will be set as if it was a string of variables (and without any spaces—for example. use the starred form of the align environment. For example.18 Mathematical Notation A L TEX Command Short Long Name Positive Space thinspace medspace thickspace 1 em 2 em Negative Space thinspace \. \thinspace \quad \qquad \! \negthinspace A Table 3. \: \.1: L TEX math spacing commands. If you’d like to have many aligned equations without numbers. you will also have to enclose the text within a command such as \mathrm. and giving the desired number or name as the argument to an \eqno command. align*. 2 0 or √ ∞ π −x2 . as in . e dx = 2 0 Note that you have to specify the parentheses in the argument to the \eqno command.

Specifying Equation Numbers or Names 19 The area K of ABC is given by K= ah a 2 ab = sin C 2 = rs = s(s − a)(s − b)(s − c) abc = 4R a2 sin B sin C = 2 sin A = 2R2 sin A sin B sin C. as in K= ah a 2 ab = sin C 2 = rs = s(s − a)(s − b)(s − c) abc = 4R a2 sin B sin C = 2 sin A = 2R2 sin A sin B sin C.) . (3. and h a is the length of the altitude from the vertex A to the side BC. you could use the normal (unstarred) form of align and precede each line you don’t want to be numbered with a \notag command. r is the radius of the inscribed circle. If you wanted to number the ﬁnal derived equation.16) Note that the \notag command could appear after the linebreak command (\\) on all lines except the ﬁrst and the next-to-last. s is one-half of the perimeter. (Commands following the linebreak apply to the following line. R is the radius of the circumscribed circle. and C are the angles in ABC. where A. B.

\Big. f (x) = 1 + (1 + x)2 n . type a \newtheorem command in the preamble of your document. This document includes three such deﬁnitions.20 Mathematical Notation 3. 3. as in or (a + b) + c + d + e + f 3.8 Sizing Delimiters The \left and \right commands. and z are positive integers.9 Theorems The theorem environment provides you with an easy way to typeset theorems in your document. . tell TEX to adjust the size of the delimiter to its contents. or parenthesis. followed by a bracket. y. Examples of each appear below. or \Bigg to specify larger delimiters (useful if you have multiple levels of delimiters).17) You can also use commands such as \big. (3. such as \newtheorem{Theo1}{Theorem} You can then type a theorem using your theorem environment.9.1 The equation x4 + y4 = z4 has no solutions where x.1 A Theo1 Environment Theorem 3. \bigg. To use it. brace. \newtheorem{Theo1}{Theorem} \newtheorem{Theo2}{Theorem}[section] \newtheorem{Lemma}[Theo2]{Lemma} which show you some of the possibilities available.

Proofs 21 3.9. as here. takes an optional argument that allows you to rename the “title” (e. Thus.10 Proofs Adding a proof is even easier. You can also use the proof environment provided by the amsthm package (not shown here).9.g. 3. For example. Two positive integers a and b are amicable if σ(a) = σ(b) = a + b. . 3. The main difference is that the AMS’s proof environment is typeset differently.. as above.3 A Lemma Environment Lemma 3.2 A Theo2 Environment Theorem 3.2 There do not exist two consecutive integers which are amicable. The \hfill makes the box print ﬂush right at the end of the line. if two consecutive integers are amicable.1 (Wilson) A positive integer p is prime if and only if (p − 1)! ≡ −1 (mod p). no integers are amicable with even numbers. where σ(N) denotes the sum of the divisors of N. symbol at the end of the environment. and automatically inserts the Q. Bernoff’s Putnam mug is a multiply connected 2-manifold of genus 1. use \hfill$\Box$. Theorem 3. However. To create the end-of-proof marker shown here. from “Proof” to “Proof of Theorem 5”). Proof: Since even numbers are annoying.1 Prof. they are both odd. courtesy of the proof environment.E. The following is a theorem with an associated proof.D. two consecutive odd numbers do not exist.

.

The table environment is generally used for—surprise!—tables. but could also be used for other illustrative graphics. you can specify a caption that will appear with the ﬂoat. if at the bottom. you can accommodate them. The basic ﬂoat environments don’t format their contents specially. figure and table. Its position in your typeset document depends on where in the environment you type it—if the command is at the top of the environment. So . complete sentences. the caption will appear beneath its contents. the caption will be typeset above its contents. The figure environment is often used for graphs or diagrams. Captions should usually be set at the bottom of a ﬂoat. If you want an illustration or table to be centered.1 Captions By adding a \caption command. Captions should generally be written as brief. They should either be capitalized as normal sentences. ending with a period.Chapter 4 A Figures and Tables—L TEX’s Float Environments A L TEX provides two “ﬂoat” environments. but if a particular publisher or journal prefers the captions on top. Float environments are so called because they can be typeset on a later page in your document than their location in the source code. you will need to type it inside a center environment or add a \centering command after the \begin{float} command. 4.

8. that is. they produce output that can cause problems if the typeset text is moved somewhere other than the place that TEX originally thought it would be typeset. 1977–1987.1 Figures Including Graphics The figure environment is often used for including graphic images. 4. which is typed inside brackets ([ ]).24 A Figures and Tables—L TEX’s Float Environments Production Statistics from Soviet Russia. 1977–1987 Whichever style you choose. 12.31–51) for more details. rather than production statistics from Soviet Russia. The \caption command takes an optional argument. Both packages provide the same functionality. Do your explanation in the text that refers to the ﬂoat.1 More information about the graphics package 1 The graphicx package deﬁnes commands that take their arguments in key–value pairs. or Production statistics from Soviet Russia. 4. The state-of-the-art method requires you to load the graphics or graphicx package.1 Fragile Commands and Moving Arguments Both arguments to the \caption command are moving arguments (because TEX can move them).1. but take arguments in a slightly different format.2 4. 4.2. To prevent fragile commands from being expanded too early and causing problems.1. .2 Labels The \label command for a ﬂoat is generally typed immediately after the \caption command. 1977–1987.) Avoid explaining the whole ﬂoat in the caption. Some commands are fragile. This argument is used in the list of tables or list of ﬁgures in place of your actual caption. you can use the \protect command just before the command you want to keep unexpanded. be consistent! (See The Chicago Manual of Style (2003: 12.

A we can typeset this document with PDFL TEX without making any other changes.1: Some shapes.6 for some hints on converting your EPS ﬁgures to PDF.1: \begin{figure}[ht] \begin{center} \scalebox{. 1999). By dropping the extension. See Section 7. PostScript. EPS ﬁles are special PostScript ﬁles that deﬁne a tight “bounding box”.50}{\includegraphics{shapes}} \end{center} \caption[Some shapes]{Some shapes.Figures is available in its manual. or Visio. The \includegraphics command searches for different graphic formats depending on the typeset document’s format. PDFTEX requires you to have your graphic ﬁles available in PDF (or PNG or JPEG. Notice that we didn’t specify the . They can also be created from TEX ﬁles by using the -E ﬂag with dvips. EPS ﬁles are generally created with a vector-graphics application such as Adobe Illustrator. . and are restricted from using some PostScript operators. grfguide (Carlisle. Dia. With the development of PDFTEX. generating Portable Document Format ﬁles has become much easier. or PDF format with most TEX systems.}% \label{fig:an-eps-graphic} \end{figure} 25 Figure 4. The following code tells TEX to include the graphic shown in Figure 4. provided that we have the graphic available as a PDF ﬁle. or EPS. The standard graphic format used with TEX is called Encapsulated PostScript. See Section 6.1 for ways to ﬁnd documentation. may include a bitmap representation for use in previewers. which is included in DVI. if the images are bitmaps). OmniGrafﬂe.eps extension in the ﬁlename argument to the \includegraphics command.

26 A Figures and Tables—L TEX’s Float Environments Small Multiples Sometimes you need (or want) to include more than one image in a ﬁgure.3. 4.2: Small multiples. as shown in Figure 4. such as when you have several close variations on a single image. (a) Original image. Chapter 6 of Kopka and Daly (1999) describes how you can create diagrams such as that shown in Figure 4. You may ﬁnd it easier to produce such diagrams with a separate application.2c or Figure 4.3 shows a graph created with the picture environment. You could also refer to the subﬁgures as Figure 4. Figure 4. (c) Turned 90°. .2.2 A L TEX Diagrams A L TEX can also be used to create both simple pictures and sophisticated diagrams.2. (b) Turned 45°. Figure 4. (d) Turned 135°. which has subﬁgures a or (b).2(d).

(University of Chicago Press. calls “tableaux”. which is automatically loaded by the icmmcm class. Most books on L TE bles. and midrules.3: A step function with a peak at t.1a. has some special commands for creating lines of different thicknesses for use as top. A X cover tabut because they’re difﬁcult to do right. 4.1b. The Chicago Manual of Style. not because they’re difﬁcult to do in L TEX. and Edward Tufte (1983) support his assertion. Simon argues that such a tableau would be better presented as the table shown in Table 4. and provide excellent references and inspiration. The booktabs package. but present what Simon Fear. author of the booktabs package.Tables 27 2 1 F0 0 F3 F2 F1 1 t Figure 4. 2003).3 Tables A Tables are a complicated subject. One such tableau is illustrated in Table 4. It also has some code that provides . bottom.

Also. Table 4.01 92. The rest is up to you and your style guide.65 0. for creating spanner rules for decked spanner heads. (Taken from Lamport (1994).50 33.50 33.65 .99 (b) The tableau as a table. alas) in George Gr¨ tzer’s Math into LTEX were prepared a with booktabs. the \cmidrule command.2 is taken from The Chicago Manual of Style.99 (a) A tableau.33 8. 64. As an example of a table to strive toward. .01 92. tables. all of the tables (except for those in the section A describing tables.33 8.1: Tableaus vs. Table 4.) Item Description per gram each Gnu stuffed Emu stuffed Armadillo frozen Animal Gnat Price ($) 13. pg.28 A Figures and Tables—L TEX’s Float Environments gnats gnu emu armadillo gram each stuffed frozen $13.

) .0 52 39 59 0 150 3 2 8 0 13 ¨ Table 4.1 46.5 52.4 49.0 47 18 85 0 150 4 1 7 0 12 1906 % of Vote Seats Won Provincial Assembly 26.8 100.Tables 29 Party Conservative Socialist Christian Democrat Other Total Conservative Socialist Christian Democrat Other Total 1900 % of Vote Seats Won 35.1 44 41.1 100.3 3 42.2 100.2 68 5. (Taken from University of Chicago Press (2003).7 1 100. 1900–1910.0 12 1910 % of Vote Seats Won 30.4 1.8 3 27.2 2.0 37 27.9 24.2: A sample table: Elections in Gotefrith province.8 6 6.6 13.1 0 100. pg.0 150 National Assembly 23.8 39.0 1.8 100. 414.6 12.3 24.0 32.0 28.2 5.

.

5.tex. you can create a PostScript ﬁle by running the following commands: unix% latex foo unix% dvips -o foo. you can use -o’|lpr’ to pipe dvips’s output to the printer.tex. dvips automatically prints your document to your default printer. you can achieve the same result with dvips foo— dvips knows what extensions to append to the base name of the ﬁle. On our systems. your goal is to end up with a PostScript ﬁle (for printing) or a PDF ﬁle (for printing or placing on the web). you can create a PDF ﬁle by typing . or “typesetting”. Generally. How do you get a typeset document that you can print or put on the web? The process of typesetting a document is referred to as “TEXing”.Chapter 5 Typesetting A So you’ve got a L TEX source document. There are multiple ways to do both tasks. foo. “compiling”.ps On some systems.2 PDF for the Web Starting with foo. 5.1 Getting to Paper A Starting with a L TEX document. If you want to print in one step. You need to specify the -o ﬂag to get a PostScript ﬁle on such systems.ps foo unix% lpr foo.

It’s generally good practice to run A L TEX three times. .32 Typesetting unix% pdflatex foo or with the following sequence of commands: unix% latex foo unix% dvips -Ppdf foo -o foo. man prv). or a Makeﬁle. or JPEG verA sions of any graphics ﬁles that you’re including to be able to use PDFL TEX. 5. which automate much of this process. or until it stops warning you about possible changes. using PDFL TEX directly is preferable to the longer.ps unix% ps2pdf foo. However. and you can’t convert them to formats A that are compatible with PDFL TEX. you will need to have PDF. It then reads that information in on the next pass.ps foo.3 General Comments A L TEX does its numbering (and some other functions) by writing information to an auxiliary ﬁle. such as alias mylatex ’latex \!* && latex \!* && latex \!*’ (for the csh) used as mylatex foo or by writing a Perl script. If all you have are EPS or GIF ﬁles.) A If possible. shell script. then the latex →dvips →ps2pdf route may be the only one available to you. The mathematics department has the prv and prvps programs installed.g. PNG. Thus you have to run latex or pdflatex at least twice whenever you make a change that affects the numbering of elements or the ﬂow of text across pages.pdf (The last step in the second example (running ps2pdf) can be replaced by running the PostScript ﬁle through Adobe’s Acrobat Distiller application. and uses it to typeset references. You can ﬁnd out more about how these programs work and the arguments that they take by running the man command with the name of one of the programs as an argument (e. You can make this process easier by creating a shell alias.. more complicated route.

4 Additional Programs There are some additional functions. such as indexing and bibliographies. .Additional Programs 33 5. We won’t cover those programs in this document. A that use external programs to read auxiliary ﬁles and produce L TEX code for inclusion on later runs.

.

Using these characters in your writing requires you to do a bit of extra work. as in x2 Starts commands To Typeset \# \$ \% \& \_ \{. This chapter covers some of these tricky bits. \} \~{} \^{} \verb |\| A Table 6. As a result. 6. Character # octothorp $ dollar sign % percent sign & ampersand underscore {. there are many sneaky aspects to it that will cause you problems if you don’t know about them.1.1 Special Characters A TEX and L TEX have a number of “special” characters that are reserved for use by the language. as in x2 Parameters Nonbreaking space Superscripts. .Chapter 6 Tips and Tricks A L TEX is a very complicated and powerful language. as shown in Table 6.1: Special characters in L TEX. } braces ˜ tilde ˆ caret \ backslash Function Macro parameter character Start/end inline math mode Comment character Column separator Subscripts.

7 in Math into LTEX (Gr¨ tzer. as in A See Section 2. of the line.4. 2000) for information about a accents (and some handy charts!). Any line that starts with a % will be “commented out”. will typeset as This line is not a comment line. 6. This line is not a comment line. and won’t be interpreted. You can also add a % at the end of a line.2 Accents ` Paul Erd˝ s s’est reveill´ tot pour enseigner le francais a son fr` re o e ˆ ¸ e et sa sœur. you also comment out the carriage return on that line. and you’ll have words run into one another unless you have a space before the %. There are a variety of commands for producing diacritical accents.36 Tips and Tricks 6. Notice the lack of a space in “endof” on the last line of the typeset output. and it will make the end of the line (including the linebreak!) disappear. and interprets that carriage return as an interword space.3 Comments and Spacing You can add comments to your source ﬁle that won’t appear in your typeset document by starting them with a %. This line has a comment at the end% % This line should be invisible. . with or without text. For example. % This line is a comment line. TEX expects to ﬁnd a carriage-return character at the end of a line. This line has a comment at the endof the line. and ignores whitespace at the beginning of a line. If you comment out the end of a line. TEX collapses multiple spaces into one. Thus No spaces.

and to indicate interruptions in dialogue. such as “reddish-green–colored item”. are typed with ‘ and ’. typesets as No spaces.) Paragraphs are delimited by two carriage returns (with or without whitespace between them). ".Quotes and Dashes Five spaces. as in “I hear you—” “No. balanced relationships. as in “U. ‘ and ’. 2. En dashes are used to indicate ranges. as in “there are 35–50 of them”. The hyphen. you don’t!” .4 Quotes and Dashes Because TEX was designed to do high-quality typesetting. –. (The lines are indented because they are at the start of a paragraph. 37 6. respectively. as in “John believed—honestly believed— that he was right”. and for extended hyphenated phrases.–European agreements”. Single-quotes. is typed as two dashes. —. There are three basic forms of dashes: 1. Open and close double quotes—“ and ”—are created by typing ‘‘ and ’’. The en dash. -. is typed as three dashes. is typed as a single dash. A tab. as in “high-quality”. it cares about which quotation mark and dash you’re using. The double-quote mark. The em dash. as in 36”). Em dashes are used to separate independent phrases. A tab. You can suppress paragraph indentation with \noindent. --Hyphens are used in hyphenated words. Five spaces.S. is typeset as ” (and is useful for abbreviating “inches”. -3. and requires you to specify the correct punctuation (although most text editors with special TEX modes will do the substitution for you).

If you do need to tinker with your document’s layout. A George Gr¨ tzer’s Math into LTEX (2000) includes a chapter on preparing a books that covers this topic in depth. so you’ll have to redirect the output to a ﬁle. you should avoid doing so until you’re very nearly done. If you go back and add or reA move text after forcing L TEX to do your will. you should let L TEX have its way. If you’re using a graphics program such as Adobe Illustrator to prepare your ﬁgures. you must ﬁrst convert your EPS ﬁles to PDF. as in unix% epstopdf foo. just save them as PDF instead of (or in addition to) EPS.eps > foo.5 Controlling Pagination A Sometimes you may need to override L TEX’s choices for line or page breaks. The \\ command can be used to tell L TEX where to break a line.38 Tips and Tricks Note that you shouldn’t type spaces around any of these dashes—they run directly against the words on either side. you may ﬁnd that new blank spaces appear as a result of your changes. epstopdf writes to standard output by default. A X to start a new page immediately The \pagebreak command causes L TE A after the command appears. EPS is not directly supported—to use EPS ﬁgures with PDFTEX.6 Using Graphics with PDFTEX PDFTEX supports PDF and JPEG as native graphic ﬁle formats. 6. but you still need to convert them. you can use the program epstopdf.pdf foreach? end . as they will undoubtedly have many changes that will have to be made before your document works for them. you could use a command such as the following (with the csh): unix% foreach f ( ‘find . 6.pdf To convert a whole slew of ﬁles. especially if your document is going to be published by someone else. If you don’t have access to the tool you used to create your images. -type f -name ’*. A In general. as in 35--50.eps’‘) foreach? eps2pdf $f -o=$f:r.

the line numbers that L TEX reports are often not the line A numbers where the problem is. One useful way of getting a bit more context to help you understand the problem is to put the line \setcounter{errorcontextlines}{1000} in the preamble of your document. Computer Modern. Knuth created his own font family. A If you’re using PDFTEX (or PDFL TEX). which will provide you with a (perhaps excessive) amount of context for an error. try the following procedure: .6). by writing a tool called METAFONT. most typesetting was done by trained typesetters using expensive equipment to cast molten lead into runs of type.7 Fonts Look Fuzzy in PostScript or PDF Files When Donald E. Unfortunately. but the line numbers where L TEX noticed there was a problem.Fonts Look Fuzzy in PostScript or PDF Files 39 6. The solution is to use Type 1 PostScript fonts instead of bitmaps.ps 6.8 Debugging A A One of the trickiest things about using L TEX is interpreting L TEX’s sometimes cryptic error messages. Knuth originally wrote TEX. ready for printing. A In particular.1) • Leaving off or mismatching a brace or bracket • Leaving out or swapping arguments to a command or environment If you’ve tried everything and you can’t ﬁnd the source of an error message. and generates bitmap representations of those characters at a particular resolution.dvi -o foo. METAFONT reads in programs that deﬁne various aspects of every character in a font. bitmaps with resolutions suited for printing look terrible on screen. as in unix% dvips -Ppdf foo. The most common errors are • Using one of the special characters (see Section 6. you can force dvips to use Type 1 fonts by specifying the -Ppdf ﬂag. If you’re using dvips to get PostScript as an intermediate step (using ps2pdf or Acrobat Distiller to get PDF). you get Type 1 fonts without having to do anything special (but see Section 6.

which also deﬁnes new versions of the verbatim and verbatim* environments. followed by an empty document environment 2. Try typesetting the new document—if you have an error. % c. % b. and typeset that 5. copy half of your original document’s body into the new ﬁle. If you don’t see your error. you can comment and comment those lines to control which ﬁles are A included in a L TEX run. Create a new ﬁle. which allows you to “comment out” anything between the begin and end environment commands.8. If you place each item on a separate line. then you can also use the \includeonly command to limit the parts of your document that will be typeset to some subset.40 Tips and Tricks 1. The comment environment is provided by the verbatim package. the problem is in your preamble 4. If the document typesets.2 The \includeonly Command If you’ve written your document in such a way that each chapter or other signiﬁcant subdivision is stored in a separate ﬁle and included in your master document with an \include command. then continue halving the document until you narrow it down to the problem section 6.1 The comment Environment If you don’t want to go through the process of copying your document. \includeonly takes as its argument a comma-separated list of ﬁles that are \include d in your document.8. you can also use the comment environment. 6. \includeonly{ a. d} . get rid of the single word you’d put in the document environment. and copy your preamble into it. Add a word to the document environment so that TEX will have something to typeset 3. try the other half 6. If you see your error. For example.

the chapter numbers will be incremented for the typeset ﬁles but not for the ﬁles you’re not typesetting. A nice side-effect is that the auxilliary ﬁles for these ﬁles are not changed.Debugging 41 will allow you to typeset the contents of the ﬁles a and d. any \pageref commands will be incorrect. if you add a new chapter in a ﬁle called aa between the line that includes a and b. the same applies if any additional structural commands are added at the same level as the topmost level in the excluded ﬁles—that is. so that references to labels in the ﬁles not being typeset will still be expanded in the ﬁles that are typeset. . of course. (If the pagination changes. without typesetting the contents of b and c.

.

it’s the only manual in their distribution).1 Online Documentation A Much of the documentation for TEX and L TEX is available online. which lists all the ﬁles on your system that match a string that you provide.edu/computing/support/tex/). and passing that list to another grep for the string doc: unix% locate graphics | grep texmf | grep doc Another hard to ﬁnd. for instance. The authors of the graphics package. Sometimes you can ﬁnd documentation using the locate command.Chapter 7 Resources A There are lots of great resources available for using TEX and L TEX. texdoc only works for documentation that is sensibly named. Still others decided that manual was a good name for their manual (after all. includes a script called texdoc to access this documentation. document. Here are a few (there are also links available online at http://www. as part of the TEX system. which is called amsldoc. All you have to do is type texdoc followed by a string that you believe is the name of the document you’re looking for. For example. the TEX system installed on the mathematics department’s computers. is the “User’s Guide for the amsmath Package” (1999). teTEX. you could ﬁnd grfguide by trying locate graphics and grep ping out the results with texmf in them. 7.hmc. called their manual grfguide. . For example.math. but very useful. Unfortunately. texdoc booktabs will give you the documentation for the booktabs package that I used to create the tables in this document.

text. Figure 7.tex If you can’t ﬁnd an answer in the UK-TUG FAQ.uk/cgi-bin/texfaq2html.text.ac.1. If you’re not sure how to do something.t. which gives you a graphical window into the documentation installed on the system.text. type in some search terms. You start texdoctk by typing its name at a shell prompt. 7.44 Resources 7. (If you specify group:comp.3 comp.tex.t. and check out the answers.google. Go to Google Groups (http: //groups. the Usenet newsgroup devoted to TEX and L TEX. you’ll only see results from comp. A window (Figure 7. and got an answer.2 UK-TUG FAQ The primary list of frequently asked questions in the TEX world is the UK TUG FAQ.1 \texdoctk Our current teTEX installation includes the texdoctk program.tex.tex at the end of your search terms. 7. asked about it on c.) .tex. or you’ve got a problem that you’re pretty sure isn’t being caused by a typo. Usenet’s past is preserved in an easily searchable format. check here ﬁrst. whatever your problem is.1: texdoctk main window. Chances are. Thanks to Google. available at http://www. clicking on one will open another dialog box with the titles of available documentation (with the names of the actual packages in parentheses). someone else already had it.text.1) will appear with buttons corresponding to broad categories of documentation.com/). then your next step is A to check comp.

hmc. Dupr´ is one of Addison Wesley’s senior editors.math. It also has excellent reference tables and a thorough index.Chapter 8 Books http://www. It’s the kind of book you leave in the bathroom so you’ll always have something interesting and amusing to read. My pick for the best introductory/reference book is the third edition of A George Gr¨ tzer’s Math into LTEX (2000).edu/computing/support/tex/ has some brief reA views of a number of signiﬁcant books about TEX and L TEX. . and want to start doing some fancy page design or want to be sure you’re using the right kind of type. 1 Which I edited. BUGS is an accessible guide to writing clearly and effectively. Learning how to write better is almost a byproduct! If you get serious about typesetting. Another book I highly recommend is Lyn Dupr´ ’s BUGS in Writing e (1998). Robert Bringhurst’s The Elements of Typographic Style (1996) will show you the way.1 It’s the only book I’m aware of a A that discusses the latest version of AMSL TEX in depth. and has edited e many of the most signiﬁcant books published by Addison Wesley.

.

. Please send such comments and “bug reports” to us at latex@math. In 2005. questions. created in 1999. A. making maintenance and distribution a bit easier.hmc. Connelly. whereas other material has been written from scratch or adapted from other sources.Appendix A Versions of the Sample Thesis/Clinic Report This document is based. in part. on earlier versions of sample Clinic reports and sample theses. and Updates The department is eager to receive feedback from users of the sample document so that we can improve it. and what version and date are noted in the master ﬁle for the document you’re working with. and updates to the content are also welcome. Claire merged the sample thesis and sample Clinic reports. We are especially interested in any problems that you may have in compiling the document. the Department of Mathematics Systems Administrator. The current version of the document is based on the updated sample thesis created in 2003 by Claire M.edu. The original sample Clinic report was based on this sample thesis document.1 Comments. She and Jeremy Rouse (HMC 2003) revised that document in the year 2000. Some material from those versions is included nearly intact in this document. but advice. The authors of the present work would like to acknowledge and thank Professor Lesley Ward for her original sample thesis report. Problems. If possible. please tell us where you downloaded the document’s source code.

.

A Simon Fear. Mathematics Association of America Notes. 3rd edition. Donald E. A Primer of Mathematical Writing. The Elements of Typographic Style. 14. 1997. 2:43–44. Knuth. A Helmut Kopka and Patrick W. Addison-Wesley. Transcendental numbers based on the Fibonacci sequence. 1986. 1989. 1994. second edition. 1996. Editor. Reading. American Mathematical Society. TUGboat. Packages in the ‘graphics’ Bundle. second edie tion. Krantz. Addison-Wesley. 1998. David P. User’s Guide for the amsmath Package. BUGS in Writing. American Mathematical Society. and Alexander Samarin. Addison-Wesley. Publication quality tables in L TEX. A Guide to LTEX. Carlisle. A George Gr¨ tzer.Bibliography American Mathematical Society. A Michel Goossens. Birkh¨ user. Addison-Wesley. Roberts. Daly. Lyn Dupr´ . Robert Bringhurst. Fibonacci Quarterly. 1999. MA. Math into LTEX. Hyphenation exception log. and Paul M. Donald E. BC. Vancouver. Boston. Knuth. The TEXbook. Mathematical writing. Dec 1999. 1993. . July 1997. 1964. Knuth. The LTEX Companion. Stephen G. Hartley & Marks. 7(3):145. Tracy Larrabee. Frank Mittelbach. January 1999. 2000. a a Donald E.

. Eric Weisstein’s world of mathematics. The Chicago Manual of Style. CT. Cheshire. LTEX: A Document Preparation System. Eric Weisstein. IL. 1983.wolfram. editor. ISBN 0-9613921-0-X. 2nd edition. Chicago. 1994. University of Chicago Press.50 Bibliography A Leslie Lamport. University of Chicago Press. URL http://mathworld. ISBN 0-226-104036. Tufte. Available online at mathworld.wolfram. The Visual Display of Quantitative Information. 15th edition. Edward R. 2003.com. Addison-Wesley. 2000.com/. Graphics Press.