Skip to main content

MathJax easy integration with django

Project description

Django-mathjax is an application to easy include MathJax in your django projects as dependency, and easy configure directly from django settings.

Installation and configuration

To install django-mathjax you can use pip:

pip install Django-MathJax

Then you have to add django_mathjax 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></title>
      {% mathjax_scripts %}
  </head>
  <body>
    $$1+1=2$$
  </body>
</html>

django-mathjax use 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/'

You can force the usage of mathjax https CDN version enabling the template tag https parameter {% mathjax_scripts True %}.

Settings parameters

MATHJAX_ENABLED

Allow to enable/disable the mathjax app.

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"

MATHJAX_CONFIG_DATA

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-mathjax-0.0.3.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file django-mathjax-0.0.3.tar.gz.

File metadata

File hashes

Hashes for django-mathjax-0.0.3.tar.gz
Algorithm Hash digest
SHA256 96a64856d3117040299e5367919d73c1ec0c6bf43589f48b9572ebfba6e8952a
MD5 1256c6a50b23eb1c6789a42fa9936ed7
BLAKE2b-256 da46cf867e67e3b84c97b7cebe5be541792e4554c019501c549dc9ddd43fdae7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page