左对齐Sphinx HTML输出中的所有数学块 [英] Left-align all math blocks in Sphinx HTML output
本文介绍了左对齐Sphinx HTML输出中的所有数学块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有通过the math
directive包含数学块的Sphinx文档。默认情况下,它们在HTML输出中居中。我希望它们都显示为左侧对齐,但相对于周围文本有一些缩进。
例如,如果这在index.rst
For :math:`|r| < 1`:
.. math::
sumlimits_{k=0}^{infty} r^k = frac{1}{1-r}
Text in following paragraph put here to demonstrate that the math block
is in fact centered on the page.
和conf.py
完全为空,则在同一文件夹中运行sphinx-build . output
将生成以下在浏览器中查看的HTML页面:
MathJax
此答案适用于推荐答案输出中的默认数学呈现器。
conf.py中的以下设置左对齐所有math
指令内容:
mathjax3_config = {'chtml': {'displayAlign': 'left'}}
可以使用displayIndent
:
mathjax3_config = {'chtml': {'displayAlign': 'left',
'displayIndent': '2em'}}
引用:
- https://www.sphinx-doc.org/en/master/usage/extensions/math.html#confval-mathjax3_config
- https://docs.mathjax.org/en/v3.0-latest/options/output/index.html#options-common-to-all-output-processors
这篇关于左对齐Sphinx HTML输出中的所有数学块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文