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