Skip to content

fix(docx): handle unknown math functions in OMML converter without crashing - #2268

Open
MeiSiristhebest wants to merge 2 commits into
microsoft:mainfrom
MeiSiristhebest:fix/docx-math-unknown-func
Open

fix(docx): handle unknown math functions in OMML converter without crashing#2268
MeiSiristhebest wants to merge 2 commits into
microsoft:mainfrom
MeiSiristhebest:fix/docx-math-unknown-func

Conversation

@MeiSiristhebest

Copy link
Copy Markdown

Description

The OMML-to-LaTeX converter previously crashed with a NotImplementedError when encountering math function names not present in the FUNC dictionary.

This PR:

  1. Expands FUNC in latex_dict.py with 15 common standard LaTeX functions (log, ln, exp, det, gcd, lcm, lim, max, min, sup, inf, dim, ker, hom, deg, arg).
  2. Replaces raise NotImplementedError in omml.py with a safe \operatorname{...} fallback so unlisted custom functions render as valid LaTeX without crashing conversion.
  3. Adds unit tests covering math function parsing and fallback rendering.

Fixes #1982

…nverter

Do not set a default api_version string in DocumentIntelligenceConverter. If api_version is omitted or None, avoid passing api_version kwarg to DocumentIntelligenceClient so Azure SDK uses its native default version.

Fixes microsoft#1904
…ashing

Add common standard math functions to FUNC dictionary in latex_dict.py and fallback to \operatorname{} for unknown functions in omml.py instead of throwing NotImplementedError.

Fixes microsoft#1982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: DOCX math converter crashes with NotImplementedError on unknown functions

1 participant