Skip to main content
On this page

Math & LaTeX

Pagesmith supports mathematical notation through remark-math and rehype-mathjax. Write equations using standard LaTeX syntax and Pagesmith renders them to accessible SVG output. Use $...$ for inline math and $$...$$ for display math.

Inline Math

Inline math flows naturally within text. The $ delimiters must not have spaces immediately inside them.

The equation describes mass-energy equivalence.

The sum of the first natural numbers is .

A circle with radius has area and circumference .

In probability, the expected value of a discrete random variable is .

The Pythagorean theorem states that for a right triangle with legs and and hypotenuse .

Display Math

Display math is centered on its own line, which is useful for important equations or more complex expressions.

Quadratic formula

The solutions to are given by:

Definite integral

The Gaussian integral is one of the most useful results in calculus and probability theory:

Matrix notation

A 2x2 rotation matrix for angle :

Taylor series

The Taylor expansion of around :

Euler’s identity

Often called the most beautiful equation in mathematics:

This connects five fundamental constants: , , , , and .

Bayes’ theorem

The foundation of Bayesian inference:

where is the posterior probability, is the likelihood, is the prior, and is the marginal likelihood.

Mixing Text and Math

Mathematical expressions work naturally alongside prose, tables, links, and the rest of your Markdown content.

The standard deviation of a dataset is , where is the mean and is the number of observations.

Given a function , we can find its roots by factoring:

so the roots are , , and .

Big-O notation in context

Algorithm complexity is commonly expressed using Big-O notation. Binary search runs in time, while a naive sort might take . Merge sort guarantees regardless of input.

Algorithm Best case Average case Worst case
Binary search
Quicksort
Merge sort

Maxwell’s equations

The four equations that describe classical electromagnetism:

These equations unify electricity, magnetism, and light into a single theoretical framework.