ed-mathml2tex 0.0.4 → 0.0.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 +47 -40
- package/lib/mathml2latex.browser.es.js +47 -40
- package/lib/mathml2latex.browser.umd.js +47 -40
- package/lib/mathml2latex.cjs.js +47 -40
- package/lib/mathml2latex.es.js +47 -40
- package/lib/mathml2latex.umd.js +47 -40
- package/package.json +1 -1
|
@@ -1028,50 +1028,57 @@ function renderMmultiscripts(node, children) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
1030
|
function renderMover(node, children) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
if (isMrow) {
|
|
1047
|
-
// Handle case like AB or AI
|
|
1048
|
-
const base = parse(baseNode);
|
|
1049
|
-
const overNode = children[1];
|
|
1050
|
-
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1051
|
-
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1052
|
-
|
|
1053
|
-
if (overText === "→" && isAccent) {
|
|
1054
|
-
return `\\overrightarrow{${base}}`;
|
|
1031
|
+
const nodes = flattenNodeTreeByNodeName(node, 'mover');
|
|
1032
|
+
let result = undefined;
|
|
1033
|
+
|
|
1034
|
+
// Get the base node and check if it's a subscript or mrow
|
|
1035
|
+
const baseNode = children[0];
|
|
1036
|
+
const nodeName = NodeTool.getNodeName(baseNode);
|
|
1037
|
+
const isSubscript = nodeName === 'msub';
|
|
1038
|
+
const isMrow = nodeName === 'mrow';
|
|
1039
|
+
|
|
1040
|
+
if (isSubscript) {
|
|
1041
|
+
// Handle case like n₂ with arrow
|
|
1042
|
+
const base = parse(baseNode);
|
|
1043
|
+
return `\\overrightarrow{${base}}`;
|
|
1055
1044
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1045
|
+
|
|
1046
|
+
if (isMrow) {
|
|
1047
|
+
// Handle case like 0 with arrow
|
|
1048
|
+
const base = parse(baseNode);
|
|
1049
|
+
const overNode = children[1];
|
|
1050
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1051
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1052
|
+
|
|
1053
|
+
if (overText === "→" && isAccent) {
|
|
1054
|
+
return `\\overrightarrow{${base}}`;
|
|
1055
|
+
}
|
|
1061
1056
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1057
|
+
|
|
1058
|
+
// Handle case where there is no base (like your example with just 0 and an arrow)
|
|
1059
|
+
const overNode = children[1];
|
|
1064
1060
|
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
if (overText === "→" && isAccent) {
|
|
1068
|
-
return `\\overrightarrow{${result}}`;
|
|
1061
|
+
if (overText === "→") {
|
|
1062
|
+
return `\\overrightarrow{0}`;
|
|
1069
1063
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1064
|
+
|
|
1065
|
+
for (let i = 0; i < nodes.length - 1; i++) {
|
|
1066
|
+
if (!result) {
|
|
1067
|
+
result = parse(nodes[i]);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
const overNode = nodes[i + 1];
|
|
1071
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1072
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1073
|
+
|
|
1074
|
+
if (overText === "→" && isAccent) {
|
|
1075
|
+
return `\\overrightarrow{${result}}`;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
const over = parse(overNode);
|
|
1079
|
+
result = `${result}^{${over}}`;
|
|
1080
|
+
}
|
|
1081
|
+
return result;
|
|
1075
1082
|
}
|
|
1076
1083
|
|
|
1077
1084
|
function renderMunder(node, children){
|
|
@@ -1026,50 +1026,57 @@ function renderMmultiscripts(node, children) {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
1028
|
function renderMover(node, children) {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
if (isMrow) {
|
|
1045
|
-
// Handle case like AB or AI
|
|
1046
|
-
const base = parse(baseNode);
|
|
1047
|
-
const overNode = children[1];
|
|
1048
|
-
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1049
|
-
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1050
|
-
|
|
1051
|
-
if (overText === "→" && isAccent) {
|
|
1052
|
-
return `\\overrightarrow{${base}}`;
|
|
1029
|
+
const nodes = flattenNodeTreeByNodeName(node, 'mover');
|
|
1030
|
+
let result = undefined;
|
|
1031
|
+
|
|
1032
|
+
// Get the base node and check if it's a subscript or mrow
|
|
1033
|
+
const baseNode = children[0];
|
|
1034
|
+
const nodeName = NodeTool.getNodeName(baseNode);
|
|
1035
|
+
const isSubscript = nodeName === 'msub';
|
|
1036
|
+
const isMrow = nodeName === 'mrow';
|
|
1037
|
+
|
|
1038
|
+
if (isSubscript) {
|
|
1039
|
+
// Handle case like n₂ with arrow
|
|
1040
|
+
const base = parse(baseNode);
|
|
1041
|
+
return `\\overrightarrow{${base}}`;
|
|
1053
1042
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1043
|
+
|
|
1044
|
+
if (isMrow) {
|
|
1045
|
+
// Handle case like 0 with arrow
|
|
1046
|
+
const base = parse(baseNode);
|
|
1047
|
+
const overNode = children[1];
|
|
1048
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1049
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1050
|
+
|
|
1051
|
+
if (overText === "→" && isAccent) {
|
|
1052
|
+
return `\\overrightarrow{${base}}`;
|
|
1053
|
+
}
|
|
1059
1054
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1055
|
+
|
|
1056
|
+
// Handle case where there is no base (like your example with just 0 and an arrow)
|
|
1057
|
+
const overNode = children[1];
|
|
1062
1058
|
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
if (overText === "→" && isAccent) {
|
|
1066
|
-
return `\\overrightarrow{${result}}`;
|
|
1059
|
+
if (overText === "→") {
|
|
1060
|
+
return `\\overrightarrow{0}`;
|
|
1067
1061
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1062
|
+
|
|
1063
|
+
for (let i = 0; i < nodes.length - 1; i++) {
|
|
1064
|
+
if (!result) {
|
|
1065
|
+
result = parse(nodes[i]);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
const overNode = nodes[i + 1];
|
|
1069
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1070
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1071
|
+
|
|
1072
|
+
if (overText === "→" && isAccent) {
|
|
1073
|
+
return `\\overrightarrow{${result}}`;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
const over = parse(overNode);
|
|
1077
|
+
result = `${result}^{${over}}`;
|
|
1078
|
+
}
|
|
1079
|
+
return result;
|
|
1073
1080
|
}
|
|
1074
1081
|
|
|
1075
1082
|
function renderMunder(node, children){
|
|
@@ -1032,50 +1032,57 @@
|
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
1034
|
function renderMover(node, children) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
if (isMrow) {
|
|
1051
|
-
// Handle case like AB or AI
|
|
1052
|
-
const base = parse(baseNode);
|
|
1053
|
-
const overNode = children[1];
|
|
1054
|
-
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1055
|
-
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1056
|
-
|
|
1057
|
-
if (overText === "→" && isAccent) {
|
|
1058
|
-
return `\\overrightarrow{${base}}`;
|
|
1035
|
+
const nodes = flattenNodeTreeByNodeName(node, 'mover');
|
|
1036
|
+
let result = undefined;
|
|
1037
|
+
|
|
1038
|
+
// Get the base node and check if it's a subscript or mrow
|
|
1039
|
+
const baseNode = children[0];
|
|
1040
|
+
const nodeName = NodeTool.getNodeName(baseNode);
|
|
1041
|
+
const isSubscript = nodeName === 'msub';
|
|
1042
|
+
const isMrow = nodeName === 'mrow';
|
|
1043
|
+
|
|
1044
|
+
if (isSubscript) {
|
|
1045
|
+
// Handle case like n₂ with arrow
|
|
1046
|
+
const base = parse(baseNode);
|
|
1047
|
+
return `\\overrightarrow{${base}}`;
|
|
1059
1048
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1049
|
+
|
|
1050
|
+
if (isMrow) {
|
|
1051
|
+
// Handle case like 0 with arrow
|
|
1052
|
+
const base = parse(baseNode);
|
|
1053
|
+
const overNode = children[1];
|
|
1054
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1055
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1056
|
+
|
|
1057
|
+
if (overText === "→" && isAccent) {
|
|
1058
|
+
return `\\overrightarrow{${base}}`;
|
|
1059
|
+
}
|
|
1065
1060
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1061
|
+
|
|
1062
|
+
// Handle case where there is no base (like your example with just 0 and an arrow)
|
|
1063
|
+
const overNode = children[1];
|
|
1068
1064
|
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
if (overText === "→" && isAccent) {
|
|
1072
|
-
return `\\overrightarrow{${result}}`;
|
|
1065
|
+
if (overText === "→") {
|
|
1066
|
+
return `\\overrightarrow{0}`;
|
|
1073
1067
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1068
|
+
|
|
1069
|
+
for (let i = 0; i < nodes.length - 1; i++) {
|
|
1070
|
+
if (!result) {
|
|
1071
|
+
result = parse(nodes[i]);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const overNode = nodes[i + 1];
|
|
1075
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1076
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1077
|
+
|
|
1078
|
+
if (overText === "→" && isAccent) {
|
|
1079
|
+
return `\\overrightarrow{${result}}`;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const over = parse(overNode);
|
|
1083
|
+
result = `${result}^{${over}}`;
|
|
1084
|
+
}
|
|
1085
|
+
return result;
|
|
1079
1086
|
}
|
|
1080
1087
|
|
|
1081
1088
|
function renderMunder(node, children){
|
package/lib/mathml2latex.cjs.js
CHANGED
|
@@ -1028,50 +1028,57 @@ function renderMmultiscripts(node, children) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
1030
|
function renderMover(node, children) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
if (isMrow) {
|
|
1047
|
-
// Handle case like AB or AI
|
|
1048
|
-
const base = parse(baseNode);
|
|
1049
|
-
const overNode = children[1];
|
|
1050
|
-
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1051
|
-
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1052
|
-
|
|
1053
|
-
if (overText === "→" && isAccent) {
|
|
1054
|
-
return `\\overrightarrow{${base}}`;
|
|
1031
|
+
const nodes = flattenNodeTreeByNodeName(node, 'mover');
|
|
1032
|
+
let result = undefined;
|
|
1033
|
+
|
|
1034
|
+
// Get the base node and check if it's a subscript or mrow
|
|
1035
|
+
const baseNode = children[0];
|
|
1036
|
+
const nodeName = NodeTool.getNodeName(baseNode);
|
|
1037
|
+
const isSubscript = nodeName === 'msub';
|
|
1038
|
+
const isMrow = nodeName === 'mrow';
|
|
1039
|
+
|
|
1040
|
+
if (isSubscript) {
|
|
1041
|
+
// Handle case like n₂ with arrow
|
|
1042
|
+
const base = parse(baseNode);
|
|
1043
|
+
return `\\overrightarrow{${base}}`;
|
|
1055
1044
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1045
|
+
|
|
1046
|
+
if (isMrow) {
|
|
1047
|
+
// Handle case like 0 with arrow
|
|
1048
|
+
const base = parse(baseNode);
|
|
1049
|
+
const overNode = children[1];
|
|
1050
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1051
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1052
|
+
|
|
1053
|
+
if (overText === "→" && isAccent) {
|
|
1054
|
+
return `\\overrightarrow{${base}}`;
|
|
1055
|
+
}
|
|
1061
1056
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1057
|
+
|
|
1058
|
+
// Handle case where there is no base (like your example with just 0 and an arrow)
|
|
1059
|
+
const overNode = children[1];
|
|
1064
1060
|
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
if (overText === "→" && isAccent) {
|
|
1068
|
-
return `\\overrightarrow{${result}}`;
|
|
1061
|
+
if (overText === "→") {
|
|
1062
|
+
return `\\overrightarrow{0}`;
|
|
1069
1063
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1064
|
+
|
|
1065
|
+
for (let i = 0; i < nodes.length - 1; i++) {
|
|
1066
|
+
if (!result) {
|
|
1067
|
+
result = parse(nodes[i]);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
const overNode = nodes[i + 1];
|
|
1071
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1072
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1073
|
+
|
|
1074
|
+
if (overText === "→" && isAccent) {
|
|
1075
|
+
return `\\overrightarrow{${result}}`;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
const over = parse(overNode);
|
|
1079
|
+
result = `${result}^{${over}}`;
|
|
1080
|
+
}
|
|
1081
|
+
return result;
|
|
1075
1082
|
}
|
|
1076
1083
|
|
|
1077
1084
|
function renderMunder(node, children){
|
package/lib/mathml2latex.es.js
CHANGED
|
@@ -1026,50 +1026,57 @@ function renderMmultiscripts(node, children) {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
1028
|
function renderMover(node, children) {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
if (isMrow) {
|
|
1045
|
-
// Handle case like AB or AI
|
|
1046
|
-
const base = parse(baseNode);
|
|
1047
|
-
const overNode = children[1];
|
|
1048
|
-
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1049
|
-
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1050
|
-
|
|
1051
|
-
if (overText === "→" && isAccent) {
|
|
1052
|
-
return `\\overrightarrow{${base}}`;
|
|
1029
|
+
const nodes = flattenNodeTreeByNodeName(node, 'mover');
|
|
1030
|
+
let result = undefined;
|
|
1031
|
+
|
|
1032
|
+
// Get the base node and check if it's a subscript or mrow
|
|
1033
|
+
const baseNode = children[0];
|
|
1034
|
+
const nodeName = NodeTool.getNodeName(baseNode);
|
|
1035
|
+
const isSubscript = nodeName === 'msub';
|
|
1036
|
+
const isMrow = nodeName === 'mrow';
|
|
1037
|
+
|
|
1038
|
+
if (isSubscript) {
|
|
1039
|
+
// Handle case like n₂ with arrow
|
|
1040
|
+
const base = parse(baseNode);
|
|
1041
|
+
return `\\overrightarrow{${base}}`;
|
|
1053
1042
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1043
|
+
|
|
1044
|
+
if (isMrow) {
|
|
1045
|
+
// Handle case like 0 with arrow
|
|
1046
|
+
const base = parse(baseNode);
|
|
1047
|
+
const overNode = children[1];
|
|
1048
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1049
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1050
|
+
|
|
1051
|
+
if (overText === "→" && isAccent) {
|
|
1052
|
+
return `\\overrightarrow{${base}}`;
|
|
1053
|
+
}
|
|
1059
1054
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1055
|
+
|
|
1056
|
+
// Handle case where there is no base (like your example with just 0 and an arrow)
|
|
1057
|
+
const overNode = children[1];
|
|
1062
1058
|
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
if (overText === "→" && isAccent) {
|
|
1066
|
-
return `\\overrightarrow{${result}}`;
|
|
1059
|
+
if (overText === "→") {
|
|
1060
|
+
return `\\overrightarrow{0}`;
|
|
1067
1061
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1062
|
+
|
|
1063
|
+
for (let i = 0; i < nodes.length - 1; i++) {
|
|
1064
|
+
if (!result) {
|
|
1065
|
+
result = parse(nodes[i]);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
const overNode = nodes[i + 1];
|
|
1069
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1070
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1071
|
+
|
|
1072
|
+
if (overText === "→" && isAccent) {
|
|
1073
|
+
return `\\overrightarrow{${result}}`;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
const over = parse(overNode);
|
|
1077
|
+
result = `${result}^{${over}}`;
|
|
1078
|
+
}
|
|
1079
|
+
return result;
|
|
1073
1080
|
}
|
|
1074
1081
|
|
|
1075
1082
|
function renderMunder(node, children){
|
package/lib/mathml2latex.umd.js
CHANGED
|
@@ -1032,50 +1032,57 @@
|
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
1034
|
function renderMover(node, children) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
if (isMrow) {
|
|
1051
|
-
// Handle case like AB or AI
|
|
1052
|
-
const base = parse(baseNode);
|
|
1053
|
-
const overNode = children[1];
|
|
1054
|
-
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1055
|
-
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1056
|
-
|
|
1057
|
-
if (overText === "→" && isAccent) {
|
|
1058
|
-
return `\\overrightarrow{${base}}`;
|
|
1035
|
+
const nodes = flattenNodeTreeByNodeName(node, 'mover');
|
|
1036
|
+
let result = undefined;
|
|
1037
|
+
|
|
1038
|
+
// Get the base node and check if it's a subscript or mrow
|
|
1039
|
+
const baseNode = children[0];
|
|
1040
|
+
const nodeName = NodeTool.getNodeName(baseNode);
|
|
1041
|
+
const isSubscript = nodeName === 'msub';
|
|
1042
|
+
const isMrow = nodeName === 'mrow';
|
|
1043
|
+
|
|
1044
|
+
if (isSubscript) {
|
|
1045
|
+
// Handle case like n₂ with arrow
|
|
1046
|
+
const base = parse(baseNode);
|
|
1047
|
+
return `\\overrightarrow{${base}}`;
|
|
1059
1048
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1049
|
+
|
|
1050
|
+
if (isMrow) {
|
|
1051
|
+
// Handle case like 0 with arrow
|
|
1052
|
+
const base = parse(baseNode);
|
|
1053
|
+
const overNode = children[1];
|
|
1054
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1055
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1056
|
+
|
|
1057
|
+
if (overText === "→" && isAccent) {
|
|
1058
|
+
return `\\overrightarrow{${base}}`;
|
|
1059
|
+
}
|
|
1065
1060
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1061
|
+
|
|
1062
|
+
// Handle case where there is no base (like your example with just 0 and an arrow)
|
|
1063
|
+
const overNode = children[1];
|
|
1068
1064
|
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
if (overText === "→" && isAccent) {
|
|
1072
|
-
return `\\overrightarrow{${result}}`;
|
|
1065
|
+
if (overText === "→") {
|
|
1066
|
+
return `\\overrightarrow{0}`;
|
|
1073
1067
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1068
|
+
|
|
1069
|
+
for (let i = 0; i < nodes.length - 1; i++) {
|
|
1070
|
+
if (!result) {
|
|
1071
|
+
result = parse(nodes[i]);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const overNode = nodes[i + 1];
|
|
1075
|
+
const overText = NodeTool.getNodeText(overNode).trim();
|
|
1076
|
+
const isAccent = NodeTool.getAttr(node, "accent", "false") === "true";
|
|
1077
|
+
|
|
1078
|
+
if (overText === "→" && isAccent) {
|
|
1079
|
+
return `\\overrightarrow{${result}}`;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const over = parse(overNode);
|
|
1083
|
+
result = `${result}^{${over}}`;
|
|
1084
|
+
}
|
|
1085
|
+
return result;
|
|
1079
1086
|
}
|
|
1080
1087
|
|
|
1081
1088
|
function renderMunder(node, children){
|