Skip to content

Instantly share code, notes, and snippets.

@jSayal
Last active September 4, 2025 08:30
Show Gist options
  • Save jSayal/d0f80acc9d36fa1715a1b8c2035249a0 to your computer and use it in GitHub Desktop.
Save jSayal/d0f80acc9d36fa1715a1b8c2035249a0 to your computer and use it in GitHub Desktop.

MathJax 2.0 Cheatsheet

Note: Use $...$ for inline math and $$...$$ or \[...\] for display math.


Equations

Simple equation

x = a + b

Result: $x = a + b$

Pythagorean theorem

x^2 + y^2 = z^2

Result: $x^2 + y^2 = z^2$

Subscripts

x_1 + x_2 = x_{total}

Result: $x_1 + x_2 = x_{total}$

Simple fraction

\frac{a}{b} = \frac{c}{d}

Result: $\frac{a}{b} = \frac{c}{d}$


Multi-line Equations

Using align environment (with alignment)

\begin{align}
x &= a + b \\
y &= c + d \\
z &= e + f
\end{align}

& is used to mark align points. For the equations below & is before =, so alignment is done at the = sign See the result below:

Result: $\begin{align}x &= a + b \y &= c + d \z &= e + f\end{align}$

Using gather environment (no alignment)

\begin{gather}
x = a + b \\
y = c + d
\end{gather}

Result: $\begin{gather}x = a + b \y = c + d\end{gather}$


Fractions and Roots

Basic fraction

\frac{numerator}{denominator}

Result: $\frac{numerator}{denominator}$

Square root

\sqrt{x}

Result: $\sqrt{x}$

nth root

\sqrt[n]{x}

Result: $\sqrt[n]{x}$

Complex fraction

\frac{x^2 + 1}{x - 1}

Result: $\frac{x^2 + 1}{x - 1}$


Matrices

Basic matrix (no brackets)

\begin{matrix}
a & b \\
c & d
\end{matrix}

Result: $\begin{matrix}a & b \ c & d \end{matrix}$

Matrix with parentheses

\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}

Result: $\begin{pmatrix}a & b \c & d\end{pmatrix}$

Matrix with square brackets

\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}

Result: $\begin{bmatrix}1 & 2 & 3 \4 & 5 & 6 \7 & 8 & 9\end{bmatrix}$

Determinant (vertical bars)

\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}

Result: $\begin{vmatrix}a & b \c & d\end{vmatrix}$


Vectors

Arrow vector:

\vec{v}

Result: $\vec{v}$

Vector from A to B:

\overrightarrow{AB}

Result: $\overrightarrow{AB}$

Bold vector:

\mathbf{v}

Result: $\mathbf{v}$

Unit vector:

\hat{i}

Result: $\hat{i}$

Column vector:

\vec{v} = \begin{pmatrix} x \\ y \\ z \end{pmatrix}

Dot product:

\vec{a} \cdot \vec{b} = |\vec{a}||\vec{b}|\cos\theta

Summation

Basic summation:

\sum_{i=1}^{n} x_i

Result: $\sum_{i=1}^{n} x_i$

Infinite series:

\sum_{i=1}^{\infty} \frac{1}{i^2}

Result: $\sum_{i=1}^{\infty} \frac{1}{i^2}$

Product notation:

\prod_{i=1}^{n} x_i

Result: $\prod_{i=1}^{n} x_i$


Limits

Basic limit

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

Result: $\lim_{x \to 0} f(x)$

Limit to infinity

\lim_{x \to \infty} \frac{1}{x} = 0

Result: $\lim_{x \to \infty} \frac{1}{x} = 0$

Derivative definition

\lim_{h \to 0} \frac{f(x+h) - f(x)}{h}

Result: $\lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$

Integration

Indefinite integral

\int f(x) \, dx

Result: $\int f(x) , dx$

Definite integral

\int_{a}^{b} f(x) \, dx

Result: $\int_{a}^{b} f(x) , dx$

Double integral

\iint_{D} f(x,y) \, dx \, dy

Result: $\iint_{D} f(x,y) , dx , dy$

Line integral

\oint_{C} \vec{F} \cdot d\vec{r}

Result: $\oint_{C} \vec{F} \cdot d\vec{r}$


Differentiation

Basic derivative

\frac{d}{dx} f(x)

Result: $\frac{d}{dx} f(x)$

