Professional Documents
Culture Documents
Lecture 04
Lecture 04
Ryan Higginbottom
1
An Overview
An Overview
Getting Started
Getting Started
2
An Overview
Getting Started
Two Types
The Delimiters
An Example
Symbols
Getting Started
Multiline Mathematics
3
Two Types
An Overview
There are two types of math (or formulas):
Getting Started
Two Types inline — the formula is part of the current line or paragraph
The Delimiters
An Example
Working With Math displayed — on a separate line (or lines) with spacing that sets
Symbols it apart
Multiline Mathematics
4
The Delimiters
An Overview
Inline Formulas
Getting Started
Two Types
Use dollar signs to surround a formula like 2 + 2 = 4.
The Delimiters
An Example
Use dollar signs to surround
Working With Math a formula like $2+2=4$.
Symbols
Multiline Mathematics
Displayed Formulas
Use the symbols \[ and \] to enclose a formula like
2 + 2 = 4.
5
An Example
Getting Started
Two Types
The Delimiters f (−3) = 9.
An Example
6
An Overview
Getting Started
Text in Math
Practice
Symbols
Multiline Mathematics
7
Spacing in Math Mode
An Overview
LATEX treats multiple spaces as one. The following give the same
Getting Started
output:
Working With Math
Text in Math
Example: To write x = a, b, or c type:
Practice
Symbols
Multiline Mathematics
$x=a$, $b$, or $c$
8
The amsmath package
An Overview
Some of what follows requires the amsmath package to be loaded
Getting Started
in your preamble. So, just to be safe, include
Working With Math
\end{document}
9
Equations
An Overview
The equation environment is the same as the displaymath
Getting Started
environment except each equation environment is numbered.
Working With Math
10
The Operations of Arithmetic
An Overview
Here are the ways to type common arithmetic operations:
Getting Started
Symbols
Multiline Mathematics
11
Fractions
An Overview
Fractions are only slightly different than the other mathematical
Getting Started
operators.
Working With Math
12
Subscripts and Superscripts
An Overview
The “caret” ^ is used for superscripts and the underscore _ is used
Getting Started
for subscripts.
Working With Math
Text in Math
$x_{17}$ x17
Practice
Symbols
Multiline Mathematics
Note that if your subscript or superscript is more than one character,
you’ll need to enclose it in braces.
13
Ellipses
An Overview
There are several types of ellipses that LATEX provides in math mode:
Getting Started
Text in Math
Practice
Symbols
Multiline Mathematics
14
Roots
An Overview
The square root sign is made with a command in math mode.
Getting Started
√
Working With Math $\sqrt{51}$ produces 51
Spacing in Math Mode
The amsmath package
Equations
The Operations of This is used for all kinds of roots, not just square roots:
Arithmetic
Fractions √
3
Subscripts and $\sqrt[3]{5}$ produces 5
Superscripts
Ellipses √
10
Roots
$\sqrt[10]{44}$ produces 44
Text in Math
Practice
Symbols
Multiline Mathematics
15
Text in Math
An Overview
Text in math is produced with the \text command.
Getting Started
Text in Math
Practice
Symbols
Multiline Mathematics
16
Practice
An Overview
Let’s practice!
Getting Started
Text in Math
Practice
Symbols
Multiline Mathematics
17
An Overview
Getting Started
Symbols
Greek Letters
Integral Signs
Delimiters
Stretching Delimiters
Symbols
More on Stretching
Delimiters
Specifying Delimiter
Height
Operators
Tables of Operators
Large Operators
Practice
Multiline Mathematics
18
Greek Letters
An Overview
Greek letters are needed frequently within formulas, like
Getting Started
Greek Letters
. . . within formulas, like \[ A = \pi r^2. \]
Integral Signs
Delimiters
Stretching Delimiters You can find a list of the permitted Greek letters in a table on our
More on Stretching
Delimiters web site. LATEX can do some of the Greek capitals, but not all of
Specifying Delimiter
Height them.
Operators
Tables of Operators
A lot of these are easy to guess:
Large Operators
Practice Type Display Type Display
Multiline Mathematics $\alpha$ α $\phi$ φ
$\beta$ β $\psi$ ψ
$\gamma$ γ $\omega$ ω
$\delta$ δ
19
Integral Signs
An Overview
This is a mathematics-specific symbol, but it illustrates a larger
Getting Started
point. Consider this formula:
Working With Math
Symbols
Z 15
Greek Letters x2 dx.
Integral Signs 2
Delimiters
Stretching Delimiters
formula: \[ \int_2^{15} x^2\,dx. \]
More on Stretching
Delimiters
Specifying Delimiter
Height There are lots of integral symbols available:
Operators
Tables of Operators
Large Operators
Practice Type Display Type Display
R RR
Multiline Mathematics
$\int$ $\iint$
H RRR
$\oint$ $\iiint$
20
Delimiters
An Overview
A delimiter is simply a special math symbol to enclose part of a
Getting Started
formula. The parentheses in the following formula are an example
Working With Math
of delimiters:
(x + y)2 .
Symbols
Greek Letters
Integral Signs
Delimiters
There are all sorts of delimiters available:
Stretching Delimiters
More on Stretching
Delimiters
Specifying Delimiter
Height
Type Display Type Display
Operators
Tables of Operators
$($ ( $[$ [
Large Operators
Practice
$\{$ { $|$ |
Multiline Mathematics
$\langle$ h $\rangle$ i
$\|$ k
21
Stretching Delimiters
An Overview
Sometimes delimiters do not extend up and down enough to fully
Getting Started
enclose what’s inside. You can see that here:
Working With Math
1 6
Symbols
( ) (\frac{1}{5})^6.
Greek Letters 5
Integral Signs
Delimiters Instead, we should have
Stretching Delimiters
6
More on Stretching
Delimiters 1
Specifying Delimiter \left(\frac{1}{5}\right)^6.
Height 5
Operators
Tables of Operators The \left and \right commands can be applied to most
Large Operators
Practice
delimiters.
Multiline Mathematics 1
\left[ \frac{1}{5} \right]
5
1
\left\{ \frac{1}{5} \right\}
5
22
More on Stretching Delimiters
An Overview
LATEX requires a pair when stretching delimiters, but they don’t have
Getting Started
to match.
Working With Math
Symbols 1
\left( \frac{1}{5} \right\}
Greek Letters
5
Integral Signs
Delimiters
If you want to stretch just a single delimiter, you need to “fake” the
Stretching Delimiters
More on Stretching other one.
Delimiters
Specifying Delimiter
Height 1
Operators \left[ \frac{1}{5} \right.
Tables of Operators 5
Large Operators
Practice
\left. and \right. accomplish this for you.
Multiline Mathematics
23
Specifying Delimiter Height
An Overview
Instead of trusting LATEX to give your delimiter the correct size, you
Getting Started
can specify it yourself in some cases.
Working With Math
Symbols
Greek Letters
(
Integral Signs
Delimiters
Stretching Delimiters
More on Stretching
Delimiters
( \big( \Big( \bigg( \Bigg(
Specifying Delimiter
Height
Operators
The analogs for right delimiters exist too, and these can be applied
Tables of Operators to most delimiters.
Large Operators b
Practice
Example: in integral problems, you need to write F (x) .
Multiline Mathematics a
24
Operators
An Overview
An operator in LATEX is a log-like function, like sin or ln.
Getting Started
Working With Math To get sin x you cannot type $sin x$ or sin $x$. You must type
Symbols $\sin x$.
Greek Letters
Integral Signs Another kind of operator is lim. This is called an operator with limits
Delimiters
Stretching Delimiters
because it is frequently used like this:
More on Stretching
Delimiters
Specifying Delimiter
lim f (x) \lim_{x \to 1} f(x)
x→1
Height
Operators
Tables of Operators
For this reason, operators like sin are called operators without
Large Operators limits.
Practice
Multiline Mathematics You need to be in display mode for the x → 1 to go under the
symbol; otherwise you’ll get limx→1 f (x).
An Overview
Operators without limits:
Getting Started
Type Display Type Display
Working With Math
Symbols
$\sin$ sin $\cos$ cos
Greek Letters $\tan$ tan $\cot$ cot
Integral Signs
Delimiters
$\arcsin$ arcsin $\arctan$ arctan
Stretching Delimiters $\deg$ deg $\dim$ dim
More on Stretching
Delimiters
Specifying Delimiter
Height Operators with limits:
Operators
Tables of Operators
Type Display Type Display
Large Operators $\lim$ lim $\det$ det
Practice
$\max$ max $\min$ min
Multiline Mathematics
There are lots more of both of these; see resources linked from our
class web page if necessary.
26
Large Operators
An Overview
The symbols for sums and products are examples of symbols which
Getting Started
have different sizes depending on whether they are typeset inline or
Working With Math
in a displayed environment.
Symbols
Pn
Greek Letters
Here is the sum symbol i=i i typeset inline, and here it is
Integral Signs
Delimiters
displayed:
n
Stretching Delimiters X
More on Stretching i.
Delimiters
Specifying Delimiter i=1
Height
Operators \sum_{i=1}^n i
Tables of Operators
Large Operators
Practice Though there are lots of other symbols which have this property, the
Multiline Mathematics other most common one is the symbol for a product:
Y
i2 \prod_{i < 4} i^2
i<4
27
Practice
An Overview
Let’s practice!
Getting Started
Greek Letters
Integral Signs
Delimiters
Stretching Delimiters
More on Stretching
Delimiters
Specifying Delimiter
Height
Operators
Tables of Operators
Large Operators
Practice
Multiline Mathematics
28
An Overview
Getting Started
Symbols
Multiline Mathematics
Aligned Formulas
Multiple Aligned
Columns
Multiline Mathematics
Matrices
More Matrices
Variant Matrix
Environments
Arrays
Cases
Practice
29
Aligned Formulas
An Overview
When you want to consider multiple formulas or equations at once,
Getting Started
you need a nice way to put math on multiple lines. The simplest
Working With Math
setup here is when you have a point to line up in the equations.
Symbols
Multiline Mathematics
Aligned Formulas
a2 + b2 = c2 (3)
Multiple Aligned
Columns
a+b=c+2 (4)
Matrices
More Matrices
Variant Matrix
\begin{align}
Environments a^2 + b^2 &= c^2 \\
Arrays
Cases
a+b &= c + 2
Practice \end{align}
30
Multiple Aligned Columns
An Overview
The align environment aligned things in one column. The
Getting Started
alignat environment allows alignment of multiple columns and
Working With Math
control over the intercolumn space.
Symbols
Multiline Mathematics
Aligned Formulas
f (x) = x2 g(x) = 2x − 1 (5)
Multiple Aligned
Columns
f (2) = 4 g(2) = 3 (6)
Matrices
More Matrices
Variant Matrix
\begin{alignat}{2}
Environments f(x) &= x^2 \qquad & g(x) &= 2x-1 \\
Arrays
Cases
f(2) &= 4 & g(2) &= 3
Practice \end{alignat}
The mandatory argument is the number of aligned columns.
In this example, the first and third & give the alignment points, the
second & begins the second column. In general, even-numbered
&’s are column separators, and odd-numbered &’s are alignment
points.
31
Matrices
An Overview
Matrices function like tables, except everything is in math mode.
Getting Started
Consequently, you must enter math mode before entering a
Working With Math
matrix environment.
Symbols
32
More Matrices
An Overview
We can enclose a matrix in delimiters in the expected way:
Getting Started
Working With Math a b+c
Symbols d−e 2
Multiline Mathematics
Aligned Formulas
Multiple Aligned
\[
Columns
\left(
Matrices
More Matrices \begin{matrix}
Variant Matrix
Environments
a & b+c \\
Arrays d-e & 2
Cases
Practice
\end{matrix}
\right)
\]
a b+c
The delimiters do not have to match:
d−e 2
33
Variant Matrix Environments
An Overview
LATEX provides environments for matrices with the most common
Getting Started
delimiters:
Working With Math
Symbols a b
pmatrix
Multiline Mathematics c d
Aligned Formulas
Multiple Aligned a b
Columns bmatrix
Matrices c d
More Matrices
Variant Matrix a b
Environments
c vmatrix
Arrays d
Cases
Practice
a b
c
Vmatrix
d
a b
Bmatrix
c d
34
Arrays
An Overview
The major difference between the various matrix environments
Getting Started
and the array environment is that you have a lot more control
Working With Math
within array.
Symbols
a+b d
Multiline Mathematics
Aligned Formulas
e f +2
Multiple Aligned
Columns
Matrices \[
More Matrices
Variant Matrix
\begin{array}{|l|r|} \hline
Environments a+b & d \\ \hline
Arrays
Cases
e & f+2 \\ \hline
Practice \end{array}
\]
array is just like tabular except in math mode. If you want any
\multicolumns, you must use array instead of matrix.
You can put delimiters around array environments too.
35
Cases
An Overview
The cases environment is the way to denote a piecewise-defined
Getting Started
function. It is really a special type of matrix.
Working With Math
(
Symbols
−x x < 0
Multiline Mathematics |x| =
Aligned Formulas x x≥0
Multiple Aligned
Columns
Matrices \[
More Matrices
Variant Matrix
|x| =
Environments
Arrays
\begin{cases}
Cases -x & x<0 \\
Practice
x & x \ge 0
\end{cases}
\]
36
Practice
An Overview
Let’s practice!
Getting Started
Multiline Mathematics
Aligned Formulas
Multiple Aligned
Columns
Matrices
More Matrices
Variant Matrix
Environments
Arrays
Cases
Practice
37