Spaces:
Running on T4
Running on T4
Commit ·
e24be4d
1
Parent(s): bb28e9c
fix: prevent LaTeX regex from stripping currency dollar signs
Browse files- postprocess.py +3 -2
postprocess.py
CHANGED
|
@@ -54,8 +54,9 @@ _LATEX_SUPERSCRIPT = re.compile(r"\$\s*\^?\{([^}]*)\}\s*\$")
|
|
| 54 |
_LATEX_SUBSCRIPT = re.compile(r"\$\s*_\{([^}]*)\}\s*\$")
|
| 55 |
# $\pm value$ → ± value
|
| 56 |
_LATEX_PLUSMINUS = re.compile(r"\$\s*\\pm\s*([^$]*?)\s*\$")
|
| 57 |
-
# Generic remaining $...$ inline math —
|
| 58 |
-
|
|
|
|
| 59 |
# LaTeX command remnants: \%, \$, \&, etc.
|
| 60 |
_LATEX_ESCAPED_CHARS = re.compile(r"\\([%$&_#])")
|
| 61 |
|
|
|
|
| 54 |
_LATEX_SUBSCRIPT = re.compile(r"\$\s*_\{([^}]*)\}\s*\$")
|
| 55 |
# $\pm value$ → ± value
|
| 56 |
_LATEX_PLUSMINUS = re.compile(r"\$\s*\\pm\s*([^$]*?)\s*\$")
|
| 57 |
+
# Generic remaining $...$ inline math — only match when content has LaTeX chars
|
| 58 |
+
# (backslash, caret, underscore, braces). Avoids stripping currency like $8,125.00
|
| 59 |
+
_LATEX_INLINE = re.compile(r"\$\s*([^$]{1,60}?[\\^_{}][^$]{0,60}?)\s*\$")
|
| 60 |
# LaTeX command remnants: \%, \$, \&, etc.
|
| 61 |
_LATEX_ESCAPED_CHARS = re.compile(r"\\([%$&_#])")
|
| 62 |
|