Folioby Interconnected
Log InSign Up

Writing Math — Every Notation Available in KaTeX

A comprehensive guide to Folio's math environments. Covers inline math, equation, align, gather, cases, matrix, and \newcommand — every KaTeX-based math notation explained.

FO
Folio Official
March 3, 2026

1. Inline and Display Math

1.1. Inline Math

To embed math within text, enclose it in $...$:

The function $f(x) = x^2 + 1$ is always positive.

Result: The function f(x)=x2+1 is always positive.

1.2. Display Math

To display math on its own line, use $$...$$:

$$\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$

Result:

∫0∞​e−x2dx=2π​​

2. Numbered Equation Environments

2.1. equation Environment

Assigns a number to a single equation:

\begin{equation}
e^{i\pi} + 1 = 0
\end{equation}

Result:

eiπ+1=0
(1)

To suppress the number, use equation*:

\begin{equation*}
\sum_{k=0}^{n} \binom{n}{k} = 2^n
\end{equation*}

Result:

k=0∑n​(kn​)=2n

2.2. align Environment

Displays multiple equations with alignment. Use & to mark alignment points and \\ for line breaks:

\begin{align}
(a + b)^2 &= a^2 + 2ab + b^2 \\
(a - b)^2 &= a^2 - 2ab + b^2 \\
(a + b)(a - b) &= a^2 - b^2
\end{align}

Result:

(a+b)2(a−b)2(a+b)(a−b)​=a2+2ab+b2=a2−2ab+b2=a2−b2​(2)(3)(4)​

2.3. gather Environment

Lists equations centered without alignment:

\begin{gather}
x^2 + y^2 = r^2 \\
x = r \cos\theta \\
y = r \sin\theta
\end{gather}

Result:

x2+y2=r2x=rcosθy=rsinθ​(5)(6)(7)​

2.4. multline Environment

Splits a long equation across multiple lines. The first line is left-aligned and the last line is right-aligned:

\begin{multline}
(x_1 + x_2 + x_3 + x_4 + x_5)^2 \\
= x_1^2 + x_2^2 + ... + x_5^2 \\
\quad + 2(x_1 x_2 + x_1 x_3 + ...)
\end{multline}

Result:

(x1​+x2​+x3​+x4​+x5​)2=x12​+x22​+x32​+x42​+x52​+2(x1​x2​+x1​x3​+x1​x4​+x1​x5​+x2​x3​+x2​x4​+x2​x5​+x3​x4​+x3​x5​+x4​x5​)​
(8)

3. Piecewise Definitions and Matrices

3.1. cases Environment

Write piecewise definitions:

$$
|x| = \begin{cases}
x & \text{if } x \geq 0 \\
-x & \text{if } x < 0
\end{cases}
$$

Result:

∣x∣={x−x​if x≥0if x<0​

Another example (the Fibonacci sequence):

$$
f(n) = \begin{cases}
1 & n = 0 \\
1 & n = 1 \\
f(n-1) + f(n-2) & n \geq 2
\end{cases}
$$

Result:

f(n)=⎩⎨⎧​11f(n−1)+f(n−2)​n=0n=1n≥2​

3.2. Matrix Environments

Choose the environment based on the bracket style:

Environment Brackets
matrix None
pmatrix Parentheses ()
bmatrix Square brackets []
Bmatrix Curly braces {}
vmatrix Vertical bars ∣∣
Vmatrix Double bars ∥∥
$$
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \quad
\det A = \begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix} = -2
$$

Result:

Example 1 (Matrix Notation).
A=(13​24​),detA=​13​24​​=−2

Use smallmatrix for inline matrices:

The matrix $\left(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\right)$ like so.

Result: The matrix (ac​bd​) like so.

4. Math Symbols and Commands

4.1. Greek Letters

α,β,γ,δ,ϵ,ε,ζ,η,θ,ϑ,ι,κ,λ,μ,ν,ξ,π,ρ,σ,τ,υ,ϕ,φ,χ,ψ,ω

