# Usage

Two types of LaTeX content

This app supports two types of LaTeX content. Simple content such as `e = mc^2` will be rendered by MathJax engine, and more complex content that uses packages such as `tikz` or `chemfig` will be rendered by TeX Live engine.

## Insert macros

In the article editor, click the **Insert** button, and select **View more** from the list.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2F7RAWNkYbGdf5LNLPioOt%2Fimage.png?alt=media&#x26;token=3c7413c6-4a34-4da6-8df2-2e022d91a60f" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

In the **Select macro** dialog, search for "**latex"**.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FLUzakoVVMm45IFqzM3x6%2Fimage.png?alt=media&#x26;token=8e6fe5f8-165d-40a3-b124-0252aec79b36" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

Alternatively, type **/ (slash)** and select the LaTeX macros.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FuoVCFaqD2oFjJcJvRkdj%2Fimage.png?alt=media&#x26;token=bd729091-d852-4448-bf9e-7d64158d0e32" alt=""><figcaption><p>LaTeX for Cònluence</p></figcaption></figure>

## Insert simple LaTeX content (MathJax engine)

To insert simple LaTeX content please use the following macros:

* **Render LaTeX content inline**
* **Render LaTeX content as block**

These macros use MathJax engine to render content. The content is as simple as `e=mc2` and does not require LaTeX preambles.

The editor dialog allow users to type the LaTeX content and preview the result instantly. Errors will be highlighted in red color.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FzZn2nwCRK7HVsSf7WhAW%2Fimage.png?alt=media&#x26;token=0dc0b03e-ef5d-49d9-81ab-ee480ef124d0" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

You can open the **Math Keyboard** by clicking on the keyboard icon in the right-hand corner of the Math Editor preview area. For block content, you can also specify the alignment as left, right, center. To close the editor, click **Apply** or **Cancel** button in the top right corner.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2F7ZtPP6385ikxQAEsoauS%2Fimage.png?alt=media&#x26;token=27810d38-fe63-4d9f-86d5-e8eba0f62925" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

Click **Save** to apply the macro. Then click **Publish** to save the article.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FsbvnYbt0JT4V3m6CeFCI%2Fimage.png?alt=media&#x26;token=afc2edde-ab3b-4c07-8248-ac3f56dac0fb" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

The article with LaTeX content will then be rendered.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FL48hj5EjnySlde1cpbe0%2Fimage.png?alt=media&#x26;token=37521f4a-e0c5-4e24-8822-eebe342f6954" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

## Insert complex LaTeX content (TeX Live engine)

Sometimes you need to render complex LaTeX content such as the following one

```latex
\documentclass{article}
\pagestyle{empty}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3[
    surf,
]
{exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}
\end{document}
```

which will be rendered as

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FIQUcAcoZ0yPQ1SguAfWd%2Fimage.png?alt=media&#x26;token=8a16f04a-efe8-4f10-9911-e25f07aed9e9" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

In this case, please make use of the following macros:

* **(Advanced) Render complex LaTeX content inline using TeX Live engine**
* **(Advanced) Render complex LaTeX content as block using TeX Live engine**

The editor dialog allow users to type the LaTeX content and preview the result instantly. Errors will be highlighted in red color. For block content, you can also specify the alignment as left, right, center.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FXfzpwBzR20PJodM9QwE4%2Fimage.png?alt=media&#x26;token=228b6931-22d2-45f2-b241-129ac4cc3305" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

Please make sure that the following preample is used since it will exclude page headers, footers, and numbers from the output:

```latex
\documentclass{article}
\pagestyle{empty}
...
\begin{document}
...
\end{document}
```

The following sections will show you some examples.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FQEjK56kVtAKIsjfxSrQN%2Fimage.png?alt=media&#x26;token=396d58fd-57ae-4e07-95a9-229412984384" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

### 3d plots

```latex
\documentclass{article}
\pagestyle{empty}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3[
    surf,
]
{exp(-x^2-y^2)*x};
\end{axis}
\end{tikzpicture}
\end{document}
```

### Chemistry formulae

```latex
\documentclass{article}
\pagestyle{empty}
\usepackage{chemfig}
\begin{document}
\chemfig{A*5(-B=C-D-E=)}
\end{document}
```

### Figures

```latex
\documentclass{article}
\pagestyle{empty}
\usepackage[pdftex]{pict2e}
\usepackage[dvipsnames]{xcolor}
\begin{document}
\setlength{\unitlength}{1cm}
\setlength{\fboxsep}{0pt}
\fbox{%
\begin{picture}(3,3)
\put(0,0){{\color{blue}\circle*{0.25}}\hbox{\kern3pt \texttt{(0,0)}}}
\put(3,3){{\color{red}\circle*{0.25}}\hbox{\kern3pt \texttt{(3,3)}}}
\end{picture}}
\end{document}
```

```latex
\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (-2,0) -- (2,0);
\filldraw [gray] (0,0) circle (2pt);
\draw (-2,-2) .. controls (0,0) .. (2,-2);
\draw (-2,2) .. controls (-1,0) and (1,0) .. (2,2);
\end{tikzpicture}
\end{document}
```

## Refer to a LaTeX content

You can refer to existing LaTeX content. Below are the instructions.

Provide a reference name for the LaTeX content.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FAVK054Zcq5bYSu7APZxF%2Fimage.png?alt=media&#x26;token=6cba70fa-11a2-43ca-bcb3-38ba4e300f99" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

In edit mode, the number will be shown as **(TBD)**.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FrHRS7j9YzdB39LspulKW%2Fimage.png?alt=media&#x26;token=a5ef7815-0e9c-4dbc-a194-da537376cc77" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

Insert the **Render LaTeX Reference** macro.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FxSa5JBhqqbLAWhlFsdmh%2Fimage.png?alt=media&#x26;token=25c2edf8-6715-4ef2-a2cb-ea1cd6f6bf28" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FlwS3P1yyFDhjAfHZn62E%2Fimage.png?alt=media&#x26;token=1ff027bb-9936-41bd-b3ed-591c1e944e35" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

Publish the page.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FApzv6QgylS4nV1cJh1pn%2Fimage.png?alt=media&#x26;token=0a746cf6-d2ee-477b-b253-e8840d7fa2f8" alt=""><figcaption><p>LaTeX for Confluence</p></figcaption></figure>

## Mobile support

LaTeX content can also be viewed on mobile phones via Atlassian's Confluence Cloud apps.

![](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfN5XrttYq1wwBK--fT%2F-MfQJGN9n8OA6qo0cKB5%2Fconfluence-cloud-mobile.jpg?alt=media\&token=a66ba9ca-ceeb-42d2-b1c5-9e8da99dfd95)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fulstech.gitbook.io/docs/latex/latex-beautiful-math-for-confluence/confluence-cloud/usage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
