Skip to content
Search

Tex:Syntax

lastmod 2024-03-07created 2021-11-0513 edits

Explanation and list of Tex syntax.

Operations

Name

Syntax

Result

Multiplication

\times

\(\times\)

Division

\div

\(\div\)

Addition

+

\(+\)

Subtraction

-

\(-\)

Dot product (dot)

\cdot

\(\cdot\)

Special symbols

Name

Syntax

Result

Root (square root; Root)

\sqrt{2}

\(\sqrt{2}\)

Radical with index

\sqrt[3]{5}

\(\sqrt[3]{5}\)

Integral sign

\int_{-\infty}^{\infty}{x}

\(\int_{-\infty}^{\infty}{x}\)

Fraction

\frac{1}{2}

\(\frac{1}{2}\)

Inline (horizontal) fraction

{1}/{2}

\({1}/{2}\)

Subscript/superscript

2_{5}^{10}

\(2_{5}^{10}\)

Sum (SIGMA)

\sum_{n=0}^{10}

\(\sum_{n=0}^{10}\)

Product

\prod{x}

\(\prod{x}\)

Coproduct

\coprod{x}

\(\coprod{x}\)

Union

\bigcup{x}

\(\bigcup{x}\)

Intersection

\bigcap{x}

\(\bigcap{x}\)

V

\bigvee{x}

\(\bigvee{x}\)

Wedge

\bigwedge{x}

\(\bigwedge{x}\)

Brackets

You can just write brackets as (), but then they won't scale to the size of the content inside them. To have them sized automatically, use \left( and \right). Example:

Name

Syntax

Result

Plain

(\frac{x}{y})

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

Fitted

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

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

Bracket types:

Name

Syntax

Result

Parentheses

\left( x \right)

\(\left( x \right)\)

Braces

\left\{ x \right\}

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

Square brackets

\left[ x \right]

\(\left[ x \right]\)

Angle brackets (chevrons)

\left< x \right>

\(\left< x \right>\)

Absolute value

\left| x \right|

\(\left| x \right|\)

Accents

Name

Syntax

Result

Dot

\dot{x}

\(\dot{x}\)

Double dot

\ddot{x}

\(\ddot{x}\)

Triple dot

\dddot{x}

\(\dddot{x}\)

Quadruple dot

\ddddot{x}

\(\ddddot{x}\)

Hat (hat)

\hat{x}

\(\hat{x}\)

Check (check)

\check{x}

\(\check{x}\)

Spacing

Name

Syntax

Result

Double quad space

a \qquad b

\(a \qquad b\)

Quad space

a \quad b

\(a \quad b\)

Space

a\ b

\(a\ b\)

Space

a\;b

\(a\;b\)

Space

a\>b

\(a\>b\)

Small space

a\,b

\(a\,b\)

Small space

a\ b

\(a\ b\)

No space

ab

\(ab\)

Negative space

a\!b

\(a\!b\)

Shapes

Name

Syntax

Result

Angle

\angle

\(\angle\)

Triangle

\triangle

\(\triangle\)

Inverted triangle

\nabla

\(\nabla\)

Triangle left

\triangleleft

\(\triangleleft\)

Triangle right

\triangleright

\(\triangleright\)

Square

\square

\(\square\)

Black square

\blacksquare

\(\blacksquare\)

Circle

\circ

\(\circ\)

Degree

^{\circ}

\(^{\circ}\)

Big circle

\bigcirc

\(\bigcirc\)

Asterisk

\ast

\(\ast\)

Star

\star

\(\star\)

Diamond

\diamond

\(\diamond\)

Spade

\spadesuit

\(\spadesuit\)

Club

\clubsuit

\(\clubsuit\)

Diamond

\Diamond

\(\Diamond\)

Heart

\heartsuit

\(\heartsuit\)

Greek letters

Category

Uppercase

Lowercase

Name

Command

Output

Alpha

A

\(A\)

Beta

B

\(B\)

Gamma

\Gamma

\(\Gamma\)

Delta

\Delta

\(\Delta\)

Epsilon

E

\(E\)

Zeta

Z

\(Z\)

Eta

H

\(H\)

Theta

\Theta

\(\Theta\)

Iota

I

\(I\)

Kappa

K

\(K\)

Lambda

\Lambda

\(\Lambda\)

Mu

M

\(M\)

Nu

N

\(N\)

Xi

\Xi

\(\Xi\)

Omicron

O

\(O\)

Pi

\Pi

\(\Pi\)

Rho

P

\(P\)

Sigma

\Sigma

\(\Sigma\)

Tau

T

\(T\)

Upsilon

\Upsilon

\(\Upsilon\)

Phi

\Phi

\(\Phi\)

Chi

X

\(X\)

Psi

\Psi

\(\Psi\)

Omega

\Omega

\(\Omega\)

Relational operators

Name

Command

Output

Congruence symbol

\equiv

\(\equiv\)

Approximately equal

\approx

\(\approx\)

Proportional to

\propto

\(\propto\)

simeq

\simeq

\(\simeq\)

Similar

\sim

\(\sim\)

Not equal

\neq

\(\neq\)

Less than or equal

\leq

\(\leq\)

Greater than or equal

\geq

\(\geq\)

Much greater than

\gg

\(\gg\)

Much less than

\ll

\(\ll\)

Logic symbols

Name

Command

Output

Bullet

\bullet

\(\bullet\)

Negation

\neg

\(\neg\)

wedge

\wedge

\(\wedge\)

