亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 Doxygen 將數學公式記錄為 Python 代碼中的注釋

使用 Doxygen 將數學公式記錄為 Python 代碼中的注釋

蝴蝶不菲 2022-10-11 09:57:32
我的問題是這個問題的擴展,我想要的是 Doxygen 輸出我的 python 源代碼的同一注釋行中的數學公式和文本。讓我們看下面的例子:# Create homogeneous probability matrix from the colors matrixdef create_probability_map(colors_map):    """!\f$(x_1,y_1)\f$"""    pass當我運行上面的代碼時,Doxygen 會按預期輸出正確的數學公式。但是,如果我在數學公式之前添加一些文本:# Create homogeneous probability matrix from the colors matrixdef create_probability_map(colors_map):    """Formula is: !\f$(x_1,y_1)\f$"""    pass輸出不如預期。有誰知道如何解決這一問題?在嘗試其他幾種組合時,我發現如果文本在數學公式之后,Doxygen 會輸出正確的注釋,如下所示:# Create homogeneous probability matrix from the colors matrixdef create_probability_map(colors_map):    """!\f$(x_1,y_1)\f$ is the formula"""    passPS:我還發現奇怪的是,據說 Doxygen 無法在 Python 上處理數學公式,如文檔中所述(特別是在此處)。文檔是否過時?
查看完整描述

1 回答

?
茅侃侃

TA貢獻1842條經驗 獲得超21個贊

我嘗試使用 doxygen 1.8.18 以下代碼:


## \file


# Create homogeneous probability matrix from the colors matrix

def create_probability_map1(colors_map):

    """!\f$(x_1,y_1)\f$"""

    pass


# Create homogeneous probability matrix from the colors matrix

def create_probability_map2(colors_map):

    """Formula is: !\f$(x_2,y_2)\f$"""

    pass


# Create homogeneous probability matrix from the colors matrix

def create_probability_map3(colors_map):

    """!\f$(x_3,y_3)\f$ is the formula"""

    pass


# Create homogeneous probability matrix from the colors matrix

def create_probability_map4(colors_map):

    """!Formula is: \f$(x_4,y_4)\f$ is the formula"""

    pass

使用默認的 doxygen 配置設置,這將導致:

http://img1.sycdn.imooc.com//6344ce460001262904730457.jpg

對我來說,這看起來一切正常,文檔字符串"""!被視為 doxygen 注釋,而只是"""被視為逐字/代碼(如問題中提到的鏈接中所示)。



查看完整回答
反對 回復 2022-10-11
  • 1 回答
  • 0 關注
  • 234 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號