Skip to content

Latest commit

 

History

History
409 lines (325 loc) · 6.45 KB

File metadata and controls

409 lines (325 loc) · 6.45 KB

LaTeX MATH MODE CHEAT SHEET

jeffdecola.com MIT License

The math mode of LaTex.

Table of Contents

Documentation and Reference

DECLARING MATH MODE

First, there are three ways to declare math mode in LaTeX,

  1. In-line mode using $
  2. Block mode using $$
  3. Block mode using begin{equation} ... end{equation}

In-line Mode

Einstein's equation
$E=mc^2$
represent energy is equal to matter multiplied by the speed of light squared.

Einstein's equation $E=mc^2$ represent energy is equal to matter multiplied by the speed of light squared.

Block Mode

$$
E=mc^2
$$

$$ E=mc^2 $$

Block Mode using begin{equation}

\begin{equation}
   E=mc^2
\end{equation}

$$ \begin{equation} E=mc^2 \end{equation} $$

FORMATTING MULTIPLE EQUATIONS

There are two main ways to format multiple equations in LaTeX math mode,

  • begin{aligned}...end{aligned} - Will align on an ampersand
  • begin{gathered}...end{gathered} - Every equation centered

Block mode (using aligned)

$$
\begin{aligned}
    a&=b+c \\
    d+e&=f
\end{aligned}
$$

$$ \begin{aligned} a&=b+c \\ d+e&=f \end{aligned} $$

Block mode (using gathered)

$$
\begin{gathered}
    a=b+c \\
    d+e=f
\end{gathered}
$$

$$ \begin{gathered} a=b+c \\ d+e=f \end{gathered} $$

MATH EXAMPLES

For brevity, the dollar sign delimiters are not shown.

Einsteins famous equation

E=mc^2

$$ E=mc^2 $$

Pythagorean Theorem

x^n + y^n = z^n

$$ x^n + y^n = z^n $$

Pythagorean theorem (add numbers)

\qquad \qquad
    x^n + y^n = z^n
\qquad \qquad (4)

$$ \qquad \qquad x^n + y^n = z^n \qquad \qquad (4) $$

Square root

\sqrt[3]{x}

$$ \sqrt[3]{x} $$

Multiple equations (gathered)

\begin{gathered}
    a=b+c \\
    d+e=f
\end{gathered}

$$ \begin{gathered} a=b+c \\ d+e=f \end{gathered} $$

Multiple equations (aligned on ampersand &)

\begin{aligned}
    a&=b+c \\
    d+e&=f
\end{aligned}

$$ \begin{aligned} a&=b+c \\ d+e&=f \end{aligned} $$

Alignment and spacing (on equal sign)

\begin{aligned}
    f(x) =& x^2\! +3x\! +2 \\
    f(x) =& x^2+3x+2 \\
    f(x) =& x^2\, +3x\, +2 \\
    f(x) =& x^2\: +3x\: +2 \\
    f(x) =& x^2\; +3x\; +2 \\
    f(x) =& x^2\ +3x\ +2 \\
    f(x) =& x^2\quad +3x\quad +2 \\
    f(x) =& x^2\qquad +3x\qquad +2
\end{aligned}

$$ \begin{aligned} f(x) =& x^2! +3x! +2 \\ f(x) =& x^2+3x+2 \\ f(x) =& x^2, +3x, +2 \\ f(x) =& x^2: +3x: +2 \\ f(x) =& x^2; +3x; +2 \\ f(x) =& x^2\ +3x\ +2 \\ f(x) =& x^2\quad +3x\quad +2 \\ f(x) =& x^2\qquad +3x\qquad +2 \end{aligned} $$

An integral

\int_{a}^{b} x^2 dx

$$ \int_{a}^{b} x^2 dx $$

Limits

\lim_{x\to\infty} f(x)

$$ \lim_{x\to\infty} f(x) $$

Some trigonometry

\sin(a + b ) = \sin(a)\cos(b) + \cos(a)\sin(b)

$$ \sin(a + b ) = \sin(a)\cos(b) + \cos(a)\sin(b) $$

Fractions (binomial coefficients)

\binom{n}{k} = \frac{n!}{k!(n-k)!}

$$ \binom{n}{k} = \frac{n!}{k!(n-k)!} $$

Brackets

\left( \frac{x}{y} \right)

$$ \left( \frac{x}{y} \right) $$

Bracket array

\left(
    \begin{array}{ccc}
        1 & 2 & 3\\
        4 & 4 & 9\\
        1 & -8 & 2
    \end{array}
\right)

$$ \left( \begin{array}{ccc} 1 & 2 & 3\\ 4 & 4 & 9\\ 1 & -8 & 2 \end{array} \right) $$

Arrays in Brackets with spacing (\qquad)

\left(
    \begin{array}{ccc}
        1 & 2 & 3\\
        4 & 5 & 9\\
        1 & -8 & 2
    \end{array}
\right)
\qquad
\left[
    \begin{array}{ccc}
        1 & 5 & 8\\
        0 & 2 & 4\\
        3 & 3 & -8
    \end{array}
\right]

$$ \left( \begin{array}{ccc} 1 & 2 & 3\\ 4 & 5 & 9\\ 1 & -8 & 2 \end{array} \right) \qquad \left[ \begin{array}{ccc} 1 & 5 & 8\\ 0 & 2 & 4\\ 3 & 3 & -8 \end{array} \right] $$

Some cool arrows

A
\xleftarrow[]{
    \text{this way} }
B
\xrightarrow[]{
    \text{or that way}}
C

$$ A \xleftarrow[]{ \text{this way} } B \xrightarrow[]{ \text{or that way}} C $$

Cases

u(x) =
\begin{cases}
    \exp{x} & \text{if } x \geq 0 \\
    1       & \text{if } x < 0
\end{cases}

$$ u(x) = \begin{cases} \exp{x} & \text{if } x \geq 0 \\ 1 & \text{if } x < 0 \end{cases} $$

Getting fancy

\begin{align*}
    E_1 & = \frac{e_{1max}}{\sqrt{2}}\\
    & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\
    & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\
    \\
    E_1 & = 4.44 N_1.{\phi}_m.f \\
    \\
    E_1 &= \boxed{4.44 N_1.B_m.A.f}
\end{align*}

$$ \begin{align*} E_1 & = \frac{e_{1max}}{\sqrt{2}}\\ & = \frac{N_1.{\phi}_m.w}{\sqrt{2}}\\ & = \frac{N_1{\phi}_m.2\pi.f}{\sqrt{2}}\\ \\ E_1 & = 4.44 N_1.{\phi}_m.f \\ \\ E_1 &= \boxed{4.44 N_1.B_m.A.f} \end{align*} $$

TEXT EXAMPLES

Some big text

\huge\text{Hello Jeff}

$$ \huge\text{Hello Jeff} $$