首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用numpydoc和sphinx时格式损坏

使用numpydoc和sphinx时格式损坏
EN

Stack Overflow用户
提问于 2019-06-02 15:52:47
回答 1查看 241关注 0票数 0

我正在使用带有numpydoc扩展的sphinx。

当我制作html时,我的“示例”段落中的每一项都被破坏了。

这就是我试图制作的文档:

代码语言:javascript
复制
        """
        ...
        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上工作了。

但是,还有两个问题。

下面是另一个文档字符串:

代码语言:javascript
复制
        """
        ...
        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
            ...
        """

这是另一个Output with broken format.

EN

回答 1

Stack Overflow用户

发布于 2019-06-03 19:18:24

好的。我找到了我的问题的答案。

问题出在这里:>>>a.get_inv_using_det

它必须是:>>> a.get_inv_using_det

它现在运行得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56413176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档