Creating LaTeX math macros within Sphinx

后端 未结 5 766
梦谈多话
梦谈多话 2020-12-14 11:03

I\'m writing some mathematical code in Python and using Sphinx to produce the documentation. I know that Sphinx can handle LaTeX code in Python docstrings; see https://www.s

5条回答
  •  粉色の甜心
    2020-12-14 11:27

    To add to @Keta's answer since Aug 2018 and this commit (https://github.com/sphinx-doc/sphinx/pull/5230/files) you can use mathjax_config in the conf.py according to the documentation (http://www.sphinx-doc.org/en/master/usage/extensions/math.html?#confval-mathjax_config)

    So for example the following can be added,

    mathjax_config = {                  
        "TeX": {                        
            "Macros": {                 
                "RR": '{\\bf R}',       
                "bold": ['{\\bf #1}',1] 
                }                       
            }                           
        }                               
    

提交回复
热议问题