LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS)...

34
L A T E XInstallation and Introduction Andrew McAllister Society of Physics Students September 21st, 2011 Andrew McAllister (SPS) L A T E XIntro September 21st, 2011 1 / 22

Transcript of LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS)...

Page 1: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

LATEXInstallation and Introduction

Andrew McAllister

Society of Physics Students

September 21st, 2011

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 1 / 22

Page 2: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

What is LATEX?

LATEXis a typesetting system that is considered the “standard” for writingscientific papers - especially those with a lot of math.

Consider the following example:

OR:

\int_a^b f(x) dx = \lim_{n\rightarrow\infty} \sum_{n=1}^n f(c_i) \Delta x_i

∫ b

af (x)dx = lim

n→∞

n∑n=1

f (ci )∆xi

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 2 / 22

Page 3: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

What is LATEX?

LATEXis a typesetting system that is considered the “standard” for writingscientific papers - especially those with a lot of math.

Consider the following example:

OR:

\int_a^b f(x) dx = \lim_{n\rightarrow\infty} \sum_{n=1}^n f(c_i) \Delta x_i

∫ b

af (x)dx = lim

n→∞

n∑n=1

f (ci )∆xi

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 2 / 22

Page 4: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

What You Need to Run LATEX

A LATEXDistribution

An Editor

A Document Viewer

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 3 / 22

Page 5: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

LATEXDistribution - Miktex

The most common distribution is Miktex which can be found atmiktex.org.

Miktex also easily installs packages for you.

Examples:

AMS Math Packages

Resume Packages

TikZ and PGF. . .

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22

Page 6: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

LATEXDistribution - Miktex

The most common distribution is Miktex which can be found atmiktex.org.

Miktex also easily installs packages for you.

Examples:

AMS Math Packages

Resume Packages

TikZ and PGF. . .

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22

Page 7: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

. . . Which does things like this:

ITEMname

COMPONENT

nil

SYSTEM

parts

SENSOR

nil

PART

nil

Pressure

nil

Temperature

nil

Instants

fw-p-suctionfw-p-deliveryfw-p-loopsw-p-suctionsw-p-deliverysw-p-loop

Closed/Open

nil

Instants

fw-clop-warm-upsw-clop-control

Instants

fw-t-enginefw-t-heat-exch.sw-t-heat-exch.

Level

nil

Instants

fw-l-tank

Ammeter

nil

Instants

fw-pump-ammetersw-pump-ammeter

Pump

nil

Valve

nil

Instants

fw-pumpsw-pump

Tank

nil

Instants

fw-suction-valvefw-delivery-valvesw-suction-valvesw-delivery-valvesw-discharge-valvesw-control-valve

Engine

nil

Instants

fw-expansion-tank

Heat Exchanger

nil

Instants

fw-heat-exchanger

Instants

fw-engine

Strainer

nil

Instants

sw-strainer

Coolant

nil

Instants

fw-coolantsw-coolant

Cooling System

nil

Cooling Loop

nil

Instants

cool

Instants

fw-loopsw-loop

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 5 / 22

Page 8: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

LATEXEditor - TeXnic Center

We’ve got a lot of choices here, why use TeXnic Center?

Easy to install

Lots of features to help new users

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 6 / 22

Page 9: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

LATEXViewer

This is the easy one you all already have Acrobat installed on yourcomputers.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 7 / 22

Page 10: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Actually Writing a LATEXDocument!

The Basic Structure

\documentclass[11pt]{article}

\usepackage{amssymb}

\usepackage{amsmath}

\usepackage{amsfonts}

\usepackage{enumerate}

\begin{document}

\end{document}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 8 / 22

Page 11: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Actually Writing a LATEXDocument!

The Basic Structure

\documentclass[11pt]{article}

\usepackage{amssymb}

\usepackage{amsmath}

\usepackage{amsfonts}

\usepackage{enumerate}

\begin{document}

\end{document}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 8 / 22

Page 12: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Regular Text

\begin{document}

\title{Your Title}

\author{You}

\date{The Date}

\maketitle

\tableofcontents

\section{Stuff}

To write regular text, just write wherever you want

it to appear.

\subsection{More Stuff}

\subsubsection{Even More Stuff}

\end{document}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 9 / 22

Page 13: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

What does that look like?

Your Title

You

The Date

Contents

1 Stuff 11.1 More Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.1.1 Even More Stuff . . . . . . . . . . . . . . . . . . . . . 1

1 Stuff

To write regular text, just write wherever you want it to appear.

1.1 More Stuff

1.1.1 Even More Stuff

1

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 10 / 22

Page 14: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Including Math (the important thing)

There are two things that you need to know:

Commands are always started with a backslash

“Math Mode” - Inline math mode is surrounded by: \( MATH \)Separate line math mode is surrounded by: \[ MATH \]

NOTE: Some people use $ to and $$ for math mode. I think this is weirdlooking and prefer to use paranthesis and brackets, but you can use either.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 11 / 22

