Top Banner
L A T E X Workshop Written by Yi Liu Chen Presentation by James Canning and Barbara Schweitzer SUNY Geneseo Mathematics Department Fall Semester
28

LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Oct 13, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

LATEX Workshop Written by Yi Liu Chen Presentation by James Canning and Barbara Schweitzer SUNY Geneseo Mathematics Department

Fall Semester

Wordmark Geneseo Logo Style Guide 2

The Geneseo wordmark was implemented in 2011 as the College’s primary visual identity mark.It is set in the typeface Friz Quadrata with custom letter spacing.

Page 2: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Outline

1. LATEX Environment

2. The Basics

3. Mathematics

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 1

Page 3: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

LATEX Environment

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 2

Page 4: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Overleaf

Create an account at overleaf.com New Project =⇒ Blank Project

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 3

Page 5: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Overleaf

Make sure you have this instead

1 \ documentclass { article } 2 \ usepackage [ margin =1.25 in ]{ geometry } % Set margins 3 4 \ title {\{ LaTeX } Workshop } 5 \ author { YOUR NAME } 6 \ date {\ today } 7 8 \ begin { document } 9 \ maketitle

10 11 \ end { document }

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 4

Page 6: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

The Basics

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 5

Page 7: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Basic Commands

LATEX uses backslash \ for all of its commands, and everything is case sensitive

A command formats a small piece of text Example: \newpage creates a new page and \huge increases font size

Some commands can accept arguments Example: \textit{hello} italicize text and \ul{goodbye} underlines text

Commands can be combined and nested (starts inside and out)

Example: \textit{hello \textbf{world}}

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 6

Page 8: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Basic Environments

An environment formats a large piece of text Most environments have: \begin{} and \end{}

Example: Create document \begin{document}

. . . \end{document}

Create lists \begin{enumerate}

. . . \end{enumerate}

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 7

Page 9: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Spacing

Spacing is important

Use \indent to indent (may not always work)

Adding extra space to text does not create extra space

Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 8

Page 10: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Spacing

Start a new paragraph: \par or empty line between text, which is equivalent to Enter in Word

1 2 3

this line

new line

and

1 2

this \ par

line new line

are the same

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 9

Page 11: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Packages

LATEX can extend its format capabilities by adding packages

To add a package use \usepackage{} before \begin{document}

Common packages include: • amsmath or mathtools (extra math functions) • amssymb (more math symbols) • graphicx (display figures)

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 10

Page 12: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Structure

Use \section{} to create a section

Append "sub" in front of section to create subsections Add asterisk after section to remove section number Example:

1 2 3 4

\section{This is a section} \subsection{This is a subsection} \subsubsection{This is a sub -subsection} \section *{This is a section without a number}

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 11

Page 13: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Lists

The enumerate environment creates a numbered list and itemize environment creates a bullet list

Use \item to make a new entry List can be nested inside lists

Example:

1 2 3 4 5 6 7

\begin{enumerate} \item Fruit \begin{enumerate}

\item Apple \item Banana

\end{enumerate} \end{enumerate}

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 12

Page 14: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Lists

1. Real Numbers (R) (\mathbb{R}) 1.1 Rationals (Q) 1.2 Natural Numbers (N)

1.2.1 1 1.2.2 2 1.2.3 3 1.2.4 . . .

1.3 Integers (Z)

2. Complex Numbers (C)

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 13

Page 15: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Lists

Replace some enumerate with itemize • Real Numbers (R)

1. Rationals (Q) 2. Natural Numbers (N)

• 1 • 2 • 3 • . . .

3. Integers (Z)

• Complex Numbers (C)

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 14

Page 16: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Mathematics in LATEX

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 15

Page 17: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Di˙erent Math Modes

To write math, they have to be in math environments

Two types: In-line $ . . . $ or \( . . . \) - within text

Display \[ . . . \] - by itself Also includes equation and align environment

Normal text can be inside math environments by using \text{}

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 16

Page 18: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Math Mode Examples

Example:

1 2 3

The

The

statement $ |\ mathcal

