temml 0.10.22 → 0.10.23

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Library | Minified JavaScript + CSS |
4
4
  |:--------------|:-------------------------:|
5
- | Temml | 150 KB |
5
+ | Temml | 151 KB |
6
6
  | MathJax 2.7.5 | 338 KB |
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
@@ -0,0 +1,152 @@
1
+ /*
2
+ Fira Math fonts are released under the SIL OPEN FONT LICENSE Version 1.1.
3
+
4
+ The Fira Math WOFF2 font has been obtained from
5
+ http://www.gust.org.pl/projects/e-foundry/
6
+
7
+ The Temml.woff2 is a clone of KaTeX_Script-Regular, except that the code points
8
+ have been changed from ASCII to Unicode Mathematical Alphanumeric Symbols Script capitals,
9
+ Unicode range 1D49C to 1D4B5.
10
+ */
11
+
12
+ @font-face {
13
+ font-family: 'Temml';
14
+ src: url('Temml.woff2') format('woff2');
15
+ font-weight: normal;
16
+ font-style: normal;
17
+ }
18
+
19
+ @font-face {
20
+ font-family: Fira Math;
21
+ src: url('FiraMath-Regular.woff2');
22
+ }
23
+
24
+ math {
25
+ font-style: normal;
26
+ font-weight: normal;
27
+ line-height: normal;
28
+ font-size-adjust: none;
29
+ text-indent: 0;
30
+ text-transform: none;
31
+ letter-spacing: normal;
32
+ word-wrap: normal;
33
+ direction: ltr;
34
+ }
35
+
36
+ math * {
37
+ border-color: currentColor;
38
+ }
39
+
40
+ math {
41
+ font-family: "Fira Math", math;
42
+ }
43
+
44
+ /* Next line is active in Firefox and Safari.
45
+ * Not in Chromium, which recognizes display: "block math" written inline. */
46
+ math.tml-display { display: block; }
47
+
48
+ *.mathscr {
49
+ font-family: "Temml";
50
+ }
51
+
52
+ /* Chromium prime alignment */
53
+ mo.tml-prime {
54
+ font-family: Temml;
55
+ }
56
+
57
+ mrow.tml-cancel {
58
+ background: linear-gradient(to top left,
59
+ rgba(0,0,0,0) 0%,
60
+ rgba(0,0,0,0) calc(50% - 0.06em),
61
+ rgba(0,0,0,1) 50%,
62
+ rgba(0,0,0,0) calc(50% + 0.06em),
63
+ rgba(0,0,0,0) 100%);
64
+ }
65
+
66
+ mrow.tml-bcancel {
67
+ background: linear-gradient(to top right,
68
+ rgba(0,0,0,0) 0%,
69
+ rgba(0,0,0,0) calc(50% - 0.06em),
70
+ rgba(0,0,0,1) 50%,
71
+ rgba(0,0,0,0) calc(50% + 0.06em),
72
+ rgba(0,0,0,0) 100%);
73
+ }
74
+
75
+ mrow.tml-xcancel {
76
+ background: linear-gradient(to top left,
77
+ rgba(0,0,0,0) 0%,
78
+ rgba(0,0,0,0) calc(50% - 0.06em),
79
+ rgba(0,0,0,1) 50%,
80
+ rgba(0,0,0,0) calc(50% + 0.06em),
81
+ rgba(0,0,0,0) 100%),
82
+ linear-gradient(to top right,
83
+ rgba(0,0,0,0) 0%,
84
+ rgba(0,0,0,0) calc(50% - 0.06em),
85
+ rgba(0,0,0,1) 50%,
86
+ rgba(0,0,0,0) calc(50% + 0.06em),
87
+ rgba(0,0,0,0) 100%)
88
+ }
89
+
90
+ /* Prevent f' from overlapping in Chromium */
91
+ mo.prime-pad {
92
+ padding-left: 0.08em;
93
+ }
94
+
95
+ /* Array cell justification in Firefox & WebKit */
96
+ .tml-right {
97
+ text-align: right;
98
+ }
99
+ .tml-left {
100
+ text-align: left;
101
+ }
102
+
103
+ /* Stretch \widetilde & set array cell justification in Chromium */
104
+ @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
105
+ .tml-crooked-2 {
106
+ transform: scale(2.0, 1.1)
107
+ }
108
+ .tml-crooked-3 {
109
+ transform: scale(3.0, 1.3)
110
+ }
111
+ .tml-crooked-4 {
112
+ transform: scale(4.0, 1.4)
113
+ }
114
+ .tml-right {
115
+ text-align: -webkit-right;
116
+ }
117
+ .tml-left {
118
+ text-align: -webkit-left;
119
+ }
120
+ }
121
+
122
+ /* Adjust WebKit accents */
123
+ @supports (-webkit-backdrop-filter: blur(1px)) {
124
+ .tml-xshift { transform: translate(0px, 0.45em) }
125
+ .tml-capshift { transform: translate(0px, 0.35em) }
126
+ }
127
+
128
+ /* flex-wrap for line-breaking in Chromium */
129
+ math {
130
+ display: inline-flex;
131
+ flex-wrap: wrap;
132
+ align-items: baseline;
133
+ }
134
+ math > mrow {
135
+ padding: 0.5ex 0ex;
136
+ }
137
+
138
+ /* Avoid flex-wrap in Firefox */
139
+ @-moz-document url-prefix() {
140
+ math { display: inline; }
141
+ math > mrow { padding: 0 }
142
+ }
143
+
144
+ /* AMS environment auto-numbering via CSS counter. */
145
+ .tml-eqn::before {
146
+ counter-increment: tmlEqnNo;
147
+ content: "(" counter(tmlEqnNo) ")";
148
+ }
149
+
150
+ body {
151
+ counter-reset: tmlEqnNo;
152
+ }
package/dist/temml.cjs CHANGED
@@ -1026,6 +1026,7 @@ defineSymbol(math, mathord, "\u2609", "\\astrosun", true);
1026
1026
  defineSymbol(math, mathord, "\u263c", "\\sun", true);
