Professional Documents
Culture Documents
by Weng-Keen Wong
1 Math mode
To enter Latex's math mode, use the $ character to delimit the beginning
and end of math mode. For example, $nOmega$ gives you . Once in math
mode, you'll notice that mathematical symbols look ne but spacing and
normal text work di erently. To add a space, use n followed by a space.
For instance, $nepsilon$ n $nepsilon$ gives: (note the space).
On the other hand, $nepsilon$ $nepsilon$ gives you .
To add text, use either
$ntextf text here g$
eg. = size of array
$fnmboxfnscriptsize text here g$
eg. = size of array
Or just make sure your math delimiters end before you start adding
the text
eg. $nthetan =n $ size of array, which gives you = size of array
nalpha ( )
ndelta ( )
ntheta ( )
nsigma ( )
nbeta ( )
nepsilon ( )
nlambda ( )
npsi ( )
ngamma ( )
neta ( )
npi ( )
nomega (!)
nGamma ( )
nLambda ( )
nPhi ( )
nDelta ( )
nPi ( )
nPsi ( )
nTheta ( )
nSigma ( )
nOmega ( )
There are many more Greek letters available and this is not an exhaustive list.
2. Operators
nleq ( )
ngeq ( )
nequiv ( )
nneq (6=)
nsubset ( )
nsupset ( )
nsubseteq ( ) nsupseteq ( )
Note that < and > can be typed in directly but you need to use it
in math mode.
3. Arrows
Latex has tons of arrows to use with your equations. The list below is
just a sample of what is available.
nleftarrow ( )
nLeftarrow (()
nrightarrow (!)
nRightarrow ())
nleftrightarrow ($)
nLeftrightarrow (,)
4. Misc Symbols
nldots (: : : )
nforall P
(8)
nsum ( )
nlongleftarrow ( )
nLongleftarrow ((=)
nlongrightarrow ( !)
nLongrightarrow (=))
nlongleftrightarrow ( !)
nLongleftrightarrow (())
ncdots ( )
ninfty (Q1)
nprod ( )
nvdots (...)
nemptysetT(;)
nbigcap ( )
nddots ( . . .)
nexists (9S)
nbigcup ( ).
Subscripts are indicated by the symbol. For instance, a fsubg looks like
asub . Similarly, superscripts are indicated by the ^ symbol eg. a^fsuperg
looks like asuper . You can combine subscripts and superscripts as in T fig^f2g,
which generates Ti2.
2
noversetfngfnsumg
nundersetfi=0gfnprodg
noversetfngfnundersetfi=0gfnsumgg
n
P
Q
i=0
n
i=0
Fractions such as 11
20 are created using the nfracfnumeratorgfdenominatorg
construct. You can make the numerator and denominator as complicated as
you want eg. n2
For the choose expression likepk2 , use nbinomftopgfbottom
pn g.
For roots, use nsqrtfabcg for abc and nsqrt n]fabcg for abc.
6 Formatting Equations
You can place equations in sections using Latex commands like equation,
gather, and align. The sections are indicated using nbeginf...g and nendf...g
tags eg. nbeginfequationg and nendfequationg. Anything between these
begin and end tags will be in math mode. You will not need the $ delimiters.
If you put a * after the command eg. nbeginfequation*g, it will not label
the section with a number.
\begin{equation}
T(n) = 2T(\frac{n}{2}) + cn
\end{equation}
Looks like:
n
T (n) = 2T ( ) + cn
(1)
2
Notice that it is numbered. If I wanted the equation not to have a number,
I would have used Latex instructions like this:
\begin{equation*}
T(n) = 2T(\frac{n}{2}) + cn
\end{equation*}
n
T (n) = 2T ( ) + cn
Which yields:
x2 + y 2 = 1
q
x = 1 y2
The align command lets you use vertical alignment on multiple lines of equations. For example, the code below:
\begin{align*}
x^2 + y^2 &= 1\\
x &= \sqrt{1-y^2}
\end{align*}
Gives you:
x2 + y 2 = 1
q
x = 1 y2
Note that the & indicates where you want the alignment. In this case, I
wanted the alignment on the = signs. You also need a nn at the end of every
equation in order to indicate that a new line is about to start.