temml 0.11.8 → 0.11.10

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 | 170 KB |
5
+ | Temml | 171 KB |
6
6
  | MathJax 2.7.5 | 338 KB |
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
@@ -117,6 +117,9 @@ menclose {
117
117
  text-align: left;
118
118
  }
119
119
 
120
+ /* For CD labels that grow to the left in Firefox and WebKit */
121
+ .tml-shift-left { margin-left:-200% }
122
+
120
123
  /* Styles for Chromium only */
121
124
  @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
122
125
  /* Italic correction on accents */
@@ -138,6 +141,10 @@ menclose {
138
141
  .chr-lrg-vec {
139
142
  transform: scale(0.75) translate(0.21em, 0)
140
143
  }
144
+
145
+ /* For CD labels that grow to the left */
146
+ .tml-shift-left { margin-left:-100% }
147
+
141
148
  /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
142
149
  /* So use styles. */
143
150
  menclose {
@@ -131,6 +131,9 @@ menclose {
131
131
  text-align: left;
132
132
  }
133
133
 
134
+ /* For CD labels that grow to the left in Firefox and WebKit */
135
+ .tml-shift-left { margin-left:-200% }
136
+
134
137
  /* Styles for Chromium only */
135
138
  @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
136
139
  /* Italic correction on accents */
@@ -152,6 +155,10 @@ menclose {
152
155
  .chr-lrg-vec {
153
156
  transform: scale(0.75) translate(0.21em, 0)
154
157
  }
158
+
159
+ /* For CD labels that grow to the left */
160
+ .tml-shift-left { margin-left:-100% }
161
+
155
162
  /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
156
163
  /* So use styles. */
157
164
  menclose {
@@ -133,6 +133,9 @@ menclose {
133
133
  text-align: left;
134
134
  }
135
135
 
136
+ /* For CD labels that grow to the left in Firefox and WebKit */
137
+ .tml-shift-left { margin-left:-200% }
138
+
136
139
  /* Styles for Chromium only */
137
140
  @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
138
141
  /* Italic correction on accents */
@@ -154,6 +157,10 @@ menclose {
154
157
  .chr-lrg-vec {
155
158
  transform: scale(0.75) translate(0.21em, 0)
156
159
  }
160
+
161
+ /* For CD labels that grow to the left */
162
+ .tml-shift-left { margin-left:-100% }
163
+
157
164
  /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
158
165
  /* So use styles. */
159
166
  menclose {
@@ -124,6 +124,9 @@ menclose {
124
124
  text-align: left;
125
125
  }
126
126
 
127
+ /* For CD labels that grow to the left in Firefox and WebKit */
128
+ .tml-shift-left { margin-left:-200% }
129
+
127
130
  /* Styles for Chromium only */
128
131
  @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
129
132
  /* Italic correction on accents */
@@ -145,6 +148,10 @@ menclose {
145
148
  .chr-lrg-vec {
146
149
  transform: scale(0.75) translate(0.21em, 0)
147
150
  }
151
+
152
+ /* For CD labels that grow to the left */
153
+ .tml-shift-left { margin-left:-100% }
154
+
148
155
  /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
149
156
  /* So use styles. */
150
157
  menclose {
@@ -126,6 +126,9 @@ menclose {
126
126
  text-align: left;
127
127
  }
128
128
 
129
+ /* For CD labels that grow to the left in Firefox and WebKit */
130
+ .tml-shift-left { margin-left:-200% }
131
+
129
132
  /* Styles for Chromium only */
130
133
  @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
131
134
  /* Italic correction on accents */
@@ -147,6 +150,10 @@ menclose {
147
150
  .chr-lrg-vec {
148
151
  transform: scale(0.75) translate(0.21em, 0)
149
152
  }
153
+
154
+ /* For CD labels that grow to the left */
155
+ .tml-shift-left { margin-left:-100% }
156
+
150
157
  /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
151
158
  /* So use styles. */
152
159
  menclose {
@@ -123,6 +123,9 @@ menclose {
123
123
  text-align: left;
124
124
  }
125
125
 
126
+ /* For CD labels that grow to the left in Firefox and WebKit */
127
+ .tml-shift-left { margin-left:-200% }
128
+
126
129
  /* Styles for Chromium only */
127
130
  @supports (not (-webkit-backdrop-filter: blur(1px))) and (not (-moz-appearance: none)) {
128
131
  /* Italic correction on accents */
@@ -144,6 +147,10 @@ menclose {
144
147
  .chr-lrg-vec {
145
148
  transform: scale(0.75) translate(0.21em, 0)
146
149
  }
150
+
151
+ /* For CD labels that grow to the left */
152
+ .tml-shift-left { margin-left:-100% }
153
+
147
154
  /* MathML Core & Chromium do not support the MathML 3.0 element <menclose> attributes. */
148
155
  /* So use styles. */
149
156
  menclose {
package/dist/temml.cjs CHANGED
@@ -2405,13 +2405,12 @@ const getLabel = parent => {
2405
2405
 
2406
2406
  const taggedExpression = (expression, tag, style, leqno) => {
2407
2407
  tag = buildExpressionRow(tag[0].body, style);
2408
- tag = consolidateText(tag);
2409
- tag.classes.push("tml-tag");
2408
+ tag = consolidateText(tag); // tag is now an <mtext> element
2409
+ tag.classes.push("tml-tag"); // to be available for \ref
2410
2410
 
2411
2411
  const label = getLabel(expression); // from a \label{} function.
2412
2412
  expression = new mathMLTree.MathNode("mtd", [expression]);
2413
2413
  const rowArray = [glue$1(), expression, glue$1()];
2414
- rowArray[leqno ? 0 : 2].classes.push(leqno ? "tml-left" : "tml-right");
2415
2414
  rowArray[leqno ? 0 : 2].children.push(tag);
2416
2415
  const mtr = new mathMLTree.MathNode("mtr", rowArray, ["tml-tageqn"]);
2417
2416
  if (label) { mtr.setAttribute("id", label); }
@@ -2822,7 +2821,7 @@ const paddedNode = (group, lspace = 0.3, rspace = 0, mustSmash = false) => {
2822
2821
  if (mustSmash) {
2823
2822
  // Used for the bottom arrow in a {CD} environment
2824
2823
  const mpadded = new mathMLTree.MathNode("mpadded", row);
2825
- mpadded.setAttribute("height", "0");
2824
+ mpadded.setAttribute("height", "0.1px"); // Don't use 0. WebKit would hide it.
2826
2825
  return mpadded
2827
2826
  } else {
2828
2827
  return new mathMLTree.MathNode("mrow", row)
@@ -3314,19 +3313,19 @@ defineFunction({
3314
3313
  return new mathMLTree.MathNode("mrow", style) // empty label
3315
3314
  }
3316
3315
  // Abuse an <mtable> to create vertically centered content.
3317
- const mtd = new mathMLTree.MathNode("mtd", [buildGroup$1(group.label, style)]);
3316
+ const mrow = buildGroup$1(group.label, style);
3317
+ if (group.side === "left") {
3318
+ mrow.classes.push("tml-shift-left");
3319
+ }
3320
+ const mtd = new mathMLTree.MathNode("mtd", [mrow]);
3318
3321
  mtd.style.padding = "0";
3319
3322
  const mtr = new mathMLTree.MathNode("mtr", [mtd]);
3320
3323
  const mtable = new mathMLTree.MathNode("mtable", [mtr]);
3321
3324
  const label = new mathMLTree.MathNode("mpadded", [mtable]);
3322
3325
  // Set the label width to zero so that the arrow will be centered under the corner cell.
3323
- label.setAttribute("width", "0");
3326
+ label.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
3324
3327
  label.setAttribute("displaystyle", "false");
3325
3328
  label.setAttribute("scriptlevel", "1");
3326
- if (group.side === "left") {
3327
- label.style.display = "flex";
3328
- label.style.justifyContent = "flex-end";
3329
- }
3330
3329
  return label;
3331
3330
  }
3332
3331
  });
@@ -6474,7 +6473,6 @@ const mathmlBuilder$9 = function(group, style) {
6474
6473
 
6475
6474
  if (group.envClasses.includes("multline")) {
6476
6475
  const align = i === 0 ? "left" : i === numRows - 1 ? "right" : "center";
6477
- mtd.setAttribute("columnalign", align);
6478
6476
  if (align !== "center") {
6479
6477
  mtd.classes.push("tml-" + align);
6480
6478
  }
@@ -6504,10 +6502,8 @@ const mathmlBuilder$9 = function(group, style) {
6504
6502
  row.push(glue(group));
6505
6503
  if (group.leqno) {
6506
6504
  row[0].children.push(tagElement);
6507
- row[0].classes.push("tml-left");
6508
6505
  } else {
6509
6506
  row[row.length - 1].children.push(tagElement);
6510
- row[row.length - 1].classes.push("tml-right");
6511
6507
  }
6512
6508
  }
6513
6509
  }
@@ -6548,8 +6544,10 @@ const mathmlBuilder$9 = function(group, style) {
6548
6544
  }
6549
6545
  }
6550
6546
  if (mustSquashRow) {
6551
- // All the cell contents are \hphantom. Squash the padding.
6547
+ // All the cell contents are \hphantom. Squash the cell.
6552
6548
  for (let j = 0; j < mtr.children.length; j++) {
6549
+ mtr.children[j].style.display = "block"; // necessary in Firefox only
6550
+ mtr.children[j].style.height = "0"; // necessary in Firefox only
6553
6551
  mtr.children[j].style.paddingTop = "0";
6554
6552
  mtr.children[j].style.paddingBottom = "0";
6555
6553
  }
@@ -6636,7 +6634,7 @@ const mathmlBuilder$9 = function(group, style) {
6636
6634
  }
6637
6635
  if (group.autoTag) {
6638
6636
  const k = group.leqno ? 0 : row.children.length - 1;
6639
- row.children[k].classes = ["tml-" + (group.leqno ? "left" : "right")];
6637
+ row.children[k].classes = []; // Default is center.
6640
6638
  }
6641
6639
  }
6642
6640
  if (row.children.length > 1 && group.envClasses.includes("cases")) {
@@ -6667,7 +6665,6 @@ const mathmlBuilder$9 = function(group, style) {
6667
6665
  }
6668
6666
 
6669
6667
  // Column separator lines and column alignment
6670
- let align = "";
6671
6668
 
6672
6669
  if (group.cols && group.cols.length > 0) {
6673
6670
  const cols = group.cols;
@@ -6696,7 +6693,6 @@ const mathmlBuilder$9 = function(group, style) {
6696
6693
  for (let i = iStart; i < iEnd; i++) {
6697
6694
  if (cols[i].type === "align") {
6698
6695
  const colAlign = alignMap[cols[i].align];
6699
- align += colAlign;
6700
6696
  iCol += 1;
6701
6697
  for (const row of table.children) {
6702
6698
  if (colAlign.trim() !== "center" && iCol < row.children.length) {
@@ -6734,15 +6730,6 @@ const mathmlBuilder$9 = function(group, style) {
6734
6730
  }
6735
6731
  }
6736
6732
  }
6737
- if (group.autoTag) {
6738
- // allow for glue cells on each side
6739
- align = "left " + (align.length > 0 ? align : "center ") + "right ";
6740
- }
6741
- if (align) {
6742
- // Firefox reads this attribute, not the -webkit-left|right written above.
6743
- // TODO: When Chrome no longer needs "-webkit-", use CSS and delete the next line.
6744
- table.setAttribute("columnalign", align.trim());
6745
- }
6746
6733
 
6747
6734
  if (group.envClasses.includes("small")) {
6748
6735
  // A small array. Wrap in scriptstyle.
@@ -7965,13 +7952,25 @@ defineFunction({
7965
7952
  handler: (context, args) => {
7966
7953
  const delim = checkDelimiter(args[0], context);
7967
7954
 
7968
- return {
7955
+ const delimNode = {
7969
7956
  type: "delimsizing",
7970
7957
  mode: context.parser.mode,
7971
7958
  size: delimiterSizes[context.funcName].size,
7972
7959
  mclass: delimiterSizes[context.funcName].mclass,
7973
7960
  delim: delim.text
7974
7961
  };
7962
+ const nextToken = context.parser.fetch().text;
7963
+ if (nextToken !== "^" && nextToken !== "_") {
7964
+ return delimNode
7965
+ } else {
7966
+ // Chromium mis-renders a sized delim if it is the base of a supsub.
7967
+ // So wrap it in a ordgroup.
7968
+ return {
7969
+ type: "ordgroup",
7970
+ mode: "math",
7971
+ body: [delimNode, { type: "ordgroup", mode: "math", body: [] }]
7972
+ }
7973
+ }
7975
7974
  },
7976
7975
  mathmlBuilder: (group) => {
7977
7976
  const children = [];
@@ -9372,7 +9371,7 @@ defineFunction({
9372
9371
  const phantomInner = buildExpression(ordargument(group.body), style);
9373
9372
  const phantom = new mathMLTree.MathNode("mphantom", phantomInner);
9374
9373
  strut = new mathMLTree.MathNode("mpadded", [phantom]);
9375
- strut.setAttribute("width", "0px");
9374
+ strut.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
9376
9375
  }
9377
9376
 
9378
9377
  const inner = buildGroup$1(group.body, style);
@@ -9401,7 +9400,7 @@ defineFunction({
9401
9400
  node.style.justifyContent = "center";
9402
9401
  }
9403
9402
  }
9404
- node.setAttribute("width", "0px");
9403
+ node.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
9405
9404
  return node
9406
9405
  }
9407
9406
  });
@@ -10777,6 +10776,11 @@ defineFunction({
10777
10776
  }
10778
10777
  });
10779
10778
 
10779
+ // Letters that are x-height w/o a descender.
10780
+ const xHeights = ['a', 'c', 'e', 'ı', 'm', 'n', 'o', 'r', 's', 'u', 'v', 'w', 'x', 'z', 'α',
10781
+ 'ε', 'ι', 'κ', 'ν', 'ο', 'π', 'σ', 'τ', 'υ', 'ω', '\\alpha', '\\epsilon', "\\iota",
10782
+ '\\kappa', '\\nu', '\\omega', '\\pi', '\\tau', '\\omega'];
10783
+
10780
10784
  defineFunction({
10781
10785
  type: "sqrt",
10782
10786
  names: ["\\sqrt"],
@@ -10787,6 +10791,20 @@ defineFunction({
10787
10791
  handler({ parser }, args, optArgs) {
10788
10792
  const index = optArgs[0];
10789
10793
  const body = args[0];
10794
+ // Check if the body consists entirely of an x-height letter.
10795
+ // TODO: Remove this check after Chromium is fixed.
10796
+ if (body.body && body.body.length === 1 && body.body[0].text &&
10797
+ xHeights.includes(body.body[0].text)) {
10798
+ // Chromium does not put enough space above an x-height letter.
10799
+ // Insert a strut.
10800
+ body.body.push({
10801
+ "type": "rule",
10802
+ "mode": "math",
10803
+ "shift": null,
10804
+ "width": { "number": 0, "unit": "pt" },
10805
+ "height": { "number": 0.5, "unit": "em" }
10806
+ });
10807
+ }
10790
10808
  return {
10791
10809
  type: "sqrt",
10792
10810
  mode: parser.mode,
@@ -14010,7 +14028,7 @@ class Style {
14010
14028
  * https://mit-license.org/
14011
14029
  */
14012
14030
 
14013
- const version = "0.11.08";
14031
+ const version = "0.11.10";
14014
14032
 
14015
14033
  function postProcess(block) {
14016
14034
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -2406,13 +2406,12 @@ var temml = (function () {
2406
2406
 
2407
2407
  const taggedExpression = (expression, tag, style, leqno) => {
2408
2408
  tag = buildExpressionRow(tag[0].body, style);
2409
- tag = consolidateText(tag);
2410
- tag.classes.push("tml-tag");
2409
+ tag = consolidateText(tag); // tag is now an <mtext> element
2410
+ tag.classes.push("tml-tag"); // to be available for \ref
2411
2411
 
2412
2412
  const label = getLabel(expression); // from a \label{} function.
2413
2413
  expression = new mathMLTree.MathNode("mtd", [expression]);
2414
2414
  const rowArray = [glue$1(), expression, glue$1()];
2415
- rowArray[leqno ? 0 : 2].classes.push(leqno ? "tml-left" : "tml-right");
2416
2415
  rowArray[leqno ? 0 : 2].children.push(tag);
2417
2416
  const mtr = new mathMLTree.MathNode("mtr", rowArray, ["tml-tageqn"]);
2418
2417
  if (label) { mtr.setAttribute("id", label); }
@@ -2823,7 +2822,7 @@ var temml = (function () {
2823
2822
  if (mustSmash) {
2824
2823
  // Used for the bottom arrow in a {CD} environment
2825
2824
  const mpadded = new mathMLTree.MathNode("mpadded", row);
2826
- mpadded.setAttribute("height", "0");
2825
+ mpadded.setAttribute("height", "0.1px"); // Don't use 0. WebKit would hide it.
2827
2826
  return mpadded
2828
2827
  } else {
2829
2828
  return new mathMLTree.MathNode("mrow", row)
@@ -3315,19 +3314,19 @@ var temml = (function () {
3315
3314
  return new mathMLTree.MathNode("mrow", style) // empty label
3316
3315
  }
3317
3316
  // Abuse an <mtable> to create vertically centered content.
3318
- const mtd = new mathMLTree.MathNode("mtd", [buildGroup$1(group.label, style)]);
3317
+ const mrow = buildGroup$1(group.label, style);
3318
+ if (group.side === "left") {
3319
+ mrow.classes.push("tml-shift-left");
3320
+ }
3321
+ const mtd = new mathMLTree.MathNode("mtd", [mrow]);
3319
3322
  mtd.style.padding = "0";
3320
3323
  const mtr = new mathMLTree.MathNode("mtr", [mtd]);
3321
3324
  const mtable = new mathMLTree.MathNode("mtable", [mtr]);
3322
3325
  const label = new mathMLTree.MathNode("mpadded", [mtable]);
3323
3326
  // Set the label width to zero so that the arrow will be centered under the corner cell.
3324
- label.setAttribute("width", "0");
3327
+ label.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
3325
3328
  label.setAttribute("displaystyle", "false");
3326
3329
  label.setAttribute("scriptlevel", "1");
3327
- if (group.side === "left") {
3328
- label.style.display = "flex";
3329
- label.style.justifyContent = "flex-end";
3330
- }
3331
3330
  return label;
3332
3331
  }
3333
3332
  });
@@ -4561,7 +4560,6 @@ var temml = (function () {
4561
4560
 
4562
4561
  if (group.envClasses.includes("multline")) {
4563
4562
  const align = i === 0 ? "left" : i === numRows - 1 ? "right" : "center";
4564
- mtd.setAttribute("columnalign", align);
4565
4563
  if (align !== "center") {
4566
4564
  mtd.classes.push("tml-" + align);
4567
4565
  }
@@ -4591,10 +4589,8 @@ var temml = (function () {
4591
4589
  row.push(glue(group));
4592
4590
  if (group.leqno) {
4593
4591
  row[0].children.push(tagElement);
4594
- row[0].classes.push("tml-left");
4595
4592
  } else {
4596
4593
  row[row.length - 1].children.push(tagElement);
4597
- row[row.length - 1].classes.push("tml-right");
4598
4594
  }
4599
4595
  }
4600
4596
  }
@@ -4635,8 +4631,10 @@ var temml = (function () {
4635
4631
  }
4636
4632
  }
4637
4633
  if (mustSquashRow) {
4638
- // All the cell contents are \hphantom. Squash the padding.
4634
+ // All the cell contents are \hphantom. Squash the cell.
4639
4635
  for (let j = 0; j < mtr.children.length; j++) {
4636
+ mtr.children[j].style.display = "block"; // necessary in Firefox only
4637
+ mtr.children[j].style.height = "0"; // necessary in Firefox only
4640
4638
  mtr.children[j].style.paddingTop = "0";
4641
4639
  mtr.children[j].style.paddingBottom = "0";
4642
4640
  }
@@ -4723,7 +4721,7 @@ var temml = (function () {
4723
4721
  }
4724
4722
  if (group.autoTag) {
4725
4723
  const k = group.leqno ? 0 : row.children.length - 1;
4726
- row.children[k].classes = ["tml-" + (group.leqno ? "left" : "right")];
4724
+ row.children[k].classes = []; // Default is center.
4727
4725
  }
4728
4726
  }
4729
4727
  if (row.children.length > 1 && group.envClasses.includes("cases")) {
@@ -4754,7 +4752,6 @@ var temml = (function () {
4754
4752
  }
4755
4753
 
4756
4754
  // Column separator lines and column alignment
4757
- let align = "";
4758
4755
 
4759
4756
  if (group.cols && group.cols.length > 0) {
4760
4757
  const cols = group.cols;
@@ -4783,7 +4780,6 @@ var temml = (function () {
4783
4780
  for (let i = iStart; i < iEnd; i++) {
4784
4781
  if (cols[i].type === "align") {
4785
4782
  const colAlign = alignMap[cols[i].align];
4786
- align += colAlign;
4787
4783
  iCol += 1;
4788
4784
  for (const row of table.children) {
4789
4785
  if (colAlign.trim() !== "center" && iCol < row.children.length) {
@@ -4821,15 +4817,6 @@ var temml = (function () {
4821
4817
  }
4822
4818
  }
4823
4819
  }
4824
- if (group.autoTag) {
4825
- // allow for glue cells on each side
4826
- align = "left " + (align.length > 0 ? align : "center ") + "right ";
4827
- }
4828
- if (align) {
4829
- // Firefox reads this attribute, not the -webkit-left|right written above.
4830
- // TODO: When Chrome no longer needs "-webkit-", use CSS and delete the next line.
4831
- table.setAttribute("columnalign", align.trim());
4832
- }
4833
4820
 
4834
4821
  if (group.envClasses.includes("small")) {
4835
4822
  // A small array. Wrap in scriptstyle.
@@ -6052,13 +6039,25 @@ var temml = (function () {
6052
6039
  handler: (context, args) => {
6053
6040
  const delim = checkDelimiter(args[0], context);
6054
6041
 
6055
- return {
6042
+ const delimNode = {
6056
6043
  type: "delimsizing",
6057
6044
  mode: context.parser.mode,
6058
6045
  size: delimiterSizes[context.funcName].size,
6059
6046
  mclass: delimiterSizes[context.funcName].mclass,
6060
6047
  delim: delim.text
6061
6048
  };
6049
+ const nextToken = context.parser.fetch().text;
6050
+ if (nextToken !== "^" && nextToken !== "_") {
6051
+ return delimNode
6052
+ } else {
6053
+ // Chromium mis-renders a sized delim if it is the base of a supsub.
6054
+ // So wrap it in a ordgroup.
6055
+ return {
6056
+ type: "ordgroup",
6057
+ mode: "math",
6058
+ body: [delimNode, { type: "ordgroup", mode: "math", body: [] }]
6059
+ }
6060
+ }
6062
6061
  },
6063
6062
  mathmlBuilder: (group) => {
6064
6063
  const children = [];
@@ -7459,7 +7458,7 @@ var temml = (function () {
7459
7458
  const phantomInner = buildExpression(ordargument(group.body), style);
7460
7459
  const phantom = new mathMLTree.MathNode("mphantom", phantomInner);
7461
7460
  strut = new mathMLTree.MathNode("mpadded", [phantom]);
7462
- strut.setAttribute("width", "0px");
7461
+ strut.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
7463
7462
  }
7464
7463
 
7465
7464
  const inner = buildGroup$1(group.body, style);
@@ -7488,7 +7487,7 @@ var temml = (function () {
7488
7487
  node.style.justifyContent = "center";
7489
7488
  }
7490
7489
  }
7491
- node.setAttribute("width", "0px");
7490
+ node.setAttribute("width", "0.1px"); // Don't use 0. WebKit would hide it.
7492
7491
  return node
7493
7492
  }
7494
7493
  });
@@ -8864,6 +8863,11 @@ var temml = (function () {
8864
8863
  }
8865
8864
  });
8866
8865
 
8866
+ // Letters that are x-height w/o a descender.
8867
+ const xHeights = ['a', 'c', 'e', 'ı', 'm', 'n', 'o', 'r', 's', 'u', 'v', 'w', 'x', 'z', 'α',
8868
+ 'ε', 'ι', 'κ', 'ν', 'ο', 'π', 'σ', 'τ', 'υ', 'ω', '\\alpha', '\\epsilon', "\\iota",
8869
+ '\\kappa', '\\nu', '\\omega', '\\pi', '\\tau', '\\omega'];
8870
+
8867
8871
  defineFunction({
8868
8872
  type: "sqrt",
8869
8873
  names: ["\\sqrt"],
@@ -8874,6 +8878,20 @@ var temml = (function () {
8874
8878
  handler({ parser }, args, optArgs) {
8875
8879
  const index = optArgs[0];
8876
8880
  const body = args[0];
8881
+ // Check if the body consists entirely of an x-height letter.
8882
+ // TODO: Remove this check after Chromium is fixed.
8883
+ if (body.body && body.body.length === 1 && body.body[0].text &&
8884
+ xHeights.includes(body.body[0].text)) {
8885
+ // Chromium does not put enough space above an x-height letter.
8886
+ // Insert a strut.
8887
+ body.body.push({
8888
+ "type": "rule",
8889
+ "mode": "math",
8890
+ "shift": null,
8891
+ "width": { "number": 0, "unit": "pt" },
8892
+ "height": { "number": 0.5, "unit": "em" }
8893
+ });
8894
+ }
8877
8895
  return {
8878
8896
  type: "sqrt",
8879
8897
  mode: parser.mode,
@@ -12097,7 +12115,7 @@ var temml = (function () {
12097
12115
  * https://mit-license.org/
12098
12116
  */
12099
12117
 
12100
- const version = "0.11.08";
12118
+ const version = "0.11.10";
12101
12119
 
12102
12120
  function postProcess(block) {
12103
12121
  const labelMap = {};