temml 0.9.2 → 0.10.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Library | Minified JavaScript + CSS |
4
4
  |:--------------|:-------------------------:|
5
- | Temml | 146 KB |
5
+ | Temml | 147 KB |
6
6
  | MathJax 2.7.5 | 338 KB |
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
@@ -43,10 +43,6 @@ mo.tml-prime {
43
43
  font-feature-settings: 'salt';
44
44
  }
45
45
 
46
- .oldstylenums {
47
- font-feature-settings: 'onum';
48
- }
49
-
50
46
  /* AMS environment auto-numbering via CSS counter. */
51
47
  .tml-eqn::before {
52
48
  counter-increment: tmlEqnNo;
@@ -52,11 +52,6 @@ math {
52
52
  font-family: "Temml";
53
53
  }
54
54
 
55
- .oldstylenums {
56
- font-family: "Cambria Math", math;
57
- font-feature-settings: 'onum';
58
- }
59
-
60
55
  mo.tml-prime {
61
56
  font-family: Temml;
62
57
  }
@@ -50,11 +50,6 @@ math {
50
50
  font-family: "Cambria Math", 'STIXTwoMath-Regular', "Times New Roman", math;
51
51
  }
52
52
 
53
- .oldstylenums {
54
- font-family: "Cambria Math", math;
55
- font-feature-settings: 'onum';
56
- }
57
-
58
53
  mo.tml-prime {
59
54
  font-feature-settings: 'ssty';
60
55
  }
@@ -32,10 +32,6 @@ math .mathscr {
32
32
  font-family: "Temml";
33
33
  }
34
34
 
35
- math .oldstylenums {
36
- font-feature-settings: 'onum';
37
- }
38
-
39
35
  mo.tml-prime {
40
36
  font-family: Temml;
41
37
  }
@@ -40,11 +40,6 @@ math {
40
40
  font-feature-settings: 'ss01';
41
41
  }
42
42
 
43
- .oldstylenums {
44
- font-family: "Cambria Math", math;
45
- font-feature-settings: 'onum';
46
- }
47
-
48
43
  mo.tml-prime {
49
44
  font-feature-settings: 'ss04';
50
45
  }
package/dist/temml.cjs CHANGED
@@ -1234,6 +1234,8 @@ defineSymbol(math, textord, "\u2018", "`");
1234
1234
  defineSymbol(math, textord, "$", "\\$");
1235
1235
  defineSymbol(text, textord, "$", "\\$");
1236
1236
  defineSymbol(text, textord, "$", "\\textdollar");
1237
+ defineSymbol(math, textord, "¢", "\\cent");
1238
+ defineSymbol(text, textord, "¢", "\\cent");
1237
1239
  defineSymbol(math, textord, "%", "\\%");
1238
1240
  defineSymbol(text, textord, "%", "\\%");
1239
1241
  defineSymbol(math, textord, "_", "\\_");
@@ -3148,13 +3150,12 @@ defineFunction({
3148
3150
  names: ["\\\\"],
3149
3151
  props: {
3150
3152
  numArgs: 0,
3151
- numOptionalArgs: 1,
3152
- argTypes: ["size"],
3153
+ numOptionalArgs: 0,
3153
3154
  allowedInText: true
3154
3155
  },
3155
3156
 
3156
3157
  handler({ parser }, args, optArgs) {
3157
- const size = optArgs[0];
3158
+ const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
3158
3159
  const newLine = !parser.settings.displayMode;
3159
3160
  return {
3160
3161
  type: "cr",
@@ -4914,7 +4915,6 @@ defineFunction({
4914
4915
  "\\mathscr",
4915
4916
  "\\mathsf",
4916
4917
  "\\mathtt",
4917
- "\\oldstylenums",
4918
4918
 
4919
4919
  // aliases
4920
4920
  "\\Bbb",
@@ -7328,8 +7328,7 @@ const fontMap = {
7328
7328
  mathfrak: "fraktur",
7329
7329
  mathscr: "script",
7330
7330
  mathsf: "sans-serif",
7331
- mathtt: "monospace",
7332
- oldstylenums: "oldstylenums"
7331
+ mathtt: "monospace"
7333
7332
  };
7334
7333
 
7335
7334
  /**
@@ -7399,8 +7398,6 @@ const getVariant = function(group, style) {
7399
7398
  return "sans-serif"
7400
7399
  case "mathtt":
7401
7400
  return "monospace"
7402
- case "oldstylenums":
7403
- return "oldstylenums"
7404
7401
  }
7405
7402
 
7406
7403
  let text = group.text;
@@ -7696,10 +7693,7 @@ defineFunctionBuilders({
7696
7693
  let node;
7697
7694
  if (numberRegEx$1.test(group.text)) {
7698
7695
  const tag = group.mode === "text" ? "mtext" : "mn";
7699
- if (variant === "oldstylenums") {
7700
- const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
7701
- node = new mathMLTree.MathNode(tag, [ms]);
7702
- } else if (variant === "italic" || variant === "bold-italic") {
7696
+ if (variant === "italic" || variant === "bold-italic") {
7703
7697
  return italicNumber(text, variant, tag)
7704
7698
  } else {
7705
7699
  if (variant !== "normal") {
@@ -11430,6 +11424,36 @@ const uSubsAndSups = Object.freeze({
11430
11424
  '\u1DBF': 'θ'
11431
11425
  });
11432
11426
 
11427
+ // Used for Unicode input of calligraphic and script letters
11428
+ const asciiFromScript = Object.freeze({
11429
+ "\ud835\udc9c": "A",
11430
+ "\u212c": "B",
11431
+ "\ud835\udc9e": "C",
11432
+ "\ud835\udc9f": "D",
11433
+ "\u2130": "E",
11434
+ "\u2131": "F",
11435
+ "\ud835\udca2": "G",
11436
+ "\u210B": "H",
11437
+ "\u2110": "I",
11438
+ "\ud835\udca5": "J",
11439
+ "\ud835\udca6": "K",
11440
+ "\u2112": "L",
11441
+ "\u2113": "M",
11442
+ "\ud835\udca9": "N",
11443
+ "\ud835\udcaa": "O",
11444
+ "\ud835\udcab": "P",
11445
+ "\ud835\udcac": "Q",
11446
+ "\u211B": "R",
11447
+ "\ud835\udcae": "S",
11448
+ "\ud835\udcaf": "T",
11449
+ "\ud835\udcb0": "U",
11450
+ "\ud835\udcb1": "V",
11451
+ "\ud835\udcb2": "W",
11452
+ "\ud835\udcb3": "X",
11453
+ "\ud835\udcb4": "Y",
11454
+ "\ud835\udcb5": "Z"
11455
+ });
11456
+
11433
11457
  // Mapping of Unicode accent characters to their LaTeX equivalent in text and
11434
11458
  // math mode (when they exist).
11435
11459
  var unicodeAccents = {
@@ -12665,6 +12689,22 @@ class Parser {
12665
12689
  text
12666
12690
  };
12667
12691
  } else {
12692
+ if (asciiFromScript[text]) {
12693
+ // Unicode 14 disambiguates chancery from roundhand.
12694
+ // See https://www.unicode.org/charts/PDF/U1D400.pdf
12695
+ this.consume();
12696
+ const nextCode = this.fetch().text.charCodeAt(0);
12697
+ // mathcal is Temml default. Use mathscript if called for.
12698
+ const font = nextCode === 0xfe01 ? "mathscr" : "mathcal";
12699
+ if (nextCode === 0xfe00 || nextCode === 0xfe01) { this.consume(); }
12700
+ return {
12701
+ type: "font",
12702
+ mode: "math",
12703
+ font,
12704
+ body: { type: "mathord", mode: "math", loc, text: asciiFromScript[text] }
12705
+ }
12706
+ }
12707
+ // Default ord character. No disambiguation necessary.
12668
12708
  s = {
12669
12709
  type: group,
12670
12710
  mode: this.mode,
@@ -12921,7 +12961,7 @@ class Style {
12921
12961
  * https://mit-license.org/
12922
12962
  */
12923
12963
 
12924
- const version = "0.9.2";
12964
+ const version = "0.10.0";
12925
12965
 
12926
12966
  function postProcess(block) {
12927
12967
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -1235,6 +1235,8 @@ var temml = (function () {
1235
1235
  defineSymbol(math, textord, "$", "\\$");
1236
1236
  defineSymbol(text, textord, "$", "\\$");
1237
1237
  defineSymbol(text, textord, "$", "\\textdollar");
1238
+ defineSymbol(math, textord, "¢", "\\cent");
1239
+ defineSymbol(text, textord, "¢", "\\cent");
1238
1240
  defineSymbol(math, textord, "%", "\\%");
1239
1241
  defineSymbol(text, textord, "%", "\\%");
1240
1242
  defineSymbol(math, textord, "_", "\\_");
@@ -3149,13 +3151,12 @@ var temml = (function () {
3149
3151
  names: ["\\\\"],
3150
3152
  props: {
3151
3153
  numArgs: 0,
3152
- numOptionalArgs: 1,
3153
- argTypes: ["size"],
3154
+ numOptionalArgs: 0,
3154
3155
  allowedInText: true
3155
3156
  },
3156
3157
 
3157
3158
  handler({ parser }, args, optArgs) {
3158
- const size = optArgs[0];
3159
+ const size = parser.gullet.future().text === "[" ? parser.parseSizeGroup(true) : null;
3159
3160
  const newLine = !parser.settings.displayMode;
3160
3161
  return {
3161
3162
  type: "cr",
@@ -4915,7 +4916,6 @@ var temml = (function () {
4915
4916
  "\\mathscr",
4916
4917
  "\\mathsf",
4917
4918
  "\\mathtt",
4918
- "\\oldstylenums",
4919
4919
 
4920
4920
  // aliases
4921
4921
  "\\Bbb",
@@ -7329,8 +7329,7 @@ var temml = (function () {
7329
7329
  mathfrak: "fraktur",
7330
7330
  mathscr: "script",
7331
7331
  mathsf: "sans-serif",
7332
- mathtt: "monospace",
7333
- oldstylenums: "oldstylenums"
7332
+ mathtt: "monospace"
7334
7333
  };
7335
7334
 
7336
7335
  /**
@@ -7400,8 +7399,6 @@ var temml = (function () {
7400
7399
  return "sans-serif"
7401
7400
  case "mathtt":
7402
7401
  return "monospace"
7403
- case "oldstylenums":
7404
- return "oldstylenums"
7405
7402
  }
7406
7403
 
7407
7404
  let text = group.text;
@@ -7697,10 +7694,7 @@ var temml = (function () {
7697
7694
  let node;
7698
7695
  if (numberRegEx$1.test(group.text)) {
7699
7696
  const tag = group.mode === "text" ? "mtext" : "mn";
7700
- if (variant === "oldstylenums") {
7701
- const ms = new mathMLTree.MathNode("mstyle", [text], ["oldstylenums"]);
7702
- node = new mathMLTree.MathNode(tag, [ms]);
7703
- } else if (variant === "italic" || variant === "bold-italic") {
7697
+ if (variant === "italic" || variant === "bold-italic") {
7704
7698
  return italicNumber(text, variant, tag)
7705
7699
  } else {
7706
7700
  if (variant !== "normal") {
@@ -9531,6 +9525,36 @@ var temml = (function () {
9531
9525
  '\u1DBF': 'θ'
9532
9526
  });
9533
9527
 
9528
+ // Used for Unicode input of calligraphic and script letters
9529
+ const asciiFromScript = Object.freeze({
9530
+ "\ud835\udc9c": "A",
9531
+ "\u212c": "B",
9532
+ "\ud835\udc9e": "C",
9533
+ "\ud835\udc9f": "D",
9534
+ "\u2130": "E",
9535
+ "\u2131": "F",
9536
+ "\ud835\udca2": "G",
9537
+ "\u210B": "H",
9538
+ "\u2110": "I",
9539
+ "\ud835\udca5": "J",
9540
+ "\ud835\udca6": "K",
9541
+ "\u2112": "L",
9542
+ "\u2113": "M",
9543
+ "\ud835\udca9": "N",
9544
+ "\ud835\udcaa": "O",
9545
+ "\ud835\udcab": "P",
9546
+ "\ud835\udcac": "Q",
9547
+ "\u211B": "R",
9548
+ "\ud835\udcae": "S",
9549
+ "\ud835\udcaf": "T",
9550
+ "\ud835\udcb0": "U",
9551
+ "\ud835\udcb1": "V",
9552
+ "\ud835\udcb2": "W",
9553
+ "\ud835\udcb3": "X",
9554
+ "\ud835\udcb4": "Y",
9555
+ "\ud835\udcb5": "Z"
9556
+ });
9557
+
9534
9558
  // Mapping of Unicode accent characters to their LaTeX equivalent in text and
9535
9559
  // math mode (when they exist).
9536
9560
  var unicodeAccents = {
@@ -10766,6 +10790,22 @@ var temml = (function () {
10766
10790
  text
10767
10791
  };
10768
10792
  } else {
10793
+ if (asciiFromScript[text]) {
10794
+ // Unicode 14 disambiguates chancery from roundhand.
10795
+ // See https://www.unicode.org/charts/PDF/U1D400.pdf
10796
+ this.consume();
10797
+ const nextCode = this.fetch().text.charCodeAt(0);
10798
+ // mathcal is Temml default. Use mathscript if called for.
10799
+ const font = nextCode === 0xfe01 ? "mathscr" : "mathcal";
10800
+ if (nextCode === 0xfe00 || nextCode === 0xfe01) { this.consume(); }
10801
+ return {
10802
+ type: "font",
10803
+ mode: "math",
10804
+ font,
10805
+ body: { type: "mathord", mode: "math", loc, text: asciiFromScript[text] }
10806
+ }
10807
+ }
10808
+ // Default ord character. No disambiguation necessary.
10769
10809
  s = {
10770
10810
  type: group,
10771
10811
  mode: this.mode,
@@ -11022,7 +11062,7 @@ var temml = (function () {
11022
11062
  * https://mit-license.org/
11023
11063
  */
11024
11064
 
11025
- const version = "0.9.2";
11065
+ const version = "0.10.0";
11026
11066
 
11027
11067
  function postProcess(block) {
11028
11068
  const labelMap = {};