Introduction to L A T EX Society of Physics Students Adam Dishaw - - PowerPoint PPT Presentation

introduction to l a t ex
SMART_READER_LITE
LIVE PREVIEW

Introduction to L A T EX Society of Physics Students Adam Dishaw - - PowerPoint PPT Presentation

Introduction to L A T EX Society of Physics Students Adam Dishaw & Ben Nachman Cornell University Society of Physics Students 2011 September 21 Adam & Ben (Cornell SPS) Intro to L A T X 2011-09-21 1 / 23 E Table Of Contents


slide-1
SLIDE 1

Introduction to L

AT

EX

Society of Physics Students Adam Dishaw & Ben Nachman

Cornell University Society of Physics Students

2011 September 21

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 1 / 23

slide-2
SLIDE 2

Table Of Contents

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 2 / 23

slide-3
SLIDE 3

What is L

A

T E X?

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 3 / 23

slide-4
SLIDE 4

What is L

A

T E X? What is L

A

T E X?

Why L

AT

EX?

Imagine making this in Word:

  • ∂V
  • E · d

A = 4π

  • ρ dV
  • ∂V
  • B · d

A = 0

  • ∂S
  • E · d

s = −1 c ∂ ∂t

  • B · d

A

  • ∂S
  • B · d

s = 4π c I + 1 c ∂ ∂t

  • E · d

A Or how about this: M1

φ1

− − − − → M2

φ2

− − − − → M3

φ3

− − − − → M4

φ4

− − − − → M5   f1   f2   f3   f4   f5 N1

ψ1

− − − − → N2

ψ2

− − − − → N3

ψ3

− − − − → N4

ψ4

− − − − → N5

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 4 / 23

slide-5
SLIDE 5

What is L

A

T E X? Pros and Cons

What L

AT

EX is Not

L

AT

EX is not recommended for: Reproducing the exact appearance of another document.

Point is to not think about formatting. Should automatically produce good looking documents. Can manually specify appearance, but tedious.

Taking notes “live”

With practice, not much slower than writing. Initially will take some time.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 5 / 23

slide-6
SLIDE 6

What is L

A

T E X? Pros and Cons

What L

AT

EX Is

Makes better looking math faster and more easily than Word. Lets you keep a PDF of your documents that will never get crinkled or smudged or become illegible. Used for publishing research papers throughout the scientific community.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 6 / 23

slide-7
SLIDE 7

Getting Started

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 7 / 23

slide-8
SLIDE 8

Getting Started Framework

Producing a L

AT

EX Document

To produce a L

AT

EX document:

1 Use a basic text editor (gedit, notepad, etc.) or special L AT

EX editor (TeXWorks, etc.) to create a .tex file.

2 “Compile” the .tex file either by clicking the relevant button in

your L

AT

EX editor or typing “pdflatex myfilename.tex” into a terminal (mostly for Linux/Mac users)

3 L AT

EX produces a .pdf file. Open it and check the document.

Some more advanced commands will require you to compile twice to get the desired result. If you have a dedicated L

AT

EX editor, it may display the .pdf file alongside your .tex file.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 8 / 23

slide-9
SLIDE 9

Getting Started .tex Files

What Goes in a .tex File

What You Type \documentclass{article} \usepackage{amsmath} \begin{document}

  • Hello. $y=ax^2+bx+c$!

\end{document} What You Get

  • Hello. y = ax2 + bx + c!

What It Means backslash The “word” after is a command to L

AT

EX. usepackage Packages provide extra commands for you to use documentclass What type of document you want begin, end Begins and ends an environment $ For putting math within a text line

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 9 / 23

slide-10
SLIDE 10

Basic Text

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 10 / 23

slide-11
SLIDE 11

Basic Text Text

Putting Basic Text Into a Document

Just type as you normally would. You don’t need to (but can) indent paragraphs in your L

AT

EX file. L

AT

EX will handle indenting for you. To begin a new paragraph, leave a blank line between the paragraphs in your .tex file.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 11 / 23

slide-12
SLIDE 12

Inserting Math

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 12 / 23

slide-13
SLIDE 13

Inserting Math Using $

Method 1: the $

What You Type The equation $y=ax^2+bx+c$ is in the middle of this line. What You Get The equation y = ax2 + bx + c is in the middle of this line. Used for inserting math in the middle of plain text. Good for short mathematical statements that don’t need their own line Not recommended for more complicated equations

Easier to understand when equations get their own line Large symbols (sums, integrals, fractions) will be displayed in a less pleasing format

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 13 / 23

slide-14
SLIDE 14

Inserting Math Using Align

Method 2: the “align” Environment

What You Type The equations \begin{align} y&=a_1x^2+b_1x+c_1\\ y’&=a_2x^2+b_2x+c_2 \end{align} get their own lines. What You Get The equations y = a1x2 + b1x + c1 (1) y′ = a2x2 + b2x + c2 (2) get their own lines.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 14 / 23

slide-15
SLIDE 15

Inserting Math Using Align

Method 2: the “align” Environment

Puts equation onto its own line with equation number (“align*” will remove numbering) If typing multiple equations, will align all equations at the &. Start a new line with a double backslash. Large symbols look better If this is hard to remember, you can use the “equation” environment, but you lose the ability to line up the & marks

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 15 / 23

slide-16
SLIDE 16

Symbols

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 16 / 23

slide-17
SLIDE 17

Symbols Using Symbols

Using Symbols in L

AT

EX

Entered with \nameofsymbol Most have self-explanatory names. (\alpha yields α) Most symbols are either “text mode” or “math mode” and can

  • nly be used in sections of plain text or in math mode (between $
  • r in an align environment). \alpha can only be used in math

mode, for example.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 17 / 23

slide-18
SLIDE 18

Symbols Using Symbols

Using Some Common Symbols

What You Type \begin{align} \sum_{i=1}^\infty\int_0^1\alpha_i^{20}x\,\mathrm{d}x &=\frac{1}{2}\sum_{i=1}^\infty\alpha_i^{20} \end{align} What You Get

  • i=1

1 α20

i x dx = 1

2

  • i=1

α20

i

(3)

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 18 / 23

slide-19
SLIDE 19

Symbols Common Issues

Common Issues

The characters #, $, %, ˆ, &, , {, }, ˜, and \ are all used by L

AT

  • EX. To use them in a document, type

\#, \$, \%, \^{}, \&, \_, \{, \}, \~{}, $\backslash$} and ˆ will subscript and superscript the characters following them, respectively. To sub/superscript multiple characters, enclose them in curly brackets. Wrong x_ij^10 produces xij10. Right x_{ij}^{10} produces x10

ij .

Works, But Use Caution x_i^\alpha produces xα

i . α is one character despite long command.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 19 / 23

slide-20
SLIDE 20

Tips & Tricks

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 20 / 23

slide-21
SLIDE 21

Tips & Tricks Useful Tricks

Some Useful Tricks

If you use the commands \title{Awesome Title}, \author{John Doe}, and \date{The Date} before \begin{document}, then use can use the command \maketitle to easily produce a nice looking title. The command includegraphics[optional options]{image_file_name} can be used to include pictures in your document. (Requires \usepackage{graphix}.) You can make shortcuts for commonly used commands with \newcommand{\shortcutname}[# arguments]{what it does}.

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 21 / 23

slide-22
SLIDE 22

More Information

And now...

1 What is L

AT

EX? What is L

AT

EX? Pros and Cons

2 Getting Started

Framework .tex Files

3 Basic Text

Text

4 Inserting Math

Using $ Using Align

5 Symbols

Using Symbols Common Issues

6 Tips & Tricks

Useful Tricks

7 More Information

Further Resources

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 22 / 23

slide-23
SLIDE 23

More Information Further Resources

More Information

More information, common commands, tips, tricks, how-tos, and more can be found at (all clickable links): L

AT

EX Wikibook (Great for formatting, useful commands, etc.) L

AT

EX Guide (More information than you will ever need) Google (if all else fails, plenty of stuff available online)

Adam & Ben (Cornell SPS) Intro to L

A

T E X 2011-09-21 23 / 23