Advance math-mode.pdf

28
L A T E X Math Mode RSI 2012 Staff 

Transcript of Advance math-mode.pdf

Page 1: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 1/28

Page 2: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 2/28

Page 3: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 3/28

Math Mode

LATEX has a special mode for formatting mathematical formulas.In addition to displaying complicated mathematical notations,this mode allows the use of:

• Subscripts and superscripts

• Greek letters and various special symbols

Thus, math mode is also useful for some nonmathematical text:

The CH 3 COOH was irradiated with α -rays while at atemperature of 350 C.

1

Page 4: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 4/28

Types of Math Mode

1. Text math mode (\begin math . . .\end math ): the formulaappears in the middle of running text (e.g. x2 + y2 ).

2. Display math mode (\begin displaymath . . . \end displaymath ):the formula is set off on its own line.

∞0

sin x

x=

π

2.

A special type of this mode is equation mode (\begin equation . . . \end equation ), in which the formula is numbered forreference purposes (1):

H : I → πk( GL 2 n ( C )) , H t = 0 11 0

t

· 1 00 B ·

0 11 0

t(1)

Long or tall or important formulae should ordinarily be displayed.

2

Page 5: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 5/28

Using Math Mode

There are several shorthand techniques of using math mode.

• For text math mode, use $. . . $ (recommended) or \( . . . \) .

• For display math mode, use $$ . . . $$ or \[ . . . \] .

It is important to make sure that the way you end math modematches the way you started it. For example,

\begin math math stuff $

will not work.

3

Page 6: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 6/28

Example

For $a\in A = \OO_V,W$, let\[\ord_V(a) = l_A(A/(a)) \]denote the length of $A/(a)$as an A-module: we extend this as\[\ord_V\left(\fracab\right)= \ord_V(a) - \ord_V(b).\] Then,for $r\in R(W_i) $, we constructthe divisor\[\divv(r) = \sum_\substackV\subset W \\ \codim(V) = 1\ord_V(r)[V].\]

For a A = O

V,W , letord V ( a ) = lA( A/ ( a ))

denote the length of A/ ( a ) as an A-module: we extend this as

ord V ab = ord V ( a ) −ord V ( b) .

Then, for r R( W i), we construct thedivisor

div( r ) =

V W codim( V )=1

ord V ( r )[ V ].

4

Page 7: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 7/28

Typing Mathematical Expressions

• Numbers, Roman variable names, and most symbols of basicarithmetic may be typed directly:

I f $a + 2 = 4 + b$ and

$2(3b - a) = 43$,then $b = 47/4$.

If a + 2 = 4 + b and 2(3 b

− a) = 43,

then b = 47 / 4.

• Spaces are generally ignored in math mode: $abc+def$ and$a b c + d e f$ both make abc + def .

5

Page 8: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 8/28

Typefaces in Math Mode

Letters typed in math mode are set in an italic type, as isconventional for Roman variables ( x , etc.).

But do not use this as a quick way to italicize ordinary text!Words typed in math mode look reallyfreakin ′ugly (that was$really freakin’ ugly$ ). Use \emph... instead.

If you want to put text inside math mode, you canuse \textyour text here . If that doesn’t work, add\usepackageamsmath before the line \begindocument , or use

\textrmyour text here .

For sin, cos, lim, and other notations written in upright type,use commands \sin , \cos , \lim , and so forth.

6

Page 9: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 9/28

Super- and Subscripts

To get a superscript, use ^text . To get a subscript, use_text .

Both a subscript and a superscript can be placed on the sameexpression.

To get a ′ (prime), use ’ repeated as many times as needed.

Examples:

Command Result Command Resulta^b ab a^b + c ab+ c

a’ a′ a’’’ a′′′a_b ab a_b + c ab+ c

a_0^n+1 an +10 a^n+1_0 an +1

0

x^y^z xyz

a_b_c abc

7

Page 10: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 10/28

Nonmath Uses of Math Mode

Subscripts and superscripts are often useful in chemical formulae

and temperature values.

Text ResultCH$_3$COOH CH 3 COOH

180$^\circ$C 180 C

$^238_92$U 23892 U

Notice that subscripts and superscripts may be attached tonothing (as in $_3$ in the formula for acetic acid above).

8

Page 11: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 11/28

Page 12: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 12/28

Assignment 1 solution

If $f(\omega) = \omega -e\log\omega$ then $f’(\omega) =1 - e/\omega$ and $e^f(\omega)= \Omega(1)$ in positive $\omega$.

If f ( ω) = ω

−e log ω then f

′( ω) = 1

−e/ω

and ef ( ω) = Ω(1) in positive ω.

10

Page 13: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 13/28

Fractions and Roots

Fraction: use \frac numerator denominator (\frac 35 → 35 ).

(In text math mode, the slashed forms n/d usually look better.)

Square root: use \sqrt · · · (\sqrt 3x + 5 →√ 3 x + 5).

n th power root: use

