$E = mc^2$
$$
\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$Scientific research, engineering specifications, machine learning documentation, and financial modeling require clear mathematical typesetting.
While standard CommonMark does not include mathematical equations, modern knowledge management tools like Oyma and Obsidian, alongside GitHub Flavored Markdown (GFM), support LaTeX-based math syntax rendered via KaTeX.
KaTeX transforms plain-text mathematical code into crisp, publication-quality mathematical typography directly in your notes.
Inline math syntax: $equation$
To insert a mathematical equation directly inside a sentence, enclose the LaTeX expression in single dollar signs ($):
Euler's identity, $e^{i\pi} + 1 = 0$, connects five fundamental mathematical constants.
The relationship between energy and mass is given by $E = mc^2$.
In the rendered view, the equation sits smoothly on the typographic baseline of the surrounding prose.
Rules for inline math delimiters
- No leading or trailing spaces: The dollar signs must directly touch the LaTeX expression (
$x + y = z$, not$ x + y = z $). - Same-line constraint: Inline math expressions cannot span across multiple lines.
Display math blocks: $$equation$$
For complex equations, fractions, integrals, summations, and multi-line derivations, use display math blocks enclosed between double dollar signs ($$):
$$
\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
Display math blocks render centered on their own dedicated lines with expanded vertical spacing and larger mathematical glyphs.
Common mathematical notation examples
KaTeX supports an extensive library of mathematical symbols, operators, and functions:
Fractions and square roots
$$
\frac{a + b}{c + d} \quad \sqrt[n]{x_1 + x_2}
$$
Summations and integrals
$$
\sum_{i=1}^{n} i = \frac{n(n + 1)}{2}
$$
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$
Greek letters and mathematical symbols
$$
\alpha, \beta, \gamma, \delta, \epsilon, \theta, \lambda, \mu, \pi, \sigma, \omega
$$
$$
\forall x \in \mathbb{R}, \quad \exists y \text{ such that } x < y
$$
Matrices and linear algebra
Display math easily handles matrix transformations:
$$
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
z
\end{bmatrix}
=
\begin{bmatrix}
x \\
y \\
z
\end{bmatrix}
$$
Multi-line derivations with aligned
To align steps of a derivation by the equal sign, use the aligned environment with ampersands (&):
$$
\begin{aligned}
(x + y)^2 &= (x + y)(x + y) \\
&= x^2 + xy + yx + y^2 \\
&= x^2 + 2xy + y^2
\end{aligned}
$$
Escaping literal dollar signs
When writing about financial figures or prices, you must avoid accidentally triggering math mode. Escape dollar signs with a backslash:
The server costs \$45 per month, and total budget is \$500.
Escaped dollar signs render as normal currency symbols without activating KaTeX.
Math rendering in Oyma on macOS
In Oyma:
- Mathematical expressions render in real time with hardware-accelerated KaTeX.
- Live preview displays the rendered equation, seamlessly revealing the underlying LaTeX syntax when your cursor moves into the block for fast editing.
- Formulas export cleanly to PDF, HTML, and Word formats.
- All notes remain 100% portable plain-text Markdown files on your local Mac disk.
Frequently asked questions
- What is the syntax for inline math vs display math in Markdown?
- Inline math is enclosed within single dollar signs (`$E = mc^2$`) and renders inline with the surrounding paragraph. Display math is enclosed within double dollar signs (`$$\int_0^\infty f(x)dx$$`) on dedicated lines, rendering centered on its own line.
- What rendering engine does Oyma use for math equations?
- Oyma uses KaTeX, the fast math typesetting library developed by Khan Academy. KaTeX renders complex LaTeX formulas instantaneously without layout shift or external network dependencies.
- How do I type a literal dollar sign in a document without triggering math mode?
- To output a literal dollar sign in Markdown, escape it with a preceding backslash (`\$100`). This ensures the dollar sign displays normally without entering math mode.
- Can I use LaTeX environments like matrices and aligned equations in Markdown?
- Yes. KaTeX supports standard LaTeX environments within display math blocks, including `\begin{matrix}`, `\begin{pmatrix}`, `\begin{bmatrix}`, and `\begin{aligned}`.
Experience Math & LaTeX (KaTeX) with zero lock-in.
Write Obsidian Flavored Markdown notes directly on your Mac with native live preview and sovereign local storage.