From ca8b7b0eefd0d6e118e63c3a8f101666b04078d7 Mon Sep 17 00:00:00 2001 From: Rafael Teixeira de Lima Date: Thu, 24 Jul 2025 09:48:04 +0200 Subject: [PATCH] Adding plain latex equations to table cells Signed-off-by: Rafael Teixeira de Lima --- docling/backend/msword_backend.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docling/backend/msword_backend.py b/docling/backend/msword_backend.py index abbcc6f6..45c53a98 100644 --- a/docling/backend/msword_backend.py +++ b/docling/backend/msword_backend.py @@ -1104,8 +1104,17 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend): ) _log.debug(f" spanned before row {spanned_idx}") + # Detect equations in cell text + text, equations = self._handle_equations_in_text( + element=cell._element, text=cell.text + ) + if len(equations) == 0: + text = cell.text + else: + text = text.replace("", "$").replace("", "$") + table_cell = TableCell( - text=cell.text, + text=text, row_span=spanned_idx - row_idx, col_span=cell.grid_span, start_row_offset_idx=row.grid_cols_before + row_idx,