24

LaTeX Math Tricks · Math exmakTer Why L A T E X? Defacto standard for mathematical typesetting Many journals accept papers in that format, and even supply style les Superior

Embed Size (px)

Citation preview

Math

LATEX Math Tricks

K. Cooper

2012

Math

Prerequisites

Prerequisites

\documentclass\usepackageEnvironments

Math mode

Math

Prerequisites

Math Mode

Uses math italic font

Uses di�erent spacing, ignoring all but explicit spaces

More �exibility in moving o� of baseline

Sometimes displayed

Math

Texmaker

Why LATEX?

Defacto standard for mathematical typesetting

Many journals accept papers in that format, and even supplystyle �les

Superior quality

Multiple platforms

Programmable

Math

Texmaker

Texmaker

http://www.xm1math.net/texmaker/

Free

Knows symbols and environments

PDF synchronization

Text folding

Math

Math Typesetting

Points of Style

Mathematical notation is a subset of English.

Punctuation

Math italic vs. roman fonts

Math

Math Typesetting

Points of Style

Mathematical notation is a subset of English.

Punctuation

Math italic vs. roman fonts

Math

Math Typesetting

Points of Style

Mathematical notation is a subset of English.

Punctuation

Math italic vs. roman fonts

Math

Math Typesetting

Points of Style

Mathematical notation is a subset of English.

Punctuation

Math italic vs. roman fonts

Math

Math Typesetting

Points of Style

Mathematical notation is a subset of English.

Punctuation

Math italic vs. roman fonts

In the sequel we shall use

f(x) =

{0 x < 0,sinx otherwise.

Math

Math Typesetting

AMS Math

\usepackage{amsmath,amsfonts,amssymb}Provides blackboard bold fonts ( Rn )

Provides \align and \cases

Math

Math Typesetting

Alignment

. . . and a corresponding sequence of closed form mesoscopiccontinuum equations (written here for an isolated system with zeroexterior forces)

∂tρ̄η + ∂x(ρ̄ηv̄η) = 0(3.1)

∂t(ρ̄ηv̄η) + ∂x(ρ̄η(v̄η)2)− ∂x(T η(c),n + T η(int),n) = 0(3.2)

Math

Math Typesetting

Alignment

\ldots and a corresponding sequence of closed form

mesoscopic continuum equations (written here for an

isolated system with zero exterior forces)

\begin{align}

\partial_t\bar{\rho}^\eta +

\partial_x(\bar{\rho}^\eta\bar{v}^\eta) &= 0\\

\partial_t(\bar{\rho}^\eta\bar{v}^\eta) +

\partial_x(\bar{\rho}^\eta(\bar{v}^\eta)^2) -

\partial_x(T_{(\text{c}),n}^\eta +

T_{(\text{int}),n}^\eta) &=0

\end{align}

Math

Math Typesetting

align

To get only one equation number, use \notag on lines not to benumbered.

To get no equation numbers, use the align* environment.

To get an equation number using the align* environment, usee.g. \tag{2.1} to put the number in explicitly.

Align starts math mode. You cannot use it when you arealready in math mode.

Math

Math Typesetting

Align

Align can do more than one column, but it can be problematic. Ingeneral, use tabular or array environments for complex layouts.

u = arctanx, dv = 1 dx

du =1

1 + x2dx, v = x.

\begin{align*}

u &= \arctan x, & dv &= 1 \, dx\\

du &= \frac{1}{1 + x^2}\, dx, & v &= x.

\end{align*}

Math

Math Typesetting

Matrices

Consider the matrix

A =(

3 −4α α

2

).

Math

Math Typesetting

Matrices

Consider the matrix

\begin{equation*}

A =

\begin{pmatrix}

3 & -4\\

\alpha & \frac{\alpha}{2}

\end{pmatrix}

\end{equation*}

Math

Math Typesetting

Matrices

Several di�erent environments

pmatrix - parenthesis matrix

bmatrix - bracket matrix

array - just make an array and specify delimiters using \leftand \right. This requires an argument to describe alignmentof each column.

Math

Math Typesetting

Matrices

Consider the array

A ={

3 −4α α

2

}.

Math

Math Typesetting

Piecewise-de�ned functions

In the sequel we shall use

f(x) =

{0 x < 0,sinx otherwise.

Math

Math Typesetting

\cases

In the sequel we shall use

$$

f(x) =

\begin{cases}

0 & x<0,\\

\sin x & \text{otherwise}.

\end{cases}

$$

Math

Math Typesetting

Display Math

Display formulas that would force text to be badly spacedvertically

Display long lines

If the displayed line is still too long, break the line before anequal sign or addition symbol. Shift the continuation line by a\qquad.

Math

Math Typesetting

Mathematical Spacing

LATEX usually spaces mathematics properly

Sometimes you need to put in explicit space for clarity.

Use a thin space (\,) for integrals:∫∞0 sinxdx vs.

∫∞0 sinx dx

Use an ordinary space (\ ) for quali�cations:fN (x) =

∑Ni=0 x

i for N = 1, 2, . . .Use a \qquad for continuations:

∞∑n=1

1n> 1 +

12

+14

+14

\qquad here−→ +

4 times︷ ︸︸ ︷18

+ · · ·+ 18

+ · · ·

Math

Math Typesetting

Details

Use \left and \right liberally

Use\sum when you want a sum - not \SigmaMatch ellipses to the surrounding notation: , . . . , vs. + · · ·+.

Plain TEX commands still work in LATEX.