首页 > 解决方案 > pycharm 没有正确显示文档字符串数学?

问题描述

正如标题所说,每当我在 pycharm 中查看文档字符串时,即使在阅读模式下我也看不到正确的数学,我认为应该向我展示数学而不是生成数学的“代码”。

在此处输入图像描述

谁能告诉我如何解决这个问题,因为尝试阅读此类复杂数学函数的文档字符串非常烦人。

这就是我将 .py 文件转换为 .md 时发生的情况

在此处输入图像描述

该文件可以被读取,但数学仍然没有被解释。我需要一些特殊的乳胶插件吗?

当我将其转换为 .rst 时,我得到以下信息:

在此处输入图像描述

很明显,这种格式在 pycharm 中根本不起作用。

Edit2:根据要求,我添加了一个包含数学的文档字符串的类。

class FullyConnectedTensorProduct(TensorProduct):
    r"""Fully-connected weighted tensor product

    All the possible path allowed by :math:`|l_1 - l_2| \leq l_{out} \leq l_1 + l_2` are made.
    The output is a sum on different paths:

    .. math::

        z_w = \sum_{u,v} w_{uvw} x_u \otimes y_v + \cdots \text{other paths}

    where :math:`u,v,w` are the indices of the multiplicities.

    Parameters
    ----------
    irreps_in1 : `Irreps`
        representation of the first input

    irreps_in2 : `Irreps`
        representation of the second input

    irreps_out : `Irreps`
        representation of the output

    normalization : {'component', 'norm'}
        see `TensorProduct`

    internal_weights : bool
        see `TensorProduct`

    shared_weights : bool
        see `TensorProduct`
    """

标签: pythonpycharmlatexdocstring

解决方案


推荐阅读