math.ps

Embed Size (px)

Citation preview

  • 8/12/2019 math.ps

    1/5

    1 5 - 4 5 1 : S a m p l e L a t e x M a t h F i l e

    b y W e n g - K e e n W o n g

    1 M a t h m o d e

    T o e n t e r L a t e x ' s m a t h m o d e , u s e t h e $ c h a r a c t e r t o d e l i m i t t h e b e g i n n i n g

    a n d e n d o f m a t h m o d e . F o r e x a m p l e , $ n O m e g a $ g i v e s y o u . O n c e i n m a t h

    m o d e , y o u ' l l n o t i c e t h a t m a t h e m a t i c a l s y m b o l s l o o k n e b u t s p a c i n g a n d

    n o r m a l t e x t w o r k d i e r e n t l y . T o a d d a s p a c e , u s e n f o l l o w e d b y a s p a c e .

    F o r i n s t a n c e , $ n e p s i l o n $ n $ n e p s i l o n $ g i v e s : ( n o t e t h e s p a c e ) .

    O n t h e o t h e r h a n d , $ n e p s i l o n $ $ n e p s i l o n $ g i v e s y o u

    T o a d d t e x t , u s e e i t h e r

    $ n t e x t f t e x t h e r e g $

    e g = s i z e o f a r r a y

    $ f n m b o x f n s c r i p t s i z e t e x t h e r e g $

    e g = s i z e o f a r r a y

    O r j u s t m a k e s u r e y o u r m a t h d e l i m i t e r s e n d b e f o r e y o u s t a r t a d d i n g

    t h e t e x t

    e g . $ n t h e t a n = n $ s i z e o f a r r a y , w h i c h g i v e s y o u = s i z e o f a r r a y

    2 B a s i c M a t h e m a t i c a l S y m b o l s

    O n c e i n m a t h m o d e , y o u c a n u s e a l l s o r t s o f m a t h e m a t i c a l s y m b o l s . C h a r -

    a c t e r s t h a t y o u ' l l p r o b a b l y n e e d i n y o u r a s s i g n m e n t s i n c l u d e :

    1 . G r e e k a l p h a b e t l e t t e r s l i k e

    n a l p h a ( ) n b e t a ( ) n g a m m a ( )

    n d e l t a ( ) n e p s i l o n ( ) n e t a ( )

    n t h e t a ( ) n l a m b d a ( ) n p i ( )

    n s i g m a ( ) n p s i ( ) n o m e g a ( ! )

    Y o u c a n a l s o c a p i t a l i z e c e r t a i n G r e e k c h a r a c t e r s e g .

    1

  • 8/12/2019 math.ps

    2/5

    n G a m m a ( ) n D e l t a ( ) n T h e t a ( )

    n L a m b d a ( ) n P i ( ) n S i g m a ( )

    n P h i ( ) n P s i ( ) n O m e g a ( )

    T h e r e a r e m a n y m o r e G r e e k l e t t e r s a v a i l a b l e a n d t h i s i s n o t a n e x h a u s -

    t i v e l i s t .

    2 . O p e r a t o r s

    n l e q ( ) n g e q ( ) n e q u i v ( ) n n e q ( 6= )

    n s u b s e t ( ) n s u p s e t ( ) n s u b s e t e q ( ) n s u p s e t e q ( )

    N o t e t h a t c a n b e t y p e d i n d i r e c t l y b u t y o u n e e d t o u s e i t

    i n m a t h m o d e .

    3 . A r r o w s

    L a t e x h a s t o n s o f a r r o w s t o u s e w i t h y o u r e q u a t i o n s . T h e l i s t b e l o w i s

    j u s t a s a m p l e o f w h a t i s a v a i l a b l e

    n l e f t a r r o w ( ) n l o n g l e f t a r r o w ( )

    n L e f t a r r o w ( ( ) n L o n g l e f t a r r o w ( ( = )

    n r i g h t a r r o w ( ! ) n l o n g r i g h t a r r o w ( ! )

    n R i g h t a r r o w ( ) ) n L o n g r i g h t a r r o w ( = ) )

    n l e f t r i g h t a r r o w ( $ ) n l o n g l e f t r i g h t a r r o w ( ! )

    n L e f t r i g h t a r r o w ( , ) n L o n g l e f t r i g h t a r r o w ( ( ) )

    4 . M i s c S y m b o l s

    n l d o t s ( ) n c d o t s ( ) n v d o t s ( ) n d d o t s ( )

    n f o r a l l ( 8 ) n i n f t y ( 1 ) n e m p t y s e t ( ; ) n e x i s t s ( 9 )

    n s u m (

    P

    ) n p r o d (

    Q

    ) n b i g c a p (

    T

    ) n b i g c u p (

    S

    )

    3 S u b s c r i p t s a n d S u p e r s c r i p t s

    S u b s c r i p t s a r e i n d i c a t e d b y t h e s y m b o l . F o r i n s t a n c e , a f s u b g l o o k s l i k e

    a

    s u b

    . S i m i l a r l y , s u p e r s c r i p t s a r e i n d i c a t e d b y t h e s y m b o l e g . a f s u p e r g

    l o o k s l i k e a

    s u p e r

    . Y o u c a n c o m b i n e s u b s c r i p t s a n d s u p e r s c r i p t s a s i n T f i g f 2 g ,

    w h i c h g e n e r a t e s T

    2

    i

    2

  • 8/12/2019 math.ps

    3/5

    4 O v e r s e t a n d U n d e r s e t

    S u b s c r i p t s a n d s u p e r s c r i p t s c a n b e u s e d f o r s u m m a t i o n o r p r o d u c t f o r m u l a s .

    F o r i n s t a n c e , n s u m f n = 0 g f 1 0 g l o o k s l i k e

    P

    1 0

    n = 0

    . H o w e v e r , t h e n o v e r s e t a n d

    n u n d e r s e t c o m m a n d s c a n a l s o b e u s e d . T h e t a b l e b e l o w i l l u s t r a t e s t h e u s e

    o f t h e s e c o m m a n d s :

    n o v e r s e t f n g f n s u m g

    n

    P

    n u n d e r s e t f i = 0 g f n p r o d g

    Q

    i = 0

    n o v e r s e t f n g f n u n d e r s e t f i = 0 g f n s u m g g

    n

    P

    i = 0

    5 F r a c t i o n s , C o m b i n a t o r i c s , a n d R o o t s

    F r a c t i o n s s u c h a s

    1 1

    2 0

    a r e c r e a t e d u s i n g t h e n f r a c f n u m e r a t o r g f d e n o m i n a t o r g

    c o n s t r u c t . Y o u c a n m a k e t h e n u m e r a t o r a n d d e n o m i n a t o r a s c o m p l i c a t e d a s

    y o u w a n t e g .

    2

    n

    F o r t h e c h o o s e e x p r e s s i o n l i k e

    k

    2

    , u s e n b i n o m f t o p g f b o t t o m g

    F o r r o o t s , u s e n s q r t f a b c g f o r

    p

    a b c a n d n s q r t n ] f a b c g f o r

    n

    p

    a b c

    6 F o r m a t t i n g E q u a t i o n s

    Y o u c a n p l a c e e q u a t i o n s i n s e c t i o n s u s i n g L a t e x c o m m a n d s l i k e e q u a t i o n ,

    g a t h e r , a n d a l i g n . T h e s e c t i o n s a r e i n d i c a t e d u s i n g n b e g i n f g a n d n e n d f g

    t a g s e g . n b e g i n f e q u a t i o n g a n d n e n d f e q u a t i o n g . A n y t h i n g b e t w e e n t h e s e

    b e g i n a n d e n d t a g s w i l l b e i n m a t h m o d e . Y o u w i l l n o t n e e d t h e $ d e l i m i t e r s .

    I f y o u p u t a * a f t e r t h e c o m m a n d e g . n b e g i n f e q u a t i o n * g , i t w i l l n o t l a b e l

    t h e s e c t i o n w i t h a n u m b e r .

    6 . 1 T h e E q u a t i o n C o m m a n d

    T h e e q u a t i o n c o m m a n d p u t s a n e q u a t i o n o n a s e p a r a t e l i n e e g .

    \ b e g i n { e q u a t i o n }

    T ( n ) = 2 T ( \ f r a c { n } { 2 } ) + c n

    \ e n d { e q u a t i o n }

    3

  • 8/12/2019 math.ps

    4/5

    L o o k s l i k e :

    T ( n ) = 2 T (

    n

    2

    ) + c n ( 1 )

    N o t i c e t h a t i t i s n u m b e r e d . I f I w a n t e d t h e e q u a t i o n n o t t o h a v e a n u m b e r ,

    I w o u l d h a v e u s e d L a t e x i n s t r u c t i o n s l i k e t h i s :

    \ b e g i n { e q u a t i o n * }

    T ( n ) = 2 T ( \ f r a c { n } { 2 } ) + c n

    \ e n d { e q u a t i o n * }

    W h i c h l o o k s l i k e :

    T ( n ) = 2 T (

    n

    2

    ) + c n

    6 . 2 T h e G a t h e r C o m m a n d

    I f y o u w a n t e d t o p u t m u l t i p l e l i n e s o f a n e q u a t i o n i n a s e c t i o n w i t h n o

    a l i g n m e n t , u s e t h e g a t h e r c o m m a n d e g .

    \ b e g i n { g a t h e r }

    x ^ 2 + y ^ 2 = 1 \ \

    x = \ s q r t { 1 - y ^ 2 }

    \ e n d { g a t h e r }

    W h i c h y i e l d s :

    x

    2

    + y

    2

    = 1

    x =

    q

    1 y

    2

    6 . 3 T h e A l i g n C o m m a n d

    T h e a l i g n c o m m a n d l e t s y o u u s e v e r t i c a l a l i g n m e n t o n m u l t i p l e l i n e s o f e q u a -

    t i o n s . F o r e x a m p l e , t h e c o d e b e l o w :

    \ b e g i n { a l i g n * }

    x ^ 2 + y ^ 2 & = 1 \ \

    x & = \ s q r t { 1 - y ^ 2 }

    \ e n d { a l i g n * }

    4

  • 8/12/2019 math.ps

    5/5

    G i v e s y o u :

    x

    2

    + y

    2

    = 1

    x =

    q

    1 y

    2

    N o t e t h a t t h e & i n d i c a t e s w h e r e y o u w a n t t h e a l i g n m e n t . I n t h i s c a s e , I

    w a n t e d t h e a l i g n m e n t o n t h e = s i g n s . Y o u a l s o n e e d a n n a t t h e e n d o f e v e r y

    e q u a t i o n i n o r d e r t o i n d i c a t e t h a t a n e w l i n e i s a b o u t t o s t a r t .

    7 O n l i n e L a t e x H e l p

    P l a c e s o n t h e w e b t h a t c a n h e l p y o u w i t h L a t e x :

    h t t p : / / w w w . l a t e x - p r o j e c t . o r g /

    h t t p : / / w w w . e m e r s o n . e m o r y . e d u / s e r v i c e s / l a t e x / l a t e x t o c . h t m l

    h t t p : / / w w w . g i s s . n a s a . g o v / l a t e x /

    h t t p : / / c o u l o m b . e c n . p u r d u e . e d u / ~ b u l s a r a / L a T e X / l a t e x . h t m l

    5