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,