Open in TheBrain

Math Expressions

Overview

TheBrain supports rendering mathematical expressions in notes using LaTeX syntax powered by MathJax. Type standard LaTeX math notation and it renders as beautifully formatted equations — fractions, integrals, matrices, chemical formulas, and more.

For a comprehensive reference of all supported commands, see the MathJax TeX command reference.

The note of Profitability under the heading How We Measure It: a formula for contribution margin, with a fraction, on a line of its own, and below it a sentence with the inline expression R = F/h and the letters F and h in math type. Labels point at the expression on its own line and at the math inside the sentence

How to Insert a Math Expression

  1. In the notes editor, choose Insert Mathematical Expression from the toolbar's Insert menu or from the right-click menu's Insert submenu, or type $$.
  2. Type your LaTeX expression in the input field, or pick a starting point from the Template… menu — seven ready-made expressions (Quadratic formula, Infinite series, Integral, Limit, Matrix, Piecewise function, Euler's identity). Picking a template over an expression you've written asks before replacing it. A live preview above the input field shows the result as you type.
  3. Click Save, or press Ctrl+Enter (⌘Enter on Mac) — the Save button shows the shortcut. The expression renders inline with your text.

The math editor open over the note: the rendered formula at the top, the LaTeX source below it, then the Template menu, the Reset button, a help button and MathJax v4.1.3, and Cancel and Save. Labels point at the preview, the LaTeX source, and the Template menu with the Reset button

Pressing Enter on its own does not save. The input field holds several lines, so Enter and Shift+Enter (⇧Enter on Mac) both start a new line in the LaTeX source. Clicking outside the math editor saves, the same as Save. To close the math editor without keeping your changes, click Cancel, or press Esc while the cursor is in the input field.

A Reset button returns the expression to how it was when the editor opened (it asks first). On phones the math editor fills the screen and makes room for the on-screen keyboard.

How to Edit or Delete a Math Expression

Clicking an expression once does not open the math editor. The first click only selects the expression, and it gets a dashed outline. You can also select it by moving onto it with the arrow keys.

Inline vs. Display Math

Basic Syntax

What you typeWhat renders
x^2 + y^2 = z^2Pythagorean theorem
\frac{a}{b}Fraction
\sqrt{x}Square root
\sum_{n=1}^{\infty} \frac{1}{n^2}Summation
\int_0^\infty e^{-x} dxIntegral
\alpha, \beta, \gamma, \thetaGreek letters
\leq, \geq, \neq, \approxComparison operators
\mathbb{R}, \mathcal{L}, \mathfrak{g}Special fonts

Multi-line Expressions

Use \\ to break an expression across multiple lines. Each line is automatically centered:

a = b + c \\
d = e + f

A new line in the math editor's source is only for readability: as in standard LaTeX, it is treated as whitespace. To produce a visible line break in the rendered output, type \\ (either on its own line or inline). For alignment, use a standard environment like aligned, cases, or a matrix environment, and \\ separates rows the usual way.

Available Extensions

TheBrain includes the full set of MathJax TeX extensions. Most work automatically — just use their commands. Here are some commonly used ones:

Chemistry (mhchem)

Write chemical formulas and reactions with \ce{}:

ExpressionDescription
\ce{H2O}Water
\ce{CO2 + C -> 2CO}Reaction
\ce{2H2 + O2 ->[\text{heat}] 2H2O}Reaction with conditions
\ce{Hg^2+ ->[I-] HgI2}Ionic reaction
\ce{^{227}_{90}Th+}Isotope notation

Cancel

Strike through parts of an expression to show cancellation:

ExpressionDescription
\cancel{x}Forward slash
\bcancel{x}Backward slash
\xcancel{x}X-shaped

Enclose

Draw shapes around expressions:

ExpressionDescription
\enclose{circle}{x}Circle
\enclose{box}{x + y}Box

Color

ExpressionDescription
\color{red}{x^2}Colored text
\bbox[yellow, 5px]{E = mc^2}Background color with padding

Braket (Dirac Notation)

ExpressionDescription
\ket{\psi}Ket
\bra{\phi}Bra

For an inner product, separate the two with a bar: \braket{\phi|\psi}.

Other Extensions

These also work automatically:

Physics Extension

The physics extension provides shorthand notation for vectors, derivatives, and other physics operations. Because it redefines common commands like \sin and \cos, it is not loaded automatically, as in MathJax itself — you must opt in.

Add \require{physics} at the beginning of your expression to enable it:

ExpressionDescription
\require{physics} \va{a}Vector arrow
\require{physics} \vu{x}Unit vector
\require{physics} \dv{f}{x}Derivative
\require{physics} \pdv{f}{x}{y}Partial derivative
\require{physics} \abs{x}Absolute value
\require{physics} \norm{x}Norm

You only need \require{physics} once per expression.

Matrices

Use standard LaTeX matrix environments:

\begin{pmatrix} a & b \\ c & d \end{pmatrix}

Available matrix styles: pmatrix (parentheses), bmatrix (brackets), vmatrix (vertical bars), Bmatrix (braces), matrix (no delimiters).

  • Math expressions are stored as LaTeX source text, so they remain editable and searchable.
  • If an expression doesn't render, check for typos in the LaTeX syntax — MathJax flags the expression instead of rendering it when it hits an error.

Related Topics