Basic LaTeX for math

Basic LaTeX for math

latex for equations



0 #latex #md

In markdown notes, it’s easy to insert simple mathematical formulas with plain LaTeX\LaTeX. However, I’m always forget some basic characters for equations. So, let’s take a short review basic on the note LaTeX\LaTeX math for undergrads1. Note the render engine is KaTeX\KaTeX in this web page.

Common constructs

plain LaTeX\LaTeX output
x^2 x2x^2
x_{i, j} xi,jx_{i, j}
\sqrt{2}, \sqrt[n]{3} 2,3n\sqrt{2}, \sqrt[n]{3}
frac{2}{3}, 2/3 23,2/3\frac{2}{3}, 2/3

Calligraphic letters

Use \mathcal{A}:

ABXYZ\mathcal{A} \mathcal{B} \mathcal{XYZ}


plain LaTeX\LaTeX output plain LaTeX\LaTeX output
\alpha α\alpha \xi, \Xi ξ,Ξ\xi, \Xi
\beta β\beta o oo
\gamma, \Gamma γ,Γ\gamma, \Gamma \pi, \Pi π,Π\pi, \Pi
\delta, \Delta δ,Δ\delta, \Delta \varpi ϖ\varpi
\epsilon ϵ\epsilon \rho ρ\rho
\varepsilon ε\varepsilon \varrho ϱ\varrho
\zeta ζ\zeta \sigma, \Sigma σ,Σ\sigma, \Sigma
\eta η\eta \varsigma ς\varsigma
\theta, \Theta θ,Θ\theta, \Theta \tau τ\tau
\vartheta ϑ\vartheta \upsilon, \Upsilon υ,Υ\upsilon, \Upsilon
\iota ι\iota \phi, \Phi ϕ,Φ\phi, \Phi
\kappa κ\kappa \varphi φ\varphi
\lambda, \Lambda λ,Λ\lambda, \Lambda \chi χ\chi
\mu μ\mu \psi, \Psi ψ,Ψ\psi, \Psi
\nu ν\nu \omega, \Omega ω,Ω\omega, \Omega

Sets and logic

plain LaTeX\LaTeX plain LaTeX\LaTeX plain LaTeX\LaTeX
\cup \cup \mathbb{R} R\mathbb{R} \forall \forall
\cap \cap \mathbb{Z} Z\mathbb{Z} \exists \exists
\subset \subset \mathbb{Q} Q\mathbb{Q} \neg ¬\neg
\subseteq \subseteq \mathbb{N} N\mathbb{N} \vee \vee
\supset \supset \mathbb{C} C\mathbb{C} \wedge \wedge
\supseteq \supseteq \varnothing \varnothing \vdash \vdash
\in \in \emptyset \emptyset \models \models
\ni \ni \aleph \aleph \Rightarrow \Rightarrow
\notin \notin \setminus \setminus \nRightarrow \nRightarrow
\not\in ∉\not\in \equiv \equiv    

Negate an operator, as in ⊄\not\subset, with \not\subset. Get the set complement AcA^{\mathsf{c}} with A^{\mathsf{c}}, get AA^{\complement} with \A^{\complement}, or get Aˉ\bar{A} with \bar{A}.


plain LaTeX\LaTeX plain LaTeX\LaTeX plain LaTeX\LaTeX
f' ff' \dot{a} a˙\dot{a} \tilde{x} x~\tilde{x}
f'' ff'' \ddot{a} a¨\ddot{a} \bar{x} xˉ\bar{x}
\Sigma^{*} Σ\Sigma^{*} \hat{x} x^\hat{x} \vec{x} x\vec{x}

If the decorated letter is ii or jj then some decorations need \imath or \jmath, as in vec{\imath}. If you need boldface for vectors: \boldsymbol{x}.

Entering \overline{x+y} produces x+y\overline{x+y}, and \widehat{x+y} gives x+y^\widehat{x+y}.


Use low dots in a list {0,1,2}\{0,1,2\,\ldots\}, entered as \{0,1,2\,\ldots\}. Use entered dots in a su or product 1++1001+\cdots+100, entered as 1+\cdots+100. You can also get vertical dots \vdots and diagonal dots \ddots.

