Spaces:
Sleeping
Sleeping
Continue to fix latex
Browse files
web/src/mathjax-config.ts
CHANGED
|
@@ -169,8 +169,9 @@ export function preprocessMathContent(content: string): string {
|
|
| 169 |
);
|
| 170 |
|
| 171 |
// Step 3: Fix spacing issues around single dollar signs
|
| 172 |
-
//
|
| 173 |
-
|
|
|
|
| 174 |
|
| 175 |
// Step 4: Ensure display math with newlines is properly formatted
|
| 176 |
// MathJax needs $$ on separate lines for multi-line display math
|
|
|
|
| 169 |
);
|
| 170 |
|
| 171 |
// Step 3: Fix spacing issues around single dollar signs
|
| 172 |
+
// Only collapse excessive whitespace, don't break trailing spaces before $
|
| 173 |
+
// $ x $ should become $x$ but $\mathbb{R}^2 $ should stay as is
|
| 174 |
+
processed = processed.replace(/\$\s{2,}(.+?)\s{2,}\$/g, '$$$$1$$');
|
| 175 |
|
| 176 |
// Step 4: Ensure display math with newlines is properly formatted
|
| 177 |
// MathJax needs $$ on separate lines for multi-line display math
|