following statement \ leq |S| \]

{P }

is

( S)| \

false .

leq

\[

|S|$

|\ mat

is

hca

false .

l {P }( S)|

The statement |P(S)| ≤ |S| is false. The following statement is false.

|P(S)| ≤ |S|

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 17

Page 19: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Math Symbols

Symbols can be on the keyboard or be a command

Keyboard Example: + − ( ) > < = Command Example (requires amssymb): \geq ≥ \neq 6= \{ and \}

To find more symbols use http://detexify.kirelabs.org/classify.html

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 18

Page 20: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

1

Math Commands

Caret symbol (Shift-6) for superscripts: ^

Underscore symbol (Shift-dash) for subscripts: _

For multiple characters, enclose in braces

Add spaces in math environment using (from smallest to greatest):

\, \: \; \quad \qquad

Example:

$ e^x \qquad e^{x^2} + y^2 \qquad e^{x^2 + y^2} $

2 2x x 2 x2+ye e + y e

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 19

Page 21: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Math Equations

The equation environment creates an equation along with a number

Example:

1 \begin{equation} 2 a^2 + b^2 = c^2 3 \end{equation}

2 2 a + b2 = c (1)

To remove the number, add an asterisk at the end of equation

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 20

Page 22: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Aligned Math

The align* environment creates several equations that are aligned together using the ampersand symbol (Shift-7) Use double backslash \\ to go to the next line

Example:

1 \ begin { align *} 2 \ text { Let } a &= b \\ 3 a ̂ 2 &= ab \\ 4 a ̂ 2 - b ̂ 2 &= ab - b ̂ 2 \\ 5 (a - b)(a + b) &= b(a - b) \\ 6 a + b &= b \\ 7 b + b &= b \\ 8 2b &= b \\ 9 2 &= 1

10 \ end { align *}

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 21

Page 23: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Aligned Math

Let a = b 2 a = ab

a 2 − b2 = ab − b2

(a − b)(a + b) = b(a − b) distributive property a + b = b

b + b = b

2b = b

2 = 1

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 22

Page 24: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Fractions

The command is \frac{}{}, where the first braces is the numerator and the second braces is the denominator.

The display mode varies based on environment

Example: 1 A linear fractional transformation: $\frac{az + b}{cz

+ d}$

A linear fractional transformation: az+b cz+d

1 \[ \text{A linear fractional transformation: } \frac{ az + b}{cz + d} \]

az + bA linear fractional transformation:

cz + d

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 23

Page 25: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Fractions

Force display or text fractions using \dfrac or \tfrac respectively

Example:

1 A linear fractional transformation: $\dfrac{az + b}{cz + d}$

az + bA linear fractional transformation:

cz + d

1 \[ \text{A linear fractional transformation: } \tfrac{ az + b}{cz + d} \]

az+bA linear fractional transformation: cz+d

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 24

Page 26: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Calculus

Summation (varies between environments): \sum_{k=1}^n k

P n kk=1

nX k

k=1

Integral: \int_a^b x^2 \, dx R b x2 dx a Z b

x 2 dx a

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 25

Page 27: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Calculus

Use fractions and add d or \partial in numerator and denominator

Example:

1 \[ \frac{d y}{d x} = 2x \] 2 \[ \frac{\ partial f}{\ partial x} = 2xy + z \]

dy = 2x

dx ∂f

= 2xy + z ∂x

Add apostrophe to the function: f’(x) \qquad f’’(x)

f 00(x)f 0(x)

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 26

Page 28: LTEX Workshop - SUNY Geneseo...Adding extra space to text does not create extra space Creating new lines: \newline or \\, which is equivalent to Shift-Enter in Word ’˛š˛ ˇ˛–fi˘ˆfi

Questions?

Additional Resources:

• https://www.geneseo.edu/prism/latex • Google!

Reversed on Black

Wordmark Reversed Geneseo Wordmark Style Guide 4

Reversed on PMS 877

Reversed on Pantone 287

LATEX Workshop

SUNY Geneseo Mathematics Department 27