Math Formulas

Tydora supports KaTeX and MathJax, two math formula rendering engines, allowing you to write LaTeX formulas in both inline and block positions.

Note

Formula rendering is enabled by default. If not needed, you can disable it in 07-Settings/02-Editor-Settings, or switch between KaTeX and MathJax engines.

Inline Formulas

Wrap with a single dollar sign $ ... $:

The mass-energy equation $E=mc^2$ is fundamental to physics.

Display effect: The mass-energy equation $E=mc^2$ is fundamental to physics.

Block Formulas

Wrap with double dollar signs $$ ... $$; the formula will occupy its own line and be centered:

$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$

Common Syntax

Superscripts and Subscripts

$x^2$        → Superscript
$H_2O$       → Subscript
$x_i^{2n}$   → Combined superscript and subscript

Fractions

$\frac{a}{b}$

Square Roots

$\sqrt{x}$       → Square root
$\sqrt[n]{x}$    → nth root

Summation, Integration, and Product

$\sum_{i=1}^{n}$   → Summation
$\int_{a}^{b}$     → Integration
$\prod_{i=1}^{n}$  → Product

Greek Letters

$\alpha$ $\beta$ $\gamma$ $\delta$
$\pi$ $\sigma$ $\omega$ $\theta$

Matrices

$$
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
$$

Multi-line Alignment

$$
\begin{aligned}
a &= b + c \\
  &= d + e
\end{aligned}
$$

Engine Switching

You can switch the rendering engine in the "Math Formulas" option of 07-Settings/02-Editor-Settings:

  • KaTeX — Fast rendering speed, good syntax compatibility, recommended for daily writing
  • MathJax — More comprehensive functionality, supports more extended LaTeX syntax
Tip

Most common formulas render correctly with both engines. If a complex formula errors under KaTeX, try switching to MathJax.