Search code examples
djangomathjax

How to configure Mathjax in Python Django


I would like to know how to configure Mathjax in Django in a Q&A system where Questions and Answers will be based on LaTeX format.

I have tried to add:

<script type="text/javascript"
   src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

into the html template where the questions and answers will be displayed to no avail.

Thanks.


Solution

  • If the page's content is dynamically created, you will need to call MathJax after the content has been loaded. See the documentation for details. The main idea is that you have to include

    MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
    

    in the javascript that is executed after the content is in place.