This commit is contained in:
三洋三洋
2024-05-08 14:18:44 +00:00
parent ad84fcfce8
commit 5d95d2e65c

View File

@@ -44,7 +44,7 @@ def change(input_str, old_inst, new_inst, old_surr_l, old_surr_r, new_surr_l, ne
i = j + 1 i = j + 1
continue continue
else: else:
assert count > 1 assert count >= 1
assert j == n assert j == n
print("Warning: unbalanced surrogate pair in input string") print("Warning: unbalanced surrogate pair in input string")
result += new_inst + new_surr_l result += new_inst + new_surr_l
@@ -74,12 +74,13 @@ def to_katex(formula: str) -> str:
r'\normalsize', r'\normalsize',
r'\small', r'\small',
r'\footnotesize', r'\footnotesize',
r'\scriptsize',
r'\tiny' r'\tiny'
] ]
for (old_ins, new_ins) in zip(origin_instructions, origin_instructions): for (old_ins, new_ins) in zip(origin_instructions, origin_instructions):
res = change(res, old_ins, new_ins, r'$', r'$', '{', '}') res = change(res, old_ins, new_ins, r'$', r'$', '{', '}')
res = change(res, r'\boldmath ', r'\bm', r'$', r'$', r'{', r'}') res = change(res, r'\boldmath ', r'\bm', r'$', r'$', r'{', r'}')
res = change(res, r'\boldmath', r'\bm', r'$', r'$', r'{', r'}')
res = change(res, r'\scriptsize', r'\scriptsize', r'$', r'$', r'{', r'}')
origin_instructions = [ origin_instructions = [
r'\left', r'\left',