How to use LaTeX (math formulas / math-equations) 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:

  • 1️⃣ LaTeX for Confluence - a standalone LaTeX macro that adds LaTeX formatting to Confluence. Try free for 30 days ➜

  • 2️⃣ Content Formatting Macros for Confluence - a complete macro toolkit that includes LaTeX for Confluence plus other macros such as BibTeX, footnotes, and tooltips. Try free for 30 days ➜

 


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.

 

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

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”.

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

 


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:

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

For example:

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

Creates:


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:



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:

 


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

 

2 comments

Comment

Log in or Sign up to comment
Andrei Stebakov October 4, 2024

Inline formatting is broken in the latest Cloud Confluence. Inline is treated as block.

Nar Kumar C_ - Narva Software
Atlassian Partner
December 9, 2024

FYI there are multiple LaTeX apps on the Marketplace, so it's worth trying them:

LaTeX Marketplace search results

One of the apps is built by my team 👉 LaTeX Math for Confluence - Math Formula & Equations 

 

TAGS
AUG Leaders

Atlassian Community Events