microsoft/markitdown · error · NotImplementedError

Not support func %s

Error message

Not support func %s

What it means

While converting OMML (Office Math Markup) equations in a DOCX to LaTeX, do_fname() maps the function-name run text through the FUNC dictionary (sin, cos, log, ...). A function name absent from FUNC raises NotImplementedError with the unmapped token. This marks a genuine gap in the OMML-to-LaTeX coverage rather than a problem with your call.

Source

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

    def do_func(self, elm):
        """
        the Function-Apply object (Examples:sin cos)
        """
        c_dict = self.process_children_dict(elm)
        func_name = c_dict.get("fName")
        return func_name.replace(FUNC_PLACE, c_dict.get("e"))

    def do_fname(self, elm):
        """
        the func name
        """
        latex_chars = []
        for stag, t, e in self.process_children_list(elm):
            if stag == "r":
                if FUNC.get(t):
                    latex_chars.append(FUNC[t])
                else:
                    raise NotImplementedError("Not support func %s" % t)
            else:
                latex_chars.append(t)
        t = BLANK.join(latex_chars)
        return t if FUNC_PLACE in t else t + FUNC_PLACE  # do_func will replace this

    def do_groupchr(self, elm):
        """
        the Group-Character object
        """
        c_dict = self.process_children_dict(elm)
        pr = c_dict["groupChrPr"]
        latex_s = get_val(pr.chr, default=CHR_DEFAULT.get("GROUP_CHR_VAL"), store=CHR)
        return pr.text + latex_s.format(c_dict["e"])

    def do_rad(self, elm):
        """
        the radical object
        """

View on GitHub (pinned to fd239d5d2b)

Solutions

  1. Upgrade markitdown to the newest release — the FUNC table grows over time
  2. Pre-process the document: replace the unsupported equation with an image or plain text before conversion
  3. As a workaround, monkey-patch/extend converter_utils.docx.math.omml.FUNC with your token before converting
  4. File an issue upstream with the failing equation's OMML so the mapping is added

Example fix

# before
md.convert("math.docx")  # NotImplementedError: Not support func <token>

# after
from markitdown.converter_utils.docx.math import omml
omml.FUNC["<token>"] = r"\\operatorname{<token>}"
md.convert("math.docx")
Defensive patterns

Strategy: fallback

Validate before calling

from markitdown.converter_utils.docx.math import omml

def docx_math_safe(path) -> bool:
    # heuristic: extract document.xml and check function tokens against FUNC
    import zipfile, re
    xml = zipfile.ZipFile(path).read("word/document.xml").decode("utf-8", "ignore")
    tokens = set(re.findall(r"<m:t>([^<]+)</m:t>", xml))
    return all(t in omml.FUNC or not t.isalpha() for t in tokens)

Try / catch

try:
    result = md.convert(docx_path)
except NotImplementedError as e:
    if "Not support func" in str(e):
        log.warning("unsupported equation token; retrying without math conversion")
        # e.g. strip math elements or convert equations to images, then retry
        raise

Prevention

When it happens

Trigger: Converting a .docx containing an equation whose m:f element has an unusual or localized function name (custom operators, non-English function names) not present in the converter's FUNC table.

Common situations: Scientific/financial documents authored in other locales or with add-in equation editors that emit non-standard function tokens.

Related errors


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