Leibniz notation

\frac{df}{dx}

Result: $\frac{df}{dx}$

Prime notation

f'(x)

Result: $f'(x)$

Partial derivative

\frac{\partial f}{\partial x}

Result: $\frac{\partial f}{\partial x}$

Second derivative

\frac{d^2y}{dx^2}

Result: $\frac{d^2y}{dx^2}$


Common Mathematical Symbols

Greek letters (lowercase)

\alpha, \beta, \gamma, \delta, \epsilon, \theta, \lambda, \mu, \pi, \sigma, \phi, \omega

Result: $\alpha, \beta, \gamma, \delta, \epsilon, \theta, \lambda, \mu, \pi, \sigma, \phi, \omega$

Greek letters (uppercase)

\Delta, \Gamma, \Lambda, \Sigma, \Phi, \Omega

Result: $\Delta, \Gamma, \Lambda, \Sigma, \Phi, \Omega$

Infinity and plus/minus

\infty, \pm, \mp

Result: $\infty, \pm, \mp$

Inequalities

\leq, \geq, \neq, <, >

Result: $\leq, \geq, \neq, &lt;, &gt;$

Set theory

\in, \notin, \subset, \supset, \subseteq, \supseteq

Result: $\in, \notin, \subset, \supset, \subseteq, \supseteq$

Set operations

\cup, \cap, \emptyset, \setminus

Result: $\cup, \cap, \emptyset, \setminus$

Logic

\land, \lor, \neg, \implies, \iff

Result: $\land, \lor, \neg, \implies, \iff$


Special Functions

Trigonometric functions

\sin x, \cos x, \tan x, \sec x, \csc x, \cot x

Result: $\sin x, \cos x, \tan x, \sec x, \csc x, \cot x$

Inverse trigonometric functions

\arcsin x, \arccos x, \arctan x

Result: $\arcsin x, \arccos x, \arctan x$

Logarithmic functions

\log x, \ln x, \log_a x

Result: $\log x, \ln x, \log_a x$

Exponential functions

e^x, a^b, \exp(x)

Result: $e^x, a^b, \exp(x)$

Hyperbolic functions

\sinh x, \cosh x, \tanh x

Result: $\sinh x, \cosh x, \tanh x$


Spacing and Formatting

Manual spacing

a \, b \quad c \qquad d

Result: $a , b \quad c \qquad d$

Text in math mode

\text{This is text in math mode}

Result: $\text{This is text in math mode}$

Special fonts

\mathbb{R}, \mathcal{F}, \mathbf{x}, \mathrm{d}x

Result: $\mathbb{R}, \mathcal{F}, \mathbf{x}, \mathrm{d}x$

Overlines and underlines

\overline{x}, \underline{y}, \hat{z}, \tilde{a}

Result: $\overline{x}, \underline{y}, \hat{z}, \tilde{a}$


Advanced Examples

Quadratic formula

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Result: $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$

Euler's formula

e^{i\theta} = \cos\theta + i\sin\theta

Result: $e^{i\theta} = \cos\theta + i\sin\theta$

Gaussian integral

\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}

Result: $\int_{-\infty}^{\infty} e^{-x^2} , dx = \sqrt{\pi}$

Matrix equation

\mathbf{A}\mathbf{x} = \mathbf{b}

Result: $\mathbf{A}\mathbf{x} = \mathbf{b}$

System of equations

\begin{cases}
x + y = 1 \\
2x - y = 0
\end{cases}

Result: $\begin{cases}x + y = 1 \2x - y = 0\end{cases}$


Pro Tips

  1. Build complex expressions gradually - Start with simple parts and combine them
  2. Use proper spacing - \, for thin space, \quad for medium, \qquad for large
  3. Align equations properly - Use & in align environment for clean alignment
  4. Use \text{} for words - Don't put regular text directly in math mode
  5. Test your expressions - Always preview to ensure they render correctly
  6. Use \left and \right - For automatically sized parentheses: \left( \frac{a}{b} \right)

Common Environments Summary

  • align - For aligned equations with & alignment points
  • gather - For centered equations without alignment
  • matrix - Basic matrix without brackets
  • pmatrix - Matrix with parentheses ( )
  • bmatrix - Matrix with square brackets [ ]
  • vmatrix - Matrix with vertical bars | | (determinant)
  • cases - For piecewise functions and systems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment