PaddlePaddle/PaddleOCR · error · RuntimeError
Not support lim {e}
Error message
Not support lim {e} What it means
Raised by the OMML (Office Math Markup Language) to LaTeX converter when a lower-limit construct (m:limLow) whose base expression is not one of the recognized functions. LIM_FUNC in paddleocr/_doc2md/math/latex_dict.py only maps "lim", "max", and "min", so any other base (e.g. "sup", "inf", "gcd" or a non-text run) cannot be converted and the converter aborts with RuntimeError. It occurs during doc-to-markdown conversion of Word documents containing equations.
Source
Thrown at paddleocr/_doc2md/math/omml.py:358
if len(rows) == 1:
row = rows[0]
tag_match = re.search(r"\\#\s*\(([^)]*)\)\s*$", row)
if tag_match:
formula = row[: tag_match.start()].rstrip()
tag_content = tag_match.group(1)
return f"{formula}\\tag{{{tag_content}}}"
return row
return ARR.format(text=BRK.join(rows))
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 RuntimeError("Not support lim {}".format(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 2661c7c0ef)
Solutions
- Extend LIM_FUNC in paddleocr/_doc2md/math/latex_dict.py with the missing operator, e.g. add "inf": "\\inf_{{{lim}}}" and "sup": "\\sup_{{{lim}}}".
- Wrap the doc2md math conversion call in try/except and skip/keep the original XML for the failing formula so the rest of the document still converts.
- Edit the equation in the source document to use a form the converter supports (plain \lim) and re-convert.
Example fix
# paddleocr/_doc2md/math/latex_dict.py
# before
LIM_FUNC = {
"lim": "\\lim_{{{lim}}}",
"max": "\\max_{{{lim}}}",
"min": "\\min_{{{lim}}}",
}
# after
LIM_FUNC = {
"lim": "\\lim_{{{lim}}}",
"max": "\\max_{{{lim}}}",
"min": "\\min_{{{lim}}}",
"inf": "\\inf_{{{lim}}}",
"sup": "\\sup_{{{lim}}}",
"gcd": "\\gcd_{{{lim}}}",
} Defensive patterns
Strategy: try-catch
Validate before calling
from paddleocr._doc2md.math.latex_dict import LIM_FUNC
def limlow_convertible(base_text: str) -> bool:
return base_text in LIM_FUNC Try / catch
try:
md = converter.convert(docx_path)
except RuntimeError as e:
if "Not support lim" in str(e):
logger.warning("Skipping unsupported limLow formula: %s", e)
md = convert_without_math(docx_path) # fallback mode
else:
raise Prevention
- Audit Word docs for \inf/\sup/\gcd-style limit constructs before batch conversion
- Extend LIM_FUNC once per newly encountered operator instead of skipping
- Log the offending t_dict['e'] value from the chained exception to identify the operator to add
When it happens
Trigger: Converting a .docx with PaddleOCR's doc2md pipeline where an equation contains an m:limLow element whose m:e resolves to text not in {"lim", "max", "min"} (for example \inf, \sup, \oint limits, or a nested construct instead of a plain run).
Common situations: Scientific/academic Word documents with \inf_{n} or \sup_{x} expressions; documents produced by different equation editors that emit limLow for unusual operators; conversion failing mid-document on one specific formula.
Related errors
- DOCX conversion requires python-docx: pip install paddleocr[
- A dependency error occurred during predictor creation. Pleas
- A dependency error occurred during pipeline creation. Please
- Second argument needs to be a %s
- Unable to apply style {self.paragraph_style}.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/71a747348352e7ef.
Report an issue: GitHub.