Sign Up

Math

Doctave supports mathematical equations via KaTeX to enable rendering mathematical expressions in your documentation.

Visit the KaTeX documentation for a list of supported functions and symbols.

lambda=1n∑i=1n(xi−xˉ)2lambda = \frac{1}{n} \sum_{i=1}^n \left( x_i - \bar{x} \right)^2

Doctave does not validate the syntax of your mathematical expressions.

Inline syntax

To render inline math, wrap your mathematical expression with double dollar signs ($$). This renders the math expression within the flow of the text.

Some math (a−b)2(a - b)^2 here.

Block syntax

If you want to display a mathematical expression on its own line, wrap the expression with double dollar signs ($$) and place it on a new line.

Here is some math:

(a−b)2(a - b)^2

What was some math!

Attributes

You can customize the math notation using the following attributes.

Display Mode

Display mode is used for more complex equations that require additional formatting, such as alignment. To enable display mode, set the display_mode parameter to true.

(a−b)2=(a−b)(a−b)=a(a−b)−b(a−b)=a2−ab−ba+b2=a2−2ab+b2\begin{equation} \begin{split} (a - b)^2 &= (a - b)(a - b) \\ &= a(a - b) - b(a - b) \\ &= a^2 - ab - ba + b^2 \\ &= a^2 - 2ab + b^2 \nonumber \end{split} \end{equation}

Was this page helpful?