An Incredibly Brief Introduction to...

20
ASU-MSD 1 An Incredibly Brief Introduction to L A T E X Wm C Bauldry [email protected] Spring 2010 Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to L A T E X Spring 2010 1 / 20

Transcript of An Incredibly Brief Introduction to...

Page 1: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 1

An Incredibly Brief Introduction to LATEX

Wm C Bauldry

[email protected]

Spring 2010

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 1 / 20

Page 2: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 2

Topics

1 Background

2 Basic DocumentsEntering TextEntering MathematicsIncluding Graphics

3 LATEX 2ε in Math Sciences at AppalachianA First Document

4 Selected References

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 2 / 20

Page 3: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 3

The Creators of TEX and LATEX

TEX was begun by Donald Knuth of Stanford U in 1977.LATEX was written by Leslie Lamport in 1985 while at DEC.Development continues with the LATEX3 Project.

Donald Knuth with the Spokeslionof the TEX Users Group

Leslie Lamport ofMicrosoft Research

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 3 / 20

Page 4: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 4

Meet LATEX

LATEX isFor logical, not WYSIWYG,compositionA free, open-source systemfor all platformsTypesets mathematics rightAutomatically numbers

chapters, sectionsdefinitions, theoremsfigures, tablesequations

Automatically generatestable of contentsindex, bibliographycross references

SPECIAL FUNCTIONS—THE GAMMA FUNCTION 205

The formula Γ(n+1) = n! is why we say Γ extends the factorial function. Figure 4.19shows Γ(x) graphed in the window [−7, 5] × [−7, 7]. Note the poles at the negativeintegers. Observe that Γ(1) = 1 gives another reason for setting 0! = 1.

Figure 4.19 Graph of Γ(x)

Let’s consider a general property of the gamma function called the reflectionformula that is due to Euler. The easiest proof uses Weierstrass’s product formula

Γ(x) =e−γx

x

∞�

n=1

�1 +

x

n

�−1

ex/n

where γ is Euler’s constant ≈ 0.57722. Euler’s constant is the difference between thenth partial sum of the harmonic series and ln(n). The harmonic series is related tothe gamma function which is related to factorials! Weierstrass’s formula is based onGauss’s limit

Γ(x) = limn→∞

nx n!

x(x + 1) . . . (x + n)

See the classic text Rainville (1971) for a derivation.

Theorem 4.10 (Euler’s Reflection Formula) Suppose that x ∈ R is not an integer.Then

Γ(x) · Γ(1 − x) =π

sin(πx)

Proof : Invert Weierstrass’s product formula to see

1

Γ(x)= xeγx

∞�

n=1

��1 +

x

n

�e−x/n

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 4 / 20

Page 5: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 5

A Basic LATEX Document

The basic LATEX document has two parts:Preamble Choose the class: article, book, report, etc.

Load LATEX packagesMake declarations and definitions

Body Document source

Example (Simple LATEX Document)\documentclass{article}\usepackage{times}\begin{document}\section{First Section}Hello World.\end{document}

1 First Section

Hello World.

1

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 5 / 20

Page 6: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 6

Text in LATEX

Plain text is typed directly; white-space and tabs are compressed andadjusted according to TEX’s typography rules. Part, chapter, section,subsection commands are used for logical divisions. Otherenvironments also use similar commands. The two main commandformats are:

1 \command{text}2 \begin{environment} text \end{environment}

Example

\emph{emphasized text} emphasized text\begin{center}centered text centered text\end{center}

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 6 / 20

Page 7: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 7

Text Style Examples

Example\texttt{Typewriter font}

Typewriter font

\textsf{Sans serif font}Sans serif font

\textbf{Bold face text}Bold face text

\textcolor{blue}{Text in color}Text in color

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 7 / 20

Page 8: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 8

Simple List Examples

Example\begin{enumerate}\item First item\item Second item\end{enumerate}

1. First item2. Second item

\begin{itemize}\item First item\begin{enumerate}\item First subitem\item Second subitem\end{enumerate}

\item Second item\end{itemize}

First item1. First subitem2. Second subitem

Second item

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 8 / 20

Page 9: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 9

Special Characters

There are a number of special characters in TEX.

Symbol TEX Usage To print as text

# argument \#$ math mode \$& tab stop \&% comment \%{ open delimiter \{} close delimiter \}˜ nonbreaking space \textasciitilde

subscript (math) \ˆ superscript (math) \textasciicircum\ escape character \textbackslash

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 9 / 20

Page 10: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 10

Math in LATEX

There are two basic modes for mathematics: inline and display. Enterinline math, math in the line, by typing opening and closing ‘$’ signs [or‘\(’ and ‘\)’] as in $xˆ2$ to have x2. Enter displayed math, expressionson their own line, by typing an opening ‘$$’ (or ‘\[’) and a closing ‘$$’(or ‘\]’) as in \[xˆ3.\] to have

x3.

Displayed math can be numbered automatically by using the equationenvironment. E.g., \begin{equation} xˆ4.\end{equation}gives

x4. (1)

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 10 / 20

Page 11: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 11

Mathematics Definitions

Fraction Enter as $\frac{num}{den}$. dydx is $\frac{dy}{dx}$

Root Enter as $\sqrt{x}$ or $\sqrt[n]{x}$; e.g.,√x 3√x is

