小编Ral*_* B.的帖子

Sphinx 的方程编号如何工作?

我对 sphinx 比较陌生,我刚刚创建了两个文件来测试带有编号的方程交叉引用。

我在conf.py中做了以下配置

numfig = True
math_numfig = True
numfig_secnum_depth = 2
math_eqref_format = "Eq.{number}"
Run Code Online (Sandbox Code Playgroud)

第一个文件是

1. Test File 1 Main
=============

Inline math examples: :math:`\color{blue}{\sigma_{1}}` equals :math:`\colorbox{yellow}{\sigma_{2}}` then etc, etc.

Any text.

.. math::
 x^2+y^2=1
 :label: eq_a

Math block example with label:

.. math::
 e^{i\pi} + 1 = 0
 :label: eq_b


1.1 Some Examples
****************

.. math::
 \color{red}{x^2}+y^2=3
 :label: eq_c
Run Code Online (Sandbox Code Playgroud)

第二个是

2. Test File 2 Main
=============

Refer to :eq:`eq_a`

Refer to :eq:`eq_b`

Refer to :eq:`eq_c`
Run Code Online (Sandbox Code Playgroud)

输出是 HTML。它不适用于编号,所有标签都丢失(但链接很好)。 …

restructuredtext python-sphinx

6
推荐指数
1
解决办法
2998
查看次数

如何在 reStructuredText (sphinx) 中嵌入 HTML 或 XML,以便浏览器 cna 呈现它们?

我只需要在 reStructuredText (sphinx) 中嵌入一小段 html 或 xml,以便浏览器可以在生成的 HTML 文件中呈现它们,如下面的小块

.. raw:: html
  <a href="testurl">testurl</a>
Run Code Online (Sandbox Code Playgroud)

或者

.. raw:: html
  <math><apply><plus/><ci>a</ci><apply><minus/><ci>b</ci><ci>c</ci></apply></apply></math>
Run Code Online (Sandbox Code Playgroud)

无论我尝试过像“literal”、“raw”、“container”、“code”这样的指令,html代码都显示为某些“p”块的内部文本(因此浏览器显示代码而不是渲染它) ,或者代码从输出中消失

在 reStructuredText (sphinx) 中嵌入 html 或 xml 以便浏览器可以呈现它们的正确方法是什么?我只想将 html 或 xml 原封不动地放在那里。

restructuredtext python-sphinx

3
推荐指数
1
解决办法
2776
查看次数

标签 统计

python-sphinx ×2

restructuredtext ×2