Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: add support for Degree Celsius symbol and normalize LaTeX delimiters in OMML processing
myhlolie37f92e77f72
diff --git a/mineru/model/docx/tools/math/latex_dict.py b/mineru/model/docx/tools/math/latex_dict.pyindex 99f361be..baab8900 100644--- a/mineru/model/docx/tools/math/latex_dict.py+++ b/mineru/model/docx/tools/math/latex_dict.py@@ -158,6 +158,7 @@ T = {"\u2127": "\\mho ", # ℧ INVERTED OHM SIGN — pylatexenc: \textmho (textcomp, not in KaTeX/MathJax)"\u212e": "e", # ℮ ESTIMATED SIGN — pylatexenc: \textestimated (no math equivalent; use 'e')"\u00c5": "\\mathring{A} ", # Å LATIN CAPITAL LETTER A WITH RING — pylatexenc: \r{A} (text-mode only)+ "\u2103": "\\text{°C}", # ℃ DEGREE CELSIUS — pylatexenc: \textcelsius (textcomp, not in KaTeX/MathJax)# Multiplication/division operators (text-mode pylatexenc mappings overridden to math-mode)"\u00b7": "\\cdot ", # MIDDLE DOT (·) — common in Chinese scientific notation"\u22c5": "\\cdot ", # DOT OPERATOR (⋅)diff --git a/mineru/model/docx/tools/math/omml.py b/mineru/model/docx/tools/math/omml.pyindex 52c18636..d8272906 100644--- a/mineru/model/docx/tools/math/omml.py+++ b/mineru/model/docx/tools/math/omml.py@@ -88,6 +88,13 @@ def get_val(key, default=None, store=CHR):return default+def _normalize_latex_delimiter(delimiter):+ """将 Word OMML 定界符字符转换为 LaTeX/KaTeX 可渲染的定界符。"""+ if delimiter in ("\u2225", "\u2016"):+ return r"\|"+ return delimiter++class Tag2Method:def call_method(self, elm, stag=None):getmethod = self.tag2meth.get@@ -273,8 +280,12 @@ class oMath2Latex(Tag2Method):pr = c_dict["dPr"]null = D_DEFAULT.get("null")- s_val = get_val(pr.begChr, default=D_DEFAULT.get("left"), store=T)- e_val = get_val(pr.endChr, default=D_DEFAULT.get("right"), store=T)+ s_val = _normalize_latex_delimiter(+ get_val(pr.begChr, default=D_DEFAULT.get("left"), store=T)+ )+ e_val = _normalize_latex_delimiter(+ get_val(pr.endChr, default=D_DEFAULT.get("right"), store=T)+ )delim = pr.text + D.format(left=null if not s_val else escape_latex(s_val),text=c_dict["e"],