microsoft/markitdown · error · NotImplementedError

Not support lim %s

Error message

Not support lim %s

What it means

For OMML Lower-Limit objects (m:limLow), do_limlow() looks up the base expression's text in LIM_FUNC (known constructs like lim/min/max) and formats a \lim-style LaTeX template. If the base text has no template, NotImplementedError is raised naming the unknown base. It reflects an unmapped lower-limit construct in the DOCX math converter.

Source

Thrown at packages/markitdown/src/markitdown/converter_utils/docx/math/omml.py:324

    def do_eqarr(self, elm):
        """
        the Array object
        """
        return ARR.format(
            text=BRK.join(
                [t for stag, t, e in self.process_children_list(elm, include=("e",))]
            )
        )

    def do_limlow(self, elm):
        """
        the Lower-Limit object
        """
        t_dict = self.process_children_dict(elm, include=("e", "lim"))
        latex_s = LIM_FUNC.get(t_dict["e"])
        if not latex_s:
            raise NotImplementedError("Not support lim %s" % t_dict["e"])
        else:
            return latex_s.format(lim=t_dict.get("lim"))

    def do_limupp(self, elm):
        """
        the Upper-Limit object
        """
        t_dict = self.process_children_dict(elm, include=("e", "lim"))
        return LIM_UPP.format(lim=t_dict.get("lim"), text=t_dict.get("e"))

    def do_lim(self, elm):
        """
        the lower limit of the limLow object and the upper limit of the limUpp function
        """
        return self.process_children(elm).replace(LIM_TO[0], LIM_TO[1])

    def do_m(self, elm):
        """

View on GitHub (pinned to fd239d5d2b)

Solutions

  1. Upgrade markitdown to pick up any newly added LIM_FUNC entries
  2. Edit the source document: convert that equation to an image or plain text
  3. Extend the mapping before conversion: add your token to converter_utils.docx.math.omml.LIM_FUNC
  4. Report the equation upstream so coverage improves

Example fix

# before
md.convert("paper.docx")  # NotImplementedError: Not support lim <base>

# after
from markitdown.converter_utils.docx.math import omml
omml.LIM_FUNC["<base>"] = r"\\underset{\\lim_{{lim}}}{\\text{<base>}}"
md.convert("paper.docx")
Defensive patterns

Strategy: fallback

Validate before calling

from markitdown.converter_utils.docx.math import omml

def limlow_bases_supported(path) -> bool:
    import zipfile, re
    xml = zipfile.ZipFile(path).read("word/document.xml").decode("utf-8", "ignore")
    for base in re.findall(r"<m:limLow>.*?<m:e><m:r><m:t>([^<]+)</m:t>", xml, re.S):
        if base not in omml.LIM_FUNC:
            return False
    return True

Try / catch

try:
    result = md.convert(docx_path)
except NotImplementedError as e:
    if "Not support lim" in str(e):
        log.warning("unsupported lower-limit construct %s; converting without math", e)
        raise

Prevention

When it happens

Trigger: Converting a .docx whose equations use a lower-limit structure whose base element is an unusual expression (custom operator under/over scripts) instead of the recognized lim/min/max tokens.

Common situations: Documents built with advanced equation editors or exported from LaTeX->Word tools that emit non-standard m:limLow bases.

Related errors


AI-assisted analysis of microsoft/markitdown@fd239d5d2b (2026-08-14). Data as JSON: /api/errors/3a0a075ff6cf034c. Report an issue: GitHub.