How to easily use LaTeX in Confluence Cloud

Confluence_LaTeX_transparent.png

In Confluence, integrating complex formulas can be a challenge. Enter LaTeX - a simple solution for adding technical content to your pages. Here’s how to get started with LaTeX in Confluence Cloud.

📝 Note: You’ll need some previous knowledge of LaTeX. Confluence also requires a macro to convert LaTeX to HTML using MathJax. Read the MathJax documentation to learn how it works.

What is LaTeX?

LaTeX is software that’s used for formatting complex equations and formulas, and is often used in academic, scientific, and mathematical documentation.

Users input commands that determine the structure of the text. These commands start with a backslash and a keyword. For example, you would use “\title{This is my title}” to create a title.

How to use LaTeX in Confluence

To get started with LaTeX in Confluence, you’ll need the help of a third-party app from the Atlassian Marketplace.

In this article, we’ll look at two types of apps you can use: ones that only provide LaTeX formatting and ones that include a suite of other Confluence macros to add style, structure, and context. Here are two examples:


Choose the right app for your needs, then head back here to follow the rest of the guide.

1. On your Confluence page, click the pencil icon in the top-right to edit the page.

 Latex_1.png2. Type “/latex” where you’d like to add your macro, then select it from the dropdown menu.

Latex_2.png

3. In the pop-up dialog, add your LaTeX equation to the “Content” section. Choose its block and inline equation alignment (left, right, center), and press “Save”.

Latex_3.png

4. Click “Publish” or “Update” to view your LaTeX formula on the page. Latex_4.png


LaTeX cheat sheet: How to format equations


Format inline (on the same line as other text): A single dollar sign ($) on each side of the text

For example:

$ax^2 + bx + c = 0$


Display as block (separate from other text): Two dollar signs ($$) on each side of the text 

For example:

$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$

Here you can see the difference, with inline formatting on the same line as the text, but with block formatting on another line:

Latex_5.png

Add colour: Add “\color{your_color}” to the beginning of your formula.

For example:

$\color{red}{ax^2 + 1 + 55 + bx + c =0}$

Creates:

Latex_6.png

Format as a matrix (display numbers/symbols in rows and columns within square brackets): 

  • Use \begin{matrix} at the beginning of the matrix
  • Add an ampersand (&) to add an extra column to your row
  • Add two forward slashes (\\) at the end of your row to add a new row
  • Use \end{bmatrix} at the end

For example:


\begin{bmatrix}

\alpha& \beta^{*}\\

\gamma^{*}& \delta

\end{bmatrix}

Creates:

Latex_7.png

Format as an array (format equations in a table with each column independently aligned):

  • Use \begin{array}{lcl} at the beginning of the array
  • Add an ampersand (&) to skip/move to the next column in your table
  • Add two forward slashes (\\) at the end of your row to add a new row
  • Use \end{array} at the end

For example:

\begin{array}{lcl}

z & = & a \\

& = & a \\

f(x,y,z) & = & x + y + z

\end{array}

Creates:

 Latex_8.png

What formatting tips do you have for academic and scientific content in Confluence? Share with us below! 👇

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events