fraudTech commited on
Commit
58c3261
·
1 Parent(s): 4cba7bd

fix latex

Browse files
Files changed (2) hide show
  1. web/src/App.tsx +1 -1
  2. web/src/math-preprocessing.ts +6 -51
web/src/App.tsx CHANGED
@@ -7,7 +7,7 @@ import rehypeKatex from 'rehype-katex';
7
  import 'katex/dist/katex.min.css';
8
  import Login from './Login';
9
  import './App.css';
10
- import { preprocessMathContent } from './mathjax-config';
11
 
12
 
13
  const LOGIC_SAYINGS = [
 
7
  import 'katex/dist/katex.min.css';
8
  import Login from './Login';
9
  import './App.css';
10
+ import { preprocessMathContent } from './math-preprocessing';
11
 
12
 
13
  const LOGIC_SAYINGS = [
web/src/math-preprocessing.ts CHANGED
@@ -1,59 +1,14 @@
1
  /**
2
- * MathJax Configuration for EVO AI
3
  *
4
- * This configures MathJax v3 for optimal math rendering.
5
- * MathJax supports full AMS-LaTeX environments (align, equation, etc.)
6
- * that KaTeX cannot handle.
7
  */
8
 
9
- export const mathJaxConfig = {
10
- tex: {
11
- // Math delimiters
12
- inlineMath: [
13
- ['$', '$'],
14
- ['\\(', '\\)']
15
- ],
16
- displayMath: [
17
- ['$$', '$$'],
18
- ['\\[', '\\]']
19
- ],
20
- // Load AMS packages
21
- packages: ['base', 'ams', 'amscd', 'boldsymbol', 'newcommand'],
22
- // Process escaped dollar signs (\$)
23
- processEscapes: true,
24
- // Process \begin{...}...\end{...} environments
25
- processEnvironments: true,
26
- // Custom macros
27
- macros: {
28
- R: '{\\mathbb{R}}',
29
- N: '{\\mathbb{N}}',
30
- Z: '{\\mathbb{Z}}',
31
- Q: '{\\mathbb{Q}}',
32
- C: '{\\mathbb{C}}',
33
- },
34
- // Equation numbering
35
- tags: 'ams',
36
- },
37
- svg: {
38
- fontCache: 'global',
39
- scale: 1.0,
40
- matchFontHeight: true,
41
- },
42
- options: {
43
- // Skip math inside code blocks
44
- skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
45
- // Include classes for styling
46
- includeHtmlTags: {
47
- br: '\n',
48
- wbr: '',
49
- '#comment': ''
50
- }
51
- }
52
- };
53
-
54
  /**
55
- * Process content to make it MathJax-safe
56
- * Handles common issues that break MathJax rendering
57
  */
58
  export function preprocessMathContent(content: string): string {
59
  if (!content) return content;
 
1
  /**
2
+ * Math Preprocessing for KaTeX Rendering
3
  *
4
+ * This file contains utilities to preprocess mathematical content before
5
+ * KaTeX rendering. It handles common LaTeX formatting issues, delimiter
6
+ * normalization, and edge cases that would otherwise break rendering.
7
  */
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  /**
10
+ * Preprocesses content to make it KaTeX-compatible.
11
+ * Handles common issues that break KaTeX rendering.
12
  */
13
  export function preprocessMathContent(content: string): string {
14
  if (!content) return content;