matplotlib.sphinxext.mathmpl
#
在Sphinx中显示mathtext的角色和指令#
mathmpl
Sphinx 扩展在 Matplotlib 中创建一个 mathtext 图像,并在 html 输出中显示它。因此,它是您将看到的真实且忠实的表示,如果您将给定的 LaTeX 字符串传递给 Matplotlib(参见 书写数学表达式)。
警告
在大多数情况下,您可能希望使用 Sphinx 的内置数学扩展之一 而不是这个。内置的 Sphinx 数学指令使用 MathJax 来渲染数学表达式,并解决了 mathmpl
没有解决的可访问性问题。
数学文本可以通过两种方式包含:
内联,使用角色:
This text uses inline math: :mathmpl:`\alpha > \beta`.
生成结果:
这段文字使用了行内数学公式:
。
独立使用指令:
Here is some standalone math: .. mathmpl:: \alpha > \beta
生成结果:
这里是一些独立的数学内容:
选项#
mathmpl
角色和指令都支持以下选项:
- 字体集str, 默认值: 'cm'
显示数学公式时使用的字体集。参见
rcParams["mathtext.fontset"]
(default:'dejavusans'
)。- 字体大小浮动
字体大小,以点为单位。默认为以下扩展配置选项中定义的值。
配置选项#
mathtext 扩展有以下配置选项:
- class matplotlib.sphinxext.mathmpl.MathDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[源代码][源代码]#
.. mathmpl::
指令,如模块的文档字符串中所述。- final_argument_whitespace = False#
最终参数可以包含空格吗?
- has_content = True#
指令可以有内容吗?
- option_spec = {'fontset': <function fontset_choice>, 'fontsize': <function _make_type_validator.<locals>.validate_float_or_None>}#
选项名称到验证器函数的映射。
- optional_arguments = 0#
在必需参数之后的可选参数数量。
- required_arguments = 0#
所需指令参数的数量。