Basic LaTeX for math

Basic LaTeX for math

latex for equations



👣 #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 that the render engine is KaTeX\KaTeX on this web page.

Common constructs

plainLaTeX\LaTeX output
x_{i, j}xi,jx_{i, j}
\sqrt{2}, \sqrt[n]{3}2,3n\sqrt{2}, \sqrt[n]{3}
frac{2}{3}, 2/323,2/3\frac{2}{3}, 2/3

Calligraphic letters

Use \mathcal{A}:

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


plainLaTeX\LaTeX outputplainLaTeX\LaTeX output
\alphaα\alpha\xi, \Xiξ,Ξ\xi, \Xi
\gamma, \Gammaγ,Γ\gamma, \Gamma\pi, \Piπ,Π\pi, \Pi
\delta, \Deltaδ,Δ\delta, \Delta\varpiϖ\varpi
\zetaζ\zeta\sigma, \Sigmaσ,Σ\sigma, \Sigma
\theta, \Thetaθ,Θ\theta, \Theta\tauτ\tau
\varthetaϑ\vartheta\upsilon, \Upsilonυ,Υ\upsilon, \Upsilon
\iotaι\iota\phi, \Phiϕ,Φ\phi, \Phi
\lambda, \Lambdaλ,Λ\lambda, \Lambda\chiχ\chi
\muμ\mu\psi, \Psiψ,Ψ\psi, \Psi
\nuν\nu\omega, \Omegaω,Ω\omega, \Omega

Sets and logic


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}.



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:

\loglog\log\degdeg\deg\liminflim inf\liminf
\lnln\ln\argarg\arg\limsuplim sup\limsup

Other symbols


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:



\rightarrow, \to,\rightarrow, \to\mapsto\mapsto

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


()()()\langle\rangle\langle \rangle| || |
[][][]\lfloor\rfloor\lfloor\rfloor\| \|| |

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, matrices

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

\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.41 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 template language that Jekyll uses to process pages for your site. With Liquid you can output complex contents without additional plugins.

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 tunnelling between networks. It is developed by Microsoft and Cisco (primarily) for mobile users, and introduced as an updated version of IKEv1 in 2005. The IKEv2 MOBIKE (Mobility and Multihoming) protocol allows the client to main secure connection despite network switches, such as when leaving a WiFi area for a mobile data area. IKEv2 works on most platforms, and natively supported on some platforms (OS X 10.11+, iOS 9.1+, and Windows 10) with no additional applications necessary.