【发布时间】:2019-06-02 07:52:46
【问题描述】:
我正在使用带有 numpydoc 扩展名的 sphinx。
当我制作 html 时,我的“示例”段落中的最后一项都被破坏了。
这是我尝试制作的文档:
"""
...
Examples
--------
Example of using gauss_elem with no option:
>>> a = Matrix([[1,2,3],[2,5,3],[1,0,8]])
>>> print(a.gauss_elem())
[[-40 16 9]
[ 13 -5 -3]
[ 5 -2 -1]]
Example of using gauss_elem with option:
>>> b = Matrix([[1,0,0],[0,1,0],[0,1,1]])
>>> print(a.gauss_elem(b))
[[-40 16 9]
[ 13 -5 -3]
[ 5 -2 -1]]
Example of using step by step solution:
>>> a.gauss_elem(step_by_step=True)
1 2 3 | 1 0 0
2 5 3 | 0 1 0
1 0 8 | 0 0 1
Add row 1 * -2 to row 2
...
"""
但是输出是这样的。 Output image link with broken format at last element
这有什么问题?
已编辑
正如 Steve Piercy 所说,我更改了我的代码,现在它适用于 gauss_elem。
但是,还有两个问题。
这是另一个文档字符串:
"""
...
Examples
--------
Example of using inv_using_det:
>>> a = Matrix([[1,2,3],[2,5,3],[1,0,8]]
>>> print(a.inv_using_det())
[[-40 16 9]
[ 13 -5 -3]
[ 5 -2 -1]]
Example of using step by step solution:
>>>a.inv_using_det(step_by_step=True)
Get adjugate matrix before transpose
[[ 40 -13 -5]
[-16 5 2]
[ -9 3 1]]
Transpose it
...
"""
【问题讨论】:
-
随机猜测,尝试去掉
>>> a.gauss_elem(step_by_step=True)后面的空行 -
@StevePiercy 谢谢。但它只适用于这个......我有类似的两个问题,但它不起作用。我将编辑我的问题。