Professional Documents
Culture Documents
Latex Intro MATH
Latex Intro MATH
Latex Intro MATH
Introduction
TEX looks more dicult 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 Ax , Axy x x2 ab A and superscripts, e , e , and e . We will use L TEX, 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 dierence. 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.
Equations
N
wi (xi x )2 .
(1)
It is a good idea to number equations, but we can have a equation without a number by writing xa , P ( x) = ba and 1 2. g= 2 We can give an equation a label so that we can refer to it later.
N
E = J
i=1
si si+1 ,
(2)
Equation (2) expresses the energy of a conguration of spins in the Ising model.1 We can dene our own macros to save typing. For example, suppose that we introduce the macros: \newcommand{\lb}{{\langle}} \newcommand{\rb}{{\rangle}} Then we can write the average value of x as \begin{equation} \lb x \rb = 3 \end{equation}
1
(3)
I=
f (x) dx.
(4)
We can do some ne tuning by adding small amounts of horizontal spacing: \, small space \! negative space
as is done in Eq. (4). We also can align several equations: a=b c = d, or number them as subequations: a=b c = d. We can also have dierent cases: m(T ) = write matrices T= = and A B = P
i
(5) (6)
(7a) (7b)
0 1 [sinh 2J ]
4 1/8
T > Tc T < Tc
(8)
T++ T+ , T+ T e (J +B ) eJ . eJ e (J B ) (9)
dA = P rn
r dV.
(10)
Tables
Tables are a little more dicult. TeX automatically calculates the width of the columns.
d q 2 4 2 6 3 4 3 6 3 8 3 12
Table 1: Comparison of the mean-eld predictions for the critical temperature of the Ising model with exact results and the best known estimates for dierent spatial dimensions d and lattice symmetries.
Lists
1. bread 2. cheese Tom Dick
Figures
sin x
We can make gures bigger or smaller by scaling them. Figure 2 has been scaled by 60%.
Figure 2: Plot of the Lennard-Jones potential u(r). The potential is characterized by a length and an energy .
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: double double double double double y0 = 10; // example of declaration and assignment statement v0 = 0; // initial velocity t = 0; // time dt = 0.01; // time step y = y0;
The command \verbatiminput{programs/Square.java}\allows you to list the le Square.java in the directory programs.
7
7.1
Special Symbols
Common Greek letters
These commands may be used only in math mode. Only the most common letters are included here. , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
7.2
Special symbols
y dy = lim dx x0 x f (x) y as x x0 f (x) y
xx0
(15) (16)
f (x) x3 . Finally we can skip some space by using commands such as \bigskip \medskip \smallskip \vspace{1pc}
(17)
Use of Color
We can change colors for emphasis, but who is going pay for the ink?
Subgures
A As soon as many students start becoming comfortable using L TEX, they want to use some of its advanced features. So we now show how to place two gures side by side.
We rst have to include the necessary package, \usepackage{subfigure}, which has to go in the preamble (before \begin{document}). It sometimes can be dicult to place a gure in the desired place. Your LaTeX document can be easily modied 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. 5
References
A [1] Helmut Kopka and Patrick W. Daly, A Guide to L TEX: Document Preparation for Beginners and Advanced Users, fourth edition, Addison-Wesley (2004).