Skip to content

Equation

A math formula component (self-developed simplified LaTeX subset, zero third-party formula engine) covering common high-school / university formulas: superscripts/subscripts, fractions, square roots, summation/integration (with limits), Greek letters, and common operators.

Superscripts and Subscripts

Superscript / subscript

^ superscript, _ subscript; both single characters x^2 and braced forms z_{max} work.

Fractions

Fraction

\frac{numerator}{denominator} renders as a vertical fraction (numerator/denominator stacked with a horizontal line).

Square Roots

Square root

\sqrt{radicand}; an optional root index \sqrt[3]{y} is supported.

Summation / Integration

Summation / integration (with limits)



\sum_{lower}^{upper} / \int_{lower}^{upper} automatically typesets the limits.

Greek Letters and Operators

Greek letters + operators

Greek letters like \alpha and common operators such as \times \div \pm \cdot \leq \geq \neq \approx \infty are mapped automatically.

Unknown Commands

Unknown commands shown literally

Unknown commands are displayed literally without errors.

API

Attributes

AttributeDescriptionTypeDefault
codeLaTeX subset source textstring

ARIA

The container's aria-label equals the raw LaTeX source text, so screen readers read the formula source directly.

Engine Choice (Architecture Decision)

Self-developed simplified LaTeX subset, no third-party formula engine:

  1. Zero-dependency core selling point: zero third-party runtime dependencies; the in-house parser (tokenizer + recursive descent) introduces no dependencies.
  2. The subset covers common scenarios: superscripts/subscripts, fractions, square roots (with root index), summation/integration/product (with limits), Greek letters, common operators — covering common high-school / university formulas; full LaTeX (matrices, large operators, multi-line alignment, etc.) is a future enhancement to be re-evaluated.
  3. Unknown command tolerance: unknown commands are shown literally without errors, following the same strategy as "unknown language renders as plain text".
  4. Rendered as HTML (stacked spans + CSS layout) using only library tokens, inheriting font size / theme.

Boundaries

  • All text is HTML-escaped to prevent injection
  • Empty code renders an empty container without errors