Crash Course in LaTeX

Basics: Math Mode

So you can type a simple document. Let's get down to the business we came for: typing math.

You tell LaTeX that you are going to type math commands by putting them between a pair of dollar signs:

$ math stuff here $

If you want the math code to be centered on its own line, use two dollar signs at each end:

$$ centered math stuff here $$

Now for the codes:

Code Use Sample code Appearance
^ exponents $x^5 * x^{5y}$
_ subscripts $x_5 * x_{5y}$
\frac{}{} fractions $\frac{a+b}{a^2-b^2}$
\sqrt{} square roots $\sqrt{15}$
\sqrt[n]{} n-th roots $\sqrt[5]{3}$
\sum summations $\sum_{i=1}^n r^i$
\int integrals $\int_1^t \frac{dt}{t}$
\ldots elipsis $x_1+\ldots+x_n$
Lower-case Greek letters $\delta + \gamma$
Upper-case Greek letters $\Delta + \Gamma$
\lim limits $\lim_{x\rightarrow10} \frac{|x-10|}{x-10}$

Other "math words" like sin, cos, tan, arccos, liminf, limsup, log, ln, max, min, and many more can be used the same way \lim is used.

WinEdt Math Toolbar: Click on the Sigma button and this will open up another toolbar in WinEdt:

WinEdt math toolbar
This toolbar has all of the codes listed above and a whole lot more. How convenient!

Use the code \displaystyle at the beginning of a math expression to make it look better. For example, if we add it to the summation example above:

$\displaystyle \sum_{i=1}^n r^i$

Then we get the better looking output:

Displaystyle also helps improve the appearance of fractions and integrals.


Parentheses, Brackets, and Braces

You can use (parentheses) and [brackets] as you like. To type {curly braces}, you must precede them with a backslash:

\{inside!\}

Looks like {inside!}.

To get these grouping symbols to automatically grow to fit what's inside, you can precede them with \left and \right.

$\left( \frac{x}{10} \right)$

This code will show the fraction x/10 with parentheses stretched to fit the whole fraction. These symbols must appear in pairs; if you want to omit the left or right grouping symbol, use a period instead:

$\left( \frac{x}{10} \right.$

This code will show the fraction x/10 with only a left parenthesis.


Other fun commands you should look up:

These and other commands are discussed here.