fraudTech commited on
Commit
24bdd40
·
1 Parent(s): 001f64b

fixed LaTeX for $ sign

Browse files
Files changed (1) hide show
  1. src/App.js +9 -0
src/App.js CHANGED
@@ -139,8 +139,17 @@ function normalizeLatex(text) {
139
 
140
  let normalized = text;
141
 
 
142
  normalized = normalized.replace(/\\\[(.+?)\\\]/gs, (_, inner) => `$$${inner}$$`);
 
 
143
  normalized = normalized.replace(/\\\((.+?)\\\)/gs, (_, inner) => `$${inner}$`);
 
 
 
 
 
 
144
 
145
  return normalized;
146
  }
 
139
 
140
  let normalized = text;
141
 
142
+ // Replace \[...\] with $$...$$
143
  normalized = normalized.replace(/\\\[(.+?)\\\]/gs, (_, inner) => `$$${inner}$$`);
144
+
145
+ // Replace \(...\) with $...$
146
  normalized = normalized.replace(/\\\((.+?)\\\)/gs, (_, inner) => `$${inner}$`);
147
+
148
+ // Fix triple dollar signs $$$ back to $$
149
+ normalized = normalized.replace(/\$\$\$/g, '$$');
150
+
151
+ // Fix quadruple dollar signs $$$$ back to $$
152
+ normalized = normalized.replace(/\$\$\$\$/g, '$$');
153
 
154
  return normalized;
155
  }