gpt4 book ai didi

python-sphinx - MathJax 未在 Sphinx 中呈现

转载 作者:行者123 更新时间:2023-12-01 08:59:53 24 4
gpt4 key购买 nike

我在 Sphinx reST 中有一个文档集。
我在 conf.py 中包含了 sphinx.ext.mathjax,并包含了“mathjax_path = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js'”这一行。
我相信这就是在向 rst 文件添加标记之前我需要做的所有事情。但是我的方程没有被渲染。例如,

:math:`a^2 + b^2 = c^2`

从浏览器中出来
\(a^2 + b^2 = c^2\)

没有花哨的字体或任何东西。 HTML是
<span class="math">\(a^2 + b^2 = c^2\)</span>

最佳答案

您仍然需要在 conf.py 文件中声明对 sphinx-doc 的扩展名。

在 conf.py 文件的顶部,在“常规配置”下的 import sys, os 之后不久,您将看到有关包括扩展的注释说明。对于 mathjax,您需要将其添加到列出的扩展名中:

 # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig']

(我刚刚复制粘贴了我自己的,您目前可能有其他或没有列出的扩展名)。

结合您已经设置的 mathjax_path 应该可以工作。

关于python-sphinx - MathJax 未在 Sphinx 中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19655706/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com