From abd6057378152b80c85b99e670931b9f7b3df3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E6=B4=8B=E4=B8=89=E6=B4=8B?= <1258009915@qq.com> Date: Sat, 1 Mar 2025 22:38:27 +0800 Subject: [PATCH] [feat] Remove bold style --- texteller/models/ocr_model/utils/to_katex.py | 4 ++++ 1 file changed, 4 insertions(+) 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',