Easily Use MathJax with Django without any hassel
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
pydjax
.gitignore
README.rst
setup.py

README.rst

Project PyDJAX

Easily Use MathJax with Django without any hassel

Author Palash Bauri
version image0
Documention Documentation Status

PyDjax is an easy to use application to include MathJax in your django projects without any hassel, and easy configure directly from django settings.

Installation and configuration

To install pydjax you can use pip:

pip install pydjax

Then you have to add pydjax app to your INSTALLED_APPS and add a MATHJAX_ENABLED=True to your settings file.

Then you can put in any template the MathJax javascript using the template tag mathjax_scripts. Example:

{% load mathjax %}
<html>
  <head>
    <title>Sample Page</title>
    {% mathjax_scripts %}
  </head>
  <body>
    $$1+1=2$$
  </body>
</html>

pydjax uses the CDN mathjax version, if you want to have your own copy of MathJax, you have to download and put it in your static directory, and add the MATHJAX_LOCAL_PATH with the path of MathJax on static to your settings. Example

MATHJAX_LOCAL_PATH = 'js/libs/mathjax/'

Settings Parameters

  • MATHJAX_ENABLED

Allow to enable/disable the mathjax app. Example:

MATHJAX_ENABLED = True # to enable mathjax on your django project
  • MATHJAX_LOCAL_PATH

Use a local path of MathJax Library instead of the CDN. Example:

MATHJAX_LOCAL_PATH = 'js/libs/mathjax/'
  • MATHJAX_CONFIG_FILE

Allow to configure the config file used by mathjax. Example:

MATHJAX_CONFIG_FILE = "TeX-AMS-MML_HTMLorMML"

The default value is "TeX-AMS-MML_HTMLorMML".

  • MATHJAX_CONFIG_DATA

Allow to configure the mathjax directly by a python dictionary. Example:

MATHJAX_CONFIG_DATA = {
    "tex2jax": {
      "inlineMath":
    [
        ['$','$'],
        ['\\(','\\)']
    ]
    }
}