Roman names

Enter \tan{x}, with a backslash, instead of tan{x}. These get the same treatment:

plain LaTeX\LaTeX plain LaTeX\LaTeX plain LaTeX\LaTeX
\sin sin\sin \sinh sinh\sinh \arcsin arcsin\arcsin
\cos cos\cos \cosh cosh\cosh \arccos arccos\arccos
\tan tan\tan \tanh tanh\tanh \arctan arctan\arctan
\sec sec\sec \coth coth\coth \min min\min
\csc csc\csc \det det\det \max max\max
\cot cot\cot \dim dim\dim \inf inf\inf
\exp exp\exp \ker ker\ker \sup sup\sup
\log log\log \deg deg\deg \liminf lim inf\liminf
\ln ln\ln \arg arg\arg \limsup lim sup\limsup
\lg lg\lg \gcd gcd\gcd \lim lim\lim

Other symbols

plain LaTeX\LaTeX plain LaTeX\LaTeX plain LaTeX\LaTeX
< << \angle \angle \cdot \cdot
\leq \leq \measuredangle \measuredangle \pm ±\pm
> >> \ell \ell \mp \mp
\geq \geq \parallel \parallel \times ×\times
\neq \neq 45^{\circ} 4545^{\circ} \div ÷\div
\ll \ll \cong \cong \ast \ast
\gg \gg \ncong \ncong \mid \mid
\approx \approx \sim \sim \nmid \nmid
\asymp \asymp \simeq \simeq n! n!n!
\equiv \equiv \nsim \nsim \partial \partial
\prec \prec \oplus \oplus \nabla \nabla
\preceq \preceq \ominus \ominus \hbar \hbar
\succ \succ \odot \odot \circ \circ
\succeq \succeq \otimes \otimes \star \star
\propto \propto \oslash \oslash \surd \surd
\doteq \doteq \upharpoonright \upharpoonright \checkmark \checkmark

Variable-sized operators

The summation j=03j2\sum_{j=0}^3 j^2 using \sum_{j=0}^3 j^2 and the integral x=03x2dx\int_{x=0}^3 x^2\,dx with \int_{x=0}^3 x^2\,dx.

These do the same:

plain LaTeX\LaTeX plain LaTeX\LaTeX plain LaTeX\LaTeX
\int \int \iiint \iiint \bigcup \bigcup
\iint \iint \oint \oint \bigcap \bigcap


plain LaTeX\LaTeX plain LaTeX\LaTeX
\rightarrow, \to ,\rightarrow, \to \mapsto \mapsto
\nrightarrow \nrightarrow \longmapsto \longmapsto
\longrightarrow \longrightarrow \leftarrow \leftarrow
\Rightarrow \Rightarrow \leftrightarrow \leftrightarrow
\nRightarrow \nRightarrow \downarrow \downarrow
\Longrightarrow \Longrightarrow \uparrow \uparrow
\leadsto \leadsto \updownarrow \updownarrow

The right arrows in the first column have matching left arrows, such as \nleftarrow, and there are some other matches for down arrows, etc.


plain LaTeX\LaTeX plain LaTeX\LaTeX plain LaTeX\LaTeX
() ()() \langle\rangle \langle \rangle | | | |
[] [][] \lfloor\rfloor \lfloor\rfloor \| \| | |
{} {} \lceil\rceil \lceil\rceil    

They will grow with the enclosed formula using \left and \right.

\left\langle i, 2^{2^i} \right\rangle
i,22i\left\langle i,2^{2^i} \right\rangle

Every \left must match a \right and they must end on the same line in the output. For a one-sided fence put a period \left. or \right. on the other side.


Fix the size with \big, \Big, \bigg, or \Bigg.

\Big[\sum_{k=0}^n e^{k^2}\Big]
[k=0nek2]\Big[\sum_{k=0}^n e^{k^2}\Big]

Array, matrics

Make an array of mathematical text as you make a table of plain text.

	0 &\leftrightarrow &0 \\
	1 &\leftrightarrow &1 \\
	2 &\leftrightarrow &4 \\
	\vdots &           &\vdots
