Django-MathJax无法正确显示 [英] Django-MathJax not displaying correctly

查看:55
本文介绍了Django-MathJax无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 Django-MathJax 应用程序完全按照提示说:在Django项目中启用MathJax.我已按照他们的安装说明进行操作,并安装了该应用程序,并按如下方式更改了我的Django配置文件:

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 %}

应该正确显示"1 +1 = 2"的格式,但是,它只是在1 + 1 = 2的任一端显示为两个美元符号.有人知道我在做什么错吗?我不是前端开发人员,所以我有点在黑暗中摸索.

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.

推荐答案

问题是文档没有说明版本< = 0.0.4需要MATHJAX_CONFIG_FILE,此问题已在版本0.0.5中修复.具有MATHJAX_CONFIG_FILE的默认值.

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.

您可以通过在settings.py(这是0.0.5版的默认值)中添加MATHJAX_CONFIG_FILE ="TeX-AMS-MML_HTMLorMML"来解决该问题.

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).

这篇关于Django-MathJax无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