# Equations

## Inline equations #

• Inline equations are wrapped between $$ and $$.

• $ wrapping also works, but it is not preferred as it comes with restrictions like “there should be no whitespace between the equation and the $ delimiters”.

So $a=b$ will not work (it will look like: $a=b$), but $a=b$ will work (it will look like: $$a=b$$).

On the other hand, both $$a=b$$ (it will look like: $$a=b$$) and $$a=b$$ (it will look like: $$a=b$$) will work.

• One-per-line equations are wrapped between $ and $ or $$ delimiters. For example, below in Org: LaTeX formatted equation: $$E = -J \sum_{i=1}^N s_i s_{i+1}$$ will look like this in Hugo rendered HTML: LaTeX formatted equation: $$E = -J \sum_{i=1}^N s_i s_{i+1 }$$ Don’t see this in Markdown, see what it looks after Hugo has processed it.ox-hugo does some heavy escaping to get around a Blackfriday issue with supporting MathJax syntax equations (that Org supports). Here’s another example, taken from (org) LaTeX fragments. Below in Org: If a^2=b and $$b=2$$, then the solution must be either$$ a=+\sqrt{2}  or $a=-\sqrt{2}$

renders to:

If $$a^2=b$$ and $$b=2$$, then the solution must be either $a=+\sqrt{2}$ or $a=-\sqrt{2}$

(Note that the last two equations show up on their own lines.)

## LaTeX Environments #

ox-hugo support LaTeX environments.

So below in Org buffer:

$$\label{eq:1} C = W\log_{2} (1+\mathrm{SNR})$$

will export as:

$$\label{eq:1} C = W\log_{2} (1+\mathrm{SNR})$$

Equation referencing will also work1. So \ref{eq:1} will render as \ref{eq:1}.

## Examples #

You can find many examples by looking at tests tagged equations.

1. This requires MathJax. Here is a MathJax configuration that is tested to work for equation referencing (referencing \label{} labeled equations using \ref{}). The same is used on the ox-hugo test site too. [return]