Basic Code
LaTeXiT-1
•00
1700
=1
11
Erlint_11linfty\!\frac{1}{x^2}\,dx=\left[-\frac{1}{x}\right]_11\infty-1
Auto Align Display Inline Text
Fontsize:36,00ptColor: LaTeXit!
Special keys
Many script-languages use backslash "\" to denote special commands. In LaTeX backslash is used to
generate a special symbol or a command.
Curly brackets are used to group characters.
Hat and underscore are used for superscripts and subscripts.
Superscripts, subscripts and groups of characters
Formula LaTeX-code
x2 x^2
x2+a x^{2+a}
n1 n_1
nk+1 n_{k+1}
n2k+1 n_{k+1}^2
x
ee
ee e^{e^{e^{e^{x}}}}
Arithmetics
By convention you should either not write a multiplication-sign at all, as in y = mx + c; or you should
write it using a vertically centered dot, as in 3 ⋅ 5 = 15 . Do not use symbols like "*"! In LaTeX you use the
command \cdot to make a multiplication-dot.
Sometimes you can use the symbol × . A matrix having n rows and m columns is a m × n -matrix. The
code \times is used in LaTeX to make the symbol × .
The square root symbol is written using the command \sqrt{expression}. The n -th root is written using
the command \sqrt[n]{expression}.
The square root of a number can never be negative by deMnition. The root of a quadratic equation
however, can be either positive or negative. The solution to the equation x2 = 4 is given by x = ±2 . The
symbol ± is written using the code \pm in LaTeX.
To write a fraction, you use the code
\frac{expression in the numerator}{expression in the denominator}.
Formulas that appear in text are called inline. Inline formulas are sometimes squashed to avoid altering
the height of the lines. Squashed fractions may look strange, and for that reason there is a special
command to force a fraction to appear as displaystyle even though it is inline; the command is \dfrac.
2
This is a squashed inline fraction 3
, written using the code \frac{2}{3}.
2
This is an inline fraction in displaystyle , written using the code \dfrac{2}{3}.
3
Formula LaTeX-code
3 ⋅ 5 = 15 3\cdot5=15
n×m n\times m
±2 \pm 2
2÷3 2\div 3
2
3
\frac{2}{3}
–
√2 \sqrt{2}
3 –
1
√ 8 = 83 = 2 \sqrt[3]{8}=8^{\frac{1}{3}}=2
2/3
\frac{2/3}{4/5}
4/5
2
3 \frac{\frac{2}{3}}{\frac{4}{5}}
4
5
2 \frac{\dfrac{2}{3}}{\dfrac{4}{5}}
3
4
5
Standard functions
By convention, variables are written in italics. For that reason all text when writing in math mode is in
italics. In some cases however, the text should not be in italics. One such example is the mathematical
standard functions.
Formula LaTeX-code
lnex = x (wrong by convention) lne^x = x
ln ex = x (correct by convention) \ln e^x = x (note the space after \ln)
There are commands for all standard functions; here are some examples:
\sin \cos \tan \arcsin \arccos \arctan \ln \log
Text in math mode
Sometimes you need text that isn't written in italics even though it's written in math mode.
Formula LaTeX-code
3 apples × 5 apples 3\text{ apples}\times 5\text{ apples}
Brackets
Since mathematical expressions often vary in height, you sometimes need brackets of varying heights.
You can specify a bracket by labelling the left bracket and the right bracket, then LaTeX will Mnd the
height of the expression enclosed by those brackets and adjust the heights of the brackets accordingly.
You specify the brackets by using the commands \left and \right. Note that you need both
commands, otherwise there is no way for the program to determine the height of the expression.
Sometimes you may need only one bracket that is adjusted to the height of an expression; in such a
case you can use an invisible bracket at one of the sides. You make an invisible bracket by adding a
point, i.e. by using the command \left..
Some brackets are written using regular keyboard strokes, such as these: (), [], ||.
| is written by using option + 7 on a Mac, and Alt Gr + < on Windows/Linux. How to write various
special characters using a Mac, is shown here.
Other brackets, on the other hand, have special meaning in LaTeX-code; you can't just write { since this
character is used for grouping characters. If you want to write such a bracket, you must escape it using a
backslash in front of it.
Formula LaTeX-code
1 2
(1 + x)
(1+\frac{1}{x})^2
1 2 \left(1+\frac{1}{x}\right)^2
(1 + x)
∞
[− 1x ]1 \left[-\frac{1}{x}\right]_1^\infty
{1, 2, 3, … , n} \{1,2,3,\ldots ,n\}
{1, 12 , 13 , … , n1 } \left\{1,\frac{1}{2},\frac{1}{3},\ldots ,\frac{1}{n}\right\}
1 ∣∞ \left.\frac{1}{1+x^2}\right|_0^\infty
1+x2 ∣0
Integrals, series and limits
When writing integrals, series using sigma-notation or limits; you often want to specify boundaries. You
use the same characters as are used for subscripts and superscripts when specifying boundaries.
When it comes the integrals, the boundaries are placed beside the integral-sign. In some cases you may
want to place the boundary below the integral-sign; you can then use the command \limits_{}.
The commands used are \int for integral, \sum for sigma-notation, \lim for limits and \prod products.
Formula LaTeX-code
2
∫0 x2 dx \int_0^2x^2dx
∫ dx \int\limits_{x\in C}dx
x∈C
n(n+1)
∑ni=1 i = \sum_{i=1}^{n}i=\frac{n(n+1)}{2}
2
f(x+h)−f(x)
limh→0 \lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
h
∏ni=1 i = n! \prod_{i=1}^ni=n!
Using display it looks like this:
2
∫ x2 dx
0
∫ dx
x∈C
n
n(n + 1)
∑i =
i=1
2
f(x + h) − f(x)
lim
h→0 h
n
∏ i = n!
i=1
Spaces
In math mode you don't get a space when using space bar, white spaces are simply ignored. If you need
a space, there are three commands; \, for a short space, \: for a medium space and \; for a long space.
If you want to reduce the space between two characters, you use the command \!; this command is
useful for reducing the space between the integral-sign and the integrand.
Formula LaTeX-code
ab a b
ab a\: b
∫ xdx \int\limits_{x\in C}xdx
x∈C
∫ x dx \int\limits_{x\in C}\! x\, dx
x∈C
by Malin Christersson under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden
License
[Link]