temml 0.13.2 → 0.13.4

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/temml.js CHANGED
@@ -788,7 +788,7 @@ var temml = (function () {
788
788
  };
789
789
 
790
790
  const stretchyCodePoint = {
791
- widehat: "^",
791
+ widehat: "\u02c6", // Shorter than \u005e, which is appropriate for an accent.
792
792
  widecheck: "ˇ",
793
793
  widetilde: "~",
794
794
  wideparen: "⏜", // \u23dc
@@ -851,19 +851,30 @@ var temml = (function () {
851
851
  return node
852
852
  };
853
853
 
854
- const crookedWides = ["\\widetilde", "\\widehat", "\\widecheck", "\\utilde"];
854
+ const wideHats = ["\\widehat", "\\widecheck"];
855
855
 
856
- // TODO: Remove when Chromium stretches \widetilde & \widehat
856
+ // TODO: Remove if/when Chromium stretches \widetilde & \widehat
857
857
  const accentNode = (group) => {
858
858
  const mo = mathMLnode(group.label);
859
- if (crookedWides.includes(group.label)) {
859
+ if (group.label.indexOf("tilde") > -1) {
860
860
  const width = estimatedWidth(group.base);
861
861
  if (1 < width && width < 1.6) {
862
- mo.classes.push("tml-crooked-2");
862
+ mo.classes.push("tml-tilde-2");
863
+ } else if (1.6 <= width && width < 2.5) {
864
+ mo.classes.push("tml-tilde-3");
865
+ } else if (2.5 <= width) {
866
+ mo.classes.push("tml-tilde-4");
867
+ }
868
+ } else if (wideHats.includes(group.label)) {
869
+ const width = estimatedWidth(group.base);
870
+ if (0 < width && width <= 1) {
871
+ mo.classes.push("tml-hat-1");
872
+ } else if (1 < width && width < 1.6) {
873
+ mo.classes.push("tml-hat-2");
863
874
  } else if (1.6 <= width && width < 2.5) {
864
- mo.classes.push("tml-crooked-3");
875
+ mo.classes.push("tml-hat-3");
865
876
  } else if (2.5 <= width) {
866
- mo.classes.push("tml-crooked-4");
877
+ mo.classes.push("tml-hat-4");
867
878
  }
868
879
  }
869
880
  return mo
@@ -1772,7 +1783,7 @@ var temml = (function () {
1772
1783
  defineSymbol(math, accent, "\u203e", "\\bar");
1773
1784
  defineSymbol(math, accent, "\u02d8", "\\breve");
1774
1785
  defineSymbol(math, accent, "\u02c7", "\\check");
1775
- defineSymbol(math, accent, "\u005e", "\\hat");
1786
+ defineSymbol(math, accent, "\u02c6", "\\hat");
1776
1787
  defineSymbol(math, accent, "\u2192", "\\vec");
1777
1788
  defineSymbol(math, accent, "\u02d9", "\\dot");
1778
1789
  defineSymbol(math, accent, "\u02da", "\\mathring");
@@ -4607,9 +4618,9 @@ var temml = (function () {
4607
4618
  }
4608
4619
  if (mustSquashRow) {
4609
4620
  // All the cell contents are \hphantom. Squash the cell.
4621
+ // TODO: Remove the next line when Firefox no longer needs it.
4622
+ mtr.classes.push("ff-squash"); // necessary in Firefox only.
4610
4623
  for (let j = 0; j < mtr.children.length; j++) {
4611
- mtr.children[j].style.display = "block"; // necessary in Firefox only
4612
- mtr.children[j].style.height = "0"; // necessary in Firefox only
4613
4624
  mtr.children[j].style.paddingTop = "0";
4614
4625
  mtr.children[j].style.paddingBottom = "0";
4615
4626
  }
@@ -5250,13 +5261,11 @@ var temml = (function () {
5250
5261
  },
5251
5262
  handler: ({ parser, funcName }, args, optArgs) => {
5252
5263
  // Find out if the author has defined custom delimiters
5253
- let delimiters = ["(", ")"];
5264
+ let delimiters = ["(", ")"]; // default
5254
5265
  if (funcName === "\\bordermatrix" && optArgs[0] && optArgs[0].body) {
5255
5266
  const body = optArgs[0].body;
5256
- if (body.length === 2 && body[0].type === "atom" && body[1].type === "atom") {
5257
- if (body[0].family === "open" && body[1].family === "close") {
5258
- delimiters = [body[0].text, body[1].text];
5259
- }
5267
+ if (body.length === 1 && body[0].type === "delimiter") {
5268
+ delimiters = [body[0].left, body[0].right];
5260
5269
  }
5261
5270
  }
5262
5271
  // consume the opening brace
@@ -6352,17 +6361,14 @@ var temml = (function () {
6352
6361
  mathmlBuilder: (group) => {
6353
6362
  const textNode = makeText(group.delim, group.mode);
6354
6363
  const middleNode = new MathNode("mo", [textNode]);
6355
- middleNode.setAttribute("fence", "true");
6356
- if (group.delim.indexOf("arrow") > -1) {
6357
- middleNode.setAttribute("stretchy", "true");
6358
- }
6359
- // The next line is not semantically correct, but
6360
- // Chromium fails to stretch if it is not there.
6361
- middleNode.setAttribute("form", "prefix");
6362
- // MathML gives 5/18em spacing to each <mo> element.
6363
- // \middle should get delimiter spacing instead.
6364
- middleNode.setAttribute("lspace", "0.05em");
6365
- middleNode.setAttribute("rspace", "0.05em");
6364
+ middleNode.setAttribute("stretchy", "true");
6365
+ middleNode.setAttribute("form", "infix");
6366
+ if (textNode.text !== "/") {
6367
+ // MathML gives 5/18em spacing to each <mo> element.
6368
+ // \middle should get delimiter spacing instead.
6369
+ middleNode.setAttribute("lspace", "0.05em");
6370
+ middleNode.setAttribute("rspace", "0.05em");
6371
+ }
6366
6372
  return middleNode;
6367
6373
  }
6368
6374
  });
@@ -6529,7 +6535,7 @@ var temml = (function () {
6529
6535
 
6530
6536
  defineFunction({
6531
6537
  type: "enclose",
6532
- names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\overline",
6538
+ names: ["\\angl", "\\cancel", "\\bcancel", "\\xcancel", "\\overline",
6533
6539
  "\\boxed", "\\longdiv", "\\phase"],
6534
6540
  props: {
6535
6541
  numArgs: 1
@@ -6546,6 +6552,25 @@ var temml = (function () {
6546
6552
  mathmlBuilder: mathmlBuilder$7
6547
6553
  });
6548
6554
 
6555
+ defineFunction({
6556
+ type: "enclose",
6557
+ names: ["\\sout"],
6558
+ props: {
6559
+ numArgs: 1,
6560
+ allowedInText: true
6561
+ },
6562
+ handler({ parser, funcName }, args) {
6563
+ const body = args[0];
6564
+ return {
6565
+ type: "enclose",
6566
+ mode: parser.mode,
6567
+ label: funcName,
6568
+ body
6569
+ };
6570
+ },
6571
+ mathmlBuilder: mathmlBuilder$7
6572
+ });
6573
+
6549
6574
  defineFunction({
6550
6575
  type: "enclose",
6551
6576
  names: ["\\underline"],
@@ -6678,8 +6703,237 @@ var temml = (function () {
6678
6703
  }
6679
6704
  });
6680
6705
 
6706
+ // Chromium does not support the MathML `mathvariant` attribute.
6707
+ // Instead, we replace ASCII characters with Unicode characters that
6708
+ // are defined in the font as bold, italic, double-struck, etc.
6709
+ // This module identifies those Unicode code points.
6710
+
6711
+ // First, a few helpers.
6712
+ const script = Object.freeze({
6713
+ B: 0x20EA, // Offset from ASCII B to Unicode script B
6714
+ E: 0x20EB,
6715
+ F: 0x20EB,
6716
+ H: 0x20C3,
6717
+ I: 0x20C7,
6718
+ L: 0x20C6,
6719
+ M: 0x20E6,
6720
+ R: 0x20C9,
6721
+ e: 0x20CA,
6722
+ g: 0x20A3,
6723
+ o: 0x20C5
6724
+ });
6725
+
6726
+ const frak = Object.freeze({
6727
+ C: 0x20EA,
6728
+ H: 0x20C4,
6729
+ I: 0x20C8,
6730
+ R: 0x20CA,
6731
+ Z: 0x20CE
6732
+ });
6733
+
6734
+ const bbb = Object.freeze({
6735
+ C: 0x20BF, // blackboard bold
6736
+ H: 0x20C5,
6737
+ N: 0x20C7,
6738
+ P: 0x20C9,
6739
+ Q: 0x20C9,
6740
+ R: 0x20CB,
6741
+ Z: 0x20CA
6742
+ });
6743
+
6744
+ const bold = Object.freeze({
6745
+ "\u03f5": 0x1D2E7, // lunate epsilon
6746
+ "\u03d1": 0x1D30C, // vartheta
6747
+ "\u03f0": 0x1D2EE, // varkappa
6748
+ "\u03c6": 0x1D319, // varphi
6749
+ "\u03f1": 0x1D2EF, // varrho
6750
+ "\u03d6": 0x1D30B // varpi
6751
+ });
6752
+
6753
+ const boldItalic = Object.freeze({
6754
+ "\u03f5": 0x1D35B, // lunate epsilon
6755
+ "\u03d1": 0x1D380, // vartheta
6756
+ "\u03f0": 0x1D362, // varkappa
6757
+ "\u03c6": 0x1D38D, // varphi
6758
+ "\u03f1": 0x1D363, // varrho
6759
+ "\u03d6": 0x1D37F // varpi
6760
+ });
6761
+
6762
+ const boldsf = Object.freeze({
6763
+ "\u03f5": 0x1D395, // lunate epsilon
6764
+ "\u03d1": 0x1D3BA, // vartheta
6765
+ "\u03f0": 0x1D39C, // varkappa
6766
+ "\u03c6": 0x1D3C7, // varphi
6767
+ "\u03f1": 0x1D39D, // varrho
6768
+ "\u03d6": 0x1D3B9 // varpi
6769
+ });
6770
+
6771
+ const bisf = Object.freeze({
6772
+ "\u03f5": 0x1D3CF, // lunate epsilon
6773
+ "\u03d1": 0x1D3F4, // vartheta
6774
+ "\u03f0": 0x1D3D6, // varkappa
6775
+ "\u03c6": 0x1D401, // varphi
6776
+ "\u03f1": 0x1D3D7, // varrho
6777
+ "\u03d6": 0x1D3F3 // varpi
6778
+ });
6779
+
6780
+ // Code point offsets below are derived from https://www.unicode.org/charts/PDF/U1D400.pdf
6781
+ const offset = Object.freeze({
6782
+ upperCaseLatin: { // A-Z
6783
+ "normal": ch => { return 0 },
6784
+ "bold": ch => { return 0x1D3BF },
6785
+ "italic": ch => { return 0x1D3F3 },
6786
+ "bold-italic": ch => { return 0x1D427 },
6787
+ "script": ch => { return script[ch] || 0x1D45B },
6788
+ "script-bold": ch => { return 0x1D48F },
6789
+ "fraktur": ch => { return frak[ch] || 0x1D4C3 },
6790
+ "fraktur-bold": ch => { return 0x1D52B },
6791
+ "double-struck": ch => { return bbb[ch] || 0x1D4F7 },
6792
+ "sans-serif": ch => { return 0x1D55F },
6793
+ "sans-serif-bold": ch => { return 0x1D593 },
6794
+ "sans-serif-italic": ch => { return 0x1D5C7 },
6795
+ "sans-serif-bold-italic": ch => { return 0x1D63C },
6796
+ "monospace": ch => { return 0x1D62F }
6797
+ },
6798
+ lowerCaseLatin: { // a-z
6799
+ "normal": ch => { return 0 },
6800
+ "bold": ch => { return 0x1D3B9 },
6801
+ "italic": ch => { return ch === "h" ? 0x20A6 : 0x1D3ED },
6802
+ "bold-italic": ch => { return 0x1D421 },
6803
+ "script": ch => { return script[ch] || 0x1D455 },
6804
+ "script-bold": ch => { return 0x1D489 },
6805
+ "fraktur": ch => { return 0x1D4BD },
6806
+ "fraktur-bold": ch => { return 0x1D525 },
6807
+ "double-struck": ch => { return 0x1D4F1 },
6808
+ "sans-serif": ch => { return 0x1D559 },
6809
+ "sans-serif-bold": ch => { return 0x1D58D },
6810
+ "sans-serif-italic": ch => { return 0x1D5C1 },
6811
+ "sans-serif-bold-italic": ch => { return 0x1D5F5 },
6812
+ "monospace": ch => { return 0x1D629 }
6813
+ },
6814
+ upperCaseGreek: { // A-Ω
6815
+ "normal": ch => { return 0 },
6816
+ "bold": ch => { return 0x1D317 },
6817
+ "italic": ch => { return 0x1D351 },
6818
+ // \boldsymbol actually returns upright bold for upperCaseGreek
6819
+ "bold-italic": ch => { return 0x1D317 },
6820
+ "script": ch => { return 0 },
6821
+ "script-bold": ch => { return 0 },
6822
+ "fraktur": ch => { return 0 },
6823
+ "fraktur-bold": ch => { return 0 },
6824
+ "double-struck": ch => { return 0 },
6825
+ // Unicode has no code points for regular-weight san-serif Greek. Use bold.
6826
+ "sans-serif": ch => { return 0x1D3C5 },
6827
+ "sans-serif-bold": ch => { return 0x1D3C5 },
6828
+ "sans-serif-italic": ch => { return 0 },
6829
+ "sans-serif-bold-italic": ch => { return 0x1D3FF },
6830
+ "monospace": ch => { return 0 }
6831
+ },
6832
+ lowerCaseGreek: { // α-ω
6833
+ "normal": ch => { return 0 },
6834
+ "bold": ch => { return 0x1D311 },
6835
+ "italic": ch => { return 0x1D34B },
6836
+ "bold-italic": ch => { return ch === "\u03d5" ? 0x1D37E : 0x1D385 },
6837
+ "script": ch => { return 0 },
6838
+ "script-bold": ch => { return 0 },
6839
+ "fraktur": ch => { return 0 },
6840
+ "fraktur-bold": ch => { return 0 },
6841
+ "double-struck": ch => { return 0 },
6842
+ // Unicode has no code points for regular-weight san-serif Greek. Use bold.
6843
+ "sans-serif": ch => { return 0x1D3BF },
6844
+ "sans-serif-bold": ch => { return 0x1D3BF },
6845
+ "sans-serif-italic": ch => { return 0 },
6846
+ "sans-serif-bold-italic": ch => { return 0x1D3F9 },
6847
+ "monospace": ch => { return 0 }
6848
+ },
6849
+ varGreek: { // \varGamma, etc
6850
+ "normal": ch => { return 0 },
6851
+ "bold": ch => { return bold[ch] || -51 },
6852
+ "italic": ch => { return 0 },
6853
+ "bold-italic": ch => { return boldItalic[ch] || 0x3A },
6854
+ "script": ch => { return 0 },
6855
+ "script-bold": ch => { return 0 },
6856
+ "fraktur": ch => { return 0 },
6857
+ "fraktur-bold": ch => { return 0 },
6858
+ "double-struck": ch => { return 0 },
6859
+ "sans-serif": ch => { return boldsf[ch] || 0x74 },
6860
+ "sans-serif-bold": ch => { return boldsf[ch] || 0x74 },
6861
+ "sans-serif-italic": ch => { return 0 },
6862
+ "sans-serif-bold-italic": ch => { return bisf[ch] || 0xAE },
6863
+ "monospace": ch => { return 0 }
6864
+ },
6865
+ numeral: { // 0-9
6866
+ "normal": ch => { return 0 },
6867
+ "bold": ch => { return 0x1D79E },
6868
+ "italic": ch => { return 0 },
6869
+ "bold-italic": ch => { return 0 },
6870
+ "script": ch => { return 0 },
6871
+ "script-bold": ch => { return 0 },
6872
+ "fraktur": ch => { return 0 },
6873
+ "fraktur-bold": ch => { return 0 },
6874
+ "double-struck": ch => { return 0x1D7A8 },
6875
+ "sans-serif": ch => { return 0x1D7B2 },
6876
+ "sans-serif-bold": ch => { return 0x1D7BC },
6877
+ "sans-serif-italic": ch => { return 0 },
6878
+ "sans-serif-bold-italic": ch => { return 0 },
6879
+ "monospace": ch => { return 0x1D7C6 }
6880
+ }
6881
+ });
6882
+
6883
+ const variantChar = (ch, variant) => {
6884
+ const codePoint = ch.codePointAt(0);
6885
+ const block = 0x40 < codePoint && codePoint < 0x5b
6886
+ ? "upperCaseLatin"
6887
+ : 0x60 < codePoint && codePoint < 0x7b
6888
+ ? "lowerCaseLatin"
6889
+ : (0x390 < codePoint && codePoint < 0x3AA)
6890
+ ? "upperCaseGreek"
6891
+ : 0x3B0 < codePoint && codePoint < 0x3CA || ch === "\u03d5"
6892
+ ? "lowerCaseGreek"
6893
+ : 0x1D6E1 < codePoint && codePoint < 0x1D6FC || bold[ch]
6894
+ ? "varGreek"
6895
+ : (0x2F < codePoint && codePoint < 0x3A)
6896
+ ? "numeral"
6897
+ : "other";
6898
+ return block === "other"
6899
+ ? ch
6900
+ : String.fromCodePoint(codePoint + offset[block][variant](ch))
6901
+ };
6902
+
6903
+ const smallCaps = Object.freeze({
6904
+ a: "ᴀ",
6905
+ b: "ʙ",
6906
+ c: "ᴄ",
6907
+ d: "ᴅ",
6908
+ e: "ᴇ",
6909
+ f: "ꜰ",
6910
+ g: "ɢ",
6911
+ h: "ʜ",
6912
+ i: "ɪ",
6913
+ j: "ᴊ",
6914
+ k: "ᴋ",
6915
+ l: "ʟ",
6916
+ m: "ᴍ",
6917
+ n: "ɴ",
6918
+ o: "ᴏ",
6919
+ p: "ᴘ",
6920
+ q: "ǫ",
6921
+ r: "ʀ",
6922
+ s: "s",
6923
+ t: "ᴛ",
6924
+ u: "ᴜ",
6925
+ v: "ᴠ",
6926
+ w: "ᴡ",
6927
+ x: "x",
6928
+ y: "ʏ",
6929
+ z: "ᴢ"
6930
+ });
6931
+
6932
+ const varNameFonts = ["mathrm", "mathit"];
6933
+
6681
6934
  const isLongVariableName = (group, font) => {
6682
- if (font !== "mathrm" || group.body.type !== "ordgroup" || group.body.body.length === 1) {
6935
+ if (!varNameFonts.includes(font) || !group.body || group.body.type !== "ordgroup" ||
6936
+ group.body.body.length === 1) {
6683
6937
  return false
6684
6938
  }
6685
6939
  if (group.body.body[0].type !== "mathord") { return false }
@@ -6705,8 +6959,7 @@ var temml = (function () {
6705
6959
  }
6706
6960
  // Check if it is possible to consolidate elements into a single <mi> element.
6707
6961
  if (isLongVariableName(group, font)) {
6708
- // This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
6709
- // wraps <mi> elements with <mpadded>s to work around a Firefox bug.
6962
+ // This is a \mathrm{…} or \mathit{…} group. It gets special treatment.
6710
6963
  const mi = mathGroup.children[0].children[0].children
6711
6964
  ? mathGroup.children[0].children[0]
6712
6965
  : mathGroup.children[0];
@@ -6716,7 +6969,14 @@ var temml = (function () {
6716
6969
  ? mathGroup.children[i].children[0].children[0].text
6717
6970
  : mathGroup.children[i].children[0].text;
6718
6971
  }
6719
- // Wrap in a <mpadded> to prevent the same Firefox bug.
6972
+ if (font === "mathit") {
6973
+ // Long <mi> elements are normally rendered in upright font.
6974
+ // To get italic, we need to convert each character to the corresponding italic character.
6975
+ mi.children[0].text = mi.children[0].text.split("")
6976
+ .map(c => variantChar(c, "italic")).join("");
6977
+ return mi
6978
+ }
6979
+ // Otherwise, font is "mathrm". Wrap in a <mpadded> to prevent a Firefox spacing bug.
6720
6980
  const mpadded = new MathNode("mpadded", [mi]);
6721
6981
  mpadded.setAttribute("lspace", "0");
6722
6982
  return mpadded
@@ -8594,7 +8854,7 @@ var temml = (function () {
8594
8854
  const inner = buildExpression(ordargument(group.body), style);
8595
8855
  const phantom = new MathNode("mphantom", inner);
8596
8856
  const node = new MathNode("mpadded", [phantom]);
8597
- node.setAttribute("width", "0px");
8857
+ node.setAttribute("width", "0.1px");
8598
8858
  return node;
8599
8859
  }
8600
8860
  });
@@ -9411,232 +9671,6 @@ var temml = (function () {
9411
9671
  return Object.prototype.hasOwnProperty.call(fontMap, font) ? fontMap[font] : null
9412
9672
  };
9413
9673
 
9414
- // Chromium does not support the MathML `mathvariant` attribute.
9415
- // Instead, we replace ASCII characters with Unicode characters that
9416
- // are defined in the font as bold, italic, double-struck, etc.
9417
- // This module identifies those Unicode code points.
9418
-
9419
- // First, a few helpers.
9420
- const script = Object.freeze({
9421
- B: 0x20EA, // Offset from ASCII B to Unicode script B
9422
- E: 0x20EB,
9423
- F: 0x20EB,
9424
- H: 0x20C3,
9425
- I: 0x20C7,
9426
- L: 0x20C6,
9427
- M: 0x20E6,
9428
- R: 0x20C9,
9429
- e: 0x20CA,
9430
- g: 0x20A3,
9431
- o: 0x20C5
9432
- });
9433
-
9434
- const frak = Object.freeze({
9435
- C: 0x20EA,
9436
- H: 0x20C4,
9437
- I: 0x20C8,
9438
- R: 0x20CA,
9439
- Z: 0x20CE
9440
- });
9441
-
9442
- const bbb = Object.freeze({
9443
- C: 0x20BF, // blackboard bold
9444
- H: 0x20C5,
9445
- N: 0x20C7,
9446
- P: 0x20C9,
9447
- Q: 0x20C9,
9448
- R: 0x20CB,
9449
- Z: 0x20CA
9450
- });
9451
-
9452
- const bold = Object.freeze({
9453
- "\u03f5": 0x1D2E7, // lunate epsilon
9454
- "\u03d1": 0x1D30C, // vartheta
9455
- "\u03f0": 0x1D2EE, // varkappa
9456
- "\u03c6": 0x1D319, // varphi
9457
- "\u03f1": 0x1D2EF, // varrho
9458
- "\u03d6": 0x1D30B // varpi
9459
- });
9460
-
9461
- const boldItalic = Object.freeze({
9462
- "\u03f5": 0x1D35B, // lunate epsilon
9463
- "\u03d1": 0x1D380, // vartheta
9464
- "\u03f0": 0x1D362, // varkappa
9465
- "\u03c6": 0x1D38D, // varphi
9466
- "\u03f1": 0x1D363, // varrho
9467
- "\u03d6": 0x1D37F // varpi
9468
- });
9469
-
9470
- const boldsf = Object.freeze({
9471
- "\u03f5": 0x1D395, // lunate epsilon
9472
- "\u03d1": 0x1D3BA, // vartheta
9473
- "\u03f0": 0x1D39C, // varkappa
9474
- "\u03c6": 0x1D3C7, // varphi
9475
- "\u03f1": 0x1D39D, // varrho
9476
- "\u03d6": 0x1D3B9 // varpi
9477
- });
9478
-
9479
- const bisf = Object.freeze({
9480
- "\u03f5": 0x1D3CF, // lunate epsilon
9481
- "\u03d1": 0x1D3F4, // vartheta
9482
- "\u03f0": 0x1D3D6, // varkappa
9483
- "\u03c6": 0x1D401, // varphi
9484
- "\u03f1": 0x1D3D7, // varrho
9485
- "\u03d6": 0x1D3F3 // varpi
9486
- });
9487
-
9488
- // Code point offsets below are derived from https://www.unicode.org/charts/PDF/U1D400.pdf
9489
- const offset = Object.freeze({
9490
- upperCaseLatin: { // A-Z
9491
- "normal": ch => { return 0 },
9492
- "bold": ch => { return 0x1D3BF },
9493
- "italic": ch => { return 0x1D3F3 },
9494
- "bold-italic": ch => { return 0x1D427 },
9495
- "script": ch => { return script[ch] || 0x1D45B },
9496
- "script-bold": ch => { return 0x1D48F },
9497
- "fraktur": ch => { return frak[ch] || 0x1D4C3 },
9498
- "fraktur-bold": ch => { return 0x1D52B },
9499
- "double-struck": ch => { return bbb[ch] || 0x1D4F7 },
9500
- "sans-serif": ch => { return 0x1D55F },
9501
- "sans-serif-bold": ch => { return 0x1D593 },
9502
- "sans-serif-italic": ch => { return 0x1D5C7 },
9503
- "sans-serif-bold-italic": ch => { return 0x1D63C },
9504
- "monospace": ch => { return 0x1D62F }
9505
- },
9506
- lowerCaseLatin: { // a-z
9507
- "normal": ch => { return 0 },
9508
- "bold": ch => { return 0x1D3B9 },
9509
- "italic": ch => { return ch === "h" ? 0x20A6 : 0x1D3ED },
9510
- "bold-italic": ch => { return 0x1D421 },
9511
- "script": ch => { return script[ch] || 0x1D455 },
9512
- "script-bold": ch => { return 0x1D489 },
9513
- "fraktur": ch => { return 0x1D4BD },
9514
- "fraktur-bold": ch => { return 0x1D525 },
9515
- "double-struck": ch => { return 0x1D4F1 },
9516
- "sans-serif": ch => { return 0x1D559 },
9517
- "sans-serif-bold": ch => { return 0x1D58D },
9518
- "sans-serif-italic": ch => { return 0x1D5C1 },
9519
- "sans-serif-bold-italic": ch => { return 0x1D5F5 },
9520
- "monospace": ch => { return 0x1D629 }
9521
- },
9522
- upperCaseGreek: { // A-Ω
9523
- "normal": ch => { return 0 },
9524
- "bold": ch => { return 0x1D317 },
9525
- "italic": ch => { return 0x1D351 },
9526
- // \boldsymbol actually returns upright bold for upperCaseGreek
9527
- "bold-italic": ch => { return 0x1D317 },
9528
- "script": ch => { return 0 },
9529
- "script-bold": ch => { return 0 },
9530
- "fraktur": ch => { return 0 },
9531
- "fraktur-bold": ch => { return 0 },
9532
- "double-struck": ch => { return 0 },
9533
- // Unicode has no code points for regular-weight san-serif Greek. Use bold.
9534
- "sans-serif": ch => { return 0x1D3C5 },
9535
- "sans-serif-bold": ch => { return 0x1D3C5 },
9536
- "sans-serif-italic": ch => { return 0 },
9537
- "sans-serif-bold-italic": ch => { return 0x1D3FF },
9538
- "monospace": ch => { return 0 }
9539
- },
9540
- lowerCaseGreek: { // α-ω
9541
- "normal": ch => { return 0 },
9542
- "bold": ch => { return 0x1D311 },
9543
- "italic": ch => { return 0x1D34B },
9544
- "bold-italic": ch => { return ch === "\u03d5" ? 0x1D37E : 0x1D385 },
9545
- "script": ch => { return 0 },
9546
- "script-bold": ch => { return 0 },
9547
- "fraktur": ch => { return 0 },
9548
- "fraktur-bold": ch => { return 0 },
9549
- "double-struck": ch => { return 0 },
9550
- // Unicode has no code points for regular-weight san-serif Greek. Use bold.
9551
- "sans-serif": ch => { return 0x1D3BF },
9552
- "sans-serif-bold": ch => { return 0x1D3BF },
9553
- "sans-serif-italic": ch => { return 0 },
9554
- "sans-serif-bold-italic": ch => { return 0x1D3F9 },
9555
- "monospace": ch => { return 0 }
9556
- },
9557
- varGreek: { // \varGamma, etc
9558
- "normal": ch => { return 0 },
9559
- "bold": ch => { return bold[ch] || -51 },
9560
- "italic": ch => { return 0 },
9561
- "bold-italic": ch => { return boldItalic[ch] || 0x3A },
9562
- "script": ch => { return 0 },
9563
- "script-bold": ch => { return 0 },
9564
- "fraktur": ch => { return 0 },
9565
- "fraktur-bold": ch => { return 0 },
9566
- "double-struck": ch => { return 0 },
9567
- "sans-serif": ch => { return boldsf[ch] || 0x74 },
9568
- "sans-serif-bold": ch => { return boldsf[ch] || 0x74 },
9569
- "sans-serif-italic": ch => { return 0 },
9570
- "sans-serif-bold-italic": ch => { return bisf[ch] || 0xAE },
9571
- "monospace": ch => { return 0 }
9572
- },
9573
- numeral: { // 0-9
9574
- "normal": ch => { return 0 },
9575
- "bold": ch => { return 0x1D79E },
9576
- "italic": ch => { return 0 },
9577
- "bold-italic": ch => { return 0 },
9578
- "script": ch => { return 0 },
9579
- "script-bold": ch => { return 0 },
9580
- "fraktur": ch => { return 0 },
9581
- "fraktur-bold": ch => { return 0 },
9582
- "double-struck": ch => { return 0x1D7A8 },
9583
- "sans-serif": ch => { return 0x1D7B2 },
9584
- "sans-serif-bold": ch => { return 0x1D7BC },
9585
- "sans-serif-italic": ch => { return 0 },
9586
- "sans-serif-bold-italic": ch => { return 0 },
9587
- "monospace": ch => { return 0x1D7C6 }
9588
- }
9589
- });
9590
-
9591
- const variantChar = (ch, variant) => {
9592
- const codePoint = ch.codePointAt(0);
9593
- const block = 0x40 < codePoint && codePoint < 0x5b
9594
- ? "upperCaseLatin"
9595
- : 0x60 < codePoint && codePoint < 0x7b
9596
- ? "lowerCaseLatin"
9597
- : (0x390 < codePoint && codePoint < 0x3AA)
9598
- ? "upperCaseGreek"
9599
- : 0x3B0 < codePoint && codePoint < 0x3CA || ch === "\u03d5"
9600
- ? "lowerCaseGreek"
9601
- : 0x1D6E1 < codePoint && codePoint < 0x1D6FC || bold[ch]
9602
- ? "varGreek"
9603
- : (0x2F < codePoint && codePoint < 0x3A)
9604
- ? "numeral"
9605
- : "other";
9606
- return block === "other"
9607
- ? ch
9608
- : String.fromCodePoint(codePoint + offset[block][variant](ch))
9609
- };
9610
-
9611
- const smallCaps = Object.freeze({
9612
- a: "ᴀ",
9613
- b: "ʙ",
9614
- c: "ᴄ",
9615
- d: "ᴅ",
9616
- e: "ᴇ",
9617
- f: "ꜰ",
9618
- g: "ɢ",
9619
- h: "ʜ",
9620
- i: "ɪ",
9621
- j: "ᴊ",
9622
- k: "ᴋ",
9623
- l: "ʟ",
9624
- m: "ᴍ",
9625
- n: "ɴ",
9626
- o: "ᴏ",
9627
- p: "ᴘ",
9628
- q: "ǫ",
9629
- r: "ʀ",
9630
- s: "s",
9631
- t: "ᴛ",
9632
- u: "ᴜ",
9633
- v: "ᴠ",
9634
- w: "ᴡ",
9635
- x: "x",
9636
- y: "ʏ",
9637
- z: "ᴢ"
9638
- });
9639
-
9640
9674
  // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in
9641
9675
  // src/symbols.js.
9642
9676
 
@@ -10256,7 +10290,7 @@ var temml = (function () {
10256
10290
  this.pushToken(new Token("EOF", end.loc));
10257
10291
 
10258
10292
  this.pushTokens(tokens);
10259
- return start.range(end, "");
10293
+ return new Token("", SourceLocation.range(start, end));
10260
10294
  }
10261
10295
 
10262
10296
  /**
@@ -12261,7 +12295,7 @@ var temml = (function () {
12261
12295
  * https://mit-license.org/
12262
12296
  */
12263
12297
 
12264
- const version = "0.13.02";
12298
+ const version = "0.13.4";
12265
12299
 
12266
12300
  function postProcess(block) {
12267
12301
  const labelMap = {};