Functions, Symbols, and Special Characters
Basic Syntax
| Type | LaTeX Source | Rendered Example |
|---|---|---|
| Inline Math | $...$ | |
| Display Math | \[...\] | |
| Superscripts and Subscripts | \hat{x}{10} | |
| Superscripts and Subscripts | a_{ij} | |
| Fractions/Radicals | \frac{a}{b} | |
| Fractions/Radicals | \sqrt[n]{x} | |
| Automatically Sized Delimiters | \left( | |
| Automatically Sized Delimiters | \right) | |
| Display-Style Inline Fraction | \dfrac{a}{b} | |
| Upright Characters | \mathrm{e} |
Equation Numbering
In LaTeX, you can use the \tag command to assign custom equation numbers. The following examples demonstrate how to add custom equation numbers in LaTeX:
Unnumbered Equations
Use $$ ... $$ or the [equation*] environment to create unnumbered equations.
% Unnumbered Equations
$$
\dot{V}(x) \leq -k_1 V(x)^{\frac{m}{n}} - k_2 V(x)^{\frac{r}{s}}
$$
Rendered output:
Numbered Equations
Use the \tag{} command to assign a custom equation number, for example \tag{1.1}
% Equation with Custom Numbering
$$
\dot{V}(x) \leq -k_1 V(x)^{\frac{m}{n}} - k_2 V(x)^{\frac{r}{s}} \tag{1.1}
$$
Rendered output:
Custom Numbering for Multiline Equations
In the align environment, you can assign a custom equation number to each line individually.
% Custom Numbering for Multiline Equations
\begin{align}
\dot{V}(x) &\leq -k_1 V(x)^{\frac{m}{n}} - k_2 V(x)^{\frac{r}{s}} \tag{1.2} \\
&\leq -k_1 V(x)^{\frac{m}{n}} \quad \text{(neglecting the sublinear term)} \tag{1.3}
\end{align}
\end{document}
Rendered output:
Notes:
- The
\tag{}command overrides the equation number generated automatically by LaTeX. - To reference custom equation numbers within equations, use
\label{}together with\ref{}.
Accents / Diacritical Marks
| LaTeX Source | Rendered Example |
|---|---|
\dot{a} | |
\ddot{a} | |
\acute{a} | |
\grave{a} | |
\check{a} | |
\breve{a} | |
\tilde{a} | |
\bar{a} | |
\hat{a} | |
\widehat{a} | |
\vec{a} |
Standard Functions
Exponential Functions
| LaTeX Source | Rendered Example |
|---|---|
\exp_a b = a^{b} | |
\exp b = e^{b} | |
10^{m} |
Logarithms
| LaTeX Source | Rendered Example |
|---|---|
\ln c | |
\lg d = \log e | |
\log_{10} f |
Trigonometric Functions
| LaTeX Source | Rendered Example |
|---|---|
\sin a | |
\cos b | |
\tan c | |
\cot d | |
\sec e | |
\csc f | |
\arcsin a | |
\arccos b | |
\arctan c | |
\arccot d | |
\arcsec e | |
\arccsc f | |
\sinh a | |
\cosh b | |
\tanh c | |
\coth d | |
\operatorname{sh}k | |
\operatorname{ch}l | |
\operatorname{th}m | |
\operatorname{coth}n | |
\operatorname{argsh}o | |
\operatorname{argch}p | |
\operatorname{argth}q |
Sign Function and Absolute Value
| LaTeX Source | Rendered Example |
|---|---|
\operatorname{sgn} r | |
\left\vert s \right\vert |
Maximum and Minimum
| LaTeX Source | Rendered Example |
|---|---|
\min(x,y) | |
\max(x,y) |
Bounds and Limits
| LaTeX Source | Rendered Example |
|---|---|
\min x | |
\max y | |
\inf s | |
\sup t | |
\lim u | |
\liminf v | |
\limsup w | |
\lim_{n \to \infty} \frac{1}{n(n+1)} | |
\dim p | |
\deg q | |
\det m | |
\ker\phi |
Projections
| LaTeX Source | Rendered Example |
|---|---|
\Pr j | |
\hom l | |
\lVert z \rVert | |
\arg z |
Differentials and Derivatives
| LaTeX Source | Rendered Example |
|---|---|
dt | |
\mathrm{d}t | |
\partial t | |
\nabla\psi | |
dy/dx | |
\mathrm{d}y/\mathrm{d}x | |
\frac{dy}{dx} | |
\frac{\mathrm{d}y}{\mathrm{d}x} | |
\frac{\partial^2}{\partial x_1\partial x_2}y | |
\prime | |
\backprime | |
f^\prime | |
f' | |
f'' | |
f^{(3)} | |
\dot y | |
\ddot y |
Letterlike Symbols and Constants
| LaTeX Source | Rendered Example |
|---|---|
\infty | |
\aleph | |
\complement | |
\backepsilon | |
\eth | |
\Finv | |
\hbar | |
\Im | |
\imath | |
\jmath | |
\Bbbk | |
\ell | |
\mho | |
\wp | |
\Re | |
\circledS |
Modular Arithmetic
| LaTeX Source | Rendered Example |
|---|---|
s_k \equiv 0 \pmod{m} | |
a \bmod b | |
\gcd(m, n), \operatorname{lcm}(m, n) | |
\mid, \nmid, \shortmid, \nshortmid |
Radicals
| LaTeX Source | Rendered Example |
|---|---|
\surd, \sqrt{2}, \sqrt[n]{}, \sqrt[3]{\frac{x^3+y^3}{2}} |
Operators
| LaTeX Source | Rendered Example |
|---|---|
+, -, \pm, \mp, \dotplus | |
\times, \div, \divideontimes, /, \backslash | |
\cdot, * \ast, \star, \circ, \bullet | |
\boxplus, \boxminus, \boxtimes, \boxdot | |
\oplus, \ominus, \otimes, \oslash, \odot | |
\circleddash, \circledcirc, \circledast | |
\bigoplus, \bigotimes, \bigodot |
Sets
| LaTeX Source | Rendered Example |
|---|---|
\{ \}, \O \empty \emptyset, \varnothing | |
\in, \notin \not\in, \ni, \not\ni | |
\cap, \Cap, \sqcap, \bigcap | |
\cup, \Cup, \sqcup, \bigcup, \bigsqcup, \uplus, \biguplus | |
\setminus, \smallsetminus, \times | |
\subset, \Subset, \sqsubset | |
\supset, \Supset, \sqsupset | |
\subseteq, \nsubseteq, \subsetneq, \varsubsetneq, \sqsubseteq | |
\supseteq, \nsupseteq, \supsetneq, \varsupsetneq, \sqsupseteq | |
\subseteqq, \nsubseteqq, \subsetneqq, \varsubsetneqq | |
\supseteqq, \nsupseteqq, \supsetneqq, \varsupsetneqq |
Relation Symbols
| LaTeX Source | Rendered Example |
|---|---|
=, \ne, \neq, \equiv, \not\equiv | |
\doteq, \doteqdot, \overset{\underset{\mathrm{def}}{}}{=}, := | |
\sim, \nsim, \backsim, \thicksim, \simeq, \backsimeq, \eqsim, \cong, \ncong | |
\approx, \thickapprox, \approxeq, \asymp, \propto, \varpropto | |
<, \nless, \ll, \not\ll, \lll, \not\lll, \lessdot | |
>, \ngtr, \gg, \not\gg, \ggg, \not\ggg, \gtrdot | |
\le, \leq, \lneq, \leqq, \nleq, \nleqq, \lneqq, \lvertneqq | |
\ge, \geq, \gneq, \geqq, \ngeq, \ngeqq, \gneqq, \gvertneqq | |
\lessgtr, \lesseqgtr, \lesseqqgtr, \gtrless, \gtreqless, \gtreqqless | |
\leqslant, \nleqslant, \eqslantless | |
\geqslant, \ngeqslant, \eqslantgtr | |
\lesssim, \lnsim, \lessapprox, \lnapprox | |
\gtrsim, \gnsim, \gtrapprox, \gnapprox | |
\prec, \nprec, \preceq, \npreceq, \precneqq | |
\succ, \nsucc, \succeq, \nsucceq, \succneqq | |
\preccurlyeq, \curlyeqprec | |
\succcurlyeq, \curlyeqsucc | |
\precsim, \precnsim, \precapprox, \precnapprox | |
\succsim, \succnsim, \succapprox, \succnapprox |
Geometric Symbols
| LaTeX Source | Rendered Example |
|---|---|
\parallel, \nparallel, \shortparallel, \nshortparallel | |
\perp, \angle, \sphericalangle, \measuredangle, 45^\circ | |
\Box, \blacksquare, \diamond, \Diamond \lozenge, \blacklozenge, \bigstar | |
\bigcirc, \triangle, \bigtriangleup, \bigtriangledown | |
\vartriangle, \triangledown | |
\blacktriangle, \blacktriangledown, \blacktriangleleft, \blacktriangleright |
Logical Symbols
| LaTeX Source | Rendered Example |
|---|---|
\forall, \exists, \nexists | |
\therefore, \because, \And | |
\lor \lor \vee, \curlyvee, \bigvee | |
\land \land \wedge, \curlywedge, \bigwedge | |
\bar{q}, \bar{abc}, \overline{q}, \overline{abc}, | |
\lnot \neg, \not\operatorname{R}, \bot, \top | |
\vdash \dashv, \vDash, \models | |
\Vdash \nvDash \nVdash \nvdash \nVDash | |
\ulcorner \urcorner \llcorner \lrcorner |
Arrows
| LaTeX Source | Rendered Example |
|---|---|
\Rightarrow, \Leftarrow | |
\Rightarrow, \nRightarrow, \Longrightarrow \implies | |
\Leftarrow, \nLeftarrow, \Longleftarrow | |
\Leftrightarrow, \nLeftrightarrow, \Longleftrightarrow \iff | |
\Uparrow, \Downarrow, \Updownarrow | |
\rightarrow \to, \nrightarrow, \longrightarrow | |
\leftarrow \gets, \nleftarrow, \longleftarrow | |
\leftrightarrow, \nleftrightarrow, \longleftrightarrow | |
\uparrow, \downarrow, \updownarrow | |
\nearrow, \swarrow, \nwarrow, \searrow | |
\mapsto, \longmapsto | |
\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown \upharpoonleft \upharpoonright \downharpoonleft \downharpoonright \rightleftharpoons \leftrightharpoons | |
\curvearrowleft \circlearrowleft \Lsh \upuparrows \rightrightarrows \rightleftarrows \rightarrowtail \looparrowright | |
\curvearrowright \circlearrowright \Rsh \downdownarrows \leftleftarrows \leftrightarrows \leftarrowtail \looparrowleft | |
\hookrightarrow \hookleftarrow \multimap \leftrightsquigarrow \rightsquigarrow \twoheadrightarrow \twoheadleftarrow |
Special Symbols
Ellipses: Two types of ellipses are commonly used in mathematical formulas.
\ldotsproduces dots aligned with the text baseline, while\cdotsproduces dots aligned with the mathematical axis.
| LaTeX Source | Rendered Example |
|---|---|
\amalg \% \dagger \ddagger \ldots \cdots | |
\smile \frown \wr \triangleleft \triangleright | |
\diamondsuit, \heartsuit, \clubsuit, \spadesuit, \Game, \flat, \natural, \sharp |
Miscellaneous
| LaTeX Source | Rendered Example |
|---|---|
\diagup \diagdown \centerdot \ltimes \rtimes \leftthreetimes \rightthreetimes | |
\eqcirc \circeq \triangleq \bumpeq \Bumpeq \doteqdot \risingdotseq \fallingdotseq | |
\intercal \barwedge \veebar \doublebarwedge \between \pitchfork | |
\vartriangleleft \ntriangleleft \vartriangleright \ntriangleright | |
\trianglelefteq \ntrianglelefteq \trianglerighteq \ntrianglerighteq |
Superscripts, Subscripts, Integrals, and More
Function|Syntax|Output
^denotes a superscript, and_denotes a subscript. If a superscript or subscript contains more than one character, enclose the characters in{}to group them. Superscripts and subscripts can be nested or used together.
| Function | LaTeX Source | Rendered Example |
|---|---|---|
| Superscript | a^2 | |
| Subscript | a_2 | |
| Grouping | a^{2+2} | |
| Grouping | a_{i,j} | |
| Combined Superscripts and Subscripts | x_2^3 | |
| Prescripts | {}_1^2\!X_3^4 | |
| Derivative (HTML) | x' | |
| Derivative (PNG) | x^\prime | |
| Derivative (Incorrect) | x\prime | |
| Dot Notation for Derivatives | \dot{x} | |
| Dot Notation for Derivatives | \ddot{y} | |
| Vector | \vec{c}(single letter only) | |
| Vector | \overleftarrow{a b} | |
| Vector | \overrightarrow{c d} | |
| Vector | \overleftrightarrow{a b} | |
| Vector | \widehat{e f g} | |
| Overarc | \overset{\frown}{AB} | |
| Overline | \overline{h i j} | |
| Underline | \underline{k l m} | |
| Summation | \sum_{k=1}^N k^2 | |
| Summation | \begin{matrix} \sum_{k=1}^N k^2 \end{matrix} | |
| Product | \prod_{i=1}^N x_i | |
| Product | \begin{matrix} \prod_{i=1}^N x_i \end{matrix} | |
| Coproduct | \coprod_{i=1}^N x_i | |
| Coproduct | \begin{matrix} \coprod_{i=1}^N x_i\end{matrix} | |
| Limit | \lim_{n \to \infty}x_n | |
| Limit | \begin{matrix} \lim_{n \to \infty}x_n \end{matrix} | |
| Integral | \int_{-N}^{N} e^x\, \mathrm{d}x | |
| Integral | \begin{matrix} \int_{-N}^{N} e^x\, \mathrm{d}x \end{matrix} | |
| Double Integral | \iint_{D}^{W} \, \mathrm{d}x\,\mathrm{d}y | |
| Triple Integral | \iiint_{E}^{V} \, \mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z | |
| Closed Contour and Surface Integrals | \oint_{C} x^3\, \mathrm{d}x + 4y^2\, \mathrm{d}y | |
| Intersection | \bigcap_{i=1}^{n} p | |
| Union | \bigcup_{i=1}^{k} p |
Fractions
Use the
\frac{numerator}{denominator}command to create a fraction. Fractions can be nested. For a simple fraction, enter\frac abto quickly produce . For a complex fractional expression, you can also usenumerator \over denominatorto create a single-level fraction.
| Function | LaTeX Source | Rendered Example |
|---|---|---|
| Fraction | \frac{2}{4}=0.5 | |
| Small Fraction | \tfrac{2}{4} = 0.5 | |
| Continued Fraction (Large Nested Fraction) | \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a | |
| Large Non-Nested Fraction | \dfrac{2}{4} = 0.5 \quad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a | |
| Binomial Coefficient | \dbinom{n}{r}=\binom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r} | |
| Small Binomial Coefficient | \tbinom{n}{r}=\tbinom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r} | |
| Large Binomial Coefficient | \binom{n}{r}=\dbinom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r} |
Avoid using
\fracin base-e exponential functions, limits, and integrals: it can make the expression look awkward and may introduce ambiguity. For this reason, it is rarely used in these contexts in professional mathematical typesetting. Write these fractions horizontally, using a slash/instead of a fraction bar.
\begin{array}{cc}
\mathrm{Bad} & \mathrm{Better} \\
\hline \\
e^{i\frac{\pi}2} \quad e^{\frac{i\pi}2}& e^{i\pi/2} \\
\int_{-\frac\pi2}^\frac\pi2 \sin x\,dx & \int_{-\pi/2}^{\pi/2}\sin x\,dx \\
\end{array}
Rendered output:
Note: In exponents and integrals, professional typesetting recommends using a slash
/instead of\fracfor a more concise and visually balanced formula.
Matrices, Piecewise Expressions, and Systems of Equations
Syntax:
\begin{type}
formula content
\end{type}
The type can be a matrix environment (matrix pmatrix bmatrix Bmatrix vmatrix Vmatrix), a piecewise expression (cases), multiline aligned equations (aligned), or an array (array).
Within the formula, insert & in each row to specify alignment points, and use \\ at the end of each row to start a new line.
Matrices without Delimiters
\begin{matrix}
x & y \\
z & v
\end{matrix}
Rendered output:
Matrices with Delimiters
\begin{vmatrix}
x & y \\
z & v
\end{vmatrix}
Rendered output:
\begin{Vmatrix}
x & y \\
z & v
\end{Vmatrix}
Rendered output:
Use \cdots, \ddots, and \vdots to insert ellipses.
\begin{bmatrix}
0 & \cdots & 0 \\
\vdots & \ddots & \vdots \\
0 & \cdots & 0
\end{bmatrix}
Rendered output:
\begin{Bmatrix}
x & y \\
z & v
\end{Bmatrix}
Rendered output:
\begin{pmatrix}
x & y \\
z & v
\end{pmatrix}
Rendered output:
Piecewise Expressions
f(n) =
\begin{cases}
n/2, & \text{if }n\text{ is even} \\
3n+1, & \text{if }n\text{ is odd}
\end{cases}
Rendered output:
Multiline Equations and Congruences
To arrange a sequence of equations in a neatly aligned, centered column, use \begin{aligned}...\end{aligned}.
\begin{aligned}
f(x) &= (m+n)^2 \\
&= m^2+2mn+n^2
\end{aligned}
Rendered output:
\begin{aligned}
3^{6n+3}+4^{6n+3}
&\equiv (3^3)^{2n+1}+(4^3)^{2n+1}\\
&\equiv 27^{2n+1}+64^{2n+1}\\
&\equiv 27^{2n+1}+(-27)^{2n+1}\\
&\equiv 27^{2n+1}-27^{2n+1}\\
&\equiv 0 \pmod{91}\\
\end{aligned}
Rendered output:
\begin{alignedat}{3}
f(x) &= (m-n)^2 \\
f(x) &= (-m+n)^2 \\
&= m^2-2mn+n^2
\end{alignedat}
Rendered output:
Systems of Equations
\begin{cases}
\begin{split}
p &= P(y=1|\mathbf{x})=
\frac{1}{1+e^{-\theta^T\mathbf{X}}}\\
1-p &= P(y=0|\mathbf{x})=1-P(y=1|\mathbf{x})=
\frac{1}{1+e^{\theta^T\mathbf{X}}}
\end{split}
\end{cases}
Rendered output:
Note that LaTeX environments can be nested. The example above uses \begin{cases} \end{cases} to enclose \begin{split} \end{split}. You can also combine formulas with text, for example:
\text{Decision Boundary}=
\begin{cases}
1\quad \text{if }\ \hat{y}>0.5\\
0\quad \text{otherwise}
\end{cases}
Rendered output:
Example
\begin{cases}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}
Rendered output:
or
\left\{\begin{aligned}
3x + 5y + z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{aligned}\right.
Rendered output:
Arrays and Tables
A formatted table is generally easier to read than plain or typeset text alone. Arrays and tables begin with \begin{array}, followed by a specification of the number of columns and their text alignment. The specifiers c, l, and r indicate centered, left-aligned, and right-aligned columns, respectively. To insert a vertical rule, add | to the column specification; to insert a horizontal rule, add \hline before the next row. As with matrices, separate entries within each row using &, end each row with \\, and close the array with \end{array}.
\begin{array}{c|lcr}
n & \text{Left-aligned} & \text{Centered} & \text{Right-aligned} \\
\hline
1 & 0.24 & 1 & 125 \\
2 & -1 & 189 & -8 \\
3 & -20 & 2000 & 1+10i
\end{array}
Rendered output:
\begin{array}{lcl}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
Rendered output:
\begin{array}{lcr}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
Rendered output:
\begin{array}{ccc}
a & b & S \\
\hline
0&0&1\\
0&1&1\\
1&0&1\\
1&1&0
\end{array}
Rendered output:
Nested Arrays or Tables
Multiple arrays or tables can be nested to form a group of arrays or tables.
Declare the $$ delimiters before using nested arrays or tables.
% outer vertical array of arrays (outer vertical table)
\begin{array}{c}
% inner horizontal array of arrays (inner horizontal table)
\begin{array}{cc}
% inner array of minimum values (inner array of minimum values)
\begin{array}{c|cccc}
\text{min} & 0 & 1 & 2 & 3\\
\hline
0 & 0 & 0 & 0 & 0\\
1 & 0 & 1 & 1 & 1\\
2 & 0 & 1 & 2 & 2\\
3 & 0 & 1 & 2 & 3
\end{array}
&
% inner array of maximum values (inner array of maximum values)
\begin{array}{c|cccc}
\text{max}&0&1&2&3\\
\hline
0 & 0 & 1 & 2 & 3\\
1 & 1 & 1 & 2 & 3\\
2 & 2 & 2 & 2 & 3\\
3 & 3 & 3 & 3 & 3
\end{array}
\end{array}
\\ % End of the first inner row of tables
% inner array of delta values (second inner row: delta values)
\begin{array}{c|cccc}
\Delta&0&1&2&3\\
\hline
0 & 0 & 1 & 2 & 3\\
1 & 1 & 0 & 1 & 2\\
2 & 2 & 1 & 0 & 1\\
3 & 3 & 2 & 1 & 0
\end{array}
\end{array}
Rendered output:
Matrices with Separators Using Arrays
& separates entries, and \\ starts a new line
\left[
\begin{array}{cc|c}
1&2&3\\
4&5&6
\end{array}
\right]
Rendered output:
Fonts
To change the font of selected characters in a formula, use {\font {characters to format}}, replacing \font with an appropriate font command from the table below. Mathematical formulas generally use italic type by default.
Greek Letters
| Category | Source | Rendered Output |
|---|---|---|
| Uppercase Greek Letters 1 | \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta | |
| Uppercase Greek Letters 2 | \Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi | |
| Uppercase Greek Letters 3 | \Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega | |
| Lowercase Greek Letters 1 | \alpha \beta \gamma \delta \epsilon \zeta \eta \theta | |
| Lowercase Greek Letters 2 | \iota \kappa \lambda \mu \nu \omicron \xi \pi | |
| Lowercase Greek Letters 3 | \rho \sigma \tau \upsilon \phi \chi \psi \omega | |
| Variant Greek Letters 1 | \varepsilon \digamma \varkappa \varpi | |
| Variant Greek Letters 2 | \varrho \varsigma \vartheta \varphi |
Hebrew Symbols
| Source | Rendered Output |
|---|---|
\aleph \beth \gimel \daleth |
Font Command Shorthands
| Input | Description | Output | Input | Description | Output |
|---|---|---|---|---|---|
\rm | Roman | \cal | Calligraphic | ||
\it | Italic | \Bbb | Blackboard Bold | ||
\bf | Bold | \mathit | Math Italic | ||
\sf | Sans Serif | \scr | Script | ||
\tt | Typewriter | \frak | Fraktur |
All Fonts
Blackboard Bold \mathbb{}
| Source | Rendered Output |
|---|---|
\mathbb{ABCDEFGHI} | |
\mathbb{JKLMNOPQR} | |
\mathbb{STUVWXYZ} |
Bold \mathbf{}
| Source | Rendered Output |
|---|---|
\mathbf{ABCDEFGHI} | |
\mathbf{JKLMNOPQR} | |
\mathbf{STUVWXYZ} | |
\mathbf{abcdefghijklm} | |
\mathbf{nopqrstuvwxyz} | |
\mathbf{0123456789} |
Bold Greek Letters \boldsymbol{}
| Source | Rendered Output |
|---|---|
\boldsymbol{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta} | |
\boldsymbol{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho} | |
\boldsymbol{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega} | |
\boldsymbol{\alpha \beta \gamma \delta \epsilon \zeta \eta \theta} | |
\boldsymbol{\iota \kappa \lambda \mu \nu \omicron \xi \pi} | |
\boldsymbol{\sigma \tau \upsilon \phi \chi \psi \omega} | |
\boldsymbol{\varepsilon \digamma \varkappa \varpi} | |
\boldsymbol{\varrho \varsigma \vartheta \varphi} |
Italic (Default for Latin Letters)\mathit{}
| Source | Rendered Output |
|---|---|
\mathit{0123456789} |
Italic Greek Letters (Default for Lowercase Letters)\mathit{}
| Source | Rendered Output |
|---|---|
\mathit{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta} | |
\mathit{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho} | |
\mathit{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega} |
Roman \mathrm{}
| Source | Rendered Output |
|---|---|
\mathrm{ABCDEFGHI} | |
\mathrm{JKLMNOPQR} | |
\mathrm{STUVWXYZ} | |
\mathrm{abcdefghijklm} | |
\mathrm{nopqrstuvwxyz} | |
\mathrm{0123456789} |
Sans Serif \mathsf{}
| Source | Rendered Output |
|---|---|
\mathsf{ABCDEFGHI} | |
\mathsf{JKLMNOPQR} | |
\mathsf{STUVWXYZ} | |
\mathsf{abcdefghijklm} | |
\mathsf{nopqrstuvwxyz} | |
\mathsf{0123456789} |
Sans Serif Greek Letters (Uppercase Only)\mathsf{}
| Source | Rendered Output |
|---|---|
\mathsf{\Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta} | |
\mathsf{\Iota \Kappa \Lambda \Mu \Nu \Xi \Pi \Rho} | |
\mathsf{\Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega} |
Script / Calligraphic \mathcal{}
| Source | Rendered Output |
|---|---|
\mathcal{ABCDEFGHI} | |
\mathcal{JKLMNOPQR} | |
\mathcal{STUVWXYZ} |
Fraktur \mathfrak{}
| Source | Rendered Output |
|---|---|
\mathfrak{ABCDEFGHI} | |
\mathfrak{JKLMNOPQR} | |
\mathfrak{STUVWXYZ} | |
\mathfrak{abcdefghijklm} | |
\mathfrak{nopqrstuvwxyz} | |
\mathfrak{0123456789} |
Lowercase Script \mathscr{}
| Source | Rendered Output |
|---|---|
\mathscr{abcdefghijklm} |
Mixed Fonts
| Feature | Syntax | Rendered Output |
|---|---|---|
| Italic Characters (Spaces Ignored) | x y z | |
| Upright Characters | \text{x y z} | |
| Mixed Italic and Upright Text (Poor) | \text{if} n \text{is even} | |
| Mixed Italic and Upright Text (Good) | \text{if } n\text{ is even} | |
Mixed Italic and Upright Text (Alternative: \ Forces a Space) | \text{if}\ n \text{is even} |
Explanatory Text
Use \text{text} to add explanatory text (the text is not interpreted as a mathematical formula and is not italicized). You can still insert formulas inside \text{text} using $formula$.
- Example:
f(n)= \begin{cases}
n/2, & \text{if } n \text{ is even} \\
3n+1, & \text{if }n \text{ is odd}
\end{cases}
Rendered output:
Delimiters
(), [], and | represent the symbols themselves. Use \{ \} to display {}.
| Function | Syntax | Output |
|---|---|---|
| Short Delimiters | \frac{1}{2} | |
| Tall Delimiters | \left(\frac{1}{2} \right) | |
| Round Brackets (Parentheses) | \left( \frac{a}{b} \right) | |
| Square Brackets | \left[ \frac{a}{b} \right] | |
| Curly Braces | \left\{ \frac{a}{b} \right\} | |
| Angle Brackets | \left \langle \frac{a}{b} \right \rangle | |
| Single Vertical Bars (Absolute Value) | \left\vert \frac{a}{b} \right\vert | |
| Double Vertical Bars (Norm) | \left\Vert \frac{a}{b} \right\Vert | |
| Floor Function | \left \lfloor \frac{a}{b} \right \rfloor | |
| Ceiling Function | \left \lceil \frac{c}{d} \right \rceil | |
| Slash and Backslash | \left / \frac{a}{b} \right \backslash | |
| Up and Down Arrows | \left \uparrow \frac{a}{b} \right \downarrow | |
| Double-Line Up and Down Arrows (Automatically Sized Delimiters) | \left \Uparrow \frac{a}{b} \right \Downarrow | |
| Single-Line and Double-Line Bidirectional Vertical Arrows | \left \updownarrow \frac{a}{b} \right \Updownarrow | |
| Mixed Delimiters | \left[ 0,1 \right) | |
| Mixed Delimiters | \left \langle \psi \right | | |
| Overbrace | \overbrace{1+2+\cdots+100} | |
| Overbrace | \begin{matrix} 5050 \\ \overbrace{ 1+2+\cdots+100 } \end{matrix} | |
| Underbrace | \underbrace{a+b+\cdots+z} | |
| Underbrace | \begin{matrix} \underbrace{ a+b+\cdots+z } \\ 26 \end{matrix} |
Use \left and \right to create automatically sized (parentheses), [square brackets], and {braces}. If only one delimiter is needed, use \left. or \right. for the other side.
| Function | Syntax | Output |
|---|---|---|
| Left Delimiter Only | \left\{\frac{a}{b} \right. | |
| Right Delimiter Only | \left. \frac{a}{b} \right\} |
Note:
Use \big, \Big, \bigg, \Bigg to control delimiter sizes, as in the following code
\Bigg ( \bigg [ \Big \langle \big \| \frac{a}{b} \big \| \Big \rangle \bigg ] \Bigg )
Rendered output:
Spacing
KaTeX handles most spacing automatically, but sometimes manual control is needed.
| Function | Syntax | Output | Description |
|---|---|---|---|
| Two Quad Spaces | A\qquad B | Two M-widths | |
| Quad Space | A\quad B | One M-width | |
| Large Space | A\ B | 1/3 M-width | |
| Medium Space | A\;B | 2/7 M-width | |
| Small Space | A\,B | 1/6 M-width | |
| Negative Thin Space | \alpha\!\beta | Minus 1/6 M-width | |
| No Space | \alpha\beta | 0 |
Text Colors in LaTeX
Use \color{color}{text} to change the color of specific text. Text coloring requires browser support; if the browser does not support the specified color, the text is rendered in black.
Colors Supported by Older Browsers
| Input | Output | Input | Output |
|---|---|---|---|
black | grey | ||
silver | white | ||
maroon | red | ||
yellow | lime | ||
olive | green | ||
teal | aqua | ||
blue | navy | ||
purple | fuchsia |
Custom RGB Colors
In newer browsers, you can customize text colors using hexadecimal color values.
Syntax:
\color{#rgb}{text}
Here, r, g, and b each take a value from 0-9 or a-f.
Example:
\begin{array}{|rrrrrrrr|}\hline
\verb+#000+ & \color{#000}{text} & & &
\verb+#00F+ & \color{#00F}{text} & & \\
& & \verb+#0F0+ & \color{#0F0}{text} &
& & \verb+#0FF+ & \color{#0FF}{text}\\
\verb+#F00+ & \color{#F00}{text} & & &
\verb+#F0F+ & \color{#F0F}{text} & & \\
& & \verb+#FF0+ & \color{#FF0}{text} &
& & \verb+#FFF+ & \color{#FFF}{text}\\
\hline
\end{array}
Rendered output:
Example:
\begin{array}{|rrrrrrrr|}
\hline
\verb+#000+ & \color{#000}{text} & \verb+#005+ & \color{#005}{text} & \verb+#00A+ & \color{#00A}{text} & \verb+#00F+ & \color{#00F}{text} \\
\verb+#500+ & \color{#500}{text} & \verb+#505+ & \color{#505}{text} & \verb+#50A+ & \color{#50A}{text} & \verb+#50F+ & \color{#50F}{text} \\
\verb+#A00+ & \color{#A00}{text} & \verb+#A05+ & \color{#A05}{text} & \verb+#A0A+ & \color{#A0A}{text} & \verb+#A0F+ & \color{#A0F}{text} \\
\verb+#F00+ & \color{#F00}{text} & \verb+#F05+ & \color{#F05}{text} & \verb+#F0A+ & \color{#F0A}{text} & \verb+#F0F+ & \color{#F0F}{text} \\
\hline
\verb+#080+ & \color{#080}{text} & \verb+#085+ & \color{#085}{text} & \verb+#08A+ & \color{#08A}{text} & \verb+#08F+ & \color{#08F}{text} \\
\verb+#580+ & \color{#580}{text} & \verb+#585+ & \color{#585}{text} & \verb+#58A+ & \color{#58A}{text} & \verb+#58F+ & \color{#58F}{text} \\
\verb+#A80+ & \color{#A80}{text} & \verb+#A85+ & \color{#A85}{text} & \verb+#A8A+ & \color{#A8A}{text} & \verb+#A8F+ & \color{#A8F}{text} \\
\verb+#F80+ & \color{#F80}{text} & \verb+#F85+ & \color{#F85}{text} & \verb+#F8A+ & \color{#F8A}{text} & \verb+#F8F+ & \color{#F8F}{text} \\
\hline
\verb+#0F0+ & \color{#0F0}{text} & \verb+#0F5+ & \color{#0F5}{text} & \verb+#0FA+ & \color{#0FA}{text} & \verb+#0FF+ & \color{#0FF}{text} \\
\verb+#5F0+ & \color{#5F0}{text} & \verb+#5F5+ & \color{#5F5}{text} & \verb+#5FA+ & \color{#5FA}{text} & \verb+#5FF+ & \color{#5FF}{text} \\
\verb+#AF0+ & \color{#AF0}{text} & \verb+#AF5+ & \color{#AF5}{text} & \verb+#AFA+ & \color{#AFA}{text} & \verb+#AFF+ & \color{#AFF}{text} \\
\verb+#FF0+ & \color{#FF0}{text} & \verb+#FF5+ & \color{#FF5}{text} & \verb+#FFA+ & \color{#FFA}{text} & \verb+#FFF+ & \color{#FFF}{text} \\
\hline
\end{array}
Rendered output:
Supported Color Palette
| Color | Color | Color | Color |
|---|---|---|---|
Note: Color names must begin with an uppercase letter, for example
\color{OliveGreen}{text}.
Examples
{\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1}
x_{\color{Maroon}1,2}=\frac{-b\pm\sqrt{{\color{Maroon}b^2-4ac}}}{2a}