module documentation

Convert LaTex maths code into presentational MathML. This module is provisional: the API is not settled and may change with any minor Docutils version.

Class math Base class for MathML elements and root of MathML trees.
Class MathRowSchema Base class for elements treating content as a single inferred mrow.
Class MathSchema Base class for schemata expecting 2 or more children.
Class MathToken Token Element: contains textual data instead of children.
Class menclose Undocumented
Class mfrac Undocumented
Class mi Undocumented
Class mn Undocumented
Class mo Undocumented
Class mover Undocumented
Class mphantom Undocumented
Class mroot Undocumented
Class mrow Group sub-expressions as a horizontal row.
Class mspace Undocumented
Class msqrt Undocumented
Class mstyle Undocumented
Class msub Undocumented
Class msubsup Undocumented
Class msup Undocumented
Class mtable Undocumented
Class mtd Undocumented
Class mtext Undocumented
Class mtr Undocumented
Class munder Undocumented
Class munderover Undocumented
Function align_attributes Undocumented
Function begin_environment Undocumented
Function end_environment Undocumented
Function handle_cmd Process LaTeX command `name` followed by `string`.
Function handle_script_or_limit Append script or limit element to `node`.
Function parse_latex_math Append MathML conversion of `string` to `node` and return it.
Function tex2mathml Return string with MathML code corresponding to `tex_math`.
Function tex_cmdname Return leading TeX command name and remainder of `string`.
Function tex_equation_columns Undocumented
Function tex_group Return first TeX group or token and remainder of `string`.
Function tex_number Return leading number literal and remainder of `string`.
Function tex_optarg Return optional argument and remainder.
Function tex_token Return first simple TeX token and remainder of `string`.
Function tex_token_or_group Return first TeX group or token and remainder of `string`.
Variable accents Undocumented
Variable anomalous_chars Undocumented
Variable bigdelimiters Undocumented
Variable delimiter_sizes Undocumented
Variable fractions Undocumented
Variable functions Undocumented
Variable greek_capitals Undocumented
Variable layout_styles Undocumented
Variable math_alphabets Undocumented
Variable mathbb Undocumented
Variable matrices Undocumented
Variable movablelimits Undocumented
Variable operators Undocumented
Variable over Undocumented
Variable small_operators Undocumented
Variable spaces Undocumented
Variable stretchables Undocumented
Variable thick_operators Undocumented
Variable under Undocumented
def align_attributes(rows): (source)

Undocumented

def begin_environment(node, string): (source)

Undocumented

def end_environment(node, string): (source)

Undocumented

def handle_cmd(name, node, string): (source)

Process LaTeX command `name` followed by `string`. Append result to `node`. If needed, parse `string` for command argument. Return new current node and remainder of `string`: >>> handle_cmd('hbar', math(), r' rac') (math(mi('ℏ')), ' \frac') >>> handle_cmd('hspace', math(), r'{1ex} (x)') (math(mspace(width='1ex')), ' (x)')

def handle_script_or_limit(node, c, limits=''): (source)

Append script or limit element to `node`.

def parse_latex_math(node, string): (source)

Append MathML conversion of `string` to `node` and return it. >>> parse_latex_math(math(), r'lpha') math(mi('α')) >>> parse_latex_math(mrow(), r'x_{n}') mrow(msub(mi('x'), mi('n')))

def tex2mathml(tex_math, inline=True): (source)

Return string with MathML code corresponding to `tex_math`. Set `inline` to False for displayed math.

def tex_cmdname(string): (source)

Return leading TeX command name and remainder of `string`. >>> tex_cmdname('mymacro2') # up to first non-letter ('mymacro', '2') >>> tex_cmdname('name 2') # strip trailing whitespace ('name', '2') >>> tex_cmdname('_2') # single non-letter character ('_', '2')

def tex_equation_columns(rows): (source)

Undocumented

def tex_group(string): (source)

Return first TeX group or token and remainder of `string`. >>> tex_group('{first group} returned without brackets') ('first group', ' returned without brackets')

def tex_number(string): (source)

Return leading number literal and remainder of `string`. >>> tex_number('123.4') ('123.4', '')

def tex_optarg(string): (source)

Return optional argument and remainder. >>> tex_optarg('[optional argument] returned without brackets') ('optional argument', ' returned without brackets') >>> tex_optarg('{empty string, if there is no optional arg}') ('', '{empty string, if there is no optional arg}')

def tex_token(string): (source)

Return first simple TeX token and remainder of `string`. >>> tex_token('\command{without argument}') ('\command', '{without argument}') >>> tex_token('or first character') ('o', 'r first character')

def tex_token_or_group(string): (source)

Return first TeX group or token and remainder of `string`. >>> tex_token_or_group('\command{without argument}') ('\command', '{without argument}') >>> tex_token_or_group('first character') ('f', 'irst character') >>> tex_token_or_group(' also whitespace') (' ', 'also whitespace') >>> tex_token_or_group('{first group} keep rest') ('first group', ' keep rest')

accents: dict = (source)

Undocumented

anomalous_chars: dict[str, str] = (source)

Undocumented

bigdelimiters: dict[str, int] = (source)

Undocumented

delimiter_sizes: list[str] = (source)

Undocumented

fractions = (source)

Undocumented

functions: dict = (source)

Undocumented

greek_capitals: dict[str, str] = (source)

Undocumented

layout_styles: dict[str, dict] = (source)

Undocumented

math_alphabets: dict[str, str] = (source)

Undocumented

mathbb: dict[str, str] = (source)

Undocumented

matrices: dict = (source)

Undocumented

movablelimits: tuple[str, ...] = (source)

Undocumented

operators: dict[str, str] = (source)

Undocumented

Undocumented

small_operators: dict[str, str] = (source)

Undocumented

spaces: dict[str, str] = (source)

Undocumented

stretchables: dict[str, str] = (source)

Undocumented

thick_operators: dict[str, str] = (source)

Undocumented

Undocumented