## Getting Started with MathJax

6 August 2014

I’ve spent the past few days getting myself reacquainted with TeX and familiarizing myself with MathJax. As it turns out, it is quite easy to get MathJax working in Octopress.

- Open
`source/_includes/custom/head.html`

. - Add the a JavaScript source:
`//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML`

. - Start typing your TeX.
- In your
`Gemfile`

, make sure you are using at least RDiscount version 2.1.`gem 'rdiscount', '~> 2.1'`

- In your
`_config.yml`

file, disable automatic superscripts by adding`- no_superscript`

to your RDiscount configuration.

The last two are quite important. Without those two steps, it looks like RDiscount will turn `x^2`

into `x<sup>2</sup>`

. This will get displayed as x^{2}. That will break the MathJax processor.

Let’s start by demonstrating a simple inline equation, like \( y = mx + c \). This is simple enough by including the inline text: `\\( y = mx + c \\)`

.

To enter full equations, like the one below, use the following syntax.

```
\begin{equation}
x = \dfrac{ -b \pm \sqrt{ b^2 - 4ac } }{ 2a }
\end{equation}
```

The above code will render as the following equation.

\begin{equation} x = \dfrac{ -b \pm \sqrt{ b^2 - 4ac } }{ 2a } \end{equation}

Happy mathing!