Math is inline or display:

  • inline: surround with single $: $y = f(x)$ yeilds $y=f(x)$
  • display: put the equation on its own line and surround with double $$:

$$y=f(x)$$ gives

$$y=f(x)$$

Greek

  • \alpha, \beta, \gamma gives $\alpha$, $\beta$, $\gamma$
  • Uppercase: \Gamma gives $\Gamma$

Superscripts use ^

  • y^2 gives $y^2$
  • y^2x gives $y^2x$
  • y^{2x} gives $y^{2x}$

Subscripts use _

  • y_2 gives $y_2$
  • y_2x gives $y_2x$
  • y_{2x} gives $y_{2x}$

Fractions

  • \frac{numerator}{denominator}
  • \alpha\frac{d^2y}{dx^2} $$\alpha\frac{d^2y}{dx^2}$$

Sums and integrals

  • \sum_{i=0}^{n+1} x_i $$\sum_{i=0}^{n+1}x_i$$
  • \int_{T_r}^{T} c_p(T)dT $$\int_{T_r}^{T} c_p(T)dT$$

Special functions

  • \sin(x), \exp(x), \ln(x) give $\sin(x)$, $\exp(x)$, $\ln(x)$.
    • Note the difference with sin(x), exp(x), ln(x) give $sin(x)$, $exp(x)$, $ln(x)$.

Text in math

  • Use T_{\text{max}} not T_{max}
  • $T_{\text{max}}$ versus $T_{max}$

Special symbols

The big list of symbols

  • \partial
  • \alpha\frac{\partial^2y}{\partial x^2} $$\alpha\frac{\partial^2y}{\partial x^2}$$
  • \nabla gives $\nabla$
  • \approx gives $\approx$
  • \equiv gives $\equiv$
  • \rightarrow gives $\rightarrow$
  • \rightleftharpoons gives $\rightleftharpoons$
  • \infty gives $\infty$
  • \le gives $\le$
  • \ge gives $\ge$
  • \langle gives $\langle$
  • \rangle gives $\rangle$
  • \times gives $\times$
  • a\cdot b gives $a\cdot b$
  • \vec{v} gives $\vec{v}$
  • \hat{v} gives $\hat{v}$
  • \tilde{v} gives $\tilde{v}$
  • \widetilde{vkjfd} gives $\widetilde{vkjfd}$
  • \dot{m} gives $\dot{m}$
  • m^\prime gives $m^\prime$

Bigness

Compare:

  • (\frac{a}{b}) gives $$(\frac{a}{b})$$
  • \left(\frac{a}{b}\right) gives $$\left(\frac{a}{b}\right)$$
  • use \left( \right), \left[ \right], \left\{ \right\}, \left< \right>, \left| \right|
  • The following will skip the leading |, \left.\frac{df}{dx}\right|_{x=2} $$\left.\frac{df}{dx}\right|_{x=2}$$

Spaces

  • use \, \: \; \! \quad \qquad to add extra horizontal space
    • but really, \, is usually fine, sometimes more than one, like \,\, $$a,b$$ $$a:b$$ $$a;b$$ $$a!b$$ $$a\quad b$$ $$a\qquad b$$
  • \phantom{xyz} will put space for xyz (or whatever), but without displaying the xyz
    • a\phantom{xxxxxxxxxxxx}b $$a\phantom{xxxxxxxxxxxx}b$$

Align equations

  • Write equations between \begin{align} and \end{align}
  • Use & as an alignment character
  • And two backslashes \\ for line breaks
  • Include \nonumber on the line if you don’t want the equation to be numbered
$$
\begin{align}
a + b + c &= d, \\
e &= f
\end{align}
$$

$$ \begin{align} a + b + c &= d, \nonumber \\ e &= f \nonumber \end{align} $$

Matrix

  • See below.
  • Can use {matrix} or {bmatrix} or {pmatrix} or {Bmatrix} or {vmatrix} or {Vmatrix} for plain, brackets, parentheses, curly brackets, vertical lines, double vertical lines, respectively.
$$
A = 
\begin{bmatrix}
a_{1,1} & a_{1,2} & a_{1,3} \\
a_{2,1} & a_{2,2} & a_{2,3} \\
a_{3,1} & a_{3,2} & a_{3,3} \\
\end{bmatrix}
$$

$$ A = \begin{bmatrix} a_{1,1} & a_{1,2} & a_{1,3} \\ a_{2,1} & a_{2,2} & a_{2,3} \\ a_{3,1} & a_{3,2} & a_{3,3} \\ \end{bmatrix} $$

Fancy pants

  • underbrace

\underbrace{\frac{\Delta t D}{\Delta x^2}}_{d}

$$\underbrace{\frac{\Delta t D}{\Delta x^2}}_{d}$$

  • cases
    • also uses & as alignment character and \\ for line breaks
$$
T = 
\begin{cases}
-P,            &\text{for } P < -2, \\
1-\frac{P}{2}, &\text{for } -2\le P\le 2, \\
0,             &\text{for } P > 2.
\end{cases}
$$gg

$$ T = \begin{cases} -P, &\text{for } P < -2, \\ 1-\frac{P}{2}, &\text{for } -2\le P\le 2, \\ 0, &\text{for } P > 2. \end{cases} $$

Color

\color{blue}h_0 + \int_{T_r}^{T} c_p(T)dT $$\color{blue}h_0 + \int_{T_r}^{T} c_p(T)dT$$

{\color{blue}h_0} + \int_{T_r}^{T} c_p(T)dT $${\color{blue}h_0} + \int_{T_r}^{T} c_p(T)dT$$