math-exercises 3.0.76 → 3.0.78
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/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/calculateDistanceWithAbsoluteValue.js +112 -0
- package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/calculateWithAbsoluteValue.js +123 -0
- package/lib/exercises/math/calcul/arithmetics/compareInverseValues.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/compareInverseValues.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/compareInverseValues.js +136 -0
- package/lib/exercises/math/calcul/arithmetics/compareSquaredValues.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/compareSquaredValues.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/compareSquaredValues.js +143 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +5 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +5 -0
- package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/sqrtInequality.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/sqrtInequality.js +160 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.js +1 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +5 -1
- package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicEquation.js +33 -1
- package/lib/exercises/math/functions/basics/twoFunctionsEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/twoFunctionsEquation.js +27 -0
- package/lib/exercises/math/functions/cube/compareCubeValues.d.ts +8 -0
- package/lib/exercises/math/functions/cube/compareCubeValues.d.ts.map +1 -0
- package/lib/exercises/math/functions/cube/compareCubeValues.js +113 -0
- package/lib/exercises/math/functions/cube/index.d.ts +1 -0
- package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/index.js +1 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/sqrt/compareSqrtValues.d.ts +8 -0
- package/lib/exercises/math/functions/sqrt/compareSqrtValues.d.ts.map +1 -0
- package/lib/exercises/math/functions/sqrt/compareSqrtValues.js +83 -0
- package/lib/exercises/math/functions/sqrt/index.d.ts +2 -0
- package/lib/exercises/math/functions/sqrt/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/sqrt/index.js +1 -0
- package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableExtremaReading.js +23 -8
- package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/index.js +1 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts +8 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +92 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.js +26 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +47 -13
- package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/linesRelativePositions.js +29 -5
- package/lib/exercises/math/probaStat/calculateMeanFromFrequencies.d.ts +8 -0
- package/lib/exercises/math/probaStat/calculateMeanFromFrequencies.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/calculateMeanFromFrequencies.js +108 -0
- package/lib/exercises/math/probaStat/checkEquiprobability.d.ts +9 -0
- package/lib/exercises/math/probaStat/checkEquiprobability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/checkEquiprobability.js +129 -0
- package/lib/exercises/math/probaStat/getComplementaryProbability.d.ts +7 -0
- package/lib/exercises/math/probaStat/getComplementaryProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/getComplementaryProbability.js +90 -0
- package/lib/exercises/math/probaStat/getMissingProbabilityValue.d.ts +9 -0
- package/lib/exercises/math/probaStat/getMissingProbabilityValue.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/getMissingProbabilityValue.js +109 -0
- package/lib/exercises/math/probaStat/index.d.ts +6 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +6 -0
- package/lib/exercises/math/probaStat/mostLeastProbable.d.ts +8 -0
- package/lib/exercises/math/probaStat/mostLeastProbable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/mostLeastProbable.js +114 -0
- package/lib/exercises/math/probaStat/unionIntersectionProba.d.ts +11 -0
- package/lib/exercises/math/probaStat/unionIntersectionProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/unionIntersectionProba.js +164 -0
- package/lib/exercises/math/python/conditionIfElifElse.d.ts +9 -0
- package/lib/exercises/math/python/conditionIfElifElse.d.ts.map +1 -0
- package/lib/exercises/math/python/conditionIfElifElse.js +121 -0
- package/lib/exercises/math/python/index.d.ts +1 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +1 -0
- package/lib/exercises/math/python/pyNestedForLoopExercise.d.ts.map +1 -1
- package/lib/exercises/math/python/pyNestedForLoopExercise.js +26 -10
- package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts +0 -1
- package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/python/pyWhileLoop1Exercise.js +54 -31
- package/lib/exercises/math/python/pythonFunctionTrinom.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonFunctionTrinom.js +23 -1
- package/lib/exercises/math/python/whileLoop.js +2 -2
- package/lib/exercises/math/python/whileLoopCount.js +1 -1
- package/lib/exercises/math/sequences/explicitFormulaUsage.js +3 -3
- package/lib/exercises/math/sequences/genericSequenceVariations.js +2 -2
- package/lib/exercises/math/sets/index.d.ts +2 -0
- package/lib/exercises/math/sets/index.d.ts.map +1 -1
- package/lib/exercises/math/sets/index.js +2 -0
- package/lib/exercises/math/sets/nameOfNumberSets.d.ts +8 -0
- package/lib/exercises/math/sets/nameOfNumberSets.d.ts.map +1 -0
- package/lib/exercises/math/sets/nameOfNumberSets.js +125 -0
- package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts +8 -0
- package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts.map +1 -0
- package/lib/exercises/math/sets/subsetsOfKnownSets.js +99 -0
- package/lib/index.d.ts +61 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +25 -7
- package/lib/tests/pdfExo.test.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
+
const getPropositions = (n, { answer }) => {
|
|
5
|
+
const propositions = [];
|
|
6
|
+
addValidProp(propositions, answer);
|
|
7
|
+
tryToAddWrongProp(propositions, "\\subset");
|
|
8
|
+
tryToAddWrongProp(propositions, "\\not\\subset");
|
|
9
|
+
return shuffleProps(propositions, n);
|
|
10
|
+
};
|
|
11
|
+
const getAnswer = (identifiers) => {
|
|
12
|
+
const { subset, set } = identifiers;
|
|
13
|
+
return set > subset ? "\\subset" : "\\not\\subset";
|
|
14
|
+
};
|
|
15
|
+
const caseToTex = (set) => {
|
|
16
|
+
switch (set) {
|
|
17
|
+
case 0:
|
|
18
|
+
return "\\mathbb{N}";
|
|
19
|
+
case 1:
|
|
20
|
+
return "\\mathbb{Z}";
|
|
21
|
+
case 2:
|
|
22
|
+
return "\\mathbb{D}";
|
|
23
|
+
case 3:
|
|
24
|
+
return "\\mathbb{Q}";
|
|
25
|
+
case 4:
|
|
26
|
+
default:
|
|
27
|
+
return "\\mathbb{R}";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const { subset, set } = identifiers;
|
|
32
|
+
return `Compléter par le bon symbole :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
${caseToTex(subset)} \\ \\ldots \\ ${caseToTex(set)}
|
|
36
|
+
$$
|
|
37
|
+
|
|
38
|
+
Le symbole $\\subset$ signifie "est inclus dans" et le symbole $\\not\\subset$ signifie "n'est pas inclus dans".`;
|
|
39
|
+
};
|
|
40
|
+
const getHint = (identifiers) => {
|
|
41
|
+
return `- $\\mathbb{N}$ est l'ensemble des nombres entiers naturels (nombres entiers positifs).
|
|
42
|
+
- $\\mathbb{Z}$ est l'ensemble des nombres entiers relatifs (nombres entiers positis et négatifs).
|
|
43
|
+
- $\\mathbb{R}$ est l'ensemble des nombres réels.
|
|
44
|
+
- $\\mathbb{D}$ est l'ensemble des nombres décimaux (nombres avec un nombre fini de chiffres apres la virgule).
|
|
45
|
+
- $\\mathbb{Q}$ est l'ensemble des nombres rationnels (nombres qui peuvent s'écrire sous la forme d'une fraction de deux entiers).
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
const getCorrection = (identifiers) => {
|
|
49
|
+
const { set, subset } = identifiers;
|
|
50
|
+
const answer = getAnswer(identifiers);
|
|
51
|
+
return `Voici les inclusions dans l'ordre des ensembles de nombres :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
\\mathbb{N} \\subset \\mathbb{Z} \\subset \\mathbb{D} \\subset \\mathbb{Q} \\subset \\mathbb{R}
|
|
55
|
+
$$
|
|
56
|
+
|
|
57
|
+
${answer === "\\subset"
|
|
58
|
+
? `
|
|
59
|
+
On a donc :
|
|
60
|
+
|
|
61
|
+
$$
|
|
62
|
+
${caseToTex(subset)} ${getAnswer(identifiers)} ${caseToTex(set)}
|
|
63
|
+
$$`
|
|
64
|
+
: `On a donc $${caseToTex(set)} \\subset ${caseToTex(subset)}$, mais $${caseToTex(subset)} \\not\\subset ${caseToTex(set)}$. `}`;
|
|
65
|
+
};
|
|
66
|
+
const getSubsetsOfKnownSetsQuestion = (ops) => {
|
|
67
|
+
const subset = randint(0, 6);
|
|
68
|
+
const set = randint(0, 6, [subset]);
|
|
69
|
+
const identifiers = { subset, set };
|
|
70
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
71
|
+
};
|
|
72
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
73
|
+
return {
|
|
74
|
+
answer: getAnswer(identifiers),
|
|
75
|
+
instruction: getInstruction(identifiers),
|
|
76
|
+
keys: [],
|
|
77
|
+
answerFormat: "tex",
|
|
78
|
+
identifiers,
|
|
79
|
+
hint: getHint(identifiers),
|
|
80
|
+
correction: getCorrection(identifiers),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export const subsetsOfKnownSets = {
|
|
84
|
+
id: "subsetsOfKnownSets",
|
|
85
|
+
label: "Inclusions des ensembles de nombres",
|
|
86
|
+
answerType: "QCU",
|
|
87
|
+
isSingleStep: true,
|
|
88
|
+
generator: (nb, opts) => getDistinctQuestions(() => getSubsetsOfKnownSetsQuestion(opts), nb),
|
|
89
|
+
qcmTimer: 60,
|
|
90
|
+
freeTimer: 60,
|
|
91
|
+
getPropositions,
|
|
92
|
+
subject: "Mathématiques",
|
|
93
|
+
getInstruction,
|
|
94
|
+
getHint,
|
|
95
|
+
getCorrection,
|
|
96
|
+
getAnswer,
|
|
97
|
+
getQuestionFromIdentifiers,
|
|
98
|
+
hasHintAndCorrection: true,
|
|
99
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Exercise, Question } from "./exercises/exercise.js";
|
|
2
|
+
import * as MathExercises from "./exercises/math/index.js";
|
|
2
3
|
import "./prototypesEnhancement.js";
|
|
3
4
|
import { parseAlgebraic } from "./tree/parsers/latexParser.js";
|
|
4
5
|
declare const mathExercises: (Exercise<{
|
|
@@ -74,9 +75,26 @@ declare const mathExercises: (Exercise<{
|
|
|
74
75
|
}, {}> | Exercise<{
|
|
75
76
|
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
76
77
|
b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
78
|
+
}, {}> | Exercise<{
|
|
79
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
80
|
+
b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
81
|
+
isMinusInside: boolean;
|
|
77
82
|
}, {}> | Exercise<{
|
|
78
83
|
a: number;
|
|
79
84
|
b: number;
|
|
85
|
+
}, {}> | Exercise<{
|
|
86
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
87
|
+
b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
88
|
+
}, {}> | Exercise<{
|
|
89
|
+
expression: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
90
|
+
}, {}> | Exercise<{
|
|
91
|
+
twoSided: boolean;
|
|
92
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
93
|
+
b?: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
94
|
+
}, {}> | Exercise<{
|
|
95
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
96
|
+
b: number;
|
|
97
|
+
c: number;
|
|
80
98
|
}, {}> | Exercise<{
|
|
81
99
|
integerFirst: boolean;
|
|
82
100
|
integer: number;
|
|
@@ -862,6 +880,9 @@ declare const mathExercises: (Exercise<{
|
|
|
862
880
|
k: number;
|
|
863
881
|
}, {}> | Exercise<{
|
|
864
882
|
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
883
|
+
}, {}> | Exercise<{
|
|
884
|
+
a: number;
|
|
885
|
+
b: number;
|
|
865
886
|
}, {}> | Exercise<{
|
|
866
887
|
a: number;
|
|
867
888
|
b: number;
|
|
@@ -1077,6 +1098,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1077
1098
|
isAskingX: boolean;
|
|
1078
1099
|
isAskingMin: boolean;
|
|
1079
1100
|
intervalXIndexes: number[];
|
|
1101
|
+
}, {}> | Exercise<{
|
|
1102
|
+
a: number;
|
|
1103
|
+
b: number;
|
|
1080
1104
|
}, {}> | Exercise<{
|
|
1081
1105
|
coin: boolean;
|
|
1082
1106
|
radius: number;
|
|
@@ -1436,6 +1460,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1436
1460
|
angleType: string;
|
|
1437
1461
|
angleIndex: number;
|
|
1438
1462
|
apexIndex: number;
|
|
1463
|
+
}, {}> | Exercise<{
|
|
1464
|
+
doubleAngle: number;
|
|
1465
|
+
singleAngle: number;
|
|
1439
1466
|
}, {}> | Exercise<{
|
|
1440
1467
|
lines: {
|
|
1441
1468
|
pointA: number[];
|
|
@@ -1863,6 +1890,25 @@ declare const mathExercises: (Exercise<{
|
|
|
1863
1890
|
}, {}> | Exercise<{
|
|
1864
1891
|
xValuesIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
|
|
1865
1892
|
yValuesIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
|
|
1893
|
+
}, {}> | Exercise<{
|
|
1894
|
+
labels: string[];
|
|
1895
|
+
pValues: number[];
|
|
1896
|
+
missingIndex: number;
|
|
1897
|
+
}, {}> | Exercise<{
|
|
1898
|
+
pA: number;
|
|
1899
|
+
}, {}> | Exercise<{
|
|
1900
|
+
pA: number;
|
|
1901
|
+
pB: number;
|
|
1902
|
+
pUnion: number;
|
|
1903
|
+
pIntersection: number;
|
|
1904
|
+
target: "pA" | "pB" | "pUnion" | "pIntersection";
|
|
1905
|
+
}, {}> | Exercise<{
|
|
1906
|
+
xValues: number[];
|
|
1907
|
+
yValues: number[];
|
|
1908
|
+
}, {}> | Exercise<MathExercises.Identifiers, {}> | Exercise<{
|
|
1909
|
+
total: number;
|
|
1910
|
+
distribution: number[];
|
|
1911
|
+
observe: boolean;
|
|
1866
1912
|
}, {}> | Exercise<{
|
|
1867
1913
|
firstValue: number;
|
|
1868
1914
|
askedRank: number;
|
|
@@ -1998,6 +2044,12 @@ declare const mathExercises: (Exercise<{
|
|
|
1998
2044
|
}, {}> | Exercise<{
|
|
1999
2045
|
type: number;
|
|
2000
2046
|
nb: string;
|
|
2047
|
+
}, {}> | Exercise<{
|
|
2048
|
+
isQuestionAboutNotation: boolean;
|
|
2049
|
+
caseNumber: number;
|
|
2050
|
+
}, {}> | Exercise<{
|
|
2051
|
+
subset: number;
|
|
2052
|
+
set: number;
|
|
2001
2053
|
}, {}> | Exercise<{
|
|
2002
2054
|
x: number;
|
|
2003
2055
|
y: number;
|
|
@@ -2124,7 +2176,6 @@ declare const mathExercises: (Exercise<{
|
|
|
2124
2176
|
a: number;
|
|
2125
2177
|
b: number;
|
|
2126
2178
|
op: string;
|
|
2127
|
-
withInput: boolean;
|
|
2128
2179
|
}, {}> | Exercise<{
|
|
2129
2180
|
a: number;
|
|
2130
2181
|
b: number;
|
|
@@ -2172,6 +2223,10 @@ declare const mathExercises: (Exercise<{
|
|
|
2172
2223
|
variableName: string;
|
|
2173
2224
|
initialVariable: number;
|
|
2174
2225
|
affines: import("./math/polynomials/affine.js").Affine[];
|
|
2226
|
+
}, {}> | Exercise<{
|
|
2227
|
+
a: number;
|
|
2228
|
+
b: number;
|
|
2229
|
+
opName: string;
|
|
2175
2230
|
}, {}> | Exercise<{
|
|
2176
2231
|
p: number;
|
|
2177
2232
|
n: number;
|
|
@@ -2204,6 +2259,11 @@ declare const mathExercises: (Exercise<{
|
|
|
2204
2259
|
labels: string[];
|
|
2205
2260
|
}, {}>)[];
|
|
2206
2261
|
declare const pcExercises: (Exercise<{
|
|
2262
|
+
atomicMass: number;
|
|
2263
|
+
atomicNumber: number;
|
|
2264
|
+
isAsking: string;
|
|
2265
|
+
symbol: string;
|
|
2266
|
+
}, {}> | Exercise<{
|
|
2207
2267
|
numbers: number[];
|
|
2208
2268
|
}, {}> | Exercise<{
|
|
2209
2269
|
randQuation: number;
|
|
@@ -2358,11 +2418,6 @@ declare const pcExercises: (Exercise<{
|
|
|
2358
2418
|
randomMaterial1: number;
|
|
2359
2419
|
randomMaterial2: number;
|
|
2360
2420
|
ramdonAngleIncidenceDeg: number;
|
|
2361
|
-
}, {}> | Exercise<{
|
|
2362
|
-
atomicMass: number;
|
|
2363
|
-
atomicNumber: number;
|
|
2364
|
-
isAsking: string;
|
|
2365
|
-
symbol: string;
|
|
2366
2421
|
}, {}> | Exercise<{
|
|
2367
2422
|
isAsking: string;
|
|
2368
2423
|
enetringLightX: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,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AAW,UAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"latexTester.d.ts","sourceRoot":"","sources":["../src/latexTester.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAW,MAAM,2CA8KxC,CAAC"}
|
package/lib/latexTester.js
CHANGED
|
@@ -5,6 +5,7 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
5
5
|
let leftRightCount = 0;
|
|
6
6
|
let inArray = false;
|
|
7
7
|
let inPython = false;
|
|
8
|
+
let inInlinePython = false;
|
|
8
9
|
const formated = latex.replace(/<svg[\s\S]*?<\/svg>/g, "");
|
|
9
10
|
for (let i = 0; i < formated.length; i++) {
|
|
10
11
|
const prevChar = formated[i - 1];
|
|
@@ -14,7 +15,7 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
14
15
|
if (char === "$") {
|
|
15
16
|
if (isDefaultInMathMode)
|
|
16
17
|
throw new Error("Dollar in default math mode");
|
|
17
|
-
if (inPython)
|
|
18
|
+
if (inPython || inInlinePython)
|
|
18
19
|
throw new Error("Dollar in python mode");
|
|
19
20
|
if (nextChar === "$") {
|
|
20
21
|
if (inDollarMode)
|
|
@@ -39,9 +40,13 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
39
40
|
inDollarMode = !inDollarMode;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
else if (char === "`") {
|
|
44
|
+
inInlinePython = !inInlinePython;
|
|
45
|
+
}
|
|
42
46
|
else {
|
|
43
47
|
//check si nombre dans latex
|
|
44
48
|
if (!inPython &&
|
|
49
|
+
!inInlinePython &&
|
|
45
50
|
!isNaN(Number(char)) &&
|
|
46
51
|
char !== " " &&
|
|
47
52
|
char !== "\n" &&
|
|
@@ -53,23 +58,28 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
53
58
|
//check si charactere spécial
|
|
54
59
|
if (mustEscapeCharacters.includes(char) &&
|
|
55
60
|
prevChar !== "\\" &&
|
|
56
|
-
!inPython
|
|
61
|
+
!inPython &&
|
|
62
|
+
!inInlinePython) {
|
|
57
63
|
throw new Error("Must escape character");
|
|
58
64
|
}
|
|
59
65
|
//check si in math
|
|
60
66
|
if (mustBeInMath.includes(char) &&
|
|
61
67
|
!inDollarMode &&
|
|
62
68
|
!inDoubleDollarMode &&
|
|
63
|
-
!inPython
|
|
69
|
+
!inPython &&
|
|
70
|
+
!inInlinePython) {
|
|
64
71
|
throw new Error(`Must be in math mode, ${char}, ${latex}`);
|
|
65
72
|
}
|
|
66
73
|
//check si commande bien fermé
|
|
67
|
-
if (char === "{" && prevChar !== "\\" && !inPython) {
|
|
74
|
+
if (char === "{" && prevChar !== "\\" && !inPython && !inInlinePython) {
|
|
68
75
|
commandModeCount++;
|
|
69
76
|
}
|
|
70
|
-
if (char === "}" && prevChar !== "\\" && !inPython) {
|
|
77
|
+
if (char === "}" && prevChar !== "\\" && !inPython && !inInlinePython) {
|
|
71
78
|
commandModeCount--;
|
|
72
79
|
}
|
|
80
|
+
if (char === "}" && prevChar !== "\\" && inInlinePython) {
|
|
81
|
+
inInlinePython = false;
|
|
82
|
+
}
|
|
73
83
|
const substring = formated.substring(i);
|
|
74
84
|
if ((inDollarMode || inDoubleDollarMode) && char === "\n") {
|
|
75
85
|
let isEmptyLine = true;
|
|
@@ -96,11 +106,14 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
96
106
|
if (cmd === "\\right") {
|
|
97
107
|
leftRightCount--;
|
|
98
108
|
}
|
|
109
|
+
if (cmd === "\\lstinline") {
|
|
110
|
+
inInlinePython = !inInlinePython;
|
|
111
|
+
}
|
|
99
112
|
if (cmd === "\\begin") {
|
|
100
113
|
//lstlisting
|
|
101
114
|
//array / tabular
|
|
102
115
|
if (substring.startsWith("\\begin{lstlisting}") ||
|
|
103
|
-
substring.startsWith("\\
|
|
116
|
+
substring.startsWith("\\lstinline")) {
|
|
104
117
|
if (inPython)
|
|
105
118
|
throw new Error("Python not closed");
|
|
106
119
|
inPython = true;
|
|
@@ -141,13 +154,16 @@ export const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
|
141
154
|
throw new Error("Array not closed");
|
|
142
155
|
if (inPython)
|
|
143
156
|
throw new Error("Python not closed");
|
|
157
|
+
if (inInlinePython)
|
|
158
|
+
throw new Error("Inline Python not closed");
|
|
144
159
|
return true;
|
|
145
160
|
};
|
|
146
161
|
const mustEscapeCharacters = ["%"];
|
|
147
162
|
const mustBeInMath = ["%", "#", "_", "~", "^"];
|
|
148
163
|
const mustBeInArrays = ["&", "\\tabularnewline", "\\hline"];
|
|
149
164
|
const validCmds = [
|
|
150
|
-
"\\
|
|
165
|
+
"\\lstinline",
|
|
166
|
+
"\\subset",
|
|
151
167
|
"\\frac",
|
|
152
168
|
"\\exp",
|
|
153
169
|
"\\cos",
|
|
@@ -237,4 +253,6 @@ const validCmds = [
|
|
|
237
253
|
"\\eta",
|
|
238
254
|
"\\Leftrightarrow",
|
|
239
255
|
"\\lstinline",
|
|
256
|
+
"\\subset",
|
|
257
|
+
"\\not",
|
|
240
258
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdfExo.test.d.ts","sourceRoot":"","sources":["../../src/tests/pdfExo.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pdfExo.test.d.ts","sourceRoot":"","sources":["../../src/tests/pdfExo.test.ts"],"names":[],"mappings":"AAmBA,OAAO,6BAA6B,CAAC"}
|
package/lib/tests/pdfExo.test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subsetsOfKnownSets, } from "../exercises/math/index.js";
|
|
2
2
|
import { buildPdfForExercise } from "./pdfs/buildPDFForExercise.js";
|
|
3
3
|
import "../prototypesEnhancement.js";
|
|
4
4
|
try {
|
|
5
|
-
buildPdfForExercise(
|
|
5
|
+
buildPdfForExercise(subsetsOfKnownSets);
|
|
6
6
|
}
|
|
7
7
|
catch (err) {
|
|
8
8
|
console.log(err);
|