@drghaliasri/butex 5.3.2 → 5.4.0
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/dist/document.d.mts +4 -1
- package/dist/document.d.ts +4 -1
- package/dist/document.js +335 -1
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +335 -1
- package/dist/document.mjs.map +1 -1
- package/dist/document2.d.mts +4 -1
- package/dist/document2.d.ts +4 -1
- package/dist/document2.js +452 -1
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +452 -1
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +213 -4
- package/dist/index.d.ts +213 -4
- package/dist/index.global.js +909 -12
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +909 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +909 -12
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +1094 -7
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +1094 -7
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +4 -1
- package/dist/react-document2.d.ts +4 -1
- package/dist/react-document2.js +1094 -7
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +1094 -7
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +166 -2
- package/dist/react.d.ts +166 -2
- package/dist/react.js +976 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +976 -7
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document.mjs
CHANGED
|
@@ -705,6 +705,141 @@ function isSupportedDocumentCommand(command) {
|
|
|
705
705
|
return TEXT_COMMANDS.has(command) || LIST_COMMANDS.has(command) || command === "\\begin{tabular}" || command === "\\includegraphics" || command === "\\raw";
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
+
// src/editor/accentCommands.ts
|
|
709
|
+
var ACCENT_COMMANDS = {
|
|
710
|
+
vec: {
|
|
711
|
+
id: "vec",
|
|
712
|
+
englishTex: "\\vec",
|
|
713
|
+
arabicTex: "\\arabvec",
|
|
714
|
+
placement: "over",
|
|
715
|
+
label: "\u20D7",
|
|
716
|
+
title: "\u0633\u0647\u0645 \u0641\u0648\u0642"
|
|
717
|
+
},
|
|
718
|
+
hat: {
|
|
719
|
+
id: "hat",
|
|
720
|
+
englishTex: "\\hat",
|
|
721
|
+
arabicTex: "\\hat",
|
|
722
|
+
placement: "over",
|
|
723
|
+
label: "\u02C6",
|
|
724
|
+
title: "\u0642\u0628\u0639\u0629"
|
|
725
|
+
},
|
|
726
|
+
tilde: {
|
|
727
|
+
id: "tilde",
|
|
728
|
+
englishTex: "\\tilde",
|
|
729
|
+
arabicTex: "\\tilde",
|
|
730
|
+
placement: "over",
|
|
731
|
+
label: "\u02DC",
|
|
732
|
+
title: "\u0645\u062F\u0629"
|
|
733
|
+
},
|
|
734
|
+
dot: {
|
|
735
|
+
id: "dot",
|
|
736
|
+
englishTex: "\\dot",
|
|
737
|
+
arabicTex: "\\dot",
|
|
738
|
+
placement: "over",
|
|
739
|
+
label: "\u02D9",
|
|
740
|
+
title: "\u0646\u0642\u0637\u0629 \u0641\u0648\u0642"
|
|
741
|
+
},
|
|
742
|
+
ddot: {
|
|
743
|
+
id: "ddot",
|
|
744
|
+
englishTex: "\\ddot",
|
|
745
|
+
arabicTex: "\\ddot",
|
|
746
|
+
placement: "over",
|
|
747
|
+
label: "\xA8",
|
|
748
|
+
title: "\u0646\u0642\u0637\u062A\u0627\u0646 \u0641\u0648\u0642"
|
|
749
|
+
},
|
|
750
|
+
dddot: {
|
|
751
|
+
id: "dddot",
|
|
752
|
+
englishTex: "\\dddot",
|
|
753
|
+
arabicTex: "\\dddot",
|
|
754
|
+
placement: "over",
|
|
755
|
+
label: "\u20DB",
|
|
756
|
+
title: "\u062B\u0644\u0627\u062B \u0646\u0642\u0627\u0637 \u0641\u0648\u0642"
|
|
757
|
+
},
|
|
758
|
+
bar: {
|
|
759
|
+
id: "bar",
|
|
760
|
+
englishTex: "\\bar",
|
|
761
|
+
arabicTex: "\\bar",
|
|
762
|
+
placement: "over",
|
|
763
|
+
label: "\xAF",
|
|
764
|
+
title: "\u062E\u0637 \u0641\u0648\u0642"
|
|
765
|
+
},
|
|
766
|
+
check: {
|
|
767
|
+
id: "check",
|
|
768
|
+
englishTex: "\\check",
|
|
769
|
+
arabicTex: "\\check",
|
|
770
|
+
placement: "over",
|
|
771
|
+
label: "\u02C7",
|
|
772
|
+
title: "\u0639\u0644\u0627\u0645\u0629 \u062A\u062D\u0642\u0642"
|
|
773
|
+
},
|
|
774
|
+
breve: {
|
|
775
|
+
id: "breve",
|
|
776
|
+
englishTex: "\\breve",
|
|
777
|
+
arabicTex: "\\breve",
|
|
778
|
+
placement: "over",
|
|
779
|
+
label: "\u02D8",
|
|
780
|
+
title: "\u0642\u0648\u0633 \u0642\u0635\u064A\u0631"
|
|
781
|
+
},
|
|
782
|
+
acute: {
|
|
783
|
+
id: "acute",
|
|
784
|
+
englishTex: "\\acute",
|
|
785
|
+
arabicTex: "\\grave",
|
|
786
|
+
placement: "over",
|
|
787
|
+
label: "\xB4",
|
|
788
|
+
title: "\u0646\u0628\u0631\u0629 \u062D\u0627\u062F\u0629"
|
|
789
|
+
},
|
|
790
|
+
grave: {
|
|
791
|
+
id: "grave",
|
|
792
|
+
englishTex: "\\grave",
|
|
793
|
+
arabicTex: "\\acute",
|
|
794
|
+
placement: "over",
|
|
795
|
+
label: "`",
|
|
796
|
+
title: "\u0646\u0628\u0631\u0629 \u062B\u0642\u064A\u0644\u0629"
|
|
797
|
+
},
|
|
798
|
+
overline: {
|
|
799
|
+
id: "overline",
|
|
800
|
+
englishTex: "\\overline",
|
|
801
|
+
arabicTex: "\\overline",
|
|
802
|
+
placement: "over",
|
|
803
|
+
label: "\u203E",
|
|
804
|
+
title: "\u062E\u0637 \u0639\u0644\u0648\u064A \u0645\u0645\u062A\u062F"
|
|
805
|
+
},
|
|
806
|
+
underline: {
|
|
807
|
+
id: "underline",
|
|
808
|
+
englishTex: "\\underline",
|
|
809
|
+
arabicTex: "\\underline",
|
|
810
|
+
placement: "under",
|
|
811
|
+
label: "_",
|
|
812
|
+
title: "\u062E\u0637 \u0633\u0641\u0644\u064A"
|
|
813
|
+
},
|
|
814
|
+
overleftarrow: {
|
|
815
|
+
id: "overleftarrow",
|
|
816
|
+
englishTex: "\\overleftarrow",
|
|
817
|
+
arabicTex: "\\overrightarrow",
|
|
818
|
+
placement: "over",
|
|
819
|
+
label: "\u2190",
|
|
820
|
+
title: "\u0633\u0647\u0645 \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631"
|
|
821
|
+
},
|
|
822
|
+
overrightarrow: {
|
|
823
|
+
id: "overrightarrow",
|
|
824
|
+
englishTex: "\\overrightarrow",
|
|
825
|
+
arabicTex: "\\overleftarrow",
|
|
826
|
+
placement: "over",
|
|
827
|
+
label: "\u2192",
|
|
828
|
+
title: "\u0633\u0647\u0645 \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646"
|
|
829
|
+
},
|
|
830
|
+
overleftrightarrow: {
|
|
831
|
+
id: "overleftrightarrow",
|
|
832
|
+
englishTex: "\\overleftrightarrow",
|
|
833
|
+
arabicTex: "\\overleftrightarrow",
|
|
834
|
+
placement: "over",
|
|
835
|
+
label: "\u2194",
|
|
836
|
+
title: "\u0633\u0647\u0645 \u0639\u0644\u0648\u064A \u0645\u0632\u062F\u0648\u062C \u0627\u0644\u0627\u062A\u062C\u0627\u0647"
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
function accentCommandSpec(id) {
|
|
840
|
+
return Object.prototype.hasOwnProperty.call(ACCENT_COMMANDS, id) ? ACCENT_COMMANDS[id] : null;
|
|
841
|
+
}
|
|
842
|
+
|
|
708
843
|
// src/editor/atomicCommands.ts
|
|
709
844
|
var ATOMIC_COMMANDS = {
|
|
710
845
|
///////////////////////// Functions ////////////////////////////////
|
|
@@ -1119,7 +1254,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1119
1254
|
id: "neq",
|
|
1120
1255
|
category: "operators1",
|
|
1121
1256
|
Tex: "\\neq",
|
|
1122
|
-
mirror:
|
|
1257
|
+
mirror: true,
|
|
1123
1258
|
Label: "\u2260",
|
|
1124
1259
|
title: "\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
1125
1260
|
svg_path: null
|
|
@@ -1129,6 +1264,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1129
1264
|
category: "operators1",
|
|
1130
1265
|
Tex: "\\approx",
|
|
1131
1266
|
mirror: false,
|
|
1267
|
+
displayMirror: true,
|
|
1132
1268
|
Label: "\u2248",
|
|
1133
1269
|
title: "\u062A\u0642\u0631\u064A\u0628\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
1134
1270
|
svg_path: null
|
|
@@ -1138,6 +1274,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1138
1274
|
category: "operators1",
|
|
1139
1275
|
Tex: "\\sim",
|
|
1140
1276
|
mirror: false,
|
|
1277
|
+
displayMirror: true,
|
|
1141
1278
|
Label: "\u223C",
|
|
1142
1279
|
title: "\u0645\u0634\u0627\u0628\u0647",
|
|
1143
1280
|
svg_path: null
|
|
@@ -1156,6 +1293,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1156
1293
|
category: "operators1",
|
|
1157
1294
|
Tex: "\\leq",
|
|
1158
1295
|
mirror: true,
|
|
1296
|
+
displayMirror: false,
|
|
1159
1297
|
Label: "\u2264",
|
|
1160
1298
|
title: "\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
1161
1299
|
svg_path: null
|
|
@@ -1165,6 +1303,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1165
1303
|
category: "operators1",
|
|
1166
1304
|
Tex: "\\geq",
|
|
1167
1305
|
mirror: true,
|
|
1306
|
+
displayMirror: false,
|
|
1168
1307
|
Label: "\u2265",
|
|
1169
1308
|
title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
1170
1309
|
svg_path: null
|
|
@@ -1174,6 +1313,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1174
1313
|
category: "operators1",
|
|
1175
1314
|
Tex: "\\coloneqq",
|
|
1176
1315
|
mirror: true,
|
|
1316
|
+
displayMirror: false,
|
|
1177
1317
|
Label: "\u2254",
|
|
1178
1318
|
title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
|
|
1179
1319
|
svg_path: null
|
|
@@ -1183,6 +1323,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1183
1323
|
category: "operators1",
|
|
1184
1324
|
Tex: "\\eqqcolon",
|
|
1185
1325
|
mirror: true,
|
|
1326
|
+
displayMirror: false,
|
|
1186
1327
|
Label: "\u2255",
|
|
1187
1328
|
title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
|
|
1188
1329
|
svg_path: null
|
|
@@ -1193,6 +1334,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1193
1334
|
category: "operators2",
|
|
1194
1335
|
Tex: "\\propto",
|
|
1195
1336
|
mirror: true,
|
|
1337
|
+
displayMirror: false,
|
|
1196
1338
|
Label: "\u221D",
|
|
1197
1339
|
title: "\u064A\u062A\u0646\u0627\u0633\u0628 \u0645\u0639",
|
|
1198
1340
|
svg_path: null
|
|
@@ -1202,6 +1344,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1202
1344
|
category: "operators2",
|
|
1203
1345
|
Tex: "\\in",
|
|
1204
1346
|
mirror: true,
|
|
1347
|
+
displayMirror: false,
|
|
1205
1348
|
Label: "\u2208",
|
|
1206
1349
|
title: "\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
1207
1350
|
svg_path: null
|
|
@@ -1211,6 +1354,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1211
1354
|
category: "operators2",
|
|
1212
1355
|
Tex: "\\notin",
|
|
1213
1356
|
mirror: false,
|
|
1357
|
+
displayMirror: true,
|
|
1214
1358
|
Label: "\u2209",
|
|
1215
1359
|
title: "\u0644\u0627 \u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
1216
1360
|
svg_path: null
|
|
@@ -1220,6 +1364,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1220
1364
|
category: "operators2",
|
|
1221
1365
|
Tex: "\\subset",
|
|
1222
1366
|
mirror: true,
|
|
1367
|
+
displayMirror: false,
|
|
1223
1368
|
Label: "\u2282",
|
|
1224
1369
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0645\u0646",
|
|
1225
1370
|
svg_path: null
|
|
@@ -1229,6 +1374,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1229
1374
|
category: "operators2",
|
|
1230
1375
|
Tex: "\\supset",
|
|
1231
1376
|
mirror: true,
|
|
1377
|
+
displayMirror: false,
|
|
1232
1378
|
Label: "\u2283",
|
|
1233
1379
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0644\u0640",
|
|
1234
1380
|
svg_path: null
|
|
@@ -1238,6 +1384,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1238
1384
|
category: "operators2",
|
|
1239
1385
|
Tex: "\\subseteq",
|
|
1240
1386
|
mirror: true,
|
|
1387
|
+
displayMirror: false,
|
|
1241
1388
|
Label: "\u2286",
|
|
1242
1389
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
1243
1390
|
svg_path: null
|
|
@@ -1247,6 +1394,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1247
1394
|
category: "operators2",
|
|
1248
1395
|
Tex: "\\supseteq",
|
|
1249
1396
|
mirror: true,
|
|
1397
|
+
displayMirror: false,
|
|
1250
1398
|
Label: "\u2287",
|
|
1251
1399
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
1252
1400
|
svg_path: null
|
|
@@ -1256,6 +1404,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1256
1404
|
category: "operators2",
|
|
1257
1405
|
Tex: "\\cap",
|
|
1258
1406
|
mirror: false,
|
|
1407
|
+
displayMirror: true,
|
|
1259
1408
|
Label: "\u2229",
|
|
1260
1409
|
title: "\u062A\u0642\u0627\u0637\u0639",
|
|
1261
1410
|
svg_path: null
|
|
@@ -1265,6 +1414,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1265
1414
|
category: "operators2",
|
|
1266
1415
|
Tex: "\\cup",
|
|
1267
1416
|
mirror: false,
|
|
1417
|
+
displayMirror: true,
|
|
1268
1418
|
Label: "\u222A",
|
|
1269
1419
|
title: "\u0627\u062A\u062D\u0627\u062F",
|
|
1270
1420
|
svg_path: null
|
|
@@ -1274,6 +1424,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1274
1424
|
category: "operators2",
|
|
1275
1425
|
Tex: "\\emptyset",
|
|
1276
1426
|
mirror: false,
|
|
1427
|
+
displayMirror: true,
|
|
1277
1428
|
Label: "\u2205",
|
|
1278
1429
|
title: "\u0627\u0644\u0645\u062C\u0645\u0648\u0639\u0629 \u0627\u0644\u062E\u0627\u0644\u064A\u0629",
|
|
1279
1430
|
svg_path: null
|
|
@@ -1283,6 +1434,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1283
1434
|
category: "operators2",
|
|
1284
1435
|
Tex: "\\nsubseteq",
|
|
1285
1436
|
mirror: true,
|
|
1437
|
+
displayMirror: false,
|
|
1286
1438
|
Label: "\u2288",
|
|
1287
1439
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
1288
1440
|
svg_path: null
|
|
@@ -1292,6 +1444,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1292
1444
|
category: "operators2",
|
|
1293
1445
|
Tex: "\\nsupseteq",
|
|
1294
1446
|
mirror: true,
|
|
1447
|
+
displayMirror: false,
|
|
1295
1448
|
Label: "\u2289",
|
|
1296
1449
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
1297
1450
|
svg_path: null
|
|
@@ -1503,6 +1656,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1503
1656
|
category: "integrals",
|
|
1504
1657
|
Tex: "\\iint",
|
|
1505
1658
|
mirror: true,
|
|
1659
|
+
displayMirror: false,
|
|
1506
1660
|
Label: "\u222C",
|
|
1507
1661
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u0632\u062F\u0648\u062C",
|
|
1508
1662
|
svg_path: null
|
|
@@ -1512,6 +1666,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1512
1666
|
category: "integrals",
|
|
1513
1667
|
Tex: "\\iiint",
|
|
1514
1668
|
mirror: true,
|
|
1669
|
+
displayMirror: false,
|
|
1515
1670
|
Label: "\u222D",
|
|
1516
1671
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062B\u0644\u0627\u062B\u064A",
|
|
1517
1672
|
svg_path: null
|
|
@@ -1521,6 +1676,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1521
1676
|
category: "integrals",
|
|
1522
1677
|
Tex: "\\iiiint",
|
|
1523
1678
|
mirror: true,
|
|
1679
|
+
displayMirror: false,
|
|
1524
1680
|
Label: "\u2A0C",
|
|
1525
1681
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0631\u0628\u0627\u0639\u064A",
|
|
1526
1682
|
svg_path: null
|
|
@@ -1530,6 +1686,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1530
1686
|
category: "integrals",
|
|
1531
1687
|
Tex: "\\oint",
|
|
1532
1688
|
mirror: true,
|
|
1689
|
+
displayMirror: false,
|
|
1533
1690
|
Label: "\u222E",
|
|
1534
1691
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u063A\u0644\u0642",
|
|
1535
1692
|
svg_path: null
|
|
@@ -1539,6 +1696,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1539
1696
|
category: "integrals",
|
|
1540
1697
|
Tex: "\\oiint",
|
|
1541
1698
|
mirror: true,
|
|
1699
|
+
displayMirror: false,
|
|
1542
1700
|
Label: "\u222F",
|
|
1543
1701
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0633\u0637\u062D\u064A \u0645\u063A\u0644\u0642",
|
|
1544
1702
|
svg_path: null
|
|
@@ -1548,6 +1706,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1548
1706
|
category: "integrals",
|
|
1549
1707
|
Tex: "\\oiiint",
|
|
1550
1708
|
mirror: true,
|
|
1709
|
+
displayMirror: false,
|
|
1551
1710
|
Label: "\u2230",
|
|
1552
1711
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062D\u062C\u0645\u064A \u0645\u063A\u0644\u0642",
|
|
1553
1712
|
svg_path: null
|
|
@@ -1641,6 +1800,14 @@ function renderMatrixRowsArabic(node, options) {
|
|
|
1641
1800
|
}
|
|
1642
1801
|
return `\\begin{${envName}}${rows.join(" \\\\\n")}\\end{${envName}}`;
|
|
1643
1802
|
}
|
|
1803
|
+
function renderAccentArabic(command, accent, base, options) {
|
|
1804
|
+
const baseTex = base ? renderChainArabic(base, options) : "";
|
|
1805
|
+
const accentTex = accent ? renderChainArabic(accent, options) : "";
|
|
1806
|
+
if (accentTex === "") {
|
|
1807
|
+
return baseTex;
|
|
1808
|
+
}
|
|
1809
|
+
return `\\${command}{${accentTex}}{${baseTex}}`;
|
|
1810
|
+
}
|
|
1644
1811
|
function escapeText(s) {
|
|
1645
1812
|
return s.replace(/\\/g, "\\textbackslash{}").replace(/[{}]/g, "\\$&");
|
|
1646
1813
|
}
|
|
@@ -1671,6 +1838,19 @@ function renderNodeArabic(node, options) {
|
|
|
1671
1838
|
const content = `\\arabsqrt${optionalRootIndexArabic(node, options)}{${renderChainArabic(node.radicand, options)}}`;
|
|
1672
1839
|
return arabicScripts(node, content, options);
|
|
1673
1840
|
}
|
|
1841
|
+
if (node.kind === "overset" && node.baseExpr) {
|
|
1842
|
+
const content = renderAccentArabic("overset", node.overExpr, node.baseExpr, options);
|
|
1843
|
+
return arabicScripts(node, content, options);
|
|
1844
|
+
}
|
|
1845
|
+
if (node.kind === "underset" && node.baseExpr) {
|
|
1846
|
+
const content = renderAccentArabic("underset", node.underExpr, node.baseExpr, options);
|
|
1847
|
+
return arabicScripts(node, content, options);
|
|
1848
|
+
}
|
|
1849
|
+
if (node.kind === "accent" && node.baseExpr) {
|
|
1850
|
+
const cmd = accentCommandSpec(node.expr)?.arabicTex ?? `\\${node.expr}`;
|
|
1851
|
+
const content = `${cmd}{${renderChainArabic(node.baseExpr, options)}}`;
|
|
1852
|
+
return arabicScripts(node, content, options);
|
|
1853
|
+
}
|
|
1674
1854
|
if (node.kind === "env") {
|
|
1675
1855
|
return arabicScripts(node, renderMatrixRowsArabic(node, options), options);
|
|
1676
1856
|
}
|
|
@@ -1869,6 +2049,109 @@ var SQRT_CSS = `
|
|
|
1869
2049
|
}
|
|
1870
2050
|
`.trim();
|
|
1871
2051
|
|
|
2052
|
+
// src/editor/display/overset.ts
|
|
2053
|
+
var OVERSET_CSS = `
|
|
2054
|
+
.overset {
|
|
2055
|
+
display: inline-flex;
|
|
2056
|
+
flex-direction: column;
|
|
2057
|
+
align-items: center;
|
|
2058
|
+
justify-content: center;
|
|
2059
|
+
vertical-align: middle;
|
|
2060
|
+
margin: 0 2px;
|
|
2061
|
+
min-width: 1.2em;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
.overset-over {
|
|
2065
|
+
display: inline-flex;
|
|
2066
|
+
justify-content: center;
|
|
2067
|
+
align-items: center;
|
|
2068
|
+
min-height: 0.85em;
|
|
2069
|
+
padding: 0 2px;
|
|
2070
|
+
font-size: 0.72em;
|
|
2071
|
+
line-height: 1.1;
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
.overset-base {
|
|
2075
|
+
display: inline-flex;
|
|
2076
|
+
justify-content: center;
|
|
2077
|
+
align-items: center;
|
|
2078
|
+
min-height: 1.05em;
|
|
2079
|
+
padding: 0 2px;
|
|
2080
|
+
}
|
|
2081
|
+
`.trim();
|
|
2082
|
+
|
|
2083
|
+
// src/editor/display/underset.ts
|
|
2084
|
+
var UNDERSET_CSS = `
|
|
2085
|
+
.underset {
|
|
2086
|
+
display: inline-flex;
|
|
2087
|
+
flex-direction: column;
|
|
2088
|
+
align-items: center;
|
|
2089
|
+
justify-content: center;
|
|
2090
|
+
vertical-align: middle;
|
|
2091
|
+
margin: 0 2px;
|
|
2092
|
+
min-width: 1.2em;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
.underset-base {
|
|
2096
|
+
display: inline-flex;
|
|
2097
|
+
justify-content: center;
|
|
2098
|
+
align-items: center;
|
|
2099
|
+
min-height: 1.05em;
|
|
2100
|
+
padding: 0 2px;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
.underset-under {
|
|
2104
|
+
display: inline-flex;
|
|
2105
|
+
justify-content: center;
|
|
2106
|
+
align-items: center;
|
|
2107
|
+
min-height: 0.85em;
|
|
2108
|
+
padding: 0 2px;
|
|
2109
|
+
font-size: 0.72em;
|
|
2110
|
+
line-height: 1.1;
|
|
2111
|
+
}
|
|
2112
|
+
`.trim();
|
|
2113
|
+
|
|
2114
|
+
// src/editor/display/accent.ts
|
|
2115
|
+
var ACCENT_CSS = `
|
|
2116
|
+
.math-accent {
|
|
2117
|
+
display: inline-flex;
|
|
2118
|
+
flex-direction: column;
|
|
2119
|
+
align-items: center;
|
|
2120
|
+
justify-content: center;
|
|
2121
|
+
vertical-align: middle;
|
|
2122
|
+
margin: 0 2px;
|
|
2123
|
+
min-width: 1.1em;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
.math-accent-chrome {
|
|
2127
|
+
display: inline-flex;
|
|
2128
|
+
justify-content: center;
|
|
2129
|
+
align-items: center;
|
|
2130
|
+
min-height: 0.7em;
|
|
2131
|
+
padding: 0 2px;
|
|
2132
|
+
font-size: 0.85em;
|
|
2133
|
+
line-height: 1;
|
|
2134
|
+
color: var(--butex-script-color, #475569);
|
|
2135
|
+
user-select: none;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
.math-accent-base {
|
|
2139
|
+
display: inline-flex;
|
|
2140
|
+
justify-content: center;
|
|
2141
|
+
align-items: center;
|
|
2142
|
+
min-height: 1.05em;
|
|
2143
|
+
padding: 0 2px;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
.math-accent--under .math-accent-chrome {
|
|
2147
|
+
min-height: 0.45em;
|
|
2148
|
+
border-top: 1.5px solid currentColor;
|
|
2149
|
+
width: 100%;
|
|
2150
|
+
font-size: 0;
|
|
2151
|
+
color: var(--butex-surface-fg, #0f172a);
|
|
2152
|
+
}
|
|
2153
|
+
`.trim();
|
|
2154
|
+
|
|
1872
2155
|
// src/editor/display/env.ts
|
|
1873
2156
|
var MATRIX_ENV_CSS = `
|
|
1874
2157
|
.matrix-env {
|
|
@@ -2256,6 +2539,12 @@ ${FRAC_CSS}
|
|
|
2256
2539
|
|
|
2257
2540
|
${SQRT_CSS}
|
|
2258
2541
|
|
|
2542
|
+
${OVERSET_CSS}
|
|
2543
|
+
|
|
2544
|
+
${UNDERSET_CSS}
|
|
2545
|
+
|
|
2546
|
+
${ACCENT_CSS}
|
|
2547
|
+
|
|
2259
2548
|
${MATRIX_ENV_CSS}
|
|
2260
2549
|
|
|
2261
2550
|
${ATOMIC_COMMAND_CSS}
|
|
@@ -2329,6 +2618,21 @@ function editorEnvToAstNode(node) {
|
|
|
2329
2618
|
const scripts = attachAstScripts(node, env);
|
|
2330
2619
|
return scripts ?? { ok: true, node: env };
|
|
2331
2620
|
}
|
|
2621
|
+
function accentChainForExport(accent) {
|
|
2622
|
+
if (!accent) {
|
|
2623
|
+
return { ok: true, chain: new ChainNode([]) };
|
|
2624
|
+
}
|
|
2625
|
+
return editorChainToAstChain(accent);
|
|
2626
|
+
}
|
|
2627
|
+
function nodeFromAccentBase(command, accent, base) {
|
|
2628
|
+
if (accent.chain.length > 0) {
|
|
2629
|
+
return new CommandNode(command, [], [accent, base]);
|
|
2630
|
+
}
|
|
2631
|
+
if (base.chain.length === 1) {
|
|
2632
|
+
return base.chain[0];
|
|
2633
|
+
}
|
|
2634
|
+
return new DelimiterNode("", base, "");
|
|
2635
|
+
}
|
|
2332
2636
|
function editorNodeToAstNode(node) {
|
|
2333
2637
|
let astNode;
|
|
2334
2638
|
if (node.kind === "char") {
|
|
@@ -2367,6 +2671,36 @@ function editorNodeToAstNode(node) {
|
|
|
2367
2671
|
optionalArgs.push(rootIndex.chain);
|
|
2368
2672
|
}
|
|
2369
2673
|
astNode = new CommandNode("\\sqrt", optionalArgs, [radicand.chain]);
|
|
2674
|
+
} else if (node.kind === "overset" && node.baseExpr) {
|
|
2675
|
+
const accent = accentChainForExport(node.overExpr);
|
|
2676
|
+
if (!accent.ok) {
|
|
2677
|
+
return accent;
|
|
2678
|
+
}
|
|
2679
|
+
const baseExpr = editorChainToAstChain(node.baseExpr);
|
|
2680
|
+
if (!baseExpr.ok) {
|
|
2681
|
+
return baseExpr;
|
|
2682
|
+
}
|
|
2683
|
+
astNode = nodeFromAccentBase("\\overset", accent.chain, baseExpr.chain);
|
|
2684
|
+
} else if (node.kind === "underset" && node.baseExpr) {
|
|
2685
|
+
const accent = accentChainForExport(node.underExpr);
|
|
2686
|
+
if (!accent.ok) {
|
|
2687
|
+
return accent;
|
|
2688
|
+
}
|
|
2689
|
+
const baseExpr = editorChainToAstChain(node.baseExpr);
|
|
2690
|
+
if (!baseExpr.ok) {
|
|
2691
|
+
return baseExpr;
|
|
2692
|
+
}
|
|
2693
|
+
astNode = nodeFromAccentBase("\\underset", accent.chain, baseExpr.chain);
|
|
2694
|
+
} else if (node.kind === "accent" && node.baseExpr) {
|
|
2695
|
+
const tex = accentCommandSpec(node.expr)?.englishTex;
|
|
2696
|
+
if (!tex) {
|
|
2697
|
+
return { ok: false, reason: `\u0644\u0643\u0646\u0629 \u0631\u064A\u0627\u0636\u064A\u0629 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645\u0629 \u062D\u0627\u0644\u064A\u0627: ${node.expr}` };
|
|
2698
|
+
}
|
|
2699
|
+
const baseExpr = editorChainToAstChain(node.baseExpr);
|
|
2700
|
+
if (!baseExpr.ok) {
|
|
2701
|
+
return baseExpr;
|
|
2702
|
+
}
|
|
2703
|
+
astNode = new CommandNode(tex, [], [baseExpr.chain]);
|
|
2370
2704
|
} else if (node.kind === "atomicCommand") {
|
|
2371
2705
|
const tex = atomicCommandSpec(node.expr)?.englishTex;
|
|
2372
2706
|
if (!tex) {
|