The LaTeX macro can be used to convert LaTeX (a document preparation system) mathematical language to HTML. This can be useful for displaying mathematical/scientific equations on a page, or formatting in a certain style. This macro requires some previous knowledge of using LaTeX and LaTeX Mathematics. It may also be useful to review the documentation for MathJax, which enables the conversion between LaTeX and HTML and provides a range of informative examples on using the language.

Instructions

  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 Insert > View More in the Confluence editor.

  5. Select the LaTeX macro in the Select Macro screen.

  6. Customize the appearance of your equations or formulas using the following parameters:

    • Block Equation Alignment: Select the alignment for block equations. Options include Left, Center (default), and Right.

    • Inline Equation Alignment: Select the alignment for inline text or equations. Options include Left (default), Center and Right.

  7. Add the desired text or equations in the Insert Text input area. Multiple formulas or equations can be included inside a single macro, and multiple macros can be included within a page.

  8. Click Insert. A macro placeholder is displayed.

  9. Click Publish to view the macro rendered in the page.

    A rendered Latex macro, with the example configuration.

Edit the macro

To make changes to the macro parameters or text content, click the macro placeholder then click the Edit icon. Make the required changes, then click Save.

Inline vs block formatting

In order to display an inline equation, a single dollar sign must be placed on either side of text within the macro, e.g. $ax^2 + bx + c = 0$.

Block equations must include a double dollar sign on either side of the text to be rendered, e.g.  $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$. See the examples below.

Inline

A rendered Latex macro, with an inline equation.

Block

A rendered Latex macro, with a block equation.

Formatting examples

Matrix and array

You can use an array to format equations similar to the example below.

\begin{array}{lcl}
z & = & a \\
& = & a \\
f(x,y,z) & = & x + y + z
\end{array}
TEXT

A rendered Latex macro, formatted with an array.

A matrix can be applied to arrange formulas in columns with different delimiters such as the centered bracketed matrix below. 

\begin{bmatrix}
\alpha& \beta^{*}\\
\gamma^{*}& \delta
\end{bmatrix}
TEXT

An example Latex macro, formatted to display a matrix.

Color

You can add color to your LaTeX formatting by adding a color parameter, e.g.  $\color{red}{ax^2 + 1 + 55 + bx + c =0}$.

The Edit Latex Macro screen. Example formatting has been added, including color parameters.

The Latex macro, rendered with the configuration and color parameters from above.

Packages

To provide extra functionality for the LaTeX macro, a number of LaTeX packages have been included.

These include Unit, mhChem, and Physics. To apply the required format, simply follow the formatting examples below.

Unit

A rendered Latex macro, using the configuration and Unit package from above.

mhChem

A rendered Latex macro, using the configuration and mhChem package from above.

Physics

A rendered Latex macro, using the configuration and Physics package from above.

Limitations

Due to a Confluence limitation, the Export to PDF functionality does not work with macros that require JavaScript to render on the Confluence page, e.g. LaTex. If you want to preserve your content in PDF format, we recommend that you use your browser’s built-in functionality to print to PDF.