math-exercises 1.4.12 → 1.4.13
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.
|
@@ -20,7 +20,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
|
|
|
20
20
|
let leftTex = this.leftChild.toTex();
|
|
21
21
|
if (this.leftChild.type === node_1.NodeType.operator) {
|
|
22
22
|
if ([operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.multiply].includes(this.leftChild.id))
|
|
23
|
-
leftTex =
|
|
23
|
+
leftTex = `\\left(${leftTex}\\right)`;
|
|
24
24
|
}
|
|
25
25
|
let needBrackets = rightTex[0] === '-';
|
|
26
26
|
if (this.rightChild.type === node_1.NodeType.operator) {
|
|
@@ -28,7 +28,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
|
|
|
28
28
|
needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(operatorRightChild.id);
|
|
29
29
|
}
|
|
30
30
|
if (needBrackets)
|
|
31
|
-
rightTex =
|
|
31
|
+
rightTex = `\\left(${rightTex}\\right)`;
|
|
32
32
|
const nextIsLetter = rightTex[0].toLowerCase() !== rightTex[0].toUpperCase();
|
|
33
33
|
return `${leftTex}\\div${nextIsLetter ? ' ' : ''}${rightTex}`;
|
|
34
34
|
}
|
|
@@ -29,7 +29,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
|
|
|
29
29
|
}
|
|
30
30
|
if (this.leftChild.type === node_1.NodeType.operator) {
|
|
31
31
|
if ([operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(this.leftChild.id))
|
|
32
|
-
leftTex =
|
|
32
|
+
leftTex = `\\left(${leftTex}\\right)`;
|
|
33
33
|
}
|
|
34
34
|
let needBrackets = rightTex[0] === '-';
|
|
35
35
|
if (this.rightChild.type === node_1.NodeType.operator) {
|
|
@@ -37,7 +37,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
|
|
|
37
37
|
needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorRightChild.id);
|
|
38
38
|
}
|
|
39
39
|
if (needBrackets)
|
|
40
|
-
rightTex =
|
|
40
|
+
rightTex = `\\left(${rightTex}\\right)`;
|
|
41
41
|
// permet de gérer le cas 3*2^x par ex
|
|
42
42
|
let showTimesSign = this.forceTimesSign || !isNaN(+rightTex[0]) || this.rightChild.type === node_1.NodeType.number;
|
|
43
43
|
if (this.rightChild.type === node_1.NodeType.operator) {
|