vee

\vee

\(\vee\)

Logical OR

\oplus

\(\oplus\)

Left arrow

\leftarrow

\(\leftarrow\)

Right arrow

\rightarrow

\(\rightarrow\)

Left-right arrow

\leftrightarrow

\(\leftrightarrow\)

Left arrow

\Leftarrow

\(\Leftarrow\)

Right arrow

\Rightarrow

\(\Rightarrow\)

Left-right arrow

\Leftrightarrow

\(\Leftrightarrow\)

There exists

\exists

\(\exists\)

For all

\forall

\(\forall\)

Hats

Name

Command

Output

Hat

\hat{x} \hat{xyz}

\(\hat{xyz}\)

Wide hat

\widehat{x} \widehat{xyz}

\(\widehat{x}\ \widehat{xyz}\)

Tilde hat

\tilde{x} \tilde{xyz}

\(\tilde{x}\ \tilde{xyz}\)

Wide tilde hat

\widetilde{x} \widetilde{xyz}

\(\widetilde{x}\ \widetilde{xyz}\)

acute

\acute{x}

\(\acute{x}\)

grave

\grave{x}

\(\grave{x}\)

Dot hat

\dot{x}

\(\dot{x}\)

Double dot hat

\ddot{x}

\(\ddot{x}\)

Check hat

\check{x}

\(\check{x}\)

breve

\breve{x}

\(\breve{x}\)

bar

\bar{x} \bar{xyz}

\(\bar{x}\ \bar{xyz}\)

overline

\overline{x} \overline{xyz}

\(\overline{x}\ \overline{xyz}\)

Arrow hat

\vec{x} \vec{xyz}

\(\vec{x} \vec{xyz}\)

Set symbols

Name

Command

Output

Intersection

\cap

\(\cap\)

Union

\cup

\(\cup\)

Superset

\supset

\(\supset\)

Superset

\subseteq

\(\subseteq\)

Proper superset

\subsetneq

\(\subsetneq\)

Subset

\subset

\(\subset\)

Subset

\subseteq

\(\subseteq\)

Proper subset

\subsetneq

\(\subsetneq\)

Not a subset

\not\subset

\(\not\subset\)

Not a subset

\nsubseteq

\(\nsubseteq\)

Empty set

\emptyset

\(\emptyset\)

Set Z

\mathbb{Z}

\(\mathbb{Z}\)

Element of

\in

\(\in\)

Not an element of

\notin

\(\notin\)

Join

\Join

\(\Join\)

Vectors

Name

Command

Output

vector

\vec{a}

\(\vec{a}\)

Matrices

There are the following 5 ways to write matrices in TeX.

Name

Command

Output

array

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

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

matrix

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

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

bmatrix

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

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

pmatrix

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

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

vmatrix

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

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

Vmatrix

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

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

Alignment

Mainly used when writing proofs of equations.

\begin{align}
f(x) &= (x + a)^2 \\
&= (x + a) (x + a) \\
&= x^2 + 2ax + a^2
\end{align}

The result is as follows.

\[ \begin{align} f(x) &= (x + a)^2 \\ &= (x + a) (x + a) \\ &= x^2 + 2ax + a^2 \end{align} \]

Other

Name

Command

Output

Center dot

\cdot

\(\cdot\)

Ellipsis

\dots

\(\dots\)

Ellipsis

\cdots

\(\cdots\)

Ellipsis

\ldots

\(\ldots\)

Vertical ellipsis

\vdots

\(\vdots\)

Diagonal ellipsis

\ddots

\(\ddots\)

Division

\div

\(\div\)

Tilde

\sim

\(\sim\)

Double tilde

\approx

\(\approx\)

Plus-minus

\pm

\(\pm\)

Minus-plus

\mp

\(\mp\)

Prime

\prime

\(\prime\)

Infinity

\infty

\(\infty\)

Integral (integral sign)

\int

\(\int\)

Partial derivative

\partial

\(\partial\)

displaystyle

As shown below, the fraction looks small, as if squeezed to fit on one line...

\(y=y_{0}+(y_{1}-y_{0}){\frac {x-x_{0}}{x_{1}-x_{0}}}\)

If you use {\displaystyle ... },

\({\displaystyle y=y_{0}+(y_{1}-y_{0}){\frac {x-x_{0}}{x_{1}-x_{0}}}}\)

it adjusts to the line size and looks nicer.

Document begin and end

\begin{document}
\end{document}

If you want a bracket on only one side

For the right side that pairs with the left \left\{, put a dot: \right..

\(\alpha(x) = \left\{ \begin{matrix} A & B \\ C & D \end{matrix} \right.\)

If you want alignment inside a matrix

Put it between \begin{matrix} \begin{align} and \end{align} \end{matrix}.

Alignment is based on &, so place it at the appropriate positions.

\(L \leftarrow \left\{ \begin{matrix} \begin{align} & 116*Y^{1/3}-16 & \textrm{for} Y>0.008856 \\ & 903.3*Y & \textrm{for} Y \le 0.008856 \end{align} \end{matrix} \right.\)

Inserting non-italic text

Use it like \textrm{for}.

\(\textrm{for} vs for\)

Adding tags

Use it like \tag{1}.

\(\begin{align} x^2 +y^2=r^2 \tag{1} \\ x\sin \theta +y\cos\theta =r^2 \tag{2} \end{align}\)

Line breaks

  • \\ (backslash twice)
  • \newline
  • \break

See also

Favorite site

author Zer0 sitemap