Sign Up

Math

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

Usage

You can use math as inline and block elements in your content.

Inline Math

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

Inline math notation
Some math $$(a - b)^2$$ here.

This will be rendered as:

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

Block Math

For block math (math displayed on its own line), wrap the expression with double dollar signs ($$) and place it on a new line.

Block math notation
$$
(a - b)^2
$$

This will be rendered as:

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

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.

Example

Math block with display mode enabled
$$ display_mode=true
\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}
$$

This will be rendered as:

(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?