001124\begin{array}{rcl} 0 &\leftrightarrow &0 \\ 1 &\leftrightarrow &1 \\ 2 &\leftrightarrow &4 \\ \vdots & &\vdots \end{array}

Definition by cases is an array with two columns.

    a   &\text{if \(n=0\)} \\
    r\cdot f_{n-1}  &\text{else}
fn={aif n=0rfn1elsef_n= \begin{cases} a &\text{if \(n=0\)} \\ r\cdot f_{n-1} &\text{else} \end{cases}

A matrix is another array variant. With this abbreviation you need not specify column alignments.

    a   &b \\
    c   &d
(abcd)\begin{pmatrix} a &b \\ c &d \end{pmatrix}

For the determinant use |A| inline and vmatrix in display.

Spacing in mathematics

plain LaTeX\LaTeX plain LaTeX\LaTeX
\rightarrow\,\leftarrow \rightarrow\,\leftarrow \rightarrow\quad\leftarrow \rightarrow\quad\leftarrow
\rightarrow\:\leftarrow \rightarrow\:\leftarrow \rightarrow\qquad\leftarrow \rightarrow\qquad\leftarrow
\rightarrow\;\leftarrow   \rightarrow\;\leftarrow \rightarrow\!\leftarrow  ⁣\rightarrow\!\leftarrow

The left column spaces are in ratio 3:4:53:4:5. The last in the right column is a negative space, opposite to \,. Get arbitrary spaces as in \hspace{0.5cm}.

Calculus examples

f ⁣:RRf\colon\mathbb{R}\to\mathbb{R}
9.8 m/s29.8~\text{m}/\text{s}^2
\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
limh0f(x+h)f(x)h\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}
int x^2\,dx=x^3/3+C
x2dx=x3/3+C\int x^2\,dx=x^3/3+C

Discrete mathematics examples

There are four modulo forms: mmodnm\bmod n is from m\bmod n, and ab(modm)a\equiv b\pmod m is from a\equiv b\pmod m, and abmodma\equiv b\mod m is from a\equiv b\mod m, and ab(m)a\equiv b\pod m is from a\equiv b\pod m.

For combinations the binomial symbol (nk)\binom{n}{k} is from \binom{n}{k}. This resizes to be bigger in a display.

For permutations use nrn^{\underline{r}} from n^{\underline{r}}.

Statistics examples

\sigma^2=\sqrt{\sum (x_i-\mu)^2/N}
σ2=(xiμ)2/N\sigma^2=\sqrt{\sum (x_i-\mu)^2/N}
E(x)=\mu_X=\sum (x_i-P(x_i))
E(x)=μX=(xiP(xi))E(x)=\mu_X=\sum (x_i-P(x_i))

The probability density of the normal distribution 12σ2πe(xμ)22σ2\frac{1}{\sqrt{2\sigma^2\pi}}\,e^{-\frac{(x-\mu)^2}{2\sigma^2}} comes from this:


For more

See more comprehensive LaTeX\LaTeX symbols list at

  1. Jim Hefferon, Saint Michael’s College, VT USA 2017-Jan-10 

Ads by Google


Frank Lin

Hey, there! This is Frank Lin (@flinhong), one of the 1.4 billion 🇨🇳. This 'inDev. Journal' site holds the exploration of my quirky thoughts and random adventures through life. Hope you enjoy reading and perusing my posts.


Using Liquid in Jekyll - Live with Demos

Web Notes


Using Liquid in Jekyll - Live with Demos

Liquid is a simple templating language that Jekyll uses to process pages on your site. With Liquid you can output an modify variables, have logic statements inside your pages and loop over content.

Setup an IKEv2 server with StrongSwan



Setup an IKEv2 server with StrongSwan

IKEv2, or Internet Key Exchange v2, is a protocol that allows for direct IPSec tunneling between two points. In IKEv2 implementations, IPSec provides encryption for the network traffic. IKEv2 is natively supported on some platforms (OS X 10.11+, iOS 9.1+, and Windows 10) with no additional applications necessary, and it handles client hiccups quite smoothly.