Page 15: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Including Math (the important thing)

There are two things that you need to know:

Commands are always started with a backslash

“Math Mode” - Inline math mode is surrounded by: \( MATH \)Separate line math mode is surrounded by: \[ MATH \]

NOTE: Some people use $ to and $$ for math mode. I think this is weirdlooking and prefer to use paranthesis and brackets, but you can use either.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 11 / 22

Page 16: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 17: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 18: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇

Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 19: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 20: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 21: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 22: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Basic Math Commands

Greek Letters: Just use \LETTER\lambda = λ \ Lambda = Λ

Del is called nabla: \nabla = ∇Integrals and Sums: \int and \sum

Upper and Lower “Things”: Upper - L̂ower -

Trig Functions: \sin,cos etc.

Fractions: \frac{}{}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 12 / 22

Page 23: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Basic Formatting - 1

Text Sizes

1 \tiny

2 \scriptsize

3 \footnotesize

4 \small

5 \normalsize

6 \large

7 \Large

8 \LARGE

9 \huge

10 \HUGE

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 13 / 22

Page 24: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Basic Formatting - 2

Font Emphasis

Bold - \textbf{}Italic - \emph{}

Breaks

Line Break \newline

Page Break \newpage

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 14 / 22

Page 25: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Basic Formatting - 3

Making Lists These are contained in environments -

\begin{itemize}

\item

\end{itemize}

Instead of itemize you can have enumerate or description.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 15 / 22

Page 26: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Tables

Tables are contained in the Table Environment:

\begin{table}[H]

\begin{center}

\begin{tabular}{| c | c | c |}

\hline

& \textbf{Outgoing Officers (2010-2011)} & \textbf{Incoming Officers (2011-2012)} \\\hline

\textbf{President} & Andrew McAllister & Charles Martin \\\hline

\textbf{Vice President} & Joe Paki & Krysta Boccuzzi \\\hline

\textbf{Secretary/Treasurer} & Charles Martin & Amy Lovell \\\hline

\textbf{Outreach Coordinater} & Allycia Gariepy & Ryan Roussel \\\hline

\end{tabular}

\end{center}

\end{table}

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 16 / 22

Page 27: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Example Table

Outgoing Officers (2010-2011) Incoming Officers (2011-2012)President Andrew McAllister Charles Martin

Vice President Joe Paki Krysta BoccuzziSecretary/Treasurer Charles Martin Amy Lovell

Outreach Coordinater Allycia Gariepy Ryan Roussel

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 17 / 22

Page 28: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Example Table 2

Outgoing Officers (2010-2011) Incoming Officers (2011-2012)President Andrew McAllister Charles Martin

Vice President Joe Paki Krysta BoccuzziSecretary/Treasurer Charles Martin Amy Lovell

Outreach Coordinater Allycia Gariepy Ryan Roussel

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 18 / 22

Page 29: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Figures

Inserting figures into documents is easy:

\begin{figure}[H]

\includegraphics[scale = .5]{FILENAME}

\end{figure}

Getting them where you want is NOT.The best advice I can give is to use [h!] or [H] after your begin figure ortable. This is telling Latex to put the figure HERE in the document.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 19 / 22

Page 30: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Figures

Inserting figures into documents is easy:

\begin{figure}[H]

\includegraphics[scale = .5]{FILENAME}

\end{figure}

Getting them where you want is NOT.

The best advice I can give is to use [h!] or [H] after your begin figure ortable. This is telling Latex to put the figure HERE in the document.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 19 / 22

Page 31: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Figures

Inserting figures into documents is easy:

\begin{figure}[H]

\includegraphics[scale = .5]{FILENAME}

\end{figure}

Getting them where you want is NOT.The best advice I can give is to use [h!] or [H] after your begin figure ortable. This is telling Latex to put the figure HERE in the document.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 19 / 22

Page 32: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Common Warning/Error Messages

Overfull or Underfull Boxes - Not that big of a deal.

“I can’t write on file. . . ” - You have the pdf open, it can’t be made unlessyou close it.

File ended while scanning the use of. . . - You didn’t close a curly bracket orforgot to end an environment.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 20 / 22

Page 33: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

Some Packages/Other Interesting Things

amssymbamsmathamsfontsGraphicxBibTexBeamer

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 21 / 22

Page 34: LaTeXInstallation and Introduction · Resume Packages TikZ and PGF... Andrew McAllister (SPS) LATEXIntro September 21st, 2011 4 / 22. LATEXDistribution ... Outreach Coordinater Allycia

What Next?

I have a few books on starting latex that I can give to you/put online. Ialso can give some example documents to look at.

If there is interest I can do some more advanced subjects.

Don’t forget - lots of upperclassmen use LaTeX and can help. Also, theinternet has the answer to 99% of your questions about Latex.

Andrew McAllister (SPS) LATEXIntro September 21st, 2011 22 / 22