---
Title: Formulas & Equations
Project: MD Visor Examples
---

# Formulas & Equations

MD Visor renders LaTeX formulas natively (no browser involved) - inline with `$...$`, or as their own
centered block with `$$...$$`. This document shows what actually renders correctly today, including
three LaTeX commands that don't work directly but have a simple substitute.

## Inline and block

Inline: the filter's cutoff is $f_c = \frac{1}{2\pi RC}$, right in the middle of a sentence.

Block:

$$
f_c = \frac{1}{2\pi RC}
$$

## Fractions, exponents, subscripts, roots

$$\frac{a+b}{c-d} \;\;\; x^{10} \;\;\; x_{i,j} \;\;\; \sqrt{x} \;\;\; \sqrt[3]{x}$$

Multi-character exponents/subscripts need braces - `x^{10}`, not `x^10`.

## Greek letters and accents

$$\alpha \; \beta \; \gamma \; \delta \; \theta \; \lambda \; \mu \; \sigma \; \omega \; \Delta \; \Sigma \; \Omega$$

$$\hat{x} \;\;\; \bar{x} \;\;\; \dot{x} \;\;\; \vec{x} \;\;\; \tilde{x}$$

## Sums, products, integrals

$$\sum_{i=1}^{n} x_i \;\;\; \prod_{i=1}^{n} x_i \;\;\; \int_a^b f(x)\,dx$$

## Binomial coefficients

$$\binom{n}{k}$$

(The older `{n \choose k}` syntax doesn't work - use `\binom{n}{k}`.)

## Piecewise functions

Write a piecewise function the normal way, with LaTeX2e's `cases` environment - rows separated by
`\\`, condition and value within a row by `&`:

$$
f(x) = \begin{cases}
x^2 & x < 0 \\
0 & x = 0 \\
\sqrt{x} & x > 0
\end{cases}
$$

Under the hood MD Visor rewrites `\begin{cases}...\end{cases}` into the older macro syntax its LaTeX
renderer actually understands - you don't need to know that, just write `cases` the way you normally
would.

## Common formulas (quick reference)

$$a^2 + b^2 = c^2$$

$$E = mc^2$$

$$\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i$$

$$\frac{d}{dx}f(g(x)) = f'(g(x)) \cdot g'(x)$$

$$e^{ix} = \cos(x) + i\sin(x)$$

## A few commands that need a substitute

Three real LaTeX commands don't render directly - each has a substitute that does:

| Instead of... | ...use | Example |
| :--- | :--- | :--- |
| `\mathbb{R}` (blackboard bold) | `\mathcal{R}` | $l \in \mathcal{R}^{\vert{}V\vert{}}$ |
| `\mathbf{1}` (bold) | `\mathrm{1}` | $\vert{}x\vert{}_G = \sum_{t=1}^N \mathrm{1}_{x_t \in G_t}$ |
| `\dots` | `\ldots` or `\cdots` | $x_1, \ldots, x_N$ |

If a formula shows up as plain **red text** (the literal `$...$`/`$$...$$` you typed) instead of
rendering, the syntax wasn't understood - check it against this list before assuming it's a typo.
Matrices and environments other than `cases` (`pmatrix`, `bmatrix`, `matrix`, `array`, `aligned`,
`gathered`, ...) aren't supported at all - an ordinary Markdown table is usually clearer in a
technical document anyway.
