Introduction To L TEX: X Xy X X A A
Introduction To L TEX: X Xy X X A A
Introduction To L TEX: X Xy X X A A
2006
c by Harvey Gould
December 5, 2006
1 Introduction
TEX looks more difficult than it is. It is almost as easy as π. See how easy it is to
make special symbols such as α, β, γ, δ, sin x, h̄, λ, . . . We also can make subscripts
2 b
Ax , Axy and superscripts, ex , ex , and ea . We will use LATEX, which is based on
TEX and has many higher-level commands (macros) for formatting, making tables,
etc. More information can be found in Ref. [1].
We just made a new paragraph. Extra lines and spaces make no difference. Note
that all formulas are enclosed by $ and occur in math mode.
The default font is Computer Modern. It includes italics, boldface, slanted,
and monospaced fonts.
2 Equations
Let us see how easy it is to write equations.
N
X
∆= wi (xi − x̄)2 . (1)
i=1
It is a good idea to number equations, but we can have a equation without a number
by writing
x−a
P (x) = ,
b−a
and
1√
g= 2π.
2
We can give an equation a label so that we can refer to it later.
N
X
E = −J si si+1 , (2)
i=1
1
Equation (2) expresses the energy of a configuration of spins in the Ising model.1
We can define our own macros to save typing. For example, suppose that we
introduce the macros:
\newcommand{\lb}{{\langle}}
\newcommand{\rb}{{\rangle}}
\begin{equation}
\lb x \rb = 3
\end{equation}
The result is
hxi = 3. (3)
Examples of more complicated equations:
Z ∞
I= f (x) dx. (4)
−∞
2
write matrices
T++ T+−
T= ,
T−+ T−−
β(J+B) −βJ
e e
= −βJ . (9)
e eβ(J−B)
and X Z Z
~·B
A ~ = −P r · n̂ dA = P ~ · r dV.
∇ (10)
i
3 Tables
Tables are a little more difficult. TeX automatically calculates the width of the
columns.
4 Lists
Some example of formatted lists include the following:
1. bread
2. cheese
3
• Tom
• Dick
5 Literal text
It is desirable to print program code exactly as it is typed in a monospaced font.
Use \begin{verbatim}and \end{verbatim}as in the following example:
6 Special Symbols
6.1 Common Greek letters
These commands may be used only in math mode. Only the most common letters
are included here.
α, β, γ, Γ, δ, ∆, , ζ, η, θ, Θ, κ, λ, Λ, µ, ν, ξ, Ξ, π, Π, ρ, σ, τ, φ, Φ, χ, ψ, Ψ, ω, Ω
Order of magnitude:
log10 f ' n (14)
4
f (x) ∼ 10n (15)
Approximate equality:
f (x) ' g(x) (16)
LATEX is simple if we keep everything in proportion:
f (x) ∝ x3 . (17)
7 Use of Color
We can change colors for emphasis, but who is going pay for the ink?
Your LaTeX document can be easily modified to make a poster or a screen
presentation similar to (and better than) PowerPoint. Conversion to HTML is
straightforward. Comments on this tutorial are appreciated.
References
[1] Helmut Kopka and Patrick W. Daly, A Guide to LATEX: Document Preparation
for Beginners and Advanced Users, fourth edition, Addison-Wesley (2004).