diff --git a/texteller/models/ocr_model/utils/to_katex.py b/texteller/models/ocr_model/utils/to_katex.py index 20518a7..14feba3 100644 --- a/texteller/models/ocr_model/utils/to_katex.py +++ b/texteller/models/ocr_model/utils/to_katex.py @@ -123,6 +123,7 @@ def to_katex(formula: str) -> str: ] for old_ins, new_ins in zip(origin_instructions, origin_instructions): res = change_all(res, old_ins, new_ins, r'$', r'$', '{', '}') + res = change_all(res, r'\mathbf', r'\bm', r'{', r'}', r'{', r'}') res = change_all(res, r'\boldmath ', r'\bm', r'{', r'}', r'{', r'}') res = change_all(res, r'\boldmath', r'\bm', r'{', r'}', r'{', r'}') res = change_all(res, r'\boldmath ', r'\bm', r'$', r'$', r'{', r'}') @@ -131,6 +132,9 @@ def to_katex(formula: str) -> str: res = change_all(res, r'\emph', r'\textit', r'{', r'}', r'{', r'}') res = change_all(res, r'\emph ', r'\textit', r'{', r'}', r'{', r'}') + # remove bold command + res = change_all(res, r'\bm', r' ', r'{', r'}', r'', r'') + origin_instructions = [ r'\left', r'\middle',