# confluence-mathjax

Please note that the binaries for this plug in are out of date but the source in Github might work for newer versions of Confluence. I am no longer working on this plug-in (and haven’t for some time) and so your mileage may vary…

This plugin for Atlassian Confluence, provides a thin wrapper around MathJax. MathJax is an open source JavaScript display engine for mathematics that works in all modern browsers.

Two macros for Confluence are provided: mathinline and mathdisplay. They both accept mathematics in Latex notation and output either an inline equation (within the main text) or a displayed equation (separate from the main text, typically centered on the page). AMSmath extensions for Latex are also enabled.

Help is provided in the Confluence Notation Guide under the Advanced Formatting tab.

### Example usage

A few simple examples:

• {mathinline}\frac{x}{y}{mathinline} a nice fraction.
• And to get a nice integral, simply use {mathdisplay}\int_{-\infty}^\infty \mbox{e}^{-x^2} \mbox{d}x.{mathdisplay}
• Or using some AMS math features: {mathdisplay} \begin{bmatrix} \dot x\\ \dot y\end{bmatrix} = \begin{bmatrix}a_{1,1} & a_{1,2}\\ a_{2,1} & a_{2,2}\end{bmatrix} \begin{bmatrix}x\\ y\end{bmatrix} {mathdisplay}

• $\frac{x}{y}$ a nice fraction.
• And to get a nice integral, simply use $\int_{-\infty}^\infty \mbox{e}^{-x^2} \mbox{d}x.$
• Or using some AMS math features: $\begin{bmatrix} \dot x\\ \dot y\end{bmatrix} =
\begin{bmatrix}a_{1,1} & a_{1,2}\\ a_{2,1} & a_{2,2}\end{bmatrix}
\begin{bmatrix}x\\ y\end{bmatrix}$

At the moment this plugin definitely works for Atlassian Confluence 3.4-4.1 and possibly for earlier versions (I haven’t tested below 3.4). If you install in Confluence 3.x, it might complain that some dependencies are not fulfilled. This is normal and due to the fact that the macro format has changed with Confluence 4.x.

You can grab the source code from GitHub.

### Compiling

The easiest way to compile this plugin is to download the Atlassian SDK and simply type

atlas-package

Alternatively, use

atlas-run

to automatically run a Confluence instance with the plugin installed (uses a development licensed Confluence). Different versions of Confluence can be tried using

atlas-run --version 3.5.13

The src/main/resources/mathjax directory contains a pristine copy of MathJax v1.1a. It can be updated as necessary to newer versions of MathJax as and when they are released, provided that the configuration mechanism does not change from version to version.

Note: MathJax itself is not included in the source repository. Simply download it from the MathJax website and unpack in the appropriate directory. MathJax.js should end up as src/main/resources/mathjax/MathJax.js.

## 3 Replies to “confluence-mathjax”

1. Ramakrishna Sharvirala says:

Hi-

I would like to upgrade this plug-in to support updated version of confluence by providing my services in contributing open source development

Regards
Ramakrishna

1. David Barton says:

Sounds good!

2. Yauhen Radyna says:

Hi David,

This is a very useful plugin. Though, it does not work as expected with Confluence 4.3.7. Inline formulas are showed on separate lines. The generated html code looks like this:

This is the test of the inline math formula –
$$\lim_{x\to 0}\frac{\sin{x}}{x}=1$$
— it doesn’t seem to stay inline.

I don’t know what is responsible for inserting extra paragraph breaks – the plugin or Confluence itself. Anyway, I don’t see plugin code responsible for inserting breaks, nor I see any obvious options regulating break insertion.

This site uses Akismet to reduce spam. Learn how your comment data is processed.