【发布时间】:2026-02-02 03:00:01
【问题描述】:
我正在使用 Sphinx(v1.4.9,在 Windows 7 上使用 Python 3.5.1,64 位)编写启用了 MathJax 的文档集。我想定义自定义 LaTeX 命令来清理我的源代码,所以我通过添加 _templates\layout.html 来实现 this approach:
{% extends "!layout.html" %}
{% set script_files = script_files + ["_static/mjconf.js"] %}
并在_static\mjconf.js 中定义我的自定义命令:
MathJax.Hub.Config({
TeX: {
Macros: {
dsetarr: ['{\\small \\textsf{#1 Array } \\mathsf{(#2)} }', 2],
dsettype: ['{\\small \\textsf{#1}}', 1],
mtt: ['{\\texttt{#1}}' ,1],
sgn: ['{\\mathrm{sgn}#1}', 1]
}
}
});
这一切都很好。
然而,每当我编辑 mjconf.js 以添加新命令或修改现有命令时,Sphinx 不会识别出配置已更改,因此很简单make html 不会像编辑 conf.py 后那样重建文档。我必须在make html 之前make clean 才能看到更改这些自定义MathJax 命令的效果。
如何配置 Sphinx 以通过重建整个文档集来响应编辑的 mjconf.js,就像它对编辑的 conf.py 所做的那样?
【问题讨论】:
-
我不知道这是否可能。但是
make clean html不解决问题吗?它确实重建了整个文档集。 -
@mzhn 不在 Windows 上。 Windows 的
make.bat一次只需要一个“make target”。
标签: python configuration python-sphinx