我想知道如何在问答系统中配置Django中的Mathjax,在问答系统中,问题和答案将基于LaTeX格式。
我试图补充说:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>到html模板中,其中问题和答案将被显示无用。
谢谢。
发布于 2012-05-13 07:28:42
如果页面的内容是动态创建的,则需要在加载内容后调用MathJax。详情请参见the documentation。主要思想是你必须包括
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);在内容就位之后执行的javascript中。
发布于 2020-03-29 17:48:08
这里的fOR Dynamic content是一个有效的解决方案。在合并了ASCIIMathML的mathjax中,我使用AsciiMath输入作为输入格式。在base.html中添加以下脚本:
<script>
MathJax = {
loader: {load: ['input/asciimath', 'output/chtml']}
}
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js"></script>
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">记住要用反划线将动态文本括起来“,即在django- ...中,您可以简单地输入sqrt(50)作为sqrt(50)或x^2,以及从视图传递到模板的动态内容,在模板中,您可以用反划线将{{e1}}括起来
{{ e1 }}
而不是
{{ e1 }} where e1 is the dynamic content. So if e1 which was earlier displayed in plain text as 2\*sqrt(2) will now be displyed as 2√2.
有关更多细节,请访问:http://docs.mathjax.org/en/latest/input/asciimath.html#asciimath-support
发布于 2020-12-31 23:35:08
参见https://docs.mathjax.org/en/latest/web/configuration.html。为了让here演示正常工作,您还应该将['\(', '\)']添加到inlineMath中:
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
},
svg: {
fontCache: 'global'
}
};
</script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>https://stackoverflow.com/questions/10565532
复制相似问题