How to use the latex2mathml.commands.MATRICES function in latex2mathml

To help you get started, weโ€™ve selected a few latex2mathml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github roniemartinez / latex2mathml / latex2mathml / converter.py View on Github external
elements: List[Any],
    index: int,
    iterable: Iterator[int],
    parent: Element,
):
    _get_prefix_element(element, parent)
    if element == r"\substack":
        parent = SubElement(parent, "mstyle", scriptlevel="1")
    params, tag, attributes = COMMANDS[element]
    if len(elements) - 1 < params:
        mo = SubElement(parent, "mo")
        mo.text = element[1:]
        return
    new_parent = SubElement(parent, tag, attributes)
    alignment = ""
    if element in MATRICES and (element.endswith("*") or element == r"\array"):
        index += 1
        alignment = elements[index]
        next(iterable)
    if element in (r"\lim", r"\inf", r"\sup", r"\max", r"\min"):
        limit = SubElement(new_parent, "mo")
        limit.text = element[1:]
    for j in range(params):
        index += 1
        param = elements[index]
        if element == "_" and index == 1 and param == r"\sum":
            new_parent.tag = "munder"
            _classify(param, new_parent)
        elif element == r"\left" or element == r"\right":
            if param == ".":
                pass
            else: