temml 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -7,11 +7,10 @@
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
9
9
 
10
- As a futher advantage, Temml can use local system fonts. The minimum Temml installation serves a font file that is only 12kb.
10
+ As a futher advantage, Temml can use local system fonts. The minimum Temml installation serves a font file that is only 12kb. Sadly, Chromium has some rendering bugs when using system fonts. It
11
+ work better with the Latin Modern font, a 380 KB file.
11
12
 
12
- Chromium will support MathML in release 109 [early in 2023](https://chromiumdash.appspot.com/schedule), At that point, all the major browsers will support MathML and Temml will become the most lightweight way to render math in a browser.
13
-
14
- Temml’s coverage of LaTeX functions is as good as MathJax, slightly better than KaTeX 0.13.0 and substantially better than TeXZilla. See a [detailed coverage comparison](https://temml.org/docs/en/comparison.html).
13
+ Temml’s coverage of LaTeX functions is as good as MathJax, slightly better than KaTeX 0.16.0 and substantially better than TeXZilla. See a [detailed coverage comparison](https://temml.org/docs/en/comparison.html).
15
14
 
16
15
  Temml's test suite includes many rendered examples, including the Temml [supported functions page](https://temml.org/docs/en/supported.html) and tests from [Mozilla](https://temml.org/tests/mozilla-tests.html), [Wikipedia](https://temml.org/tests/wiki-tests.html), [mhchem](https://temml.org/tests/mhchem-tests.html), and [LaTeXML](https://temml.org/tests/LaTeXML-tests.html).
17
16
 
@@ -35,7 +35,7 @@ mtext {
35
35
  }
36
36
 
37
37
  math {
38
- font-family: Asana Math;
38
+ font-family: Asana Math, math;
39
39
  }
40
40
 
41
41
  *.mathcal,
@@ -43,6 +43,22 @@ mo.tml-prime {
43
43
  font-feature-settings: 'salt';
44
44
  }
45
45
 
46
+ /* flex-wrap for line-breaking in Chromium */
47
+ math {
48
+ display: inline-flex;
49
+ flex-wrap: wrap;
50
+ align-items: baseline;
51
+ }
52
+ math > mrow {
53
+ padding: 0.5ex 0ex;
54
+ }
55
+
56
+ /* Avoid flex-wrap in Firefox */
57
+ @supports (-moz-appearance:meterbar) and (display:flex) {
58
+ math { display: inline; }
59
+ math > mrow { padding: 0 }
60
+ }
61
+
46
62
  /* AMS environment auto-numbering via CSS counter. */
47
63
  .tml-eqn::before {
48
64
  counter-increment: tmlEqnNo;
@@ -40,12 +40,8 @@ math * {
40
40
  border-color: currentColor;
41
41
  }
42
42
 
43
- .latin-modern math {
44
- font-family: "Latin Modern Math", "Times New Roman", math;
45
- }
46
-
47
43
  math {
48
- font-family: Latin Modern Math;
44
+ font-family: "Latin Modern Math", "Times New Roman", math;
49
45
  }
50
46
 
51
47
  *.mathscr {
@@ -56,6 +52,22 @@ mo.tml-prime {
56
52
  font-family: Temml;
57
53
  }
58
54
 
55
+ /* flex-wrap for line-breaking in Chromium */
56
+ math {
57
+ display: inline-flex;
58
+ flex-wrap: wrap;
59
+ align-items: baseline;
60
+ }
61
+ math > mrow {
62
+ padding: 0.5ex 0ex;
63
+ }
64
+
65
+ /* Avoid flex-wrap in Firefox */
66
+ @supports (-moz-appearance:meterbar) and (display:flex) {
67
+ math { display: inline; }
68
+ math > mrow { padding: 0 }
69
+ }
70
+
59
71
  /* AMS environment auto-numbering via CSS counter. */
60
72
  .tml-eqn::before {
61
73
  counter-increment: tmlEqnNo;
@@ -38,12 +38,8 @@ math * {
38
38
  border-color: currentColor;
39
39
  }
40
40
 
41
- .libertinus math {
42
- font-family: "Libertinus Math", "Times New Roman", math;
43
- }
44
-
45
41
  math {
46
- font-family: Libertinus Math;
42
+ font-family: Libertinus Math, math;
47
43
  }
48
44
 
49
45
  *.mathcal {
@@ -54,6 +50,22 @@ mo.tml-prime {
54
50
  font-feature-settings: 'ssty';
55
51
  }
56
52
 
53
+ /* flex-wrap for line-breaking in Chromium */
54
+ math {
55
+ display: inline-flex;
56
+ flex-wrap: wrap;
57
+ align-items: baseline;
58
+ }
59
+ math > mrow {
60
+ padding: 0.5ex 0ex;
61
+ }
62
+
63
+ /* Avoid flex-wrap in Firefox */
64
+ @supports (-moz-appearance:meterbar) and (display:flex) {
65
+ math { display: inline; }
66
+ math > mrow { padding: 0 }
67
+ }
68
+
57
69
  /* AMS environment auto-numbering via CSS counter. */
58
70
  .tml-eqn::before {
59
71
  counter-increment: tmlEqnNo;
@@ -36,6 +36,22 @@ mo.tml-prime {
36
36
  font-family: Temml;
37
37
  }
38
38
 
39
+ /* flex-wrap for line-breaking in Chromium */
40
+ math {
41
+ display: inline-flex;
42
+ flex-wrap: wrap;
43
+ align-items: baseline;
44
+ }
45
+ math > mrow {
46
+ padding: 0.5ex 0ex;
47
+ }
48
+
49
+ /* Avoid flex-wrap in Firefox */
50
+ @supports (-moz-appearance:meterbar) and (display:flex) {
51
+ math { display: inline; }
52
+ math > mrow { padding: 0 }
53
+ }
54
+
39
55
  /* AMS environment auto-numbering via CSS counter. */
40
56
  .tml-eqn::before {
41
57
  counter-increment: tmlEqnNo;
@@ -44,6 +44,22 @@ mo.tml-prime {
44
44
  font-feature-settings: 'ss04';
45
45
  }
46
46
 
47
+ /* flex-wrap for line-breaking in Chromium */
48
+ math {
49
+ display: inline-flex;
50
+ flex-wrap: wrap;
51
+ align-items: baseline;
52
+ }
53
+ math > mrow {
54
+ padding: 0.5ex 0ex;
55
+ }
56
+
57
+ /* Avoid flex-wrap in Firefox */
58
+ @supports (-moz-appearance:meterbar) and (display:flex) {
59
+ math { display: inline; }
60
+ math > mrow { padding: 0 }
61
+ }
62
+
47
63
  /* AMS environment auto-numbering via CSS counter. */
48
64
  .tml-eqn::before {
49
65
  counter-increment: tmlEqnNo;
package/dist/temml.cjs CHANGED
@@ -190,7 +190,7 @@ class Settings {
190
190
  this.leqno = utils.deflt(options.leqno, false); // boolean
191
191
  this.errorColor = utils.deflt(options.errorColor, "#b22222"); // string
192
192
  this.macros = options.macros || {};
193
- this.wrap = utils.deflt(options.wrap, "none"); // "none" | "tex" | "="
193
+ this.wrap = utils.deflt(options.wrap, "tex"); // "tex" | "="
194
194
  this.xml = utils.deflt(options.xml, false); // boolean
195
195
  this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); // booelean
196
196
  this.strict = utils.deflt(options.strict, false); // boolean
@@ -1749,10 +1749,12 @@ for (let i = 0; i < 10; i++) {
1749
1749
  * Then the top level of a <math> element can be occupied by <mrow> elements, and the browser
1750
1750
  * will break after a <mrow> if the expression extends beyond the container limit.
1751
1751
  *
1752
- * We want the expression to render with soft line breaks after each top-level binary or
1752
+ * The default is for soft line breaks after each top-level binary or
1753
1753
  * relational operator, per TeXbook p. 173. So we gather the expression into <mrow>s so that
1754
1754
  * each <mrow> ends in a binary or relational operator.
1755
1755
  *
1756
+ * An option is for soft line breaks before an "=" sign. That changes the <mrow>s.
1757
+ *
1756
1758
  * Soft line breaks will not work in Chromium and Safari, only Firefox.
1757
1759
  *
1758
1760
  * Hopefully browsers will someday do their own linebreaking and we will be able to delete
@@ -2098,18 +2100,6 @@ function buildMathML(tree, texExpression, style, settings) {
2098
2100
  wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
2099
2101
  }
2100
2102
 
2101
- if (wrap !== "none" && wrapper.children.length > 1) {
2102
- const maths = [];
2103
- for (let i = 0; i < wrapper.children.length; i++) {
2104
- const math = new mathMLTree.MathNode("math", [wrapper.children[i]]);
2105
- if (settings.xml) {
2106
- math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
2107
- }
2108
- maths.push(math);
2109
- }
2110
- return mathMLTree.newDocumentFragment(maths)
2111
- }
2112
-
2113
2103
  const math = new mathMLTree.MathNode("math", [wrapper]);
2114
2104
 
2115
2105
  if (settings.xml) {
@@ -2117,6 +2107,9 @@ function buildMathML(tree, texExpression, style, settings) {
2117
2107
  }
2118
2108
  if (settings.displayMode) {
2119
2109
  math.setAttribute("display", "block");
2110
+ math.style.display = math.children.length === 1 && math.children[0].type === "mtable"
2111
+ ? "inline"
2112
+ : "inline-block";
2120
2113
  }
2121
2114
  return math;
2122
2115
  }
@@ -12977,7 +12970,7 @@ class Style {
12977
12970
  * https://mit-license.org/
12978
12971
  */
12979
12972
 
12980
- const version = "0.10.2";
12973
+ const version = "0.10.3";
12981
12974
 
12982
12975
  function postProcess(block) {
12983
12976
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -191,7 +191,7 @@ var temml = (function () {
191
191
  this.leqno = utils.deflt(options.leqno, false); // boolean
192
192
  this.errorColor = utils.deflt(options.errorColor, "#b22222"); // string
193
193
  this.macros = options.macros || {};
194
- this.wrap = utils.deflt(options.wrap, "none"); // "none" | "tex" | "="
194
+ this.wrap = utils.deflt(options.wrap, "tex"); // "tex" | "="
195
195
  this.xml = utils.deflt(options.xml, false); // boolean
196
196
  this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); // booelean
197
197
  this.strict = utils.deflt(options.strict, false); // boolean
@@ -1750,10 +1750,12 @@ var temml = (function () {
1750
1750
  * Then the top level of a <math> element can be occupied by <mrow> elements, and the browser
1751
1751
  * will break after a <mrow> if the expression extends beyond the container limit.
1752
1752
  *
1753
- * We want the expression to render with soft line breaks after each top-level binary or
1753
+ * The default is for soft line breaks after each top-level binary or
1754
1754
  * relational operator, per TeXbook p. 173. So we gather the expression into <mrow>s so that
1755
1755
  * each <mrow> ends in a binary or relational operator.
1756
1756
  *
1757
+ * An option is for soft line breaks before an "=" sign. That changes the <mrow>s.
1758
+ *
1757
1759
  * Soft line breaks will not work in Chromium and Safari, only Firefox.
1758
1760
  *
1759
1761
  * Hopefully browsers will someday do their own linebreaking and we will be able to delete
@@ -2099,18 +2101,6 @@ var temml = (function () {
2099
2101
  wrapper = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
2100
2102
  }
2101
2103
 
2102
- if (wrap !== "none" && wrapper.children.length > 1) {
2103
- const maths = [];
2104
- for (let i = 0; i < wrapper.children.length; i++) {
2105
- const math = new mathMLTree.MathNode("math", [wrapper.children[i]]);
2106
- if (settings.xml) {
2107
- math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
2108
- }
2109
- maths.push(math);
2110
- }
2111
- return mathMLTree.newDocumentFragment(maths)
2112
- }
2113
-
2114
2104
  const math = new mathMLTree.MathNode("math", [wrapper]);
2115
2105
 
2116
2106
  if (settings.xml) {
@@ -2118,6 +2108,9 @@ var temml = (function () {
2118
2108
  }
2119
2109
  if (settings.displayMode) {
2120
2110
  math.setAttribute("display", "block");
2111
+ math.style.display = math.children.length === 1 && math.children[0].type === "mtable"
2112
+ ? "inline"
2113
+ : "inline-block";
2121
2114
  }
2122
2115
  return math;
2123
2116
  }
@@ -11078,7 +11071,7 @@ var temml = (function () {
11078
11071
  * https://mit-license.org/
11079
11072
  */
11080
11073
 
11081
- const version = "0.10.2";
11074
+ const version = "0.10.3";
11082
11075
 
11083
11076
  function postProcess(block) {
11084
11077
  const labelMap = {};