@drghaliasri/butex 5.5.4 → 5.6.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/README.md +2 -2
- package/dist/document.js +36 -0
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +36 -0
- package/dist/document.mjs.map +1 -1
- package/dist/document2.d.mts +10 -4
- package/dist/document2.d.ts +10 -4
- package/dist/document2.js +193 -25
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +191 -25
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.global.js +79 -14
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +79 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -14
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +254 -7
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +254 -7
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +5 -3
- package/dist/react-document2.d.ts +5 -3
- package/dist/react-document2.js +386 -41
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +386 -41
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +35 -0
- package/dist/react.d.ts +35 -0
- package/dist/react.js +1277 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1277 -7
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -693,6 +693,27 @@ function registerAtomicCommandMacros(CommandMap) {
|
|
|
693
693
|
return COMMAND_MAP3;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
+
// src/register/colonRelations.ts
|
|
697
|
+
var COMMAND_MAP4 = "butex-colon-relation-macros";
|
|
698
|
+
var COLON_RELATIONS = {
|
|
699
|
+
coloneqq: "\u2254",
|
|
700
|
+
eqqcolon: "\u2255"
|
|
701
|
+
};
|
|
702
|
+
function colonRelation(parser, name) {
|
|
703
|
+
const commandName = name.replace(/^\\/, "");
|
|
704
|
+
const label = COLON_RELATIONS[commandName] ?? commandName;
|
|
705
|
+
const node = parser.create("token", "mo", { texClass: 3 }, label);
|
|
706
|
+
parser.Push(node);
|
|
707
|
+
}
|
|
708
|
+
var colonRelationTyped = colonRelation;
|
|
709
|
+
function registerColonRelationCommandMacros(CommandMap) {
|
|
710
|
+
const mappings = Object.fromEntries(
|
|
711
|
+
Object.keys(COLON_RELATIONS).map((name) => [name, colonRelationTyped])
|
|
712
|
+
);
|
|
713
|
+
new CommandMap(COMMAND_MAP4, mappings);
|
|
714
|
+
return COMMAND_MAP4;
|
|
715
|
+
}
|
|
716
|
+
|
|
696
717
|
// src/editor/characterFonts.ts
|
|
697
718
|
var CHARACTER_FONT_SPECS = [
|
|
698
719
|
{
|
|
@@ -766,7 +787,7 @@ function characterFontSpecByMacro(macro) {
|
|
|
766
787
|
}
|
|
767
788
|
|
|
768
789
|
// src/register/fontText.ts
|
|
769
|
-
var
|
|
790
|
+
var COMMAND_MAP5 = "butex-font-text-macros";
|
|
770
791
|
function fontText(className, parser, name) {
|
|
771
792
|
const text = parser.GetArgument(name);
|
|
772
793
|
const node = parser.create(
|
|
@@ -784,12 +805,12 @@ function registerFontTextCommands(CommandMap) {
|
|
|
784
805
|
((parser, name) => fontText(font.mathJaxClass, parser, name))
|
|
785
806
|
])
|
|
786
807
|
);
|
|
787
|
-
new CommandMap(
|
|
788
|
-
return
|
|
808
|
+
new CommandMap(COMMAND_MAP5, mappings);
|
|
809
|
+
return COMMAND_MAP5;
|
|
789
810
|
}
|
|
790
811
|
|
|
791
812
|
// src/register/mirror.ts
|
|
792
|
-
var
|
|
813
|
+
var COMMAND_MAP6 = "butex-mirror-macros";
|
|
793
814
|
function mirrorContent(parser, name) {
|
|
794
815
|
const arg = parser.GetArgument(name);
|
|
795
816
|
const TexParserClass = parser.constructor;
|
|
@@ -800,12 +821,12 @@ function mirrorContent(parser, name) {
|
|
|
800
821
|
}
|
|
801
822
|
var mirrorContentTyped = mirrorContent;
|
|
802
823
|
function registerMirrorCommand(CommandMap) {
|
|
803
|
-
new CommandMap(
|
|
804
|
-
return
|
|
824
|
+
new CommandMap(COMMAND_MAP6, { butexmirror: mirrorContentTyped });
|
|
825
|
+
return COMMAND_MAP6;
|
|
805
826
|
}
|
|
806
827
|
|
|
807
828
|
// src/register/passthrough.ts
|
|
808
|
-
var
|
|
829
|
+
var COMMAND_MAP7 = "butex-passthrough-macros";
|
|
809
830
|
function passthroughArgument(parser, name) {
|
|
810
831
|
const arg = parser.GetArgument(name);
|
|
811
832
|
const TexParserClass = parser.constructor;
|
|
@@ -822,12 +843,12 @@ function arabvecArgument(parser, name) {
|
|
|
822
843
|
var passthroughArgumentTyped = passthroughArgument;
|
|
823
844
|
var arabvecArgumentTyped = arabvecArgument;
|
|
824
845
|
function registerPassthroughCommandMacros(CommandMap) {
|
|
825
|
-
new CommandMap(
|
|
846
|
+
new CommandMap(COMMAND_MAP7, {
|
|
826
847
|
unit: passthroughArgumentTyped,
|
|
827
848
|
idx: passthroughArgumentTyped,
|
|
828
849
|
arabvec: arabvecArgumentTyped
|
|
829
850
|
});
|
|
830
|
-
return
|
|
851
|
+
return COMMAND_MAP7;
|
|
831
852
|
}
|
|
832
853
|
|
|
833
854
|
// src/register.ts
|
|
@@ -854,6 +875,7 @@ function registerBuTeX(mathJax) {
|
|
|
854
875
|
registerArabSqrtCommand(CommandMap),
|
|
855
876
|
registerPrescriptCommand(CommandMap),
|
|
856
877
|
registerAtomicCommandMacros(CommandMap),
|
|
878
|
+
registerColonRelationCommandMacros(CommandMap),
|
|
857
879
|
registerFontTextCommands(CommandMap),
|
|
858
880
|
registerMirrorCommand(CommandMap),
|
|
859
881
|
registerPassthroughCommandMacros(CommandMap)
|
|
@@ -2075,6 +2097,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2075
2097
|
category: "operators1",
|
|
2076
2098
|
Tex: "\\neq",
|
|
2077
2099
|
mirror: true,
|
|
2100
|
+
compileMirror: true,
|
|
2078
2101
|
Label: "\u2260",
|
|
2079
2102
|
title: "\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
2080
2103
|
svg_path: null
|
|
@@ -2114,6 +2137,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2114
2137
|
Tex: "\\leq",
|
|
2115
2138
|
mirror: true,
|
|
2116
2139
|
displayMirror: false,
|
|
2140
|
+
compileMirror: true,
|
|
2117
2141
|
Label: "\u2264",
|
|
2118
2142
|
title: "\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
2119
2143
|
svg_path: null
|
|
@@ -2124,6 +2148,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2124
2148
|
Tex: "\\geq",
|
|
2125
2149
|
mirror: true,
|
|
2126
2150
|
displayMirror: false,
|
|
2151
|
+
compileMirror: true,
|
|
2127
2152
|
Label: "\u2265",
|
|
2128
2153
|
title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
2129
2154
|
svg_path: null
|
|
@@ -2134,6 +2159,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2134
2159
|
Tex: "\\coloneqq",
|
|
2135
2160
|
mirror: true,
|
|
2136
2161
|
displayMirror: false,
|
|
2162
|
+
compileMirror: true,
|
|
2137
2163
|
Label: "\u2254",
|
|
2138
2164
|
title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
|
|
2139
2165
|
svg_path: null
|
|
@@ -2144,6 +2170,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2144
2170
|
Tex: "\\eqqcolon",
|
|
2145
2171
|
mirror: true,
|
|
2146
2172
|
displayMirror: false,
|
|
2173
|
+
compileMirror: true,
|
|
2147
2174
|
Label: "\u2255",
|
|
2148
2175
|
title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
|
|
2149
2176
|
svg_path: null
|
|
@@ -2155,6 +2182,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2155
2182
|
Tex: "\\propto",
|
|
2156
2183
|
mirror: true,
|
|
2157
2184
|
displayMirror: false,
|
|
2185
|
+
compileMirror: true,
|
|
2158
2186
|
Label: "\u221D",
|
|
2159
2187
|
title: "\u064A\u062A\u0646\u0627\u0633\u0628 \u0645\u0639",
|
|
2160
2188
|
svg_path: null
|
|
@@ -2165,6 +2193,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2165
2193
|
Tex: "\\in",
|
|
2166
2194
|
mirror: true,
|
|
2167
2195
|
displayMirror: false,
|
|
2196
|
+
compileMirror: true,
|
|
2168
2197
|
Label: "\u2208",
|
|
2169
2198
|
title: "\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
2170
2199
|
svg_path: null
|
|
@@ -2185,6 +2214,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2185
2214
|
Tex: "\\subset",
|
|
2186
2215
|
mirror: true,
|
|
2187
2216
|
displayMirror: false,
|
|
2217
|
+
compileMirror: true,
|
|
2188
2218
|
Label: "\u2282",
|
|
2189
2219
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0645\u0646",
|
|
2190
2220
|
svg_path: null
|
|
@@ -2195,6 +2225,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2195
2225
|
Tex: "\\supset",
|
|
2196
2226
|
mirror: true,
|
|
2197
2227
|
displayMirror: false,
|
|
2228
|
+
compileMirror: true,
|
|
2198
2229
|
Label: "\u2283",
|
|
2199
2230
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0644\u0640",
|
|
2200
2231
|
svg_path: null
|
|
@@ -2205,6 +2236,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2205
2236
|
Tex: "\\subseteq",
|
|
2206
2237
|
mirror: true,
|
|
2207
2238
|
displayMirror: false,
|
|
2239
|
+
compileMirror: true,
|
|
2208
2240
|
Label: "\u2286",
|
|
2209
2241
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2210
2242
|
svg_path: null
|
|
@@ -2215,6 +2247,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2215
2247
|
Tex: "\\supseteq",
|
|
2216
2248
|
mirror: true,
|
|
2217
2249
|
displayMirror: false,
|
|
2250
|
+
compileMirror: true,
|
|
2218
2251
|
Label: "\u2287",
|
|
2219
2252
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2220
2253
|
svg_path: null
|
|
@@ -2255,6 +2288,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2255
2288
|
Tex: "\\nsubseteq",
|
|
2256
2289
|
mirror: true,
|
|
2257
2290
|
displayMirror: false,
|
|
2291
|
+
compileMirror: true,
|
|
2258
2292
|
Label: "\u2288",
|
|
2259
2293
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2260
2294
|
svg_path: null
|
|
@@ -2265,6 +2299,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2265
2299
|
Tex: "\\nsupseteq",
|
|
2266
2300
|
mirror: true,
|
|
2267
2301
|
displayMirror: false,
|
|
2302
|
+
compileMirror: true,
|
|
2268
2303
|
Label: "\u2289",
|
|
2269
2304
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2270
2305
|
svg_path: null
|
|
@@ -2312,6 +2347,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2312
2347
|
Tex: "\\ddots",
|
|
2313
2348
|
mirror: true,
|
|
2314
2349
|
displayMirror: false,
|
|
2350
|
+
compileMirror: true,
|
|
2315
2351
|
Label: "\u22F1",
|
|
2316
2352
|
title: "\u0646\u0642\u0627\u0637 \u0642\u0637\u0631\u064A\u0629",
|
|
2317
2353
|
svg_path: null
|
|
@@ -2331,6 +2367,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2331
2367
|
category: "operators3",
|
|
2332
2368
|
Tex: "\\implies",
|
|
2333
2369
|
mirror: true,
|
|
2370
|
+
compileMirror: true,
|
|
2334
2371
|
Label: "\u21D2",
|
|
2335
2372
|
title: "\u064A\u0633\u062A\u0644\u0632\u0645",
|
|
2336
2373
|
svg_path: null
|
|
@@ -2340,6 +2377,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2340
2377
|
category: "operators3",
|
|
2341
2378
|
Tex: "\\impliedby",
|
|
2342
2379
|
mirror: true,
|
|
2380
|
+
compileMirror: true,
|
|
2343
2381
|
Label: "\u21D0",
|
|
2344
2382
|
title: "\u0645\u0633\u062A\u0644\u0632\u0645 \u0645\u0646",
|
|
2345
2383
|
svg_path: null
|
|
@@ -2358,6 +2396,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2358
2396
|
category: "operators3",
|
|
2359
2397
|
Tex: "\\Longrightarrow",
|
|
2360
2398
|
mirror: true,
|
|
2399
|
+
compileMirror: true,
|
|
2361
2400
|
Label: "\u27F9",
|
|
2362
2401
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2363
2402
|
svg_path: null
|
|
@@ -2367,6 +2406,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2367
2406
|
category: "operators3",
|
|
2368
2407
|
Tex: "\\Longleftarrow",
|
|
2369
2408
|
mirror: true,
|
|
2409
|
+
compileMirror: true,
|
|
2370
2410
|
Label: "\u27F8",
|
|
2371
2411
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2372
2412
|
svg_path: null
|
|
@@ -2376,6 +2416,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2376
2416
|
category: "operators3",
|
|
2377
2417
|
Tex: "\\to",
|
|
2378
2418
|
mirror: true,
|
|
2419
|
+
compileMirror: true,
|
|
2379
2420
|
Label: "\u2192",
|
|
2380
2421
|
title: "\u064A\u0624\u0648\u0644 \u0625\u0644\u0649",
|
|
2381
2422
|
svg_path: null
|
|
@@ -2385,6 +2426,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2385
2426
|
category: "operators3",
|
|
2386
2427
|
Tex: "\\rightleftharpoons",
|
|
2387
2428
|
mirror: true,
|
|
2429
|
+
compileMirror: true,
|
|
2388
2430
|
Label: "\u21CC",
|
|
2389
2431
|
title: "\u0627\u062A\u0632\u0627\u0646",
|
|
2390
2432
|
svg_path: null
|
|
@@ -2394,6 +2436,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2394
2436
|
category: "operators3",
|
|
2395
2437
|
Tex: "\\leftarrow",
|
|
2396
2438
|
mirror: true,
|
|
2439
|
+
compileMirror: true,
|
|
2397
2440
|
Label: "\u2190",
|
|
2398
2441
|
title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2399
2442
|
svg_path: null
|
|
@@ -2403,6 +2446,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2403
2446
|
category: "operators3",
|
|
2404
2447
|
Tex: "\\rightarrow",
|
|
2405
2448
|
mirror: true,
|
|
2449
|
+
compileMirror: true,
|
|
2406
2450
|
Label: "\u2192",
|
|
2407
2451
|
title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2408
2452
|
svg_path: null
|
|
@@ -2412,6 +2456,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2412
2456
|
category: "operators3",
|
|
2413
2457
|
Tex: "\\Leftarrow",
|
|
2414
2458
|
mirror: true,
|
|
2459
|
+
compileMirror: true,
|
|
2415
2460
|
Label: "\u21D0",
|
|
2416
2461
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2417
2462
|
svg_path: null
|
|
@@ -2421,6 +2466,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2421
2466
|
category: "operators3",
|
|
2422
2467
|
Tex: "\\Rightarrow",
|
|
2423
2468
|
mirror: true,
|
|
2469
|
+
compileMirror: true,
|
|
2424
2470
|
Label: "\u21D2",
|
|
2425
2471
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2426
2472
|
svg_path: null
|
|
@@ -2430,6 +2476,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2430
2476
|
category: "operators3",
|
|
2431
2477
|
Tex: "\\leftharpoonup",
|
|
2432
2478
|
mirror: true,
|
|
2479
|
+
compileMirror: true,
|
|
2433
2480
|
Label: "\u21BC",
|
|
2434
2481
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2435
2482
|
svg_path: null
|
|
@@ -2439,6 +2486,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2439
2486
|
category: "operators3",
|
|
2440
2487
|
Tex: "\\rightharpoonup",
|
|
2441
2488
|
mirror: true,
|
|
2489
|
+
compileMirror: true,
|
|
2442
2490
|
Label: "\u21C0",
|
|
2443
2491
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2444
2492
|
svg_path: null
|
|
@@ -2448,6 +2496,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2448
2496
|
category: "operators3",
|
|
2449
2497
|
Tex: "\\leftharpoondown",
|
|
2450
2498
|
mirror: true,
|
|
2499
|
+
compileMirror: true,
|
|
2451
2500
|
Label: "\u21BD",
|
|
2452
2501
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2453
2502
|
svg_path: null
|
|
@@ -2457,6 +2506,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2457
2506
|
category: "operators3",
|
|
2458
2507
|
Tex: "\\rightharpoondown",
|
|
2459
2508
|
mirror: true,
|
|
2509
|
+
compileMirror: true,
|
|
2460
2510
|
Label: "\u21C1",
|
|
2461
2511
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2462
2512
|
svg_path: null
|
|
@@ -2467,6 +2517,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2467
2517
|
category: "integrals",
|
|
2468
2518
|
Tex: "\\int",
|
|
2469
2519
|
mirror: true,
|
|
2520
|
+
compileMirror: true,
|
|
2470
2521
|
Label: "\u222B",
|
|
2471
2522
|
title: "\u062A\u0643\u0627\u0645\u0644",
|
|
2472
2523
|
svg_path: null
|
|
@@ -2477,6 +2528,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2477
2528
|
Tex: "\\iint",
|
|
2478
2529
|
mirror: true,
|
|
2479
2530
|
displayMirror: false,
|
|
2531
|
+
compileMirror: true,
|
|
2480
2532
|
Label: "\u222C",
|
|
2481
2533
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u0632\u062F\u0648\u062C",
|
|
2482
2534
|
svg_path: null
|
|
@@ -2487,6 +2539,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2487
2539
|
Tex: "\\iiint",
|
|
2488
2540
|
mirror: true,
|
|
2489
2541
|
displayMirror: false,
|
|
2542
|
+
compileMirror: true,
|
|
2490
2543
|
Label: "\u222D",
|
|
2491
2544
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062B\u0644\u0627\u062B\u064A",
|
|
2492
2545
|
svg_path: null
|
|
@@ -2497,6 +2550,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2497
2550
|
Tex: "\\iiiint",
|
|
2498
2551
|
mirror: true,
|
|
2499
2552
|
displayMirror: false,
|
|
2553
|
+
compileMirror: true,
|
|
2500
2554
|
Label: "\u2A0C",
|
|
2501
2555
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0631\u0628\u0627\u0639\u064A",
|
|
2502
2556
|
svg_path: null
|
|
@@ -2507,6 +2561,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2507
2561
|
Tex: "\\oint",
|
|
2508
2562
|
mirror: true,
|
|
2509
2563
|
displayMirror: false,
|
|
2564
|
+
compileMirror: true,
|
|
2510
2565
|
Label: "\u222E",
|
|
2511
2566
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u063A\u0644\u0642",
|
|
2512
2567
|
svg_path: null
|
|
@@ -2517,6 +2572,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2517
2572
|
Tex: "\\oiint",
|
|
2518
2573
|
mirror: true,
|
|
2519
2574
|
displayMirror: false,
|
|
2575
|
+
compileMirror: true,
|
|
2520
2576
|
Label: "\u222F",
|
|
2521
2577
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0633\u0637\u062D\u064A \u0645\u063A\u0644\u0642",
|
|
2522
2578
|
svg_path: null
|
|
@@ -2527,6 +2583,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2527
2583
|
Tex: "\\oiiint",
|
|
2528
2584
|
mirror: true,
|
|
2529
2585
|
displayMirror: false,
|
|
2586
|
+
compileMirror: true,
|
|
2530
2587
|
Label: "\u2230",
|
|
2531
2588
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062D\u062C\u0645\u064A \u0645\u063A\u0644\u0642",
|
|
2532
2589
|
svg_path: null
|
|
@@ -2536,8 +2593,9 @@ function shouldMirrorOperatorDisplay(command) {
|
|
|
2536
2593
|
return command?.displayMirror ?? command?.mirror ?? false;
|
|
2537
2594
|
}
|
|
2538
2595
|
var MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => command.mirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
|
|
2539
|
-
|
|
2540
|
-
|
|
2596
|
+
var COMPILE_MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => "compileMirror" in command && command.compileMirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
|
|
2597
|
+
function matchingMirroredOperatorFrom(tex, index, operatorTexList) {
|
|
2598
|
+
for (const operatorTex of operatorTexList) {
|
|
2541
2599
|
if (!tex.startsWith(operatorTex, index)) {
|
|
2542
2600
|
continue;
|
|
2543
2601
|
}
|
|
@@ -2568,19 +2626,26 @@ function findMatchingBrace(tex, openIndex) {
|
|
|
2568
2626
|
}
|
|
2569
2627
|
return -1;
|
|
2570
2628
|
}
|
|
2571
|
-
function mirrorBuTeXOperatorsInTex(tex) {
|
|
2629
|
+
function mirrorBuTeXOperatorsInTex(tex, options = {}) {
|
|
2630
|
+
const mirroredOperatorTex = options.target === "compile" ? COMPILE_MIRRORED_OPERATOR_TEX : MIRRORED_OPERATOR_TEX;
|
|
2572
2631
|
let result = "";
|
|
2573
2632
|
let index = 0;
|
|
2574
2633
|
while (index < tex.length) {
|
|
2575
2634
|
if (tex.startsWith("\\butexmirror{", index)) {
|
|
2576
2635
|
const end = findMatchingBrace(tex, index + "\\butexmirror".length);
|
|
2577
2636
|
if (end !== -1) {
|
|
2578
|
-
|
|
2637
|
+
const bodyStart = index + "\\butexmirror{".length;
|
|
2638
|
+
const body = tex.slice(bodyStart, end);
|
|
2639
|
+
if (options.target === "compile" && MIRRORED_OPERATOR_TEX.includes(body) && !mirroredOperatorTex.includes(body)) {
|
|
2640
|
+
result += body;
|
|
2641
|
+
} else {
|
|
2642
|
+
result += tex.slice(index, end + 1);
|
|
2643
|
+
}
|
|
2579
2644
|
index = end + 1;
|
|
2580
2645
|
continue;
|
|
2581
2646
|
}
|
|
2582
2647
|
}
|
|
2583
|
-
const operatorTex =
|
|
2648
|
+
const operatorTex = matchingMirroredOperatorFrom(tex, index, mirroredOperatorTex);
|
|
2584
2649
|
if (operatorTex) {
|
|
2585
2650
|
result += `\\butexmirror{${operatorTex}}`;
|
|
2586
2651
|
index += operatorTex.length;
|