1

Trying to use the Django-MathJax application to do exactly what it says on the tin: enable MathJax within a Django project. I've followed their installation directions, and have installed the application, and changed my Django configuration files as such:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.staticfiles',
    'django_mathjax',
)
MATHJAX_ENABLED=True

I then go to one of my pages and set it up as follows:

{% extends "root.html" %}
{% load mathjax %}

{% block nav %}
            <li><a href="/about">About</a></li>
            <li class="active"><a href="/contact">Contact</a></li>
{% endblock %}


{% block content %}
{% mathjax_scripts %}
    <div class="row">
        <div class="col-lg-9">
            <h1>Contact</h1>
            <p>
            Text text text text text.
            <ol>
    <li>Item one </li>
    <li>Item two</li>
</ol>
            </p>
            <h1>Other things</h1>
            <p>
            Texty texty text so much text $$1 + 1 = 2$$, and thus it was written.
        </div>
    </div>

{% endblock %}

That should have the "1 + 1 = 2" show up formatted correctly, but instead it just shows up as, well, two dollar signs on either end of 1+1=2. Anyone know what I'm doing wrong? I'm not so much a front end developer, so I'm fumbling about in the dark a bit.

Fomite
  • 2,213
  • 7
  • 30
  • 46
  • Sounds like MathJax isn't loaded at all. Do you see anything on the JavaScript console? What happens when you enter `MathJax.Message.Log()` on the console? Could you provide a live sample? – Peter Krautzberger Jul 15 '14 at 15:09
  • @PeterKrautzberger I'll see about putting up a live sample. At the moment, I see nothing in the console, and in Safari, "MathJax.js", "MathMenu.js" and MathZoom.js" are all listed in resources. MathJax.Message.Log() returns " Loading [MathJax]/extensions/MathMenu.js Loading [MathJax]/extensions/MathZoom.js" – Fomite Jul 15 '14 at 18:12
  • Ok, so MathJax loads. Have you configured MathJax to support $ as delimiters? Defaults are \(\) and \[\]. – Peter Krautzberger Jul 15 '14 at 18:26
  • @PeterKrautzberger Filed a report at Djando-MathJax to see if there's something I'm missing, but their documentation suggests $$ should work. I tried a substitution with [] and that failed as well. – Fomite Jul 15 '14 at 20:35
  • You're right -- `$$...$$` will work as well by default. – Peter Krautzberger Jul 16 '14 at 10:09

1 Answers1

3

The problem is that the documentation doesn't explain that the MATHJAX_CONFIG_FILE is needed for version <= 0.0.4, this is fixed in the version 0.0.5 that have a default value for MATHJAX_CONFIG_FILE.

you can solve it adding MATHJAX_CONFIG_FILE="TeX-AMS-MML_HTMLorMML" in your settings.py (this is the default value for the version 0.0.5).