ed-mathml2tex 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mathml2latex.browser.cjs.js +39 -12
- package/lib/mathml2latex.browser.es.js +39 -12
- package/lib/mathml2latex.browser.umd.js +39 -12
- package/lib/mathml2latex.cjs.js +39 -12
- package/lib/mathml2latex.es.js +39 -12
- package/lib/mathml2latex.umd.js +39 -12
- package/package.json +1 -1
|
@@ -643,15 +643,16 @@ function toLatex(result) {
|
|
|
643
643
|
result = result.replace(/([A-Za-z0-9]+)_([0-9])\^\{\\rightarrow\}/g, "\\overrightarrow{$1_$2}");
|
|
644
644
|
result = result.replace(/(\([^()]+\))\^\{\\rightarrow\}/g, "\\overrightarrow{$1}");
|
|
645
645
|
|
|
646
|
+
// Remove or comment out these lines in toLatex function
|
|
646
647
|
// Thêm xử lý các ký hiệu toán học phổ biến
|
|
647
|
-
result = result.replace(/≤/g, "\\leq");
|
|
648
|
-
result = result.replace(/≥/g, "\\geq");
|
|
649
|
-
result = result.replace(/≠/g, "\\neq");
|
|
650
|
-
result = result.replace(/≈/g, "\\approx");
|
|
651
|
-
result = result.replace(/π/g, "\\pi");
|
|
652
|
-
result = result.replace(/α/g, "\\alpha");
|
|
653
|
-
result = result.replace(/β/g, "\\beta");
|
|
654
|
-
result = result.replace(/γ/g, "\\gamma");
|
|
648
|
+
// result = result.replace(/≤/g, "\\leq");
|
|
649
|
+
// result = result.replace(/≥/g, "\\geq");
|
|
650
|
+
// result = result.replace(/≠/g, "\\neq");
|
|
651
|
+
// result = result.replace(/≈/g, "\\approx");
|
|
652
|
+
// result = result.replace(/π/g, "\\pi"); // Comment out or remove this line
|
|
653
|
+
// result = result.replace(/α/g, "\\alpha");
|
|
654
|
+
// result = result.replace(/β/g, "\\beta");
|
|
655
|
+
// result = result.replace(/γ/g, "\\gamma");
|
|
655
656
|
|
|
656
657
|
return result;
|
|
657
658
|
}
|
|
@@ -774,9 +775,25 @@ function parseElementMs(node) {
|
|
|
774
775
|
|
|
775
776
|
// Math Text
|
|
776
777
|
function parseElementMtext(node) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
778
|
+
let content = NodeTool.getNodeText(node)
|
|
779
|
+
// Handle operators and spacing only
|
|
780
|
+
.replace(/\s*=\s*/g, ' = ')
|
|
781
|
+
.replace(/\s*\.\s*/g, ' \\cdot ')
|
|
782
|
+
.trim();
|
|
783
|
+
|
|
784
|
+
// Handle units with proper \mathrm formatting
|
|
785
|
+
if (content.includes('(') && content.includes(')')) {
|
|
786
|
+
const parts = content.split(/(\([^)]+\))/);
|
|
787
|
+
content = parts.map(part => {
|
|
788
|
+
if (part.startsWith('(') && part.endsWith(')')) {
|
|
789
|
+
// Keep original characters in units
|
|
790
|
+
return `\\mathrm{${part}}`;
|
|
791
|
+
}
|
|
792
|
+
return part;
|
|
793
|
+
}).join('');
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
return content;
|
|
780
797
|
}
|
|
781
798
|
|
|
782
799
|
// Math glyph (image)
|
|
@@ -1031,8 +1048,18 @@ function getRender(node) {
|
|
|
1031
1048
|
const overText = NodeTool.getNodeText(childrenArray[1])?.trim() || '';
|
|
1032
1049
|
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1033
1050
|
|
|
1051
|
+
// Handle biology notation (double overline)
|
|
1052
|
+
if (overText === "¯") {
|
|
1053
|
+
const parentNode = node.parentNode;
|
|
1054
|
+
// Check if this is part of a double overline structure
|
|
1055
|
+
if (NodeTool.getNodeName(parentNode) === 'mover' &&
|
|
1056
|
+
NodeTool.getNodeText(parentNode.lastChild)?.trim() === '¯') {
|
|
1057
|
+
return `\\overline{${base}}`;
|
|
1058
|
+
}
|
|
1059
|
+
return `\\overline{${base}}`;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1034
1062
|
if (overText === "→" && isAccent) return `\\vec{${base}}`;
|
|
1035
|
-
if (overText === "¯" && isAccent) return `\\overline{${base}}`;
|
|
1036
1063
|
if (overText === "^" && isAccent) return `\\hat{${base}}`;
|
|
1037
1064
|
return `\\overset{${over}}{${base}}`;
|
|
1038
1065
|
};
|
|
@@ -641,15 +641,16 @@ function toLatex(result) {
|
|
|
641
641
|
result = result.replace(/([A-Za-z0-9]+)_([0-9])\^\{\\rightarrow\}/g, "\\overrightarrow{$1_$2}");
|
|
642
642
|
result = result.replace(/(\([^()]+\))\^\{\\rightarrow\}/g, "\\overrightarrow{$1}");
|
|
643
643
|
|
|
644
|
+
// Remove or comment out these lines in toLatex function
|
|
644
645
|
// Thêm xử lý các ký hiệu toán học phổ biến
|
|
645
|
-
result = result.replace(/≤/g, "\\leq");
|
|
646
|
-
result = result.replace(/≥/g, "\\geq");
|
|
647
|
-
result = result.replace(/≠/g, "\\neq");
|
|
648
|
-
result = result.replace(/≈/g, "\\approx");
|
|
649
|
-
result = result.replace(/π/g, "\\pi");
|
|
650
|
-
result = result.replace(/α/g, "\\alpha");
|
|
651
|
-
result = result.replace(/β/g, "\\beta");
|
|
652
|
-
result = result.replace(/γ/g, "\\gamma");
|
|
646
|
+
// result = result.replace(/≤/g, "\\leq");
|
|
647
|
+
// result = result.replace(/≥/g, "\\geq");
|
|
648
|
+
// result = result.replace(/≠/g, "\\neq");
|
|
649
|
+
// result = result.replace(/≈/g, "\\approx");
|
|
650
|
+
// result = result.replace(/π/g, "\\pi"); // Comment out or remove this line
|
|
651
|
+
// result = result.replace(/α/g, "\\alpha");
|
|
652
|
+
// result = result.replace(/β/g, "\\beta");
|
|
653
|
+
// result = result.replace(/γ/g, "\\gamma");
|
|
653
654
|
|
|
654
655
|
return result;
|
|
655
656
|
}
|
|
@@ -772,9 +773,25 @@ function parseElementMs(node) {
|
|
|
772
773
|
|
|
773
774
|
// Math Text
|
|
774
775
|
function parseElementMtext(node) {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
776
|
+
let content = NodeTool.getNodeText(node)
|
|
777
|
+
// Handle operators and spacing only
|
|
778
|
+
.replace(/\s*=\s*/g, ' = ')
|
|
779
|
+
.replace(/\s*\.\s*/g, ' \\cdot ')
|
|
780
|
+
.trim();
|
|
781
|
+
|
|
782
|
+
// Handle units with proper \mathrm formatting
|
|
783
|
+
if (content.includes('(') && content.includes(')')) {
|
|
784
|
+
const parts = content.split(/(\([^)]+\))/);
|
|
785
|
+
content = parts.map(part => {
|
|
786
|
+
if (part.startsWith('(') && part.endsWith(')')) {
|
|
787
|
+
// Keep original characters in units
|
|
788
|
+
return `\\mathrm{${part}}`;
|
|
789
|
+
}
|
|
790
|
+
return part;
|
|
791
|
+
}).join('');
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
return content;
|
|
778
795
|
}
|
|
779
796
|
|
|
780
797
|
// Math glyph (image)
|
|
@@ -1029,8 +1046,18 @@ function getRender(node) {
|
|
|
1029
1046
|
const overText = NodeTool.getNodeText(childrenArray[1])?.trim() || '';
|
|
1030
1047
|
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1031
1048
|
|
|
1049
|
+
// Handle biology notation (double overline)
|
|
1050
|
+
if (overText === "¯") {
|
|
1051
|
+
const parentNode = node.parentNode;
|
|
1052
|
+
// Check if this is part of a double overline structure
|
|
1053
|
+
if (NodeTool.getNodeName(parentNode) === 'mover' &&
|
|
1054
|
+
NodeTool.getNodeText(parentNode.lastChild)?.trim() === '¯') {
|
|
1055
|
+
return `\\overline{${base}}`;
|
|
1056
|
+
}
|
|
1057
|
+
return `\\overline{${base}}`;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1032
1060
|
if (overText === "→" && isAccent) return `\\vec{${base}}`;
|
|
1033
|
-
if (overText === "¯" && isAccent) return `\\overline{${base}}`;
|
|
1034
1061
|
if (overText === "^" && isAccent) return `\\hat{${base}}`;
|
|
1035
1062
|
return `\\overset{${over}}{${base}}`;
|
|
1036
1063
|
};
|
|
@@ -647,15 +647,16 @@
|
|
|
647
647
|
result = result.replace(/([A-Za-z0-9]+)_([0-9])\^\{\\rightarrow\}/g, "\\overrightarrow{$1_$2}");
|
|
648
648
|
result = result.replace(/(\([^()]+\))\^\{\\rightarrow\}/g, "\\overrightarrow{$1}");
|
|
649
649
|
|
|
650
|
+
// Remove or comment out these lines in toLatex function
|
|
650
651
|
// Thêm xử lý các ký hiệu toán học phổ biến
|
|
651
|
-
result = result.replace(/≤/g, "\\leq");
|
|
652
|
-
result = result.replace(/≥/g, "\\geq");
|
|
653
|
-
result = result.replace(/≠/g, "\\neq");
|
|
654
|
-
result = result.replace(/≈/g, "\\approx");
|
|
655
|
-
result = result.replace(/π/g, "\\pi");
|
|
656
|
-
result = result.replace(/α/g, "\\alpha");
|
|
657
|
-
result = result.replace(/β/g, "\\beta");
|
|
658
|
-
result = result.replace(/γ/g, "\\gamma");
|
|
652
|
+
// result = result.replace(/≤/g, "\\leq");
|
|
653
|
+
// result = result.replace(/≥/g, "\\geq");
|
|
654
|
+
// result = result.replace(/≠/g, "\\neq");
|
|
655
|
+
// result = result.replace(/≈/g, "\\approx");
|
|
656
|
+
// result = result.replace(/π/g, "\\pi"); // Comment out or remove this line
|
|
657
|
+
// result = result.replace(/α/g, "\\alpha");
|
|
658
|
+
// result = result.replace(/β/g, "\\beta");
|
|
659
|
+
// result = result.replace(/γ/g, "\\gamma");
|
|
659
660
|
|
|
660
661
|
return result;
|
|
661
662
|
}
|
|
@@ -778,9 +779,25 @@
|
|
|
778
779
|
|
|
779
780
|
// Math Text
|
|
780
781
|
function parseElementMtext(node) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
782
|
+
let content = NodeTool.getNodeText(node)
|
|
783
|
+
// Handle operators and spacing only
|
|
784
|
+
.replace(/\s*=\s*/g, ' = ')
|
|
785
|
+
.replace(/\s*\.\s*/g, ' \\cdot ')
|
|
786
|
+
.trim();
|
|
787
|
+
|
|
788
|
+
// Handle units with proper \mathrm formatting
|
|
789
|
+
if (content.includes('(') && content.includes(')')) {
|
|
790
|
+
const parts = content.split(/(\([^)]+\))/);
|
|
791
|
+
content = parts.map(part => {
|
|
792
|
+
if (part.startsWith('(') && part.endsWith(')')) {
|
|
793
|
+
// Keep original characters in units
|
|
794
|
+
return `\\mathrm{${part}}`;
|
|
795
|
+
}
|
|
796
|
+
return part;
|
|
797
|
+
}).join('');
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return content;
|
|
784
801
|
}
|
|
785
802
|
|
|
786
803
|
// Math glyph (image)
|
|
@@ -1035,8 +1052,18 @@
|
|
|
1035
1052
|
const overText = NodeTool.getNodeText(childrenArray[1])?.trim() || '';
|
|
1036
1053
|
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1037
1054
|
|
|
1055
|
+
// Handle biology notation (double overline)
|
|
1056
|
+
if (overText === "¯") {
|
|
1057
|
+
const parentNode = node.parentNode;
|
|
1058
|
+
// Check if this is part of a double overline structure
|
|
1059
|
+
if (NodeTool.getNodeName(parentNode) === 'mover' &&
|
|
1060
|
+
NodeTool.getNodeText(parentNode.lastChild)?.trim() === '¯') {
|
|
1061
|
+
return `\\overline{${base}}`;
|
|
1062
|
+
}
|
|
1063
|
+
return `\\overline{${base}}`;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1038
1066
|
if (overText === "→" && isAccent) return `\\vec{${base}}`;
|
|
1039
|
-
if (overText === "¯" && isAccent) return `\\overline{${base}}`;
|
|
1040
1067
|
if (overText === "^" && isAccent) return `\\hat{${base}}`;
|
|
1041
1068
|
return `\\overset{${over}}{${base}}`;
|
|
1042
1069
|
};
|
package/lib/mathml2latex.cjs.js
CHANGED
|
@@ -643,15 +643,16 @@ function toLatex(result) {
|
|
|
643
643
|
result = result.replace(/([A-Za-z0-9]+)_([0-9])\^\{\\rightarrow\}/g, "\\overrightarrow{$1_$2}");
|
|
644
644
|
result = result.replace(/(\([^()]+\))\^\{\\rightarrow\}/g, "\\overrightarrow{$1}");
|
|
645
645
|
|
|
646
|
+
// Remove or comment out these lines in toLatex function
|
|
646
647
|
// Thêm xử lý các ký hiệu toán học phổ biến
|
|
647
|
-
result = result.replace(/≤/g, "\\leq");
|
|
648
|
-
result = result.replace(/≥/g, "\\geq");
|
|
649
|
-
result = result.replace(/≠/g, "\\neq");
|
|
650
|
-
result = result.replace(/≈/g, "\\approx");
|
|
651
|
-
result = result.replace(/π/g, "\\pi");
|
|
652
|
-
result = result.replace(/α/g, "\\alpha");
|
|
653
|
-
result = result.replace(/β/g, "\\beta");
|
|
654
|
-
result = result.replace(/γ/g, "\\gamma");
|
|
648
|
+
// result = result.replace(/≤/g, "\\leq");
|
|
649
|
+
// result = result.replace(/≥/g, "\\geq");
|
|
650
|
+
// result = result.replace(/≠/g, "\\neq");
|
|
651
|
+
// result = result.replace(/≈/g, "\\approx");
|
|
652
|
+
// result = result.replace(/π/g, "\\pi"); // Comment out or remove this line
|
|
653
|
+
// result = result.replace(/α/g, "\\alpha");
|
|
654
|
+
// result = result.replace(/β/g, "\\beta");
|
|
655
|
+
// result = result.replace(/γ/g, "\\gamma");
|
|
655
656
|
|
|
656
657
|
return result;
|
|
657
658
|
}
|
|
@@ -774,9 +775,25 @@ function parseElementMs(node) {
|
|
|
774
775
|
|
|
775
776
|
// Math Text
|
|
776
777
|
function parseElementMtext(node) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
778
|
+
let content = NodeTool.getNodeText(node)
|
|
779
|
+
// Handle operators and spacing only
|
|
780
|
+
.replace(/\s*=\s*/g, ' = ')
|
|
781
|
+
.replace(/\s*\.\s*/g, ' \\cdot ')
|
|
782
|
+
.trim();
|
|
783
|
+
|
|
784
|
+
// Handle units with proper \mathrm formatting
|
|
785
|
+
if (content.includes('(') && content.includes(')')) {
|
|
786
|
+
const parts = content.split(/(\([^)]+\))/);
|
|
787
|
+
content = parts.map(part => {
|
|
788
|
+
if (part.startsWith('(') && part.endsWith(')')) {
|
|
789
|
+
// Keep original characters in units
|
|
790
|
+
return `\\mathrm{${part}}`;
|
|
791
|
+
}
|
|
792
|
+
return part;
|
|
793
|
+
}).join('');
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
return content;
|
|
780
797
|
}
|
|
781
798
|
|
|
782
799
|
// Math glyph (image)
|
|
@@ -1031,8 +1048,18 @@ function getRender(node) {
|
|
|
1031
1048
|
const overText = NodeTool.getNodeText(childrenArray[1])?.trim() || '';
|
|
1032
1049
|
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1033
1050
|
|
|
1051
|
+
// Handle biology notation (double overline)
|
|
1052
|
+
if (overText === "¯") {
|
|
1053
|
+
const parentNode = node.parentNode;
|
|
1054
|
+
// Check if this is part of a double overline structure
|
|
1055
|
+
if (NodeTool.getNodeName(parentNode) === 'mover' &&
|
|
1056
|
+
NodeTool.getNodeText(parentNode.lastChild)?.trim() === '¯') {
|
|
1057
|
+
return `\\overline{${base}}`;
|
|
1058
|
+
}
|
|
1059
|
+
return `\\overline{${base}}`;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1034
1062
|
if (overText === "→" && isAccent) return `\\vec{${base}}`;
|
|
1035
|
-
if (overText === "¯" && isAccent) return `\\overline{${base}}`;
|
|
1036
1063
|
if (overText === "^" && isAccent) return `\\hat{${base}}`;
|
|
1037
1064
|
return `\\overset{${over}}{${base}}`;
|
|
1038
1065
|
};
|
package/lib/mathml2latex.es.js
CHANGED
|
@@ -641,15 +641,16 @@ function toLatex(result) {
|
|
|
641
641
|
result = result.replace(/([A-Za-z0-9]+)_([0-9])\^\{\\rightarrow\}/g, "\\overrightarrow{$1_$2}");
|
|
642
642
|
result = result.replace(/(\([^()]+\))\^\{\\rightarrow\}/g, "\\overrightarrow{$1}");
|
|
643
643
|
|
|
644
|
+
// Remove or comment out these lines in toLatex function
|
|
644
645
|
// Thêm xử lý các ký hiệu toán học phổ biến
|
|
645
|
-
result = result.replace(/≤/g, "\\leq");
|
|
646
|
-
result = result.replace(/≥/g, "\\geq");
|
|
647
|
-
result = result.replace(/≠/g, "\\neq");
|
|
648
|
-
result = result.replace(/≈/g, "\\approx");
|
|
649
|
-
result = result.replace(/π/g, "\\pi");
|
|
650
|
-
result = result.replace(/α/g, "\\alpha");
|
|
651
|
-
result = result.replace(/β/g, "\\beta");
|
|
652
|
-
result = result.replace(/γ/g, "\\gamma");
|
|
646
|
+
// result = result.replace(/≤/g, "\\leq");
|
|
647
|
+
// result = result.replace(/≥/g, "\\geq");
|
|
648
|
+
// result = result.replace(/≠/g, "\\neq");
|
|
649
|
+
// result = result.replace(/≈/g, "\\approx");
|
|
650
|
+
// result = result.replace(/π/g, "\\pi"); // Comment out or remove this line
|
|
651
|
+
// result = result.replace(/α/g, "\\alpha");
|
|
652
|
+
// result = result.replace(/β/g, "\\beta");
|
|
653
|
+
// result = result.replace(/γ/g, "\\gamma");
|
|
653
654
|
|
|
654
655
|
return result;
|
|
655
656
|
}
|
|
@@ -772,9 +773,25 @@ function parseElementMs(node) {
|
|
|
772
773
|
|
|
773
774
|
// Math Text
|
|
774
775
|
function parseElementMtext(node) {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
776
|
+
let content = NodeTool.getNodeText(node)
|
|
777
|
+
// Handle operators and spacing only
|
|
778
|
+
.replace(/\s*=\s*/g, ' = ')
|
|
779
|
+
.replace(/\s*\.\s*/g, ' \\cdot ')
|
|
780
|
+
.trim();
|
|
781
|
+
|
|
782
|
+
// Handle units with proper \mathrm formatting
|
|
783
|
+
if (content.includes('(') && content.includes(')')) {
|
|
784
|
+
const parts = content.split(/(\([^)]+\))/);
|
|
785
|
+
content = parts.map(part => {
|
|
786
|
+
if (part.startsWith('(') && part.endsWith(')')) {
|
|
787
|
+
// Keep original characters in units
|
|
788
|
+
return `\\mathrm{${part}}`;
|
|
789
|
+
}
|
|
790
|
+
return part;
|
|
791
|
+
}).join('');
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
return content;
|
|
778
795
|
}
|
|
779
796
|
|
|
780
797
|
// Math glyph (image)
|
|
@@ -1029,8 +1046,18 @@ function getRender(node) {
|
|
|
1029
1046
|
const overText = NodeTool.getNodeText(childrenArray[1])?.trim() || '';
|
|
1030
1047
|
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1031
1048
|
|
|
1049
|
+
// Handle biology notation (double overline)
|
|
1050
|
+
if (overText === "¯") {
|
|
1051
|
+
const parentNode = node.parentNode;
|
|
1052
|
+
// Check if this is part of a double overline structure
|
|
1053
|
+
if (NodeTool.getNodeName(parentNode) === 'mover' &&
|
|
1054
|
+
NodeTool.getNodeText(parentNode.lastChild)?.trim() === '¯') {
|
|
1055
|
+
return `\\overline{${base}}`;
|
|
1056
|
+
}
|
|
1057
|
+
return `\\overline{${base}}`;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1032
1060
|
if (overText === "→" && isAccent) return `\\vec{${base}}`;
|
|
1033
|
-
if (overText === "¯" && isAccent) return `\\overline{${base}}`;
|
|
1034
1061
|
if (overText === "^" && isAccent) return `\\hat{${base}}`;
|
|
1035
1062
|
return `\\overset{${over}}{${base}}`;
|
|
1036
1063
|
};
|
package/lib/mathml2latex.umd.js
CHANGED
|
@@ -647,15 +647,16 @@
|
|
|
647
647
|
result = result.replace(/([A-Za-z0-9]+)_([0-9])\^\{\\rightarrow\}/g, "\\overrightarrow{$1_$2}");
|
|
648
648
|
result = result.replace(/(\([^()]+\))\^\{\\rightarrow\}/g, "\\overrightarrow{$1}");
|
|
649
649
|
|
|
650
|
+
// Remove or comment out these lines in toLatex function
|
|
650
651
|
// Thêm xử lý các ký hiệu toán học phổ biến
|
|
651
|
-
result = result.replace(/≤/g, "\\leq");
|
|
652
|
-
result = result.replace(/≥/g, "\\geq");
|
|
653
|
-
result = result.replace(/≠/g, "\\neq");
|
|
654
|
-
result = result.replace(/≈/g, "\\approx");
|
|
655
|
-
result = result.replace(/π/g, "\\pi");
|
|
656
|
-
result = result.replace(/α/g, "\\alpha");
|
|
657
|
-
result = result.replace(/β/g, "\\beta");
|
|
658
|
-
result = result.replace(/γ/g, "\\gamma");
|
|
652
|
+
// result = result.replace(/≤/g, "\\leq");
|
|
653
|
+
// result = result.replace(/≥/g, "\\geq");
|
|
654
|
+
// result = result.replace(/≠/g, "\\neq");
|
|
655
|
+
// result = result.replace(/≈/g, "\\approx");
|
|
656
|
+
// result = result.replace(/π/g, "\\pi"); // Comment out or remove this line
|
|
657
|
+
// result = result.replace(/α/g, "\\alpha");
|
|
658
|
+
// result = result.replace(/β/g, "\\beta");
|
|
659
|
+
// result = result.replace(/γ/g, "\\gamma");
|
|
659
660
|
|
|
660
661
|
return result;
|
|
661
662
|
}
|
|
@@ -778,9 +779,25 @@
|
|
|
778
779
|
|
|
779
780
|
// Math Text
|
|
780
781
|
function parseElementMtext(node) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
782
|
+
let content = NodeTool.getNodeText(node)
|
|
783
|
+
// Handle operators and spacing only
|
|
784
|
+
.replace(/\s*=\s*/g, ' = ')
|
|
785
|
+
.replace(/\s*\.\s*/g, ' \\cdot ')
|
|
786
|
+
.trim();
|
|
787
|
+
|
|
788
|
+
// Handle units with proper \mathrm formatting
|
|
789
|
+
if (content.includes('(') && content.includes(')')) {
|
|
790
|
+
const parts = content.split(/(\([^)]+\))/);
|
|
791
|
+
content = parts.map(part => {
|
|
792
|
+
if (part.startsWith('(') && part.endsWith(')')) {
|
|
793
|
+
// Keep original characters in units
|
|
794
|
+
return `\\mathrm{${part}}`;
|
|
795
|
+
}
|
|
796
|
+
return part;
|
|
797
|
+
}).join('');
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return content;
|
|
784
801
|
}
|
|
785
802
|
|
|
786
803
|
// Math glyph (image)
|
|
@@ -1035,8 +1052,18 @@
|
|
|
1035
1052
|
const overText = NodeTool.getNodeText(childrenArray[1])?.trim() || '';
|
|
1036
1053
|
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1037
1054
|
|
|
1055
|
+
// Handle biology notation (double overline)
|
|
1056
|
+
if (overText === "¯") {
|
|
1057
|
+
const parentNode = node.parentNode;
|
|
1058
|
+
// Check if this is part of a double overline structure
|
|
1059
|
+
if (NodeTool.getNodeName(parentNode) === 'mover' &&
|
|
1060
|
+
NodeTool.getNodeText(parentNode.lastChild)?.trim() === '¯') {
|
|
1061
|
+
return `\\overline{${base}}`;
|
|
1062
|
+
}
|
|
1063
|
+
return `\\overline{${base}}`;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1038
1066
|
if (overText === "→" && isAccent) return `\\vec{${base}}`;
|
|
1039
|
-
if (overText === "¯" && isAccent) return `\\overline{${base}}`;
|
|
1040
1067
|
if (overText === "^" && isAccent) return `\\hat{${base}}`;
|
|
1041
1068
|
return `\\overset{${over}}{${base}}`;
|
|
1042
1069
|
};
|