1027
1027
  defineSymbol(math, mathord, "\u263e", "\\leftmoon", true);
1028
1028
  defineSymbol(math, mathord, "\u263d", "\\rightmoon", true);
1029
+ defineSymbol(math, mathord, "\u2295", "\\Earth");
1029
1030
 
1030
1031
  // AMS Negated Binary Relations
1031
1032
  defineSymbol(math, rel, "\u226e", "\\nless", true);
@@ -1253,6 +1254,8 @@ defineSymbol(math, bin, "\u27d5", "\\leftouterjoin", true);
1253
1254
  defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
1254
1255
  defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
1255
1256
 
1257
+ defineSymbol(math, bin, "\u2238", "\\dotminus", true); // stix
1258
+
1256
1259
  // AMS Arrows
1257
1260
  // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
1258
1261
  // We'll map it to AMS function \dashrightarrow. It produces the same atom.
@@ -2021,9 +2024,11 @@ const consolidateText = mrow => {
2021
2024
  };
2022
2025
 
2023
2026
  const numberRegEx$1 = /^[0-9]$/;
2024
- const isCommaOrDot = node => {
2025
- return (node.type === "atom" && node.text === ",") ||
2026
- (node.type === "textord" && node.text === ".")
2027
+ const isDotOrComma = (node, followingNode) => {
2028
+ return ((node.type === "textord" && node.text === ".") ||
2029
+ (node.type === "atom" && node.text === ",")) &&
2030
+ // Don't consolidate if there is a space after the comma.
2031
+ node.loc && followingNode.loc && node.loc.end === followingNode.loc.start
2027
2032
  };
2028
2033
  const consolidateNumbers = expression => {
2029
2034
  // Consolidate adjacent numbers. We want to return <mn>1,506.3</mn>,
@@ -2046,7 +2051,8 @@ const consolidateNumbers = expression => {
2046
2051
 
2047
2052
  // Determine if numeral groups are separated by a comma or dot.
2048
2053
  for (let i = nums.length - 1; i > 0; i--) {
2049
- if (nums[i - 1].end === nums[i].start - 2 && isCommaOrDot(expression[nums[i].start - 1])) {
2054
+ if (nums[i - 1].end === nums[i].start - 2 &&
2055
+ isDotOrComma(expression[nums[i].start - 1], expression[nums[i].start])) {
2050
2056
  // Merge the two groups.
2051
2057
  nums[i - 1].end = nums[i].end;
2052
2058
  nums.splice(i, 1);
@@ -5112,6 +5118,21 @@ defineFunction({
5112
5118
  }
5113
5119
  });
5114
5120
 
5121
+ const isLongVariableName = (group, font) => {
5122
+ if (font !== "mathrm" || group.body.type !== "ordgroup" || group.body.body.length === 1) {
5123
+ return false
5124
+ }
5125
+ if (group.body.body[0].type !== "mathord") { return false }
5126
+ for (let i = 1; i < group.body.body.length; i++) {
5127
+ const parseNodeType = group.body.body[i].type;
5128
+ if (!(parseNodeType === "mathord" ||
5129
+ (parseNodeType === "textord" && !isNaN(group.body.body[i].text)))) {
5130
+ return false
5131
+ }
5132
+ }
5133
+ return true
5134
+ };
5135
+
5115
5136
  const mathmlBuilder$6 = (group, style) => {
5116
5137
  const font = group.font;
5117
5138
  const newStyle = style.withFont(font);
@@ -5123,6 +5144,20 @@ const mathmlBuilder$6 = (group, style) => {
5123
5144
  return mathGroup
5124
5145
  }
5125
5146
  // Check if it is possible to consolidate elements into a single <mi> element.
5147
+ if (isLongVariableName(group, font)) {
5148
+ // This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
5149
+ // wraps <mi> elements with <mrow>s to work around a Firefox bug.
5150
+ const mi = mathGroup.children[0].children[0];
5151
+ delete mi.attributes.mathvariant;
5152
+ for (let i = 1; i < mathGroup.children.length; i++) {
5153
+ mi.children[0].text += mathGroup.children[i].type === "mn"
5154
+ ? mathGroup.children[i].children[0].text
5155
+ : mathGroup.children[i].children[0].children[0].text;
5156
+ }
5157
+ // Wrap in a <mrow> to prevent the same Firefox bug.
5158
+ const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
5159
+ return new mathMLTree.MathNode("mrow", [bogus, mi])
5160
+ }
5126
5161
  let canConsolidate = mathGroup.children[0].type === "mo";
5127
5162
  for (let i = 1; i < mathGroup.children.length; i++) {
5128
5163
  if (mathGroup.children[i].type === "mo" && font === "boldsymbol") {
@@ -13188,7 +13223,7 @@ class Style {
13188
13223
  * https://mit-license.org/
13189
13224
  */
13190
13225
 
13191
- const version = "0.10.22";
13226
+ const version = "0.10.23";
13192
13227
 
13193
13228
  function postProcess(block) {
13194
13229
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -1027,6 +1027,7 @@ var temml = (function () {
1027
1027
  defineSymbol(math, mathord, "\u263c", "\\sun", true);
1028
1028
  defineSymbol(math, mathord, "\u263e", "\\leftmoon", true);
1029
1029
  defineSymbol(math, mathord, "\u263d", "\\rightmoon", true);
1030
+ defineSymbol(math, mathord, "\u2295", "\\Earth");
1030
1031
 
1031
1032
  // AMS Negated Binary Relations
1032
1033
  defineSymbol(math, rel, "\u226e", "\\nless", true);
@@ -1254,6 +1255,8 @@ var temml = (function () {
1254
1255
  defineSymbol(math, bin, "\u27d6", "\\rightouterjoin", true);
1255
1256
  defineSymbol(math, bin, "\u27d7", "\\fullouterjoin", true);
1256
1257
 
1258
+ defineSymbol(math, bin, "\u2238", "\\dotminus", true); // stix
1259
+
1257
1260
  // AMS Arrows
1258
1261
  // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
1259
1262
  // We'll map it to AMS function \dashrightarrow. It produces the same atom.
@@ -2022,9 +2025,11 @@ var temml = (function () {
2022
2025
  };
2023
2026
 
2024
2027
  const numberRegEx$1 = /^[0-9]$/;
2025
- const isCommaOrDot = node => {
2026
- return (node.type === "atom" && node.text === ",") ||
2027
- (node.type === "textord" && node.text === ".")
2028
+ const isDotOrComma = (node, followingNode) => {
2029
+ return ((node.type === "textord" && node.text === ".") ||
2030
+ (node.type === "atom" && node.text === ",")) &&
2031
+ // Don't consolidate if there is a space after the comma.
2032
+ node.loc && followingNode.loc && node.loc.end === followingNode.loc.start
2028
2033
  };
2029
2034
  const consolidateNumbers = expression => {
2030
2035
  // Consolidate adjacent numbers. We want to return <mn>1,506.3</mn>,
@@ -2047,7 +2052,8 @@ var temml = (function () {
2047
2052
 
2048
2053
  // Determine if numeral groups are separated by a comma or dot.
2049
2054
  for (let i = nums.length - 1; i > 0; i--) {
2050
- if (nums[i - 1].end === nums[i].start - 2 && isCommaOrDot(expression[nums[i].start - 1])) {
2055
+ if (nums[i - 1].end === nums[i].start - 2 &&
2056
+ isDotOrComma(expression[nums[i].start - 1], expression[nums[i].start])) {
2051
2057
  // Merge the two groups.
2052
2058
  nums[i - 1].end = nums[i].end;
2053
2059
  nums.splice(i, 1);
@@ -5113,6 +5119,21 @@ var temml = (function () {
5113
5119
  }
5114
5120
  });
5115
5121
 
5122
+ const isLongVariableName = (group, font) => {
5123
+ if (font !== "mathrm" || group.body.type !== "ordgroup" || group.body.body.length === 1) {
5124
+ return false
5125
+ }
5126
+ if (group.body.body[0].type !== "mathord") { return false }
5127
+ for (let i = 1; i < group.body.body.length; i++) {
5128
+ const parseNodeType = group.body.body[i].type;
5129
+ if (!(parseNodeType === "mathord" ||
5130
+ (parseNodeType === "textord" && !isNaN(group.body.body[i].text)))) {
5131
+ return false
5132
+ }
5133
+ }
5134
+ return true
5135
+ };
5136
+
5116
5137
  const mathmlBuilder$6 = (group, style) => {
5117
5138
  const font = group.font;
5118
5139
  const newStyle = style.withFont(font);
@@ -5124,6 +5145,20 @@ var temml = (function () {
5124
5145
  return mathGroup
5125
5146
  }
5126
5147
  // Check if it is possible to consolidate elements into a single <mi> element.
5148
+ if (isLongVariableName(group, font)) {
5149
+ // This is a \mathrm{…} group. It gets special treatment because symbolsOrd.js
5150
+ // wraps <mi> elements with <mrow>s to work around a Firefox bug.
5151
+ const mi = mathGroup.children[0].children[0];
5152
+ delete mi.attributes.mathvariant;
5153
+ for (let i = 1; i < mathGroup.children.length; i++) {
5154
+ mi.children[0].text += mathGroup.children[i].type === "mn"
5155
+ ? mathGroup.children[i].children[0].text
5156
+ : mathGroup.children[i].children[0].children[0].text;
5157
+ }
5158
+ // Wrap in a <mrow> to prevent the same Firefox bug.
5159
+ const bogus = new mathMLTree.MathNode("mtext", new mathMLTree.TextNode("\u200b"));
5160
+ return new mathMLTree.MathNode("mrow", [bogus, mi])
5161
+ }
5127
5162
  let canConsolidate = mathGroup.children[0].type === "mo";
5128
5163
  for (let i = 1; i < mathGroup.children.length; i++) {
5129
5164
  if (mathGroup.children[i].type === "mo" && font === "boldsymbol") {
@@ -11289,7 +11324,7 @@ var temml = (function () {
11289
11324
  * https://mit-license.org/
11290
11325
  */
11291
11326
 
11292
- const version = "0.10.22";
11327
+ const version = "0.10.23";
11293
11328
 
11294
11329
  function postProcess(block) {
11295
11330
  const labelMap = {};