Uppercase: Γ,Δ,Θ,Λ,Ξ,Π,Σ,Φ,Ψ,Ω

4.2. Operators and Relations

+,−,×,÷,±,∓,⋅,∘,⊕,⊗

=,=,<,>,≤,≥,≈,≡,∼,≃,≅,∝

⊂,⊃,⊆,⊇,∈,∈/,∋,∪,∩,∖,∅

∀,∃,∄,¬,∧,∨,⇒,⇐,⇔,⟹

4.3. Big Operators

k=1∑n​ak​,i=1∏n​xi​,∫ab​f(x)dx,∮C​F⋅dr,∬D​fdA

4.4. Superscripts, Subscripts, and Decorations

a^,xˉ,v,x˙,x¨,n~,AB,PQ​,3 termsa+b+c​​,x+y​2 terms​

4.5. Fractions and Roots

ba​,∂x∂f​,2​,38​=2

4.6. Delimiter Sizing

\left and \right auto-size delimiters:

(ba​),[k=0∑n​ak​],{x∈R∣x>0}

4.7. Math Fonts

R,Z,Q,C,N(Blackboard bold \mathbb)
A,F,L,O(Calligraphic \mathcal)
g,h,sl,p(Fraktur \mathfrak)
v,F,0(Bold \mathbf)
Hom,End,Aut(Roman \mathrm)

5. Custom Commands

You can define custom commands with \newcommand. Writing them at the top of an article makes them available within that article, but registering them in the Settings preamble editor makes them available across all articles automatically.

\newcommand{\R}{\mathbb{R}}
\newcommand{\norm}[1]{\left\| #1 \right\|}
\newcommand{\inner}[2]{\left\langle #1, #2 \right\rangle}

With the above definitions, \R expands to R, \norm{v} to ∥v∥, and \inner{u}{v} to ⟨u,v⟩.

\DeclareMathOperator can be used to define math operators:

\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\rank}{rank}

This gives proper spacing: tr(AB)=tr(BA), rank(A)≤min(m,n).

6. Summary

On Folio, standard LaTeX math syntax works almost exactly as expected. All commands and environments supported by KaTeX are available. Next, we'll look at theorem environments in detail.

LaTeXFolioTutorialMathKaTeXalign
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Folio BasicsPart 3 of 8
Previous
Folio LaTeX Basics — Differences from Standard LaTeX and Getting Started
Next
Mastering Theorem Environments — theorem, definition, proof, and Friends

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 3, 2026

Mastering Theorem Environments — theorem, definition, proof, and Friends

A complete guide to Folio's 18+ built-in theorem environments. Covers theorem, definition, proof, lemma, corollary, example, remark, and more — usage, numbering, named arguments, and italic/roman styles explained.

LaTeXFolioTutorial
1
Folio Official·March 3, 2026

Diagrams and Tables — mermaid, tikzgraph, tikzcd, tabular

A complete guide to diagrams and tables on Folio. Covers mermaid flowcharts and sequence diagrams, tikzgraph for graph drawing, tikzcd for commutative diagrams, tabular for tables, figure/table environments, and includegraphics.

LaTeXFolioTutorial
Folio Official·March 3, 2026

Folio LaTeX Reference: A Complete Guide to Commands, Environments, and Syntax

A single-page overview of Folio's LaTeX syntax. A quick reference covering text formatting, math, theorem environments, code blocks, diagrams, and cross-references, with support status shown as ✅⚠️❌.

LaTeXFolioTutorial
Folio Official·March 3, 2026

Folio LaTeX Basics — Differences from Standard LaTeX and Getting Started

A LaTeX introduction for writing articles on Folio. Covers the preamble-free system, section structure, text formatting, special character escaping, and a list of unsupported features, focusing on differences from standard LaTeX.

LaTeXFolioTutorial