\sqrt[n]

· · · (

\sqrt[3] x

→ 3√ x ).

Assignment 2: Typeset the equation

1

1 + 3

√ 2 + 3

√ 4= 3√ 2

−1 (2)

Note that it is numbered.

11

Page 14: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 14/28

Assignment 2 solution

\beginequation\frac11 + \sqrt[3]2

+ \sqrt[3]4 =\sqrt[3]2 - 1

\endequation

11 + 3√ 2 + 3√ 4 = 3√ 2 −1 (3)

12

Page 15: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 15/28

Common Mathematical Functions

Most common mathematical functions and operators havecorresponding commands which are just names of the functions:

• Summation ( ), product ( ), and integral ( ) signs are givenby \sum, \prod , and \int respectively.

• \lim ,

\log ,

\sin ,

\cos ,

\tan ,

\sec ,

\csc ,

\cot yield proper

formatting of these common functions.

Command Result

\log (3x + 5) log(3 x + 5)

\cos (5x + x^2) cos(5 x + x2 )

\sin^2 (4x + 7) sin 2 (4 x + 7)

13

Page 16: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 16/28

Common Mathematical Symbols

Most common mathematical symbols have correspondingcommands related to the symbol name or symbol appearance.

Command Result Command Result\in \ nabla \cap ,\cup ∩, \ subset ,\supset ,

\geq ,\leq ≥, ≤ \ldots ,\cdots . . . , · · ·To negate = and , use \neq and \notin . Other symbols can benegated using the \not command: \not \leq →≤, \not> →> .

Assignment 3: Typeset the following.

If A, B Γ then (Γ −A B ) (Γ −A ∩B ).

14

Page 17: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 17/28

Page 18: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 18/28

Bounded Sums and Such

Sums, products, integrals, and the like often have written upperand lower bounds. These can be indicated using _ for the lowerbound and ^ for the upper bound:

\[ \sum_i = -N^i = N\sum_j \geq 0\frac1i^2 + j^3 \]

i= N

i= −N j ≥0

1i2 + j 3

To best display unions and intersections that are bounded, use

\bigcup and \bigcap instead of \cup and \cap .

16

Page 19: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 19/28

Sum, Integral, Limit Examples

In text:\sum_i=1^\infty i^-2 ∞i=1 i−2

\int_3^2x y\, dy 2 x3 y dy

\lim_n \to \infty \frac1n lim n→∞ 1n

In displays:

\sum_i=1^\infty i^-2∞

i=1i−2

\int_3^2x y\, dy 2x

3 y dy

\lim_n \to \infty \frac1n limn→∞1n

17

Page 20: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 20/28

Union and Intersection Examples

In text:

\bigcap_i=0^\infty U_i

∞i=0 U i

\bigcup_k=3^n \1, 2, \ldots, k\ nk=3 1 , 2 , . . . , k

In displays:

\bigcap_i=0^\infty U_i∞

i=0U i

\bigcup_k=3^n \1, 2, \ldots, k\n

k=31 , 2 , . . . , k

(\bigcup_i U_i) \cup (\bigcup_i V_i) (i

U i) (i

V i)

18

Page 21: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 21/28

Assignment 7—Integrals, roots, exponents

Typeset the following equations:

limmin x,y →∞

x + y

x2

+ y2 = 0 (4)

∞−∞e−x2

dx = √ π (5)

19

Page 22: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 22/28

Page 23: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 23/28

Mathematical fonts

• Various fonts can be used to create unique mathematical

symbols:Bold \ mathbf x x

Calligraphic \ mathcal A ABlackboard bold \ mathbb Z Z

Script

\ mathscr O O

Assignment 8: Typeset the following equation.

R s I

Note: the “I” is bold.

21

Page 24: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 24/28

Assignment 8 solution

\begindisplaymath

\mathbbR^s \supset \mathbfI\enddisplaymath R s I

22

Page 25: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 25/28

Common Error Messages

! Missing $ inserted.<inserted text>

$l.8

?

You have forgotten to end math mode. The line number afterthe “ l. ” (in this case “8”) is the rst line at which L ATEX hasrealized that you have forgotten to end math mode; it is usually

the end of the paragraph the error is in.

Common cause: Forgetting to put a \ before a %.

23

Page 26: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 26/28

Common Error Messages

! Missing $ inserted.<inserted text>

$l.6 30^

\circ?

You have used a command (in this case ^) which L ATEX knows

belongs only in math mode. The line number given is thelocation of the command in question.

24

Page 27: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 27/28

Common Error Messages

! LaTeX Error: \begindisplaymath on input line 8 ended by\enddocument.

See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.

...

l.10 \enddocument

?

You have forgotten to end display math mode. The line numberon which math mode began is listed (in this case, “inputline 8”).

25

Page 28: Advance math-mode.pdf

8/13/2019 Advance math-mode.pdf

http://slidepdf.com/reader/full/advance-math-modepdf 28/28