Latex Guide
Latex Guide
Latex Guide
Other forms of the \documentclass command can be used for letters, reports or books. If 12pt is
omitted from the \documentclass command (with the preceding comma), then the document will
be set in a `10 point' size. One may also replace 12pt with 11pt.
The documentstyle command may be followed by certain other optional commands, such as the
\pagestyle command. It is not necessary to find out about these commands when first learning to
use LaTeX.
After the \documentclass command and these other optional commands, we place the command
\begin{document}
This command is then followed by the main body of the text, in the format prescribed by the rules of
LaTeX.
Finally, we end the input file with a line containing the command
\end{document}
Error Messages
Since LaTeX will stop after any \end{document} command, a good strategy for finding errors is to
insert \end{document} temporarily earlier in the file to see if the error is above its location.
Sections
LaTeX is a language for creating structured documents. One of the most important ways of creating
structure in a document is to split it into logical sections. If your document deals with more than one
concept or theme, then each concept should go into its own section.
There are two related commands for creating sections: \section{sectiontitle} and
\section*{sectiontitle}. The first one numbers the sections, while the starred form does not.
Both create separate sections with titles in a larger font size; they also provide information to LaTeX in
case you want to create a Table of Contents.
then the title of the section and that of the subsection will be printed in a large boldface font, and will
be numbered accordingly.
Other document styles (such as the book and letter styles) have other `sectioning' commands available
(for example, the book style has a \chapter command for beginning a new chapter).
Sometimes one wishes to suppress the automatic numbering provided by LaTeX. This can be done by
placing an asterisk before the title of the section or subsection. Thus, for example, the section numbers
in the above example could be suppressed by typing
\section*{Section Headings}
Cross-References
If you wish to have cross-references in a document with numbered sections, use \label{name} to
label the point in your document with some mnemonic, and Section \ref{name} to refer to that
point. \ref{name} will be replaced by the number of the section containing the corresponding
\label command. As with your bibliography citations, you will need to run LaTeX twice to generate
these references.
Table of Contents
For a large document, it is a kindness to your reader to provide a Table of Contents. If you have been
using \section commands throughout your document, then LaTeX has all the information that it
needs to construct one for you. Place the command \tableofcontents after your
\begin{document} command.
It may be necessary to run LaTeX twice on a document with a Table of Contents: the first time, LaTeX
stores the page numbers for the sections in a separate file, and then the second time LaTeX writes this
information into the Table of Contents. If you have question marks instead of page numbers in your
Table of Contents, run LaTeX again.
Abstracts
To create an abstract, place your text in an abstract environment, i.e., between \begin{abstract}
and \end{abstract} commands. The abstract should come immediately after your \maketitle
command, but before any \tableofcontents command.
Dashes used for punctuating are often typeset as em-dashes, especially in older books. These are
obtained by typing ---.
The dialogue
(taken from Alice through the Looking Glass, by Lewis Carroll) illustrates the use of quotation marks
and dashes. It is obtained in LaTeX from the following input:
``You \emph{were} a little grave,'' said Alice.
Sometimes you need single quotes immediately following double quotes, or vica versa, as in
The way to typeset this correctly in LaTeX is to use the control sequence \, between the quotation
marks, so as to obtain the necessary amount of separation. The above example is thus produced with
the input
``I regard computer typesetting as being reasonably
`straightforward'\,'' he said.
Another useful font-changing command is \textbf{text}, which typesets the specified portion of
text in boldface.
A font family or typeface in LaTeX consists of a collection of related fonts characterized by size, shape
and series. The font families available in LaTeX include roman, sans serif and typewriter:
The sizes of fonts used in LaTeX are can be determined and changed by means of the control
sequences \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large,
\Large, \LARGE, \huge and \HUGE:
If the necessary fonts are available, one can combine changes to the size, shape and series of a font, for
example producing boldface slanted text by typing \textbf{\textsl{boldface slanted
text}}.
There are in LaTeX font declarations corresponding to the the font-changing commands described
above. When included in the LaTeX input such declarations determine the type-style of the subsequent
text (till the next font declaration or the end of the current `group' delimited by braces or by appropriate
\begin and \end commands). Here is a list of font-changing commands and declarations in text
mode:
Command Declaration
produces
Similarly we use the control sequence \` to produce the grave accent in `algèbre' and we use \" to
produce the umlaut in `Universität'. The accents provided by LaTeX include the following:
These accents are for use in ordinary text. They cannot be used within mathematical formulae, since
different control sequences are used to produce accents within mathematics.
The control sequences \i and \j produce dotless i and j. These are required when placing an accent
on the letter. Thus í is produced by typing \'{\i}.
Alignments
In these environments \\ starts a new line.
\begin{flushleft}
Some people like to stay firmly\\ on the left whereas others
\end{flushleft}
\begin{flushright}
feel more at home on the right.\\
\end{flushright}
\begin{center}
but most of us prefer to stay dead in the center.
\end{center}
Some people like to stay firmly
on the left whereas others
feel much more at home
on the right.
but most of us prefer to stay dead in the center.
have special purposes within LaTeX. Thus they cannot be produced in the final document simply by
typing them directly. On the rare occasions when one needs to use the special characters
#$%&_{}
in the final document, they can be produced by typing the control sequences
\# \$ \% \& \_ \{ \}
respectively. However the characters \, ^ and ~ cannot be produced simply by preceding them with a
backslash. They can however be produced using \char92 (in the \texttt font only), \char94
and \char126 respectively. (The decimal numbers 92, 94 and 126 are the ASCII codes of these
characters.)
Other special symbols can be introduced into text using the appropriate control sequences:
Mathematical Typesetting
Mathematics Mode
In order to obtain a mathematical formula using LaTeX, one must enter mathematics mode before the
formula and leave it afterwards. Mathematical formulae can occur either embedded in text or else
displayed between lines of text. When a formula occurs within the text of a paragraph one should place
a $ sign before and after the formula, in order to enter and leave mathematics mode. Thus to obtain a
sentence like
In particular, note that even mathematical expressions consisting of a single character, like f and a in
the example above, are placed within $ signs. This is to ensure that they are set in italic type, as is
customary in mathematical typesetting.
LaTeX also allows you to use \( and \) to mark the beginning and the end respectively of a
mathematical formula embedded in text. Thus
may be produced by typing
Let \( f \) be the function defined by \( f(x) = 3x + 7 \).
However this use of \( ... \) is only permitted in LaTeX: other dialects of TeX such as Plain TeX and
AmSTeX use $ ... $.
In order to obtain an mathematical formula or equation which is displayed on a line by itself, one
places \[ before and \] after the formula. Thus to obtain
produces
Mathematical Formulas
There are two ways to insert mathematical formulas into your document with LaTeX. One is to have it
appear in a paragraph with text. In doing so, the formulas will be compressed vertically: limits for
integrals and summations will appear to the side instead of on the top and bottom, etc. The other way is
to have them appear in a separate paragraph, where there will be more room.
For formulas that appear in a paragraph, surround them with $'s. For example,
$\alpha$ is the first letter of the Greek alphabet.
becomes
is the first letter of the Greek alphabet.
To have formulas appear in their own paragraph, use matching $$'s to surround them. For example,
$$
\frac{x^n-1}{x-1} = \sum_{k=0}^{n-1}x^k
$$
becomes
Mathematics Mode
In order to obtain a mathematical formula using LaTeX, one must enter mathematics mode before the
formula and leave it afterwards. Mathematical formulae can occur either embedded in text or else dis-
played between lines of text. When a formula occurs within the text of a paragraph one should place a $
sign before and after the formula, in order to enter and leave mathematics mode. Thus to obtain a sen-
tence like
is obtained by typing
.
\[ ds^2 = dx_1^2 + dx_2^2 + dx_3^2 - c^2 dt^2 \]
since, when a superscript is to appear above a subscript, it is immaterial whether the superscript or
subscript is the first to be specified.
Where more than one character occurs in a superscript or subscript, the characters involved should be
enclosed in braces. For example, the polynomial is obtained by typing $x^{17} - 1$.
One may not type expressions such as $s^n^j$ since this is ambiguous and could be interpreted either
as or as . The first of these alternatives is obtained by typing $s^{n j}$, the second by typing
$s^{n^j}$. A similar remark applies to subscripts. Note that one can obtain in this way double super-
scripts (where a superscript is placed on a superscript) and double subscripts.
It is sometimes necessary to obtain expressions in which the horizontal ordering of the subscripts is sig-
nificant. One can use an `empty group' {} to separate superscripts and subscripts that must follow one
another. For example, the identity
Greek Letters
1. is \alpha
2. is \beta
3. is \gamma
4. is \delta
5. is \epsilon
6. is \varepsilon
7. is \zeta
8. is \eta
9. is \theta
10. is \vartheta
11. is \iota
12. is \kappa
13. is \lambda
14. is \mu
15. is \nu
16. is \xi
17. is o
18. is \pi
19. is \varpi
20. is \rho
21. is \varrho
22. is \sigma
23. is \varsigma
24. is \tau
25. is \upsilon
26. is \phi
27. is \varphi
28. is \chi
29. is \psi
30. is \omega
31. is \Gamma
32. is \Delta
33. is \Theta
34. is \Lambda
35. is \Xi
36. is \Pi
37. is \Sigma
38. is \Upsilon
39. is \Phi
40. is \Psi
41. is \Omega
Mathematical Symbols
There are numerous mathematical symbols that can be used in mathematics mode. These are obtained
by typing an appropriate control sequence.
Miscellaneous Symbols:
``Large'' Operators:
Binary Operations:
Relations:
Negated Relations:
Arrows:
Openings:
Closings:
Alternative Names:
Above and Below
It is useful to be able to draw horizontal lines and braces
above and below parts of a formula. We can combine the
\overline, \overbrace, \underline, and \underbrace com-
mands to our heart's content.
$$
\left(
\begin{array}{c}
m+n\\
m
\end{array}
\right)
= \frac{(m+n)!}{m!n!}
= \frac
{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^\mbox{$m$
factors}
{\underbrace{m(m-1)\cdots 1}_\mbox{$m$ factors}}
$$
produces
while
$\overline{x+\overline{y}} = \overline{x}+y$
produces
Delimiters
these are made by these and these are made by these
( ( ) )
[ [ ] ]
\{ \}
\lfloor \rfloor
\lceil \rceil
\langle \rangle
/ / \backslash
| | \|
\uparrow \Uparrow
\downarrow \Downarrow
\updownarrow \Updownarrow
This table shows the standard sizes. To get bigger sizes, use these prefices
(for left delimiters) (for right delimiters) magnification
\bigl \bigr a bit bigger, but won't overlap lines
\Bigl \Bigr 150% times big
\biggl \biggr 200% times big
\Biggl \Biggr 250% times big
For example,
$\Biggl\{2\Bigl(x(3+y)\Bigr)\Biggr\}$
gives . If you're not using the default text size these commands might not
work correctly. In that case try the exscale package.
It's preferable to let LATEX choose the delimiter size for you by using \left and \right. These will
produce delimiters just big enough for the formulae inbetween.
$\left( \frac{(x+iy)}{\{\int x\}} \right)$
gives
The left and right delimiters needn't be the same type. It's sometimes useful to make one of them invisi-
ble
\[ z = \left\{
\begin{array}{ll}
1 & (x>0)\\
0 & (x<0)
\end{array}
\right.
\]
produces
Over- and underbracing works too.
$\overbrace{\alpha \ldots \omega}^{\mbox{greek}}
\underbrace{a \ldots z}_{\mbox{english}}$
The following example illustrates the use of boldface in mathematical formulae. To obtain
by typing
\[ \cos(\theta + \phi) = \cos \theta \cos \phi
- \sin \theta \sin \phi \]
The following standard functions are represented by control sequences defined in LaTeX:
Names of functions and other abbreviations not in this list can be obtained by converting to the roman
font. Thus one obtains by typing $\mathrm{cosec} A$. Note that if one were to type simply
$cosec A$ one would obtain because LaTeX has treated cosec A as the product of six quanti-
ties c, o, s, e, c and A and typeset the formula accordingly.
Functions
LaTeX uses italics in math mode for variables to make them stand out,
but Roman (non-italic) for function names. How is LaTeX to know the dif-
ference between ``sin'' as function name and ``sin'' as the product of
the variables s, i, and n? Use a backslash in front of ``sin'' and other
function names to let LaTeX know that you want the function, not the
product of variables.
Fractions
Fractions can be written in two ways: with a diagonal fraction bar or a
horizontal one. Diagonal fraction bars work best in tight places, such as
in a text paragraph or when in a larger fraction.
$a/b$
becomes
The horizontal bar is clearer when you have more room, such as in a for-
mula paragraph. The command is a little more complicated, because
the numerator and denominator are often complicated themselves. A
horizontal bar fraction is written as \frac{numerator}{denominator}.
$$
\frac{a/b-c/d}{e/f-g/h}
$$
becomes
Roots
Use the \sqrt{} command to produce square roots:
$\sqrt{\frac{a}{b}}$
produces
If you need an nth root, use \sqrt[n]{} instead.
$\sqrt[10]{\frac{a}{b}}$
produces
is obtained by typing
\[ f(x_1, x_2,\ldots, x_n) = x_1^2 + x_2^2 + \cdots + x_n^2 \]
Similarly the formula
by typing
Let $X$ be a Banach space and let $f \colon B \to \textbf{R}$
be a bounded linear functional on $X$. The \textit{norm} of
$f$, denoted by $\|f\|$, is defined by
\[ \|f\| = \inf \{ K \in [0,+\infty) :
|f(x)| \leq K \|x\| \mbox{ for all } x \in X \}.\]
Larger delimiters are sometimes required which have the appropriate height to match the size of the
subformula which they enclose. Consider, for instance, the problem of typesetting the following formu-
la:
The way to type the large parentheses is to type \left( for the left parenthesis and \right) for the
right parenthesis, and let LaTeX do the rest of the work for you. Thus the above formula was obtained
by typing
\[ f(x,y,z) = 3y^2 z \left( 3 + \frac{7x+5}{1 + y^2} \right).\]
If you type a delimiter which is preceded by \left then LaTeX will search for a corresponding
delimiter preceded by \right and calculate the size of the delimiters required to enclose the
intervening subformula. One is allowed to balance a \left( with a \right] (say) if one desires: there
is no reason why the enclosing delimiters have to have the same shape. One may also nest pairs of
delimiters within one another: by typing
\[ \left| 4 x^3 + \left( x + \frac{42}{1+x^4} \right) \right|.\]
we obtain
By typing \left. and \right. one obtains null delimiters which are completely invisible. Consider,
for example, the problem of typesetting
We wish to make the vertical bar big enough to match the derivative preceding it. To do this, we
suppose that the derivative is enclosed by delimiters, where the left delimiter is invisible and the right
delimiter is the vertical line. The invisible delimiter is produced using \left. and thus the whole
formula is produced by typing
\[ \left. \frac{du}{dx} \right|_{x=0}.\]
It is necessary to ensure that the = signs are aligned with one another. In LaTeX, such a formula is
typeset using the eqnarray* environment. The above example was obtained by typing the lines
\begin{eqnarray*}
\cos 2\theta & = & \cos^2 \theta - \sin^2 \theta \\
& = & 2 \cos^2 \theta - 1.
\end{eqnarray*}
Note the use of the special character & as an alignment tab. When the formula is typeset, the part of the
second line of the formula beginning with an occurrence of & will be placed immediately beneath that
part of the first line of the formula which begins with the corresponding occurrence of &. Also \\ is
used to separate the lines of the formula.
Although we have placed corresponding occurrences of & beneath one another in the above example, it
is not necessary to do this in the input file. It was done in the above example merely to improve the ap-
pearance (and readability) of the input file.
The more complicated example
$$
\lim_{x\rightarrow 0} \frac{\sin x}{x} = 1
$$
produces
Operators
You will probably not need most of the binary operators
listed here, but it should be a handy reference:
Operato Operato
Command Command
r r
\pm \times
\mp \div
\cdot \ast
\star \dagger
\ddagger \amalg
\cap \cup
\uplus \sqcap
\sqcup \vee
\wedge \oplus
\ominus \otimes
\circ \bullet
\diamond \oslash
\odot \bigcirc
\bigtriangleup \bigtriangledown
\triangleleft \triangleright
\setminus \wr
Relations
Again, here are more relations than you will ever need.
You may want to print this for reference.
Relatio Relatio
Command Command
n n
\le \ge
\ne \sim
\ll \gg
\doteq \simeq
\subset \supset
\approx \asymp
\subseteq \supseteq
\cong \smile
\equiv \frown
\sqsubseteq \sqsupseteq
\propto \bowtie
\in \ni
\prec \succ
\vdash \dashv
\preceq \succeq
\models \perp
\parallel \mid
Negated Symbols
Operato Operato
Command Command
r r
\not< \not>
\not\le \not\ge
\not= \not\equiv
\not\prec \not\succ
\not\preceq \not\succeq
\not\sim \not\simeq
\not\subset \not\supset
\not\subseteq \not\supseteq
\not\approx \not\cong
\not\sqsubseteq \not\sqsupseteq
\not\asymp \notin
More Symbols
Here are some more symbols:
Symbo
Command
l
\aleph
\emptyset
\nabla
\partial
\forall
\exists
\neg
\angle
\therefore
\mathbb{N}
\mathbb{Q}
\mathbb{R}
\mathbb{Z}
Double Spacing
There will be times when you will need to submit a draft
that is double-spaced, to permit a grader or editor to
make comments. LaTeX does not explicitly support doing
this, because, well, it looks ugly.
Enlarging Pages
LaTeX works very hard to find the best place to break be-
tween pages. If you are unhappy with the result, you can
change it with the following two commands:
Hyphenation
There are four different variations on hyphens in LaTeX:
-, --, ---, and $-$.
Quotation Marks
Beginning and ending quotation marks differ. In LaTeX,
use `` (usually on the left side of the keyboard) to begin
a quotation and '' (usually on the right side of the key-
board) to end a quotation:
She said ``three''.
produces
She said ``three''.
Use
\underline{phrase}
to underline a phrase,
\textbf{phrase}
to print a phrase in boldface, and
\emph{phrase}
to italicize a phrase.
Constructing Arrays
To construct an array, surround the entries with a
\begin{array}{justification} command and an \end{ar-
ray} command. The justification should consist of l for
left justification, c for centered justification, or r for right
justification. Separate column entries by an &, and end
Constructing Tables
To construct a table, surround the entries with a
\begin{tabular}{justification} command and an
\end{tabular} command. The justification should consist
of l for left justification, c for centered justification, or r
for right justification. Separate column entries by a &,
Tables
Tables can be produced in LaTeX using the tabular environment. For example, the text
is coded in LaTeX as follows:
The first five International Congresses of Mathematicians
were held in the following cities:
\begin{quote}
\begin{tabular}{lll}
Chicago&U.S.A.&1893\\
Z\"{u}rich&Switzerland&1897\\
Paris&France&1900\\
Heidelberg&Germany&1904\\
Rome&Italy&1908
\end{tabular}
\end{quote}
The \begin{tabular} command must be followed by a string of characters enclosed within braces
which specifies the format of the table. In the above example, the string {lll} is a format specification
for a table with three columns of left-justified text. Within the body of the table the ampersand
character & is used to separate columns of text within each row, and the double backslash \\ is used to
separate the rows of the table.
The next example shows how to obtain a table with vertical and horizontal lines. The table
A string str of characters in the format specification can be repeated num times using the construction
*{num}{str}. For example, a table with 15 columns of right-justified text enclosed within vertical lines
can be produced using the format specification {|*{15}{r|}}.
If additional vertical space is required between rows of the table, then this can be produced by specify-
ing the amount of space within square brackets after \\. For example, one would use \\[6pt] to sepa-
rate two rows of the table by 6 points of blank space.
A horizontal line in a table from column i to column j inclusive can be produced using \cline{i-j}.
For example \cline{3-5} produces a horizontal line spanning columns 3, 4 and 5 of some table.
A command of the form \multicolumn{num}{fmt}{text} can be used within the body of a table to
produce an entry spanning several columns. Here num specifies the number of columns to be spanned,
fmt specifies the format for the entry (e.g., l if the entry is to be left-justified entry, or c if the entry is
to be centred), and text is the text of the entry.
Many of these features are used in typesetting the table
Note that both columns of this array are set flush left. Thus we use {ll} immediately after
\begin{array}. The large brace is produced using \left\{. However this requires a corresponding
\right delimiter to match it. We therefore use the \emph{null delimiter} \right. discussed earlier.
This delimiter is invisible. We can therefore obtain the above formula by typing
\[ |x| = \left\{ \begin{array}{ll}
x & \mbox{if $x \geq 0$};\\
-x & \mbox{if $x < 0$}.\end{array} \right. \]
Array
The array environment (not to be confused with the array package) is similar to the tabular
but must be within a math environment. This
\begin{math}
\left(
\begin{array}{clrr}
a+b+c & uv & x-y & 27 \\
x+y & w & +z & 363
\end{array}
\right)
\end{math}
produces
Tabular
Tabular output is supported. When you create the environment you specify how many
columns to have and how the contents are to be aligned (use l, c or r to represent each
column with either left, center or right alignment) and where you want vertical lines (use |).
The contents of the columns are separated by a `&' and rows by \\. Here's a simple example
\begin{tabular}{l|c|r}
left & centre & right\\
more left & more centre & more right\\
\end{tabular}
left centre right
more left more centre more right
To draw a full horizontal line, use \hline otherwise draw a line across selected columns using \cline.
The \multicolumn command allows items to span columns. It takes as its first argument the number of
columns to span. The following, more complicated example shows how to use these facilities.
\begin{tabular}{||l|lr||} \hline
\textbf{Veg} & \multicolumn{2}{|c||}{\textbf{Detail}}\\\hline
carrots & per pound & \pounds 0.75 \\ \cline{2-3}
& each & 20p \\ \hline
mushrooms & dozen & 86p \\ \cline{1-1} \cline{3-3}
toadstools & pick your own & free \\ \hline
\end{tabular}
(n.b. the HTML representation below is inaccurate - too many lines)
Veg Detail
carrots per pound £0.75
each 20p
mushrooms dozen 86p
toadstools pick your own free
Tables won't continue on the next page if they're too long. The longtable or supertabular com-
mands are needed to do this. See the Supertabular document for details and examples.
If the text in a column is too wide for the page, LATEX won't automatically text-wrap. Using p{5cm} in-
stead of c, l or r in the tabular line will wrap-around the text in a 5 cm wide column.
There are various packages to assist with table creation. The array package adds some helpful fea-
tures, including the ability to add formatting commands that control a whole column at a time, like so
\begin{tabular}{>{\ttfamily}l>{\scshape}c>{\Large}r}
Text & More Text & Large Text\\
Left & Centred & Right
\end{tabular}
Text MORE TEXT
Large Text
Left CENTRED Right
The rotating package is useful if you have a wide table that you want to display in landscape mode.
You need to put your table inside \begin{sidewaystable} and \end{sidewaystable}.
If you want the table to have a caption and float (float up the page if it's started right near the foot of a
page, for example), use
\begin{table}[htbp]
\begin{tabular}...
...
\end{tabular}
\caption{...}
\end{table}
are obtained in LaTeX by typing \frac{du}{dt} and \frac{d^2 u}{dx^2} respectively. The
mathematical symbol is produced using \partial. Thus the Heat Equation
in displayed equations we type \lim_{x \to +\infty}, \inf_{x > s} and \sup_K respectively.
Thus to obtain
is obtained by typing
\[ \sum_{k=1}^n k^2 = \frac{1}{2} n (n+1).\]
We now discuss how to obtain integrals in mathematical documents. A typical integral is the follow-
ing:
and
is obtained by typing
\[ \int_0^1 \! \int_0^1 x^2 y^2\,dx\,dy.\]
Had we typed
\[ \int_0^1 \int_0^1 x^2 y^2\,dx\,dy.\]
we would have obtained
A particularly noteworthy example comes when we are typesetting a multiple integral such as
Here we use \! three times to obtain suitable spacing between the integral signs. We typeset this
integral using
\[ \int \!\!\! \int_D f(x,y)\,dx\,dy.\]
Had we typed
\[ \int \int_D f(x,y)\,dx\,dy.\]
we would have obtained
The following (reasonably complicated) passage exhibits a number of the features which we have been
discussing:
One would typeset this in LaTeX by typing
In non-relativistic wave mechanics, the wave function
$\psi(\mathbf{r},t)$ of a particle satisfies the
\emph{Schr\"{o}dinger Wave Equation}
\[ i\hbar\frac{\partial \psi}{\partial t}
= \frac{-\hbar^2}{2m} \left(
\frac{\partial^2}{\partial x^2}
+ \frac{\partial^2}{\partial y^2}
+ \frac{\partial^2}{\partial z^2}
\right) \psi + V \psi.\]
It is customary to normalize the wave equation by
demanding that
\[ \int \!\!\! \int \!\!\! \int_{\textbf{R}^3}
\left| \psi(\mathbf{r},0) \right|^2\,dx\,dy\,dz = 1.\]
A simple calculation using the Schr\"{o}dinger wave
equation shows that
\[ \frac{d}{dt} \int \!\!\! \int \!\!\! \int_{\textbf{R}^3}
\left| \psi(\mathbf{r},t) \right|^2\,dx\,dy\,dz = 0,\]
and hence
\[ \int \!\!\! \int \!\!\! \int_{\textbf{R}^3}
\left| \psi(\mathbf{r},t) \right|^2\,dx\,dy\,dz = 1\]
for all times~$t$. If we normalize the wave function in this
way then, for any (measurable) subset~$V$ of $\textbf{R}^3$
and time~$t$,
\[ \int \!\!\! \int \!\!\! \int_V
\left| \psi(\mathbf{r},t) \right|^2\,dx\,dy\,dz\]
represents the probability that the particle is to be found
within the region~$V$ at time~$t$.
Lists
LaTeX provides the following list environments:
• enumerate for numbered lists,
To produce (vertical) blank space between paragraphs, use \vspace, followed by the length of the
blank space enclosed within braces. Thus to obtain
\vspace{10 mm}
by typing
\noindent
This is the beginning of a paragraph which is not
indented in the usual way. This has been achieved
by placing an appropriate control sequence at the
beginning of the paragraph.
Conversely, the control sequence \indent forces LaTeX to indent the paragraph
Displayed Quotations
Displayed quotations can be embedded in text using the quote and quotation environments
\begin{quote} ... \end{quote}
and
\begin{quotation} ... \end{quotation}.
The quote environment is recommended for short quotations: the whole quotation is indended in the
quote environment, but the first lines of individual paragraphs are not further indented. The input file
Isaac Newton discovered the basic techiques of
the differential and integral calculus, and
applied them in the study of many problems
in mathematical physics. His main mathematical
works are the \emph{Principia} and the \emph{Optics}.
He summed up his own estimate of his work as follows:
\begin{quote}
I do not know what I may appear to the world; but to
myself I seem to have been only like a boy, playing
on the sea-shore, and diverting myself, in now and
then finding a smoother pebble, or a prettier shell
than ordinary, whilst the great ocean of truth lay
all undiscovered before me.
\end{quote}
In later years Newton became embroiled in a bitter
priority dispute with Leibniz over the discovery
of the basic techniques of calculus.
is typeset by LaTeX as follows:
For longer quotations one may use the quotation environment: the whole quotation is indented, and the
openings of paragraphs are then further indented in the normal fashion.
Pre-Formatted Text
A sequence of lines of text can be incorporated unaltered into a LaTeX document (in a fixed-width
`typewriter' font) using the verbatim environment. The lines should be enclosed between \begin{ver-
batim} and \end{verbatim}. This provides a useful way of listing all or part of a computer program.
The control sequence \verb can be used to incorporate a string of characters unaltered into a paragraph
of text (in a `typewriter' font). The string of characters should be enclosed between two instances of
some character that is not included in the string. The whole should then be preceded by the control se-
quence \verb. For example, \verb/\alpha/ produces \alpha.
1. bmp
2. eps
3. gif
4. jpg
5. pdf
6. ps
Graphics Package
If you are going to include graphics in your document,
you will need to ask LaTeX to use a package of graphics
commands: place \usepackage{graphicx} in the preamble.
Including Graphics Within Your Document
You use the \includegraphics{graphicfile} command to
include your graphic file in your document.
Bibliographies
For large documents requiring a good deal of revision, it
can be difficult to coordinate references in the body of
the document with the bibliography at its end. LaTeX
provides a mechanism for automatically linking citations
with items in the bibliography. Surround the bibliography
with \begin{thebibliography}{9} and \end{thebibliography}.
For each entry in the bibliography, start with \bibitem{la-
bel}, where label is some mnemonic for the reference.
Two characteristics which the component (Encapsulated) PostScript image files must have are
• no file contains more than one page
• each has a valid BoundingBox line
If the PostScript file does not include a bounding box line, you can insert it using the text editor of your
choice.
to load the graphicx package. To load the graphics file itself in the main body, put
\includegraphics{filename}.
PDF LaTeX produces a pdf document that is ready for printing or posting to the network, and readily
previewed using Acrobat. Hence no special previewer is needed to view graphics other than the one
most of us have already. You can also add an option like height=.., width=.., scale=.., or angle=.. to
specify a height, width, scaling factor, or angle of rotation to manage the size and orientation of your
graphics, eg
\includegraphics[height=3in]{filename}.
The graphics package provides a standard way to include graphics in LaTeX documents using encap-
sulated postscript (eps) format. To use the graphics package, as usual, you need to include the follow-
ing statement in the preamble of your LaTeX document.
\usepackage{graphics}
If you have an image in eps format named, say myimage.eps, in a location accesible to your LaTeX
typsetter, then the simplest way to include the image in your document is to put the following statement
at the place you want the image to appear in your document.
\includegraphics{myimage.eps}
However, this will only work if your image is just the right size. Especially, if you create your eps file
as I have suggested in EPS Format, you will want to crop and scale your image to make it useable.
Suppose for example that when you printed your image to a file, the image was 2 inches by 2 inches
and situated in the upper left hand corner of an 8.5 by 11 letter size sheet with half inch margins at the
top and sides. Then you would crop the image by adding a * after includegraphics, and specifying the
coordinates of the lower left corner of the image followed by the coordinates of the upper right corner
of the image where the origin, (0,0), is situated at the lower left corner of the letter size sheet. Thus the
statement you want to use is
\includegraphics*[0.5in,8.5in][2.5in,10.5in]{myimage.eps}
After cropping, your image may still be too big or too small for your purposes. By putting the image in
a scalebox, and specifying a scale factor, you can magnify or shrink your image. If for example we
wanted to reduce myimage to a one inch square, we would use the following statement to shrink it by a
factor of 0.5
\scalebox{0.5}{\includegraphics*[0.5in,8.5in][2.5in,10.5in]{myimage.eps}}
Although not usually a good idea, you can specify two scale factors, the second, in square brackets
instead of curly braces, would control the vertical stretching while the first, in curly braces as above,
would determine the horizontal stretching.
Finally, once you have cropped and scaled your image, you can put it in a figure, minipage, or picture
environment or some other kind of box to get the image to appear at a suitable place in your printed
document.
Graphics
Graphics can be produced
from within LaTeX - pictures can be drawn in a picture environment, but you'll find
graph paper handy (xfig can create code for the picture environment). The pstricks
packages (see page ) is far more powerful.
by any program that can produce Postscript files (for LaTeX) or JPEG, PNG andPDF (for
pdflatex).
Whatever graphics you want to add, you should use the figure environment so that LATEX can cope
sensibly with situations where, for example, you attempt to insert near the bottom of a page a graphic
that's half a page high. The figure environment will float the graphic to the top or bottom of the page,
or on the next page, with preferences that you can provide.
h here
t top of page
b bottom of page
p on a page with no text
Putting ! as the first argument in the square brackets will encourage LATEX to do what you say, even if
the result's sub-optimal. See the online hints about floats in LaTeX for further details.
\begin{figure}[htbp]
\vspace{0.5in}
\caption{0.5 inch of space}
\end{figure}
It's possible to have more than one graphic in a figure. See the example later on.
Figure 2: Tigers
\centering
\begin{figure}[hbtp]
\includegraphics[height=40mm]{/export/ghostfonts/tiger.eps}
\includegraphics[angle=120, height=20mm]{/export/ghostfonts/tiger.eps}
\caption{Tigers}
\end{figure}
% remember to do \usepackage{subfig} at the top of the document!
\begin{figure}[hbtp]
\centering
\subfloat[Small]% \quad on the next line adds spacing
{\includegraphics[height=30mm]{/export/ghostfonts/crest.eps}}\quad
\subfloat[Medium]
{\includegraphics[width=40mm]{CUni3.eps}}\quad
\subfloat[Large]
{\includegraphics[height=50mm]{/export/ghostfonts/crest.eps}}
\caption{3 crests}
\end{figure}
Figure 3: 3 crests
[Small] [Medium]
[Large]
To clip the postscript image use the viewpoint argument. The following fragment would display only
part of the image. The viewport coordinates are in the same units as the bounding box.
\begin{figure}[htbp]
\includegraphics[viewport=200 400 400 600,width=5cm,clip]%
{CUniv3.eps}
\end{figure}
% Use the floatflt package
\begin{floatingfigure}[l]{4cm}
\includegraphics[width=2cm]{/export/ghostfonts/crest.eps}
\caption{Using floatingfigure}
\end{floatingfigure}
4cm
The floatflt package lets you insert a graphic and have the text wrap around it. You can
provide 2 arguments to the floatingfigure command: the first (l or r) selects whether you
want the graphic to be on the left or right of the page. The 2nd argument gives the width of
the graphic. Not all text will flow perfectly around (for example, verbatim text fails, as
illustrated below) so check the final output carefully.
Using the fancybox package gives you access to \shadowbox, \ovalbox, \Ovalbox and \doublebox
commands, which can be used with text or with graphics. For example, \shadowbox{shadow pack-
age} produces shadow package and
\ovalbox{\includegraphics[height=10mm]{CUni3.eps}}
produces . Unfortunately, the fancybox package as
supplied suppresses the table of contents. The locally produced contentsfancy-
box solves this, but may introduce graphics problems.
Colored text
Commands that control foreground and background colors need
\usepackage[dvips]{color}
after the \documentclass line but before \begin{document}.
\textcolor{colorname}{text} writes text in a color which can be specified by name
(black, white, red, green, blue or a color name you've defined), RGB components,
or grayscale.
\colorbox{colorname}{text} writes text in a box with a colored background.
Pictures
LATEX has some graphics capabilities. It's much better to import an encapsulated postscript
file. See the LATEX Maths and Graphics document for more details.
\newcounter{cms}
\setlength{\unitlength}{1mm}
\begin{picture}(50,39)
\put(0,7){\makebox(0,0)[bl]{cm}}
\multiput(10,7)(10,0){5}{\addtocounter
{cms}{1}\makebox(0,0)[b]{\arabic{cms}}}
\put(15,20){\circle{6}}
\put(30,20){\circle{6}}
\put(15,20){\circle*{2}}
\put(30,20){\circle*{2}}
\put(10,24){\framebox(25,8){a box}}
\put(10,32){\vector(-2,1){10}}
\multiput(1,0)(1,0){49}{\line(0,1){2,5}}
\multiput(5,0)(10,0){5}{\line(0,1){3,5}}
\thicklines
\put(0,0){\line(1,0){50}}
\multiput(0,0)(10,0){6}{\line(0,1){5}}
\end{picture}
PStricks
The pstricks packages lets you create graphical effects from within LaTeX. See the PSTricks
Tutorial for details. Here are just a few examples to show you its power.
\begin{pspicture}(0,-5)(6,0)
\pscircle*[linecolor=black](0,-4){1}
\pscircle*[linecolor=darkgray](.5,-4){1}
\pscircle*[linecolor=gray](1,-4){1}
\pscircle*[linecolor=lightgray](1.5,-4){1}
\pscurve(-1,-5)(2,0)(3,-2)(5,0)
\psbezier[linecolor=darkgray]%
(-1,-4)(2,0)(3,-2)(5,0)
\psgrid[gridwidth=.4pt, subgriddiv=2,
subgridwidth=.2pt, gridcolor=lightgray,
gridlabels=0](0,-3)(-1,-4)(5,0)%
\end{pspicture}
\begin{pspicture}(0,0)(6,4)
\psset{linecolor=white,linewidth=0pt}
\pstextpath{\pscurve(0,0)(2,2)(4,0)(6,2)}%needs the textpath package
{\textit{Adapted From} ``\TeX{} Unbound'', Alan Hoenig, OUP, 1998 }
\end{pspicture}