The Adaptavist Group LogoDocumentation

Use the LaTeX macro

The LaTeX Builder macro enables users to add mathematical equations and formulas to Confluence pages using LaTeX syntax. It includes a code-style editor with live preview, allowing equations to be written and rendered in real time.

This macro requires some previous knowledge of using LaTeX and LaTeX Mathematics. It may also be helpful to review the documentation for MathJax, which enables the conversion between LaTeX and HTML and provides a range of informative examples of using the language.

Add a Latex Builder macro to a page

  1. Navigate to the page you would like to edit.
  2. Click the Edit icon in the top-right of the page.
  3. Click the position where you want to insert LaTeX content.
  4. Select InsertView More in the Confluence editor.
  5. Select the LaTeX Builder macro in the Select Macro screen.
  6. Add the desired text or equations in the input area.

    Multiple formulas or equations can be included inside a single macro, and multiple macros can be included within a page.

    Formulas and equations should be enclosed in delimiters to ensure they are rendered correctly. This can be done using the editor buttons or manually.

  7. Click Save.

Editor Formatting Options

You can identify formulas and equations using the editor buttons. These options also let you control how the content is displayed.

  1. Highlight the formula or equation in the editor.
  2. Select the editor button to match how you want to display your content:
    • - inline
    • - left aligned block
    • - centre aligned block
    • - right aligned block

Manual Formatting Options

Inline vs. block formatting

To display an inline equation enter the text you want the equation to be inline with inside the macro. Place a single dollar sign on either side of the equation to identify the equation. e.g.
$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $ 
Centred block equations must include a double dollar sign on either side of the text to be rendered, e.g.
$$ 
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} 
$$

Left or right aligned blocks can be achieved by using flalign*.

For left aligned use flalign* with two &s placed after the equation. eg.
\begin{flalign*}
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} &&
\end{flalign*}
For right aligned use flalign* with the equation placed after two &s eg.
\begin{flalign*}
&& x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\end{flalign*}

Array

You can use an array to format equations similar to the example below.
This is an array:
\begin{array}{lcl}
z & = & a \\
& = & a \\
f(x,y,z) & = & x + y + z
\end{array}

Matrix

A matrix can be applied to arrange formulas in columns with different delimiters such as the centered bracketed matrix below.
$$
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
$$

Color

You can add color to your LaTeX formatting by adding a color command.
$$
{\color{red}x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}
$$

Error Handling and Smart Suggestions

LaTeX builder provides live feedback as you work, including syntax validation, error highlighting and intelligent command suggestions.

Syntax Error Detection

As you type LaTeX Builder validates your content and highlight potential syntax errors.

  • Missing or unmatched brackets/braces

  • Unclosed environments

Smart Suggestions

As soon as you start typing a LaTeX command, the autocompleter displays matching suggestions based on your input. Once selected, the full command is inserted with any required parameters and closing syntax.

Search documentation

Start typing to search the docs.