$\sqrt{x}\sqrt[3]{x}$Superscript A caret gives superscripts. The expression t2 e−t

2is

entered as $tˆ2 eˆ{-tˆ2}$Subscript An underscore gives subscripts. The expression x2n+1 is

given by $x {n+1}ˆ2$Function Standard functions have LATEX definitions; e.g., sin(x) is

entered as $\sin(x)$Operator Standard operators are done similarly; e.g., lim f(x) is

entered as $\lim f(x)$

See: LATEX 2ε Cheat sheet and LATEX reference.

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 11 / 20

Page 12: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 12

Mathematics Examples

Example\[fˆ\prime(x)=\lim {h\to 0} \frac{f(x+h)-f(x)}{h}\]

f ′(x) = limh→0

f(x+ h)− f(x)

h

\[ \Gamma(z) = \int 0ˆ\infty xˆ{z-1} eˆ{-x} dx \]

Γ(z) =

∫ ∞

0xz−1e−xdx

\[ fˆ{(n)}(z) = \frac{n!}{2\pi i} \oint \gamma\frac{f(\zeta)}{(\zeta-z)ˆ{n+1}} d\zeta\]

f (n)(z) =n!

2πi

γ

f(ζ)

(ζ − z)n+1dζ

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 12 / 20

Page 13: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 13

Including Graphics

Images are easy to add to a LATEXdocument. There are manymethods to insert a graphic file.One of the easiest ways (withpdfLATEX) is to use the graphicxpackage and the command

\includegraphics[width=value]{file name}.

The TEXShop LATEX template automatically sets this method up. Thefigure above is from:

\includegraphics[width=0.5\linewidth]{Lion.jpg}

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 13 / 20

Page 14: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 14

Maple Plot Example

Example (Chebyshev Polynomials)The first five Chebyshev orthogonal polynomials are

T0 = 1, T1 = x, T2 = 2x2 − 1, T3 = 4x3 − 3x, T4 = 8x4 − 8x2 + 1

The polynomials oscillate between −1 and 1 on the interval [−1, 1].

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 14 / 20

Page 15: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 15

Maple Plot Example Source

Example (Chebyshev Polynomials Example Source)\begin{example}[Chebyshev Polynomials]

The first five Chebyshev orthogonal polynomials are

\[ T 0 = 1, T 1 = x, T 2 = 2xˆ2-1, T 3 = 4xˆ3-3x, T 4 = 8xˆ4-8xˆ2+1 \]\centerline{ \includegraphics[width=1.7in]{Chebyshev.jpg} }The polynomials oscillate between $-1$ and $1$ on the interval$[-1,1].$

\end{example}

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 15 / 20

Page 16: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 16

LATEX 2ε with Mac OS X in Math Sciences

We use the MacTeX group’s TEX Live distribution for our basicsystem.1 The front-end we use is Richard Koch’s TeXShop.

To get started:– Launch TeXShop.

A new window comes up.– Choose “Latex Template”from the Templates pop-upmenu. TeXShop will fill ina new document ready foryou to start typing.

1Math Sciences also has a license for OzTEX

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 16 / 20

Page 17: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 17

A First LATEX Document

Choose a standard document class: article, report, or book\documentclass{article}Add the title and your personal information\title{Article in \LaTeX!}\author{Yogi Berra}Start the document\begin{document}And begin typing . . .\maketitle inserts title, author, and dateThe celebrated quadratic formula, shown inEquation˜\ref{quadform}, was known in verbal form(for many cases) to the Babylonians. The formula is\begin{equation} \label{quadform}x = \frac{-b \pm \sqrt{bˆ2 - 4 a c}}{2a}\end{equation}

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 17 / 20

Page 18: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 18

A First LATEX Document (cont.)

End the document with\end{document}

Click the Typeset button once. Compare with the picture below. ClickTypeset again. What changed?

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 18 / 20

Page 19: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 19

References

There is a huge collection of reference material, both books andonline, available for LATEX.

Prof. J. Hirst has a set of templates and links on his TeXResources web page.

TextbooksGuide to LATEX 2ε – Helmut Kopka et alThe LATEX Companion – Frank Mittelbach et alMath Into LATEX – George Gratzer

Online References“The Not So Short Introduction to LATEX 2ε” – Tobias Oetiker et alThe American Math. Society’s “User’s Guide for amsmath”The online LATEX Wikibook (download a PDF copy)Google’s list of LATEX tutorials

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 19 / 20

Page 20: An Incredibly Brief Introduction to LaTeXmathsci2.appstate.edu/~wmcb/Class/3220/LaTeXIntro.pdfASU-MSD 1 An Incredibly Brief Introduction to LATEX Wm C Bauldry BauldryWC@appstate.edu

ASU-MSD 20

Exercises

1 Write and test LATEX expressions for

1 limn→∞

3n

n+ 8= 3

2d

dφsin(aφ+ b) = a cos(aφ+ b)

3

∫ ∞

0

e−xdx = 1

2 Use Dr. Hirst’s template problems.tex to write a proof for theproblem:

Find the limit of the sequence{

sin(nπ)

n

}∞

n=1

. Prove your result.

Wm C Bauldry ([email protected]) An Incredibly Brief Introduction to LATEX Spring 2010 20 / 20