Computational Science and Data Science

Hans Fangohr

Setting up Pelican - how to make equations work?

Seeing that I have solved this problem twice (forgetting the solution after having done it once), I will write down the essential steps.

To be able to use equations in the static Pelican Blog generator, the key is to include a code snippet like

<!-- Using MathJax, with the delimiters $ -->
<!-- Conflict with pygments for the .mo and .mi -->
<script type="text/x-mathjax-config">
  "HTML-CSS": {
  styles: {
  ".MathJax .mo, .MathJax .mi": {color: "black ! important"}}
  tex2jax: {inlineMath: [['$','$'], ['\\\\(','\\\\)']],processEscapes: true}

<script type="text/javascript" src=""></script>

in the template/base.html theme file (just before the <body> section.)

This has been copied from Amic Frouvelle.

Once activated, this source:

.. math::

  \alpha = 10^2

renders nicely into

α = 102

Inline mathematical expressions can be surrounded by \$ just as in LaTeX. However, we need to use a double backslash instead of a single backslash. For example \$\\alpha = 10^2\$ would be rendered as $\alpha = 10^2$ in the line.

Update: February 2014. Have now found this pelican plugin.

Testing $\alpha=0.3$ and $10^2$.

This seems easier as it does not require changing the template/base.html file.