katex 0.16.28 → 0.16.30
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 +3 -3
- package/cli.js +3 -1
- package/contrib/auto-render/auto-render.js +5 -5
- package/contrib/auto-render/index.html +3 -2
- package/contrib/copy-tex/README.md +2 -2
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +3 -3
- package/dist/contrib/auto-render.js +4 -4
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +2 -2
- package/dist/contrib/copy-tex.js +2 -2
- package/dist/contrib/copy-tex.min.js +1 -1
- package/dist/contrib/mathtex-script-type.min.js +1 -1
- package/dist/contrib/mhchem.min.js +1 -1
- package/dist/contrib/render-a11y-string.min.js +1 -1
- package/dist/katex-swap.css +7 -5
- package/dist/katex-swap.min.css +1 -1
- package/dist/katex.css +6 -4
- package/dist/katex.js +460 -555
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +415 -508
- package/katex.js +2 -2
- package/package.json +3 -4
- package/src/MacroExpander.js +2 -2
- package/src/Parser.js +4 -3
- package/src/Settings.js +2 -2
- package/src/buildCommon.js +15 -33
- package/src/buildHTML.js +11 -9
- package/src/buildMathML.js +17 -15
- package/src/buildTree.js +5 -5
- package/src/delimiter.js +32 -40
- package/src/domTree.js +17 -17
- package/src/environments/array.js +40 -39
- package/src/environments/cd.js +10 -10
- package/src/functions/accent.js +17 -17
- package/src/functions/accentunder.js +8 -8
- package/src/functions/arrow.js +16 -16
- package/src/functions/color.js +4 -4
- package/src/functions/cr.js +4 -4
- package/src/functions/delimsizing.js +18 -19
- package/src/functions/enclose.js +15 -15
- package/src/functions/font.js +2 -3
- package/src/functions/genfrac.js +25 -20
- package/src/functions/hbox.js +4 -4
- package/src/functions/horizBrace.js +12 -12
- package/src/functions/href.js +2 -2
- package/src/functions/html.js +2 -2
- package/src/functions/htmlmathml.js +3 -2
- package/src/functions/includegraphics.js +2 -2
- package/src/functions/kern.js +4 -4
- package/src/functions/lap.js +11 -11
- package/src/functions/mathchoice.js +2 -2
- package/src/functions/mclass.js +10 -12
- package/src/functions/op.js +20 -20
- package/src/functions/operatorname.js +12 -12
- package/src/functions/ordgroup.js +3 -3
- package/src/functions/overline.js +8 -8
- package/src/functions/phantom.js +14 -14
- package/src/functions/pmb.js +4 -4
- package/src/functions/raisebox.js +4 -4
- package/src/functions/rule.js +5 -5
- package/src/functions/sizing.js +4 -4
- package/src/functions/smash.js +6 -6
- package/src/functions/sqrt.js +12 -12
- package/src/functions/styling.js +2 -2
- package/src/functions/supsub.js +13 -13
- package/src/functions/symbolsOp.js +4 -4
- package/src/functions/symbolsOrd.js +9 -9
- package/src/functions/symbolsSpacing.js +9 -9
- package/src/functions/tag.js +6 -6
- package/src/functions/text.js +2 -2
- package/src/functions/underline.js +8 -8
- package/src/functions/utils/assembleSupSub.js +9 -9
- package/src/functions/vcenter.js +4 -4
- package/src/functions/verb.js +7 -7
- package/src/macros.js +5 -2
- package/src/mathMLTree.js +5 -12
- package/src/stretchy.js +18 -28
- package/src/styles/fonts.scss +5 -3
- package/src/styles/katex-swap.scss +4 -1
- package/src/styles/katex.scss +6 -4
- package/src/utils.js +10 -41
package/dist/katex.mjs
CHANGED
|
@@ -167,22 +167,9 @@ ParseError.prototype.__proto__ = Error.prototype;
|
|
|
167
167
|
* This file contains a list of utility functions which are useful in other
|
|
168
168
|
* files.
|
|
169
169
|
*/
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Provide a default value if a setting is undefined
|
|
173
|
-
* NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
|
|
174
|
-
*/
|
|
175
|
-
var deflt = function deflt(setting, defaultIfUndefined) {
|
|
176
|
-
return setting === undefined ? defaultIfUndefined : setting;
|
|
177
|
-
}; // hyphenate and escape adapted from Facebook's React under Apache 2 license
|
|
178
|
-
|
|
179
|
-
|
|
170
|
+
// hyphenate and escape adapted from Facebook's React under Apache 2 license
|
|
180
171
|
var uppercase = /([A-Z])/g;
|
|
181
|
-
|
|
182
|
-
var hyphenate = function hyphenate(str) {
|
|
183
|
-
return str.replace(uppercase, "-$1").toLowerCase();
|
|
184
|
-
};
|
|
185
|
-
|
|
172
|
+
var hyphenate = str => str.replace(uppercase, "-$1").toLowerCase();
|
|
186
173
|
var ESCAPE_LOOKUP = {
|
|
187
174
|
"&": "&",
|
|
188
175
|
">": ">",
|
|
@@ -195,17 +182,14 @@ var ESCAPE_REGEX = /[&><"']/g;
|
|
|
195
182
|
* Escapes text to prevent scripting attacks.
|
|
196
183
|
*/
|
|
197
184
|
|
|
198
|
-
|
|
199
|
-
return String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
|
200
|
-
}
|
|
185
|
+
var escape = text => String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
|
201
186
|
/**
|
|
202
187
|
* Sometimes we want to pull out the innermost element of a group. In most
|
|
203
188
|
* cases, this will just be the group itself, but when ordgroups and colors have
|
|
204
189
|
* a single element, we want to pull that out.
|
|
205
190
|
*/
|
|
206
191
|
|
|
207
|
-
|
|
208
|
-
var getBaseElem = function getBaseElem(group) {
|
|
192
|
+
var getBaseElem = group => {
|
|
209
193
|
if (group.type === "ordgroup") {
|
|
210
194
|
if (group.body.length === 1) {
|
|
211
195
|
return getBaseElem(group.body[0]);
|
|
@@ -224,33 +208,21 @@ var getBaseElem = function getBaseElem(group) {
|
|
|
224
208
|
return group;
|
|
225
209
|
}
|
|
226
210
|
};
|
|
211
|
+
var characterNodesTypes = new Set(["mathord", "textord", "atom"]);
|
|
227
212
|
/**
|
|
228
213
|
* TeXbook algorithms often reference "character boxes", which are simply groups
|
|
229
214
|
* with a single character in them. To decide if something is a character box,
|
|
230
215
|
* we find its innermost group, and see if it is a single character.
|
|
231
216
|
*/
|
|
232
217
|
|
|
233
|
-
|
|
234
|
-
var isCharacterBox = function isCharacterBox(group) {
|
|
235
|
-
var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters
|
|
236
|
-
|
|
237
|
-
return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
var assert = function assert(value) {
|
|
241
|
-
if (!value) {
|
|
242
|
-
throw new Error('Expected non-null, but got ' + String(value));
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return value;
|
|
246
|
-
};
|
|
218
|
+
var isCharacterBox = group => characterNodesTypes.has(getBaseElem(group).type);
|
|
247
219
|
/**
|
|
248
220
|
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
|
249
221
|
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
|
250
222
|
* (so should be outright rejected).
|
|
251
223
|
*/
|
|
252
224
|
|
|
253
|
-
var protocolFromUrl =
|
|
225
|
+
var protocolFromUrl = url => {
|
|
254
226
|
// Check for possible leading protocol.
|
|
255
227
|
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
|
256
228
|
// (U+20) or C0 control (U+00-U+1F) characters.
|
|
@@ -275,14 +247,6 @@ var protocolFromUrl = function protocolFromUrl(url) {
|
|
|
275
247
|
|
|
276
248
|
return protocol[1].toLowerCase();
|
|
277
249
|
};
|
|
278
|
-
var utils = {
|
|
279
|
-
deflt,
|
|
280
|
-
escape,
|
|
281
|
-
hyphenate,
|
|
282
|
-
getBaseElem,
|
|
283
|
-
isCharacterBox,
|
|
284
|
-
protocolFromUrl
|
|
285
|
-
};
|
|
286
250
|
|
|
287
251
|
/* eslint no-console:0 */
|
|
288
252
|
// TODO: automatically generate documentation
|
|
@@ -522,7 +486,7 @@ class Settings {
|
|
|
522
486
|
|
|
523
487
|
isTrusted(context) {
|
|
524
488
|
if (context.url && !context.protocol) {
|
|
525
|
-
var protocol =
|
|
489
|
+
var protocol = protocolFromUrl(context.url);
|
|
526
490
|
|
|
527
491
|
if (protocol == null) {
|
|
528
492
|
return false;
|
|
@@ -3952,19 +3916,19 @@ var toMarkup = function toMarkup(tagName) {
|
|
|
3952
3916
|
var markup = "<" + tagName; // Add the class
|
|
3953
3917
|
|
|
3954
3918
|
if (this.classes.length) {
|
|
3955
|
-
markup += " class=\"" +
|
|
3919
|
+
markup += " class=\"" + escape(createClass(this.classes)) + "\"";
|
|
3956
3920
|
}
|
|
3957
3921
|
|
|
3958
3922
|
var styles = ""; // Add the styles, after hyphenation
|
|
3959
3923
|
|
|
3960
3924
|
for (var style in this.style) {
|
|
3961
3925
|
if (this.style.hasOwnProperty(style)) {
|
|
3962
|
-
styles +=
|
|
3926
|
+
styles += hyphenate(style) + ":" + this.style[style] + ";";
|
|
3963
3927
|
}
|
|
3964
3928
|
}
|
|
3965
3929
|
|
|
3966
3930
|
if (styles) {
|
|
3967
|
-
markup += " style=\"" +
|
|
3931
|
+
markup += " style=\"" + escape(styles) + "\"";
|
|
3968
3932
|
} // Add the attributes
|
|
3969
3933
|
|
|
3970
3934
|
|
|
@@ -3974,7 +3938,7 @@ var toMarkup = function toMarkup(tagName) {
|
|
|
3974
3938
|
throw new ParseError("Invalid attribute name '" + attr + "'");
|
|
3975
3939
|
}
|
|
3976
3940
|
|
|
3977
|
-
markup += " " + attr + "=\"" +
|
|
3941
|
+
markup += " " + attr + "=\"" + escape(this.attributes[attr]) + "\"";
|
|
3978
3942
|
}
|
|
3979
3943
|
}
|
|
3980
3944
|
|
|
@@ -4117,18 +4081,18 @@ class Img {
|
|
|
4117
4081
|
}
|
|
4118
4082
|
|
|
4119
4083
|
toMarkup() {
|
|
4120
|
-
var markup = "<img src=\"" +
|
|
4084
|
+
var markup = "<img src=\"" + escape(this.src) + "\"" + (" alt=\"" + escape(this.alt) + "\""); // Add the styles, after hyphenation
|
|
4121
4085
|
|
|
4122
4086
|
var styles = "";
|
|
4123
4087
|
|
|
4124
4088
|
for (var style in this.style) {
|
|
4125
4089
|
if (this.style.hasOwnProperty(style)) {
|
|
4126
|
-
styles +=
|
|
4090
|
+
styles += hyphenate(style) + ":" + this.style[style] + ";";
|
|
4127
4091
|
}
|
|
4128
4092
|
}
|
|
4129
4093
|
|
|
4130
4094
|
if (styles) {
|
|
4131
|
-
markup += " style=\"" +
|
|
4095
|
+
markup += " style=\"" + escape(styles) + "\"";
|
|
4132
4096
|
}
|
|
4133
4097
|
|
|
4134
4098
|
markup += "'/>";
|
|
@@ -4240,7 +4204,7 @@ class SymbolNode {
|
|
|
4240
4204
|
if (this.classes.length) {
|
|
4241
4205
|
needsSpan = true;
|
|
4242
4206
|
markup += " class=\"";
|
|
4243
|
-
markup +=
|
|
4207
|
+
markup += escape(createClass(this.classes));
|
|
4244
4208
|
markup += "\"";
|
|
4245
4209
|
}
|
|
4246
4210
|
|
|
@@ -4252,16 +4216,16 @@ class SymbolNode {
|
|
|
4252
4216
|
|
|
4253
4217
|
for (var style in this.style) {
|
|
4254
4218
|
if (this.style.hasOwnProperty(style)) {
|
|
4255
|
-
styles +=
|
|
4219
|
+
styles += hyphenate(style) + ":" + this.style[style] + ";";
|
|
4256
4220
|
}
|
|
4257
4221
|
}
|
|
4258
4222
|
|
|
4259
4223
|
if (styles) {
|
|
4260
4224
|
needsSpan = true;
|
|
4261
|
-
markup += " style=\"" +
|
|
4225
|
+
markup += " style=\"" + escape(styles) + "\"";
|
|
4262
4226
|
}
|
|
4263
4227
|
|
|
4264
|
-
var escaped =
|
|
4228
|
+
var escaped = escape(this.text);
|
|
4265
4229
|
|
|
4266
4230
|
if (needsSpan) {
|
|
4267
4231
|
markup += ">";
|
|
@@ -4308,7 +4272,7 @@ class SvgNode {
|
|
|
4308
4272
|
|
|
4309
4273
|
for (var attr in this.attributes) {
|
|
4310
4274
|
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4311
|
-
markup += " " + attr + "=\"" +
|
|
4275
|
+
markup += " " + attr + "=\"" + escape(this.attributes[attr]) + "\"";
|
|
4312
4276
|
}
|
|
4313
4277
|
}
|
|
4314
4278
|
|
|
@@ -4346,9 +4310,9 @@ class PathNode {
|
|
|
4346
4310
|
|
|
4347
4311
|
toMarkup() {
|
|
4348
4312
|
if (this.alternate) {
|
|
4349
|
-
return "<path d=\"" +
|
|
4313
|
+
return "<path d=\"" + escape(this.alternate) + "\"/>";
|
|
4350
4314
|
} else {
|
|
4351
|
-
return "<path d=\"" +
|
|
4315
|
+
return "<path d=\"" + escape(path[this.pathName]) + "\"/>";
|
|
4352
4316
|
}
|
|
4353
4317
|
}
|
|
4354
4318
|
|
|
@@ -4377,7 +4341,7 @@ class LineNode {
|
|
|
4377
4341
|
|
|
4378
4342
|
for (var attr in this.attributes) {
|
|
4379
4343
|
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4380
|
-
markup += " " + attr + "=\"" +
|
|
4344
|
+
markup += " " + attr + "=\"" + escape(this.attributes[attr]) + "\"";
|
|
4381
4345
|
}
|
|
4382
4346
|
}
|
|
4383
4347
|
|
|
@@ -5438,7 +5402,6 @@ var makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {
|
|
|
5438
5402
|
* Used for rel, bin, open, close, inner, and punct.
|
|
5439
5403
|
*/
|
|
5440
5404
|
|
|
5441
|
-
|
|
5442
5405
|
var mathsym = function mathsym(value, mode, options, classes) {
|
|
5443
5406
|
if (classes === void 0) {
|
|
5444
5407
|
classes = [];
|
|
@@ -5466,7 +5429,6 @@ var mathsym = function mathsym(value, mode, options, classes) {
|
|
|
5466
5429
|
* "boldsymbol".
|
|
5467
5430
|
*/
|
|
5468
5431
|
|
|
5469
|
-
|
|
5470
5432
|
var boldsymbol = function boldsymbol(value, mode, options, classes, type) {
|
|
5471
5433
|
if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
|
|
5472
5434
|
return {
|
|
@@ -5564,7 +5526,6 @@ var makeOrd = function makeOrd(group, options, type) {
|
|
|
5564
5526
|
* and styles.
|
|
5565
5527
|
*/
|
|
5566
5528
|
|
|
5567
|
-
|
|
5568
5529
|
var canCombine = (prev, next) => {
|
|
5569
5530
|
if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {
|
|
5570
5531
|
return false;
|
|
@@ -5625,7 +5586,6 @@ var tryCombineChars = chars => {
|
|
|
5625
5586
|
* children.
|
|
5626
5587
|
*/
|
|
5627
5588
|
|
|
5628
|
-
|
|
5629
5589
|
var sizeElementFromChildren = function sizeElementFromChildren(elem) {
|
|
5630
5590
|
var height = 0;
|
|
5631
5591
|
var depth = 0;
|
|
@@ -5661,18 +5621,16 @@ var sizeElementFromChildren = function sizeElementFromChildren(elem) {
|
|
|
5661
5621
|
*/
|
|
5662
5622
|
|
|
5663
5623
|
|
|
5664
|
-
var makeSpan
|
|
5624
|
+
var makeSpan = function makeSpan(classes, children, options, style) {
|
|
5665
5625
|
var span = new Span(classes, children, options, style);
|
|
5666
5626
|
sizeElementFromChildren(span);
|
|
5667
5627
|
return span;
|
|
5668
5628
|
}; // SVG one is simpler -- doesn't require height, depth, max-font setting.
|
|
5669
5629
|
// This is also a separate method for typesafety.
|
|
5670
5630
|
|
|
5671
|
-
|
|
5672
5631
|
var makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style);
|
|
5673
|
-
|
|
5674
5632
|
var makeLineSpan = function makeLineSpan(className, options, thickness) {
|
|
5675
|
-
var line = makeSpan
|
|
5633
|
+
var line = makeSpan([className], [], options);
|
|
5676
5634
|
line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
|
|
5677
5635
|
line.style.borderBottomWidth = makeEm(line.height);
|
|
5678
5636
|
line.maxFontSize = 1.0;
|
|
@@ -5683,7 +5641,6 @@ var makeLineSpan = function makeLineSpan(className, options, thickness) {
|
|
|
5683
5641
|
* and options.
|
|
5684
5642
|
*/
|
|
5685
5643
|
|
|
5686
|
-
|
|
5687
5644
|
var makeAnchor = function makeAnchor(href, classes, children, options) {
|
|
5688
5645
|
var anchor = new Anchor(href, classes, children, options);
|
|
5689
5646
|
sizeElementFromChildren(anchor);
|
|
@@ -5693,7 +5650,6 @@ var makeAnchor = function makeAnchor(href, classes, children, options) {
|
|
|
5693
5650
|
* Makes a document fragment with the given list of children.
|
|
5694
5651
|
*/
|
|
5695
5652
|
|
|
5696
|
-
|
|
5697
5653
|
var makeFragment = function makeFragment(children) {
|
|
5698
5654
|
var fragment = new DocumentFragment(children);
|
|
5699
5655
|
sizeElementFromChildren(fragment);
|
|
@@ -5704,16 +5660,14 @@ var makeFragment = function makeFragment(children) {
|
|
|
5704
5660
|
* and styles
|
|
5705
5661
|
*/
|
|
5706
5662
|
|
|
5707
|
-
|
|
5708
5663
|
var wrapFragment = function wrapFragment(group, options) {
|
|
5709
5664
|
if (group instanceof DocumentFragment) {
|
|
5710
|
-
return makeSpan
|
|
5665
|
+
return makeSpan([], [group], options);
|
|
5711
5666
|
}
|
|
5712
5667
|
|
|
5713
5668
|
return group;
|
|
5714
5669
|
}; // These are exact object types to catch typos in the names of the optional fields.
|
|
5715
5670
|
|
|
5716
|
-
|
|
5717
5671
|
// Computes the updated `children` list and the overall depth.
|
|
5718
5672
|
//
|
|
5719
5673
|
// This helper function for makeVList makes it easier to enforce type safety by
|
|
@@ -5813,7 +5767,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5813
5767
|
}
|
|
5814
5768
|
|
|
5815
5769
|
pstrutSize += 2;
|
|
5816
|
-
var pstrut = makeSpan
|
|
5770
|
+
var pstrut = makeSpan(["pstrut"], []);
|
|
5817
5771
|
pstrut.style.height = makeEm(pstrutSize); // Create a new list of actual children at the correct offsets
|
|
5818
5772
|
|
|
5819
5773
|
var realChildren = [];
|
|
@@ -5830,7 +5784,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5830
5784
|
var _elem = _child.elem;
|
|
5831
5785
|
var classes = _child.wrapperClasses || [];
|
|
5832
5786
|
var style = _child.wrapperStyle || {};
|
|
5833
|
-
var childWrap = makeSpan
|
|
5787
|
+
var childWrap = makeSpan(classes, [pstrut, _elem], undefined, style);
|
|
5834
5788
|
childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);
|
|
5835
5789
|
|
|
5836
5790
|
if (_child.marginLeft) {
|
|
@@ -5852,7 +5806,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5852
5806
|
// without overly expanding the containing line-box.
|
|
5853
5807
|
|
|
5854
5808
|
|
|
5855
|
-
var vlist = makeSpan
|
|
5809
|
+
var vlist = makeSpan(["vlist"], realChildren);
|
|
5856
5810
|
vlist.style.height = makeEm(maxPos); // A second row is used if necessary to represent the vlist's depth.
|
|
5857
5811
|
|
|
5858
5812
|
var rows;
|
|
@@ -5863,18 +5817,18 @@ var makeVList = function makeVList(params, options) {
|
|
|
5863
5817
|
// contenteditable mode only, treats that span as if it contains some
|
|
5864
5818
|
// text content. And that min-height over-rides our desired height.
|
|
5865
5819
|
// So we put another empty span inside the depth strut span.
|
|
5866
|
-
var emptySpan = makeSpan
|
|
5867
|
-
var depthStrut = makeSpan
|
|
5820
|
+
var emptySpan = makeSpan([], []);
|
|
5821
|
+
var depthStrut = makeSpan(["vlist"], [emptySpan]);
|
|
5868
5822
|
depthStrut.style.height = makeEm(-minPos); // Safari wants the first row to have inline content; otherwise it
|
|
5869
5823
|
// puts the bottom of the *second* row on the baseline.
|
|
5870
5824
|
|
|
5871
|
-
var topStrut = makeSpan
|
|
5872
|
-
rows = [makeSpan
|
|
5825
|
+
var topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200b")]);
|
|
5826
|
+
rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])];
|
|
5873
5827
|
} else {
|
|
5874
|
-
rows = [makeSpan
|
|
5828
|
+
rows = [makeSpan(["vlist-r"], [vlist])];
|
|
5875
5829
|
}
|
|
5876
5830
|
|
|
5877
|
-
var vtable = makeSpan
|
|
5831
|
+
var vtable = makeSpan(["vlist-t"], rows);
|
|
5878
5832
|
|
|
5879
5833
|
if (rows.length === 2) {
|
|
5880
5834
|
vtable.classes.push("vlist-t2");
|
|
@@ -5887,16 +5841,14 @@ var makeVList = function makeVList(params, options) {
|
|
|
5887
5841
|
// either a vertical or horizontal list. In KaTeX, at least for now, it's
|
|
5888
5842
|
// static space between elements in a horizontal layout.
|
|
5889
5843
|
|
|
5890
|
-
|
|
5891
5844
|
var makeGlue = (measurement, options) => {
|
|
5892
5845
|
// Make an empty span for the space
|
|
5893
|
-
var rule = makeSpan
|
|
5846
|
+
var rule = makeSpan(["mspace"], [], options);
|
|
5894
5847
|
var size = calculateSize(measurement, options);
|
|
5895
5848
|
rule.style.marginRight = makeEm(size);
|
|
5896
5849
|
return rule;
|
|
5897
5850
|
}; // Takes font options, and returns the appropriate fontLookup name
|
|
5898
5851
|
|
|
5899
|
-
|
|
5900
5852
|
var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {
|
|
5901
5853
|
var baseFontName = "";
|
|
5902
5854
|
|
|
@@ -6009,7 +5961,6 @@ var svgData = {
|
|
|
6009
5961
|
oiiintSize1: ["oiiintSize1", 1.304, 0.499],
|
|
6010
5962
|
oiiintSize2: ["oiiintSize2", 1.98, 0.659]
|
|
6011
5963
|
};
|
|
6012
|
-
|
|
6013
5964
|
var staticSvg = function staticSvg(value, options) {
|
|
6014
5965
|
// Create a span with inline SVG for the element.
|
|
6015
5966
|
var [pathName, width, height] = svgData[value];
|
|
@@ -6029,24 +5980,6 @@ var staticSvg = function staticSvg(value, options) {
|
|
|
6029
5980
|
return span;
|
|
6030
5981
|
};
|
|
6031
5982
|
|
|
6032
|
-
var buildCommon = {
|
|
6033
|
-
fontMap,
|
|
6034
|
-
makeSymbol,
|
|
6035
|
-
mathsym,
|
|
6036
|
-
makeSpan: makeSpan$2,
|
|
6037
|
-
makeSvgSpan,
|
|
6038
|
-
makeLineSpan,
|
|
6039
|
-
makeAnchor,
|
|
6040
|
-
makeFragment,
|
|
6041
|
-
wrapFragment,
|
|
6042
|
-
makeVList,
|
|
6043
|
-
makeOrd,
|
|
6044
|
-
makeGlue,
|
|
6045
|
-
staticSvg,
|
|
6046
|
-
svgData,
|
|
6047
|
-
tryCombineChars
|
|
6048
|
-
};
|
|
6049
|
-
|
|
6050
5983
|
/**
|
|
6051
5984
|
* Describes spaces between different classes of atoms.
|
|
6052
5985
|
*/
|
|
@@ -6252,12 +6185,11 @@ var ordargument = function ordargument(arg) {
|
|
|
6252
6185
|
* Then, the buildExpression, buildGroup, and various groupBuilders functions
|
|
6253
6186
|
* are called, to produce a final HTML tree.
|
|
6254
6187
|
*/
|
|
6255
|
-
|
|
6188
|
+
// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
|
|
6256
6189
|
// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
|
|
6257
6190
|
// and the text before Rule 19.
|
|
6258
|
-
|
|
6259
|
-
var
|
|
6260
|
-
var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
|
|
6191
|
+
var binLeftCanceller = new Set(["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]);
|
|
6192
|
+
var binRightCanceller = new Set(["rightmost", "mrel", "mclose", "mpunct"]);
|
|
6261
6193
|
var styleMap$1 = {
|
|
6262
6194
|
"display": Style$1.DISPLAY,
|
|
6263
6195
|
"text": Style$1.TEXT,
|
|
@@ -6303,7 +6235,7 @@ var buildExpression$1 = function buildExpression(expression, options, isRealGrou
|
|
|
6303
6235
|
} // Combine consecutive domTree.symbolNodes into a single symbolNode.
|
|
6304
6236
|
|
|
6305
6237
|
|
|
6306
|
-
|
|
6238
|
+
tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings
|
|
6307
6239
|
// to avoid processing groups multiple times.
|
|
6308
6240
|
|
|
6309
6241
|
if (!isRealGroup) {
|
|
@@ -6325,8 +6257,8 @@ var buildExpression$1 = function buildExpression(expression, options, isRealGrou
|
|
|
6325
6257
|
// or "rightmost", respectively, is used to indicate it.
|
|
6326
6258
|
|
|
6327
6259
|
|
|
6328
|
-
var dummyPrev = makeSpan
|
|
6329
|
-
var dummyNext = makeSpan
|
|
6260
|
+
var dummyPrev = makeSpan([surrounding[0] || "leftmost"], [], options);
|
|
6261
|
+
var dummyNext = makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element
|
|
6330
6262
|
// of its `classes` array. A later cleanup should ensure this, for
|
|
6331
6263
|
// instance by changing the signature of `makeSpan`.
|
|
6332
6264
|
// Before determining what spaces to insert, perform bin cancellation.
|
|
@@ -6337,9 +6269,9 @@ var buildExpression$1 = function buildExpression(expression, options, isRealGrou
|
|
|
6337
6269
|
var prevType = prev.classes[0];
|
|
6338
6270
|
var type = node.classes[0];
|
|
6339
6271
|
|
|
6340
|
-
if (prevType === "mbin" && binRightCanceller.
|
|
6272
|
+
if (prevType === "mbin" && binRightCanceller.has(type)) {
|
|
6341
6273
|
prev.classes[0] = "mord";
|
|
6342
|
-
} else if (type === "mbin" && binLeftCanceller.
|
|
6274
|
+
} else if (type === "mbin" && binLeftCanceller.has(prevType)) {
|
|
6343
6275
|
node.classes[0] = "mord";
|
|
6344
6276
|
}
|
|
6345
6277
|
}, {
|
|
@@ -6353,7 +6285,7 @@ var buildExpression$1 = function buildExpression(expression, options, isRealGrou
|
|
|
6353
6285
|
|
|
6354
6286
|
if (space) {
|
|
6355
6287
|
// Insert glue (spacing) after the `prev`.
|
|
6356
|
-
return
|
|
6288
|
+
return makeGlue(space, glueOptions);
|
|
6357
6289
|
}
|
|
6358
6290
|
}, {
|
|
6359
6291
|
node: dummyPrev
|
|
@@ -6405,7 +6337,7 @@ var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev
|
|
|
6405
6337
|
if (nonspace) {
|
|
6406
6338
|
prev.node = node;
|
|
6407
6339
|
} else if (isRoot && node.hasClass("newline")) {
|
|
6408
|
-
prev.node = makeSpan
|
|
6340
|
+
prev.node = makeSpan(["leftmost"]); // treat like beginning of line
|
|
6409
6341
|
}
|
|
6410
6342
|
|
|
6411
6343
|
prev.insertAfter = (index => n => {
|
|
@@ -6464,7 +6396,7 @@ var getTypeOfDomTree = function getTypeOfDomTree(node, side) {
|
|
|
6464
6396
|
};
|
|
6465
6397
|
var makeNullDelimiter = function makeNullDelimiter(options, classes) {
|
|
6466
6398
|
var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
|
|
6467
|
-
return makeSpan
|
|
6399
|
+
return makeSpan(classes.concat(moreClasses));
|
|
6468
6400
|
};
|
|
6469
6401
|
/**
|
|
6470
6402
|
* buildGroup is the function that takes a group and calls the correct groupType
|
|
@@ -6474,7 +6406,7 @@ var makeNullDelimiter = function makeNullDelimiter(options, classes) {
|
|
|
6474
6406
|
|
|
6475
6407
|
var buildGroup$1 = function buildGroup(group, options, baseOptions) {
|
|
6476
6408
|
if (!group) {
|
|
6477
|
-
return makeSpan
|
|
6409
|
+
return makeSpan();
|
|
6478
6410
|
}
|
|
6479
6411
|
|
|
6480
6412
|
if (_htmlGroupBuilders[group.type]) {
|
|
@@ -6484,7 +6416,7 @@ var buildGroup$1 = function buildGroup(group, options, baseOptions) {
|
|
|
6484
6416
|
// for that size difference.
|
|
6485
6417
|
|
|
6486
6418
|
if (baseOptions && options.size !== baseOptions.size) {
|
|
6487
|
-
groupNode = makeSpan
|
|
6419
|
+
groupNode = makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
|
|
6488
6420
|
var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
|
|
6489
6421
|
groupNode.height *= multiplier;
|
|
6490
6422
|
groupNode.depth *= multiplier;
|
|
@@ -6504,11 +6436,11 @@ var buildGroup$1 = function buildGroup(group, options, baseOptions) {
|
|
|
6504
6436
|
|
|
6505
6437
|
function buildHTMLUnbreakable(children, options) {
|
|
6506
6438
|
// Compute height and depth of this chunk.
|
|
6507
|
-
var body = makeSpan
|
|
6439
|
+
var body = makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at
|
|
6508
6440
|
// the height of the expression, and the bottom of the HTML element
|
|
6509
6441
|
// falls at the depth of the expression.
|
|
6510
6442
|
|
|
6511
|
-
var strut = makeSpan
|
|
6443
|
+
var strut = makeSpan(["strut"]);
|
|
6512
6444
|
strut.style.height = makeEm(body.height + body.depth);
|
|
6513
6445
|
|
|
6514
6446
|
if (body.depth) {
|
|
@@ -6602,7 +6534,7 @@ function buildHTML(tree, options) {
|
|
|
6602
6534
|
children.push(eqnNum);
|
|
6603
6535
|
}
|
|
6604
6536
|
|
|
6605
|
-
var htmlNode = makeSpan
|
|
6537
|
+
var htmlNode = makeSpan(["katex-html"], children);
|
|
6606
6538
|
htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children
|
|
6607
6539
|
// (the height of the enclosing htmlNode) for proper vertical alignment.
|
|
6608
6540
|
|
|
@@ -6711,13 +6643,13 @@ class MathNode {
|
|
|
6711
6643
|
for (var attr in this.attributes) {
|
|
6712
6644
|
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
6713
6645
|
markup += " " + attr + "=\"";
|
|
6714
|
-
markup +=
|
|
6646
|
+
markup += escape(this.attributes[attr]);
|
|
6715
6647
|
markup += "\"";
|
|
6716
6648
|
}
|
|
6717
6649
|
}
|
|
6718
6650
|
|
|
6719
6651
|
if (this.classes.length > 0) {
|
|
6720
|
-
markup += " class =\"" +
|
|
6652
|
+
markup += " class =\"" + escape(createClass(this.classes)) + "\"";
|
|
6721
6653
|
}
|
|
6722
6654
|
|
|
6723
6655
|
markup += ">";
|
|
@@ -6763,7 +6695,7 @@ class TextNode {
|
|
|
6763
6695
|
|
|
6764
6696
|
|
|
6765
6697
|
toMarkup() {
|
|
6766
|
-
return
|
|
6698
|
+
return escape(this.toText());
|
|
6767
6699
|
}
|
|
6768
6700
|
/**
|
|
6769
6701
|
* Converts the text node into a string
|
|
@@ -6854,29 +6786,24 @@ class SpaceNode {
|
|
|
6854
6786
|
|
|
6855
6787
|
}
|
|
6856
6788
|
|
|
6857
|
-
var mathMLTree = {
|
|
6858
|
-
MathNode,
|
|
6859
|
-
TextNode,
|
|
6860
|
-
SpaceNode,
|
|
6861
|
-
newDocumentFragment
|
|
6862
|
-
};
|
|
6863
|
-
|
|
6864
6789
|
/**
|
|
6865
6790
|
* This file converts a parse tree into a corresponding MathML tree. The main
|
|
6866
6791
|
* entry point is the `buildMathML` function, which takes a parse tree from the
|
|
6867
6792
|
* parser.
|
|
6868
6793
|
*/
|
|
6869
|
-
|
|
6794
|
+
var noVariantSymbols = new Set(["\\imath", "\\jmath"]);
|
|
6795
|
+
var rowLikeTypes = new Set(["mrow", "mtable"]);
|
|
6870
6796
|
/**
|
|
6871
6797
|
* Takes a symbol and converts it into a MathML text node after performing
|
|
6872
6798
|
* optional replacement from symbols.js.
|
|
6873
6799
|
*/
|
|
6800
|
+
|
|
6874
6801
|
var makeText = function makeText(text, mode, options) {
|
|
6875
6802
|
if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.slice(4, 6) === "tt" || options.font && options.font.slice(4, 6) === "tt"))) {
|
|
6876
6803
|
text = symbols[mode][text].replace;
|
|
6877
6804
|
}
|
|
6878
6805
|
|
|
6879
|
-
return new
|
|
6806
|
+
return new TextNode(text);
|
|
6880
6807
|
};
|
|
6881
6808
|
/**
|
|
6882
6809
|
* Wrap the given array of nodes in an <mrow> node if needed, i.e.,
|
|
@@ -6887,7 +6814,7 @@ var makeRow = function makeRow(body) {
|
|
|
6887
6814
|
if (body.length === 1) {
|
|
6888
6815
|
return body[0];
|
|
6889
6816
|
} else {
|
|
6890
|
-
return new
|
|
6817
|
+
return new MathNode("mrow", body);
|
|
6891
6818
|
}
|
|
6892
6819
|
};
|
|
6893
6820
|
/**
|
|
@@ -6949,7 +6876,7 @@ var getVariant = function getVariant(group, options) {
|
|
|
6949
6876
|
|
|
6950
6877
|
var text = group.text;
|
|
6951
6878
|
|
|
6952
|
-
if (
|
|
6879
|
+
if (noVariantSymbols.has(text)) {
|
|
6953
6880
|
return null;
|
|
6954
6881
|
}
|
|
6955
6882
|
|
|
@@ -6957,10 +6884,10 @@ var getVariant = function getVariant(group, options) {
|
|
|
6957
6884
|
text = symbols[mode][text].replace;
|
|
6958
6885
|
}
|
|
6959
6886
|
|
|
6960
|
-
var fontName =
|
|
6887
|
+
var fontName = fontMap[font].fontName;
|
|
6961
6888
|
|
|
6962
6889
|
if (getCharacterMetrics(text, fontName, mode)) {
|
|
6963
|
-
return
|
|
6890
|
+
return fontMap[font].variant;
|
|
6964
6891
|
}
|
|
6965
6892
|
|
|
6966
6893
|
return null;
|
|
@@ -7072,7 +6999,7 @@ var buildExpressionRow = function buildExpressionRow(expression, options, isOrdg
|
|
|
7072
6999
|
|
|
7073
7000
|
var buildGroup = function buildGroup(group, options) {
|
|
7074
7001
|
if (!group) {
|
|
7075
|
-
return new
|
|
7002
|
+
return new MathNode("mrow");
|
|
7076
7003
|
}
|
|
7077
7004
|
|
|
7078
7005
|
if (_mathmlGroupBuilders[group.type]) {
|
|
@@ -7104,17 +7031,17 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly)
|
|
|
7104
7031
|
|
|
7105
7032
|
var wrapper;
|
|
7106
7033
|
|
|
7107
|
-
if (expression.length === 1 && expression[0] instanceof MathNode &&
|
|
7034
|
+
if (expression.length === 1 && expression[0] instanceof MathNode && rowLikeTypes.has(expression[0].type)) {
|
|
7108
7035
|
wrapper = expression[0];
|
|
7109
7036
|
} else {
|
|
7110
|
-
wrapper = new
|
|
7037
|
+
wrapper = new MathNode("mrow", expression);
|
|
7111
7038
|
} // Build a TeX annotation of the source
|
|
7112
7039
|
|
|
7113
7040
|
|
|
7114
|
-
var annotation = new
|
|
7041
|
+
var annotation = new MathNode("annotation", [new TextNode(texExpression)]);
|
|
7115
7042
|
annotation.setAttribute("encoding", "application/x-tex");
|
|
7116
|
-
var semantics = new
|
|
7117
|
-
var math = new
|
|
7043
|
+
var semantics = new MathNode("semantics", [wrapper, annotation]);
|
|
7044
|
+
var math = new MathNode("math", [semantics]);
|
|
7118
7045
|
math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
|
|
7119
7046
|
|
|
7120
7047
|
if (isDisplayMode) {
|
|
@@ -7127,7 +7054,7 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly)
|
|
|
7127
7054
|
|
|
7128
7055
|
var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe
|
|
7129
7056
|
|
|
7130
|
-
return
|
|
7057
|
+
return makeSpan([wrapperClass], [math]);
|
|
7131
7058
|
}
|
|
7132
7059
|
|
|
7133
7060
|
var optionsFromSettings = function optionsFromSettings(settings) {
|
|
@@ -7150,7 +7077,7 @@ var displayWrap = function displayWrap(node, settings) {
|
|
|
7150
7077
|
classes.push("fleqn");
|
|
7151
7078
|
}
|
|
7152
7079
|
|
|
7153
|
-
node =
|
|
7080
|
+
node = makeSpan(classes, [node]);
|
|
7154
7081
|
}
|
|
7155
7082
|
|
|
7156
7083
|
return node;
|
|
@@ -7164,13 +7091,13 @@ var buildTree = function buildTree(tree, expression, settings) {
|
|
|
7164
7091
|
return buildMathML(tree, expression, options, settings.displayMode, true);
|
|
7165
7092
|
} else if (settings.output === "html") {
|
|
7166
7093
|
var htmlNode = buildHTML(tree, options);
|
|
7167
|
-
katexNode =
|
|
7094
|
+
katexNode = makeSpan(["katex"], [htmlNode]);
|
|
7168
7095
|
} else {
|
|
7169
7096
|
var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);
|
|
7170
7097
|
|
|
7171
7098
|
var _htmlNode = buildHTML(tree, options);
|
|
7172
7099
|
|
|
7173
|
-
katexNode =
|
|
7100
|
+
katexNode = makeSpan(["katex"], [mathMLNode, _htmlNode]);
|
|
7174
7101
|
}
|
|
7175
7102
|
|
|
7176
7103
|
return displayWrap(katexNode, settings);
|
|
@@ -7178,7 +7105,7 @@ var buildTree = function buildTree(tree, expression, settings) {
|
|
|
7178
7105
|
var buildHTMLTree = function buildHTMLTree(tree, expression, settings) {
|
|
7179
7106
|
var options = optionsFromSettings(settings);
|
|
7180
7107
|
var htmlNode = buildHTML(tree, options);
|
|
7181
|
-
var katexNode =
|
|
7108
|
+
var katexNode = makeSpan(["katex"], [htmlNode]);
|
|
7182
7109
|
return displayWrap(katexNode, settings);
|
|
7183
7110
|
};
|
|
7184
7111
|
|
|
@@ -7233,9 +7160,8 @@ var stretchyCodePoint = {
|
|
|
7233
7160
|
"\\cdleftarrow": "\u2190",
|
|
7234
7161
|
"\\cdlongequal": "="
|
|
7235
7162
|
};
|
|
7236
|
-
|
|
7237
|
-
var
|
|
7238
|
-
var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, '')])]);
|
|
7163
|
+
var stretchyMathML = function stretchyMathML(label) {
|
|
7164
|
+
var node = new MathNode("mo", [new TextNode(stretchyCodePoint[label.replace(/^\\/, '')])]);
|
|
7239
7165
|
node.setAttribute("stretchy", "true");
|
|
7240
7166
|
return node;
|
|
7241
7167
|
}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
|
|
@@ -7275,7 +7201,6 @@ var mathMLnode = function mathMLnode(label) {
|
|
|
7275
7201
|
// That is, inside the font, that arrowhead is 522 units tall, which
|
|
7276
7202
|
// corresponds to 0.522 em inside the document.
|
|
7277
7203
|
|
|
7278
|
-
|
|
7279
7204
|
var katexImagesData = {
|
|
7280
7205
|
// path(s), minWidth, height, align
|
|
7281
7206
|
overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
|
|
@@ -7324,30 +7249,22 @@ var katexImagesData = {
|
|
|
7324
7249
|
xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
|
|
7325
7250
|
xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
|
|
7326
7251
|
};
|
|
7327
|
-
|
|
7328
|
-
var
|
|
7329
|
-
if (arg.type === "ordgroup") {
|
|
7330
|
-
return arg.body.length;
|
|
7331
|
-
} else {
|
|
7332
|
-
return 1;
|
|
7333
|
-
}
|
|
7334
|
-
};
|
|
7335
|
-
|
|
7336
|
-
var svgSpan = function svgSpan(group, options) {
|
|
7252
|
+
var wideAccentLabels = new Set(["widehat", "widecheck", "widetilde", "utilde"]);
|
|
7253
|
+
var stretchySvg = function stretchySvg(group, options) {
|
|
7337
7254
|
// Create a span with inline SVG for the element.
|
|
7338
7255
|
function buildSvgSpan_() {
|
|
7339
7256
|
var viewBoxWidth = 400000; // default
|
|
7340
7257
|
|
|
7341
7258
|
var label = group.label.slice(1);
|
|
7342
7259
|
|
|
7343
|
-
if (
|
|
7260
|
+
if (wideAccentLabels.has(label)) {
|
|
7344
7261
|
// Each type in the `if` statement corresponds to one of the ParseNode
|
|
7345
7262
|
// types below. This narrowing is required to access `grp.base`.
|
|
7346
7263
|
// $FlowFixMe
|
|
7347
7264
|
var grp = group; // There are four SVG images available for each function.
|
|
7348
7265
|
// Choose a taller image when there are more characters.
|
|
7349
7266
|
|
|
7350
|
-
var numChars =
|
|
7267
|
+
var numChars = grp.base.type === "ordgroup" ? grp.base.body.length : 1;
|
|
7351
7268
|
var viewBoxHeight;
|
|
7352
7269
|
var pathName;
|
|
7353
7270
|
|
|
@@ -7389,7 +7306,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7389
7306
|
"preserveAspectRatio": "none"
|
|
7390
7307
|
});
|
|
7391
7308
|
return {
|
|
7392
|
-
span:
|
|
7309
|
+
span: makeSvgSpan([], [svgNode], options),
|
|
7393
7310
|
minWidth: 0,
|
|
7394
7311
|
height: _height
|
|
7395
7312
|
};
|
|
@@ -7429,7 +7346,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7429
7346
|
"preserveAspectRatio": aligns[i] + " slice"
|
|
7430
7347
|
});
|
|
7431
7348
|
|
|
7432
|
-
var _span =
|
|
7349
|
+
var _span = makeSvgSpan([widthClasses[i]], [_svgNode], options);
|
|
7433
7350
|
|
|
7434
7351
|
if (numSvgChildren === 1) {
|
|
7435
7352
|
return {
|
|
@@ -7444,7 +7361,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7444
7361
|
}
|
|
7445
7362
|
|
|
7446
7363
|
return {
|
|
7447
|
-
span:
|
|
7364
|
+
span: makeSpan(["stretchy"], spans, options),
|
|
7448
7365
|
minWidth: _minWidth,
|
|
7449
7366
|
height: _height2
|
|
7450
7367
|
};
|
|
@@ -7468,14 +7385,13 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7468
7385
|
|
|
7469
7386
|
return span;
|
|
7470
7387
|
};
|
|
7471
|
-
|
|
7472
|
-
var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options) {
|
|
7388
|
+
var stretchyEnclose = function stretchyEnclose(inner, label, topPad, bottomPad, options) {
|
|
7473
7389
|
// Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl
|
|
7474
7390
|
var img;
|
|
7475
7391
|
var totalHeight = inner.height + inner.depth + topPad + bottomPad;
|
|
7476
7392
|
|
|
7477
7393
|
if (/fbox|color|angl/.test(label)) {
|
|
7478
|
-
img =
|
|
7394
|
+
img = makeSpan(["stretchy", label], [], options);
|
|
7479
7395
|
|
|
7480
7396
|
if (label === "fbox") {
|
|
7481
7397
|
var color = options.color && options.getColor();
|
|
@@ -7514,7 +7430,7 @@ var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options)
|
|
|
7514
7430
|
"width": "100%",
|
|
7515
7431
|
"height": makeEm(totalHeight)
|
|
7516
7432
|
});
|
|
7517
|
-
img =
|
|
7433
|
+
img = makeSvgSpan([], [svgNode], options);
|
|
7518
7434
|
}
|
|
7519
7435
|
|
|
7520
7436
|
img.height = totalHeight;
|
|
@@ -7522,12 +7438,6 @@ var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options)
|
|
|
7522
7438
|
return img;
|
|
7523
7439
|
};
|
|
7524
7440
|
|
|
7525
|
-
var stretchy = {
|
|
7526
|
-
encloseSpan,
|
|
7527
|
-
mathMLnode,
|
|
7528
|
-
svgSpan
|
|
7529
|
-
};
|
|
7530
|
-
|
|
7531
7441
|
/**
|
|
7532
7442
|
* Asserts that the node is of the given type and returns it with stricter
|
|
7533
7443
|
* typing. Throws if the node's type does not match.
|
|
@@ -7603,7 +7513,7 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7603
7513
|
|
|
7604
7514
|
var body = buildGroup$1(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?
|
|
7605
7515
|
|
|
7606
|
-
var mustShift = group.isShifty &&
|
|
7516
|
+
var mustShift = group.isShifty && isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the
|
|
7607
7517
|
// nucleus is not a single character, let s = 0; otherwise set s to the
|
|
7608
7518
|
// kern amount for the nucleus followed by the \skewchar of its font."
|
|
7609
7519
|
// Note that our skew metrics are just the kern between each character
|
|
@@ -7614,7 +7524,7 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7614
7524
|
if (mustShift) {
|
|
7615
7525
|
// If the base is a character box, then we want the skew of the
|
|
7616
7526
|
// innermost character. To do that, we find the innermost character:
|
|
7617
|
-
var baseChar =
|
|
7527
|
+
var baseChar = getBaseElem(base); // Then, we render its group to get the symbol inside it
|
|
7618
7528
|
|
|
7619
7529
|
var baseGroup = buildGroup$1(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.
|
|
7620
7530
|
|
|
@@ -7640,10 +7550,10 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7640
7550
|
// render combining characters when not preceded by a character.
|
|
7641
7551
|
// So now we use an SVG.
|
|
7642
7552
|
// If Safari reforms, we should consider reverting to the glyph.
|
|
7643
|
-
accent =
|
|
7644
|
-
width =
|
|
7553
|
+
accent = staticSvg("vec", options);
|
|
7554
|
+
width = svgData.vec[1];
|
|
7645
7555
|
} else {
|
|
7646
|
-
accent =
|
|
7556
|
+
accent = makeOrd({
|
|
7647
7557
|
mode: group.mode,
|
|
7648
7558
|
text: group.label
|
|
7649
7559
|
}, options, "textord");
|
|
@@ -7658,7 +7568,7 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7658
7568
|
}
|
|
7659
7569
|
}
|
|
7660
7570
|
|
|
7661
|
-
accentBody =
|
|
7571
|
+
accentBody = makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be
|
|
7662
7572
|
// at least the width of the accent, and overlap directly onto the
|
|
7663
7573
|
// character without any vertical offset.
|
|
7664
7574
|
|
|
@@ -7686,7 +7596,7 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7686
7596
|
accentBody.style.top = ".2em";
|
|
7687
7597
|
}
|
|
7688
7598
|
|
|
7689
|
-
accentBody =
|
|
7599
|
+
accentBody = makeVList({
|
|
7690
7600
|
positionType: "firstBaseline",
|
|
7691
7601
|
children: [{
|
|
7692
7602
|
type: "elem",
|
|
@@ -7698,10 +7608,10 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7698
7608
|
type: "elem",
|
|
7699
7609
|
elem: accentBody
|
|
7700
7610
|
}]
|
|
7701
|
-
}
|
|
7611
|
+
});
|
|
7702
7612
|
} else {
|
|
7703
|
-
accentBody =
|
|
7704
|
-
accentBody =
|
|
7613
|
+
accentBody = stretchySvg(group, options);
|
|
7614
|
+
accentBody = makeVList({
|
|
7705
7615
|
positionType: "firstBaseline",
|
|
7706
7616
|
children: [{
|
|
7707
7617
|
type: "elem",
|
|
@@ -7715,10 +7625,10 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7715
7625
|
marginLeft: makeEm(2 * skew)
|
|
7716
7626
|
} : undefined
|
|
7717
7627
|
}]
|
|
7718
|
-
}
|
|
7628
|
+
});
|
|
7719
7629
|
}
|
|
7720
7630
|
|
|
7721
|
-
var accentWrap =
|
|
7631
|
+
var accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
|
|
7722
7632
|
|
|
7723
7633
|
if (supSubGroup) {
|
|
7724
7634
|
// Here, we replace the "base" child of the supsub with our newly
|
|
@@ -7736,8 +7646,8 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7736
7646
|
};
|
|
7737
7647
|
|
|
7738
7648
|
var mathmlBuilder$9 = (group, options) => {
|
|
7739
|
-
var accentNode = group.isStretchy ?
|
|
7740
|
-
var node = new
|
|
7649
|
+
var accentNode = group.isStretchy ? stretchyMathML(group.label) : new MathNode("mo", [makeText(group.label, group.mode)]);
|
|
7650
|
+
var node = new MathNode("mover", [buildGroup(group.base, options), accentNode]);
|
|
7741
7651
|
node.setAttribute("accent", "true");
|
|
7742
7652
|
return node;
|
|
7743
7653
|
};
|
|
@@ -7822,10 +7732,10 @@ defineFunction({
|
|
|
7822
7732
|
htmlBuilder: (group, options) => {
|
|
7823
7733
|
// Treat under accents much like underlines.
|
|
7824
7734
|
var innerGroup = buildGroup$1(group.base, options);
|
|
7825
|
-
var accentBody =
|
|
7735
|
+
var accentBody = stretchySvg(group, options);
|
|
7826
7736
|
var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns
|
|
7827
7737
|
|
|
7828
|
-
var vlist =
|
|
7738
|
+
var vlist = makeVList({
|
|
7829
7739
|
positionType: "top",
|
|
7830
7740
|
positionData: innerGroup.height,
|
|
7831
7741
|
children: [{
|
|
@@ -7839,12 +7749,12 @@ defineFunction({
|
|
|
7839
7749
|
type: "elem",
|
|
7840
7750
|
elem: innerGroup
|
|
7841
7751
|
}]
|
|
7842
|
-
}
|
|
7843
|
-
return
|
|
7752
|
+
});
|
|
7753
|
+
return makeSpan(["mord", "accentunder"], [vlist], options);
|
|
7844
7754
|
},
|
|
7845
7755
|
mathmlBuilder: (group, options) => {
|
|
7846
|
-
var accentNode =
|
|
7847
|
-
var node = new
|
|
7756
|
+
var accentNode = stretchyMathML(group.label);
|
|
7757
|
+
var node = new MathNode("munder", [buildGroup(group.base, options), accentNode]);
|
|
7848
7758
|
node.setAttribute("accentunder", "true");
|
|
7849
7759
|
return node;
|
|
7850
7760
|
}
|
|
@@ -7852,7 +7762,7 @@ defineFunction({
|
|
|
7852
7762
|
|
|
7853
7763
|
// Helper function
|
|
7854
7764
|
var paddedNode = group => {
|
|
7855
|
-
var node = new
|
|
7765
|
+
var node = new MathNode("mpadded", group ? [group] : []);
|
|
7856
7766
|
node.setAttribute("width", "+0.6em");
|
|
7857
7767
|
node.setAttribute("lspace", "0.3em");
|
|
7858
7768
|
return node;
|
|
@@ -7893,7 +7803,7 @@ defineFunction({
|
|
|
7893
7803
|
// them in a span.
|
|
7894
7804
|
|
|
7895
7805
|
var newOptions = options.havingStyle(style.sup());
|
|
7896
|
-
var upperGroup =
|
|
7806
|
+
var upperGroup = wrapFragment(buildGroup$1(group.body, newOptions, options), options);
|
|
7897
7807
|
var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
|
|
7898
7808
|
upperGroup.classes.push(arrowPrefix + "-arrow-pad");
|
|
7899
7809
|
var lowerGroup;
|
|
@@ -7901,11 +7811,11 @@ defineFunction({
|
|
|
7901
7811
|
if (group.below) {
|
|
7902
7812
|
// Build the lower group
|
|
7903
7813
|
newOptions = options.havingStyle(style.sub());
|
|
7904
|
-
lowerGroup =
|
|
7814
|
+
lowerGroup = wrapFragment(buildGroup$1(group.below, newOptions, options), options);
|
|
7905
7815
|
lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
|
|
7906
7816
|
}
|
|
7907
7817
|
|
|
7908
|
-
var arrowBody =
|
|
7818
|
+
var arrowBody = stretchySvg(group, options); // Re shift: Note that stretchySvg returned arrowBody.depth = 0.
|
|
7909
7819
|
// The point we want on the math axis is at 0.5 * arrowBody.height.
|
|
7910
7820
|
|
|
7911
7821
|
var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
|
|
@@ -7921,7 +7831,7 @@ defineFunction({
|
|
|
7921
7831
|
|
|
7922
7832
|
if (lowerGroup) {
|
|
7923
7833
|
var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
|
|
7924
|
-
vlist =
|
|
7834
|
+
vlist = makeVList({
|
|
7925
7835
|
positionType: "individualShift",
|
|
7926
7836
|
children: [{
|
|
7927
7837
|
type: "elem",
|
|
@@ -7936,9 +7846,9 @@ defineFunction({
|
|
|
7936
7846
|
elem: lowerGroup,
|
|
7937
7847
|
shift: lowerShift
|
|
7938
7848
|
}]
|
|
7939
|
-
}
|
|
7849
|
+
});
|
|
7940
7850
|
} else {
|
|
7941
|
-
vlist =
|
|
7851
|
+
vlist = makeVList({
|
|
7942
7852
|
positionType: "individualShift",
|
|
7943
7853
|
children: [{
|
|
7944
7854
|
type: "elem",
|
|
@@ -7949,16 +7859,16 @@ defineFunction({
|
|
|
7949
7859
|
elem: arrowBody,
|
|
7950
7860
|
shift: arrowShift
|
|
7951
7861
|
}]
|
|
7952
|
-
}
|
|
7862
|
+
});
|
|
7953
7863
|
} // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
|
|
7954
7864
|
|
|
7955
7865
|
|
|
7956
7866
|
vlist.children[0].children[0].children[1].classes.push("svg-align");
|
|
7957
|
-
return
|
|
7867
|
+
return makeSpan(["mrel", "x-arrow"], [vlist], options);
|
|
7958
7868
|
},
|
|
7959
7869
|
|
|
7960
7870
|
mathmlBuilder(group, options) {
|
|
7961
|
-
var arrowNode =
|
|
7871
|
+
var arrowNode = stretchyMathML(group.label);
|
|
7962
7872
|
arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em");
|
|
7963
7873
|
var node;
|
|
7964
7874
|
|
|
@@ -7967,19 +7877,19 @@ defineFunction({
|
|
|
7967
7877
|
|
|
7968
7878
|
if (group.below) {
|
|
7969
7879
|
var lowerNode = paddedNode(buildGroup(group.below, options));
|
|
7970
|
-
node = new
|
|
7880
|
+
node = new MathNode("munderover", [arrowNode, lowerNode, upperNode]);
|
|
7971
7881
|
} else {
|
|
7972
|
-
node = new
|
|
7882
|
+
node = new MathNode("mover", [arrowNode, upperNode]);
|
|
7973
7883
|
}
|
|
7974
7884
|
} else if (group.below) {
|
|
7975
7885
|
var _lowerNode = paddedNode(buildGroup(group.below, options));
|
|
7976
7886
|
|
|
7977
|
-
node = new
|
|
7887
|
+
node = new MathNode("munder", [arrowNode, _lowerNode]);
|
|
7978
7888
|
} else {
|
|
7979
7889
|
// This should never happen.
|
|
7980
7890
|
// Parser.js throws an error if there is no argument.
|
|
7981
7891
|
node = paddedNode();
|
|
7982
|
-
node = new
|
|
7892
|
+
node = new MathNode("mover", [arrowNode, node]);
|
|
7983
7893
|
}
|
|
7984
7894
|
|
|
7985
7895
|
return node;
|
|
@@ -7987,8 +7897,6 @@ defineFunction({
|
|
|
7987
7897
|
|
|
7988
7898
|
});
|
|
7989
7899
|
|
|
7990
|
-
var makeSpan = buildCommon.makeSpan;
|
|
7991
|
-
|
|
7992
7900
|
function htmlBuilder$9(group, options) {
|
|
7993
7901
|
var elements = buildExpression$1(group.body, options, true);
|
|
7994
7902
|
return makeSpan([group.mclass], elements, options);
|
|
@@ -7999,20 +7907,20 @@ function mathmlBuilder$8(group, options) {
|
|
|
7999
7907
|
var inner = buildExpression(group.body, options);
|
|
8000
7908
|
|
|
8001
7909
|
if (group.mclass === "minner") {
|
|
8002
|
-
node = new
|
|
7910
|
+
node = new MathNode("mpadded", inner);
|
|
8003
7911
|
} else if (group.mclass === "mord") {
|
|
8004
7912
|
if (group.isCharacterBox) {
|
|
8005
7913
|
node = inner[0];
|
|
8006
7914
|
node.type = "mi";
|
|
8007
7915
|
} else {
|
|
8008
|
-
node = new
|
|
7916
|
+
node = new MathNode("mi", inner);
|
|
8009
7917
|
}
|
|
8010
7918
|
} else {
|
|
8011
7919
|
if (group.isCharacterBox) {
|
|
8012
7920
|
node = inner[0];
|
|
8013
7921
|
node.type = "mo";
|
|
8014
7922
|
} else {
|
|
8015
|
-
node = new
|
|
7923
|
+
node = new MathNode("mo", inner);
|
|
8016
7924
|
} // Set spacing based on what is the most likely adjacent atom type.
|
|
8017
7925
|
// See TeXbook p170.
|
|
8018
7926
|
|
|
@@ -8060,7 +7968,7 @@ defineFunction({
|
|
|
8060
7968
|
mclass: "m" + funcName.slice(5),
|
|
8061
7969
|
// TODO(kevinb): don't prefix with 'm'
|
|
8062
7970
|
body: ordargument(body),
|
|
8063
|
-
isCharacterBox:
|
|
7971
|
+
isCharacterBox: isCharacterBox(body)
|
|
8064
7972
|
};
|
|
8065
7973
|
},
|
|
8066
7974
|
|
|
@@ -8098,7 +8006,7 @@ defineFunction({
|
|
|
8098
8006
|
mode: parser.mode,
|
|
8099
8007
|
mclass: binrelClass(args[0]),
|
|
8100
8008
|
body: ordargument(args[1]),
|
|
8101
|
-
isCharacterBox:
|
|
8009
|
+
isCharacterBox: isCharacterBox(args[1])
|
|
8102
8010
|
};
|
|
8103
8011
|
}
|
|
8104
8012
|
|
|
@@ -8149,7 +8057,7 @@ defineFunction({
|
|
|
8149
8057
|
mode: parser.mode,
|
|
8150
8058
|
mclass,
|
|
8151
8059
|
body: [supsub],
|
|
8152
|
-
isCharacterBox:
|
|
8060
|
+
isCharacterBox: isCharacterBox(supsub)
|
|
8153
8061
|
};
|
|
8154
8062
|
},
|
|
8155
8063
|
|
|
@@ -8183,7 +8091,7 @@ defineFunction({
|
|
|
8183
8091
|
|
|
8184
8092
|
htmlBuilder(group, options) {
|
|
8185
8093
|
var elements = buildExpression$1(group.body, options, true);
|
|
8186
|
-
var node =
|
|
8094
|
+
var node = makeSpan([group.mclass], elements, options);
|
|
8187
8095
|
node.style.textShadow = "0.02em 0.01em 0.04px";
|
|
8188
8096
|
return node;
|
|
8189
8097
|
},
|
|
@@ -8191,7 +8099,7 @@ defineFunction({
|
|
|
8191
8099
|
mathmlBuilder(group, style) {
|
|
8192
8100
|
var inner = buildExpression(group.body, style); // Wrap with an <mstyle> element.
|
|
8193
8101
|
|
|
8194
|
-
var node = new
|
|
8102
|
+
var node = new MathNode("mstyle", inner);
|
|
8195
8103
|
node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px");
|
|
8196
8104
|
return node;
|
|
8197
8105
|
}
|
|
@@ -8344,7 +8252,7 @@ function parseCD(parser) {
|
|
|
8344
8252
|
body: []
|
|
8345
8253
|
}; // Process the arrow.
|
|
8346
8254
|
|
|
8347
|
-
if ("=|.".
|
|
8255
|
+
if ("=|.".includes(arrowChar)) ; else if ("<>AV".includes(arrowChar)) {
|
|
8348
8256
|
// Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take
|
|
8349
8257
|
// two optional labels. E.g. the right-point arrow syntax is
|
|
8350
8258
|
// really: @>{optional label}>{optional label}>
|
|
@@ -8460,7 +8368,7 @@ defineFunction({
|
|
|
8460
8368
|
|
|
8461
8369
|
htmlBuilder(group, options) {
|
|
8462
8370
|
var newOptions = options.havingStyle(options.style.sup());
|
|
8463
|
-
var label =
|
|
8371
|
+
var label = wrapFragment(buildGroup$1(group.label, newOptions, options), options);
|
|
8464
8372
|
label.classes.push("cd-label-" + group.side);
|
|
8465
8373
|
label.style.bottom = makeEm(0.8 - label.depth); // Zero out label height & depth, so vertical align of arrow is set
|
|
8466
8374
|
// by the arrow height, not by the label.
|
|
@@ -8471,8 +8379,8 @@ defineFunction({
|
|
|
8471
8379
|
},
|
|
8472
8380
|
|
|
8473
8381
|
mathmlBuilder(group, options) {
|
|
8474
|
-
var label = new
|
|
8475
|
-
label = new
|
|
8382
|
+
var label = new MathNode("mrow", [buildGroup(group.label, options)]);
|
|
8383
|
+
label = new MathNode("mpadded", [label]);
|
|
8476
8384
|
label.setAttribute("width", "0");
|
|
8477
8385
|
|
|
8478
8386
|
if (group.side === "left") {
|
|
@@ -8482,7 +8390,7 @@ defineFunction({
|
|
|
8482
8390
|
|
|
8483
8391
|
|
|
8484
8392
|
label.setAttribute("voffset", "0.7em");
|
|
8485
|
-
label = new
|
|
8393
|
+
label = new MathNode("mstyle", [label]);
|
|
8486
8394
|
label.setAttribute("displaystyle", "false");
|
|
8487
8395
|
label.setAttribute("scriptlevel", "1");
|
|
8488
8396
|
return label;
|
|
@@ -8511,13 +8419,13 @@ defineFunction({
|
|
|
8511
8419
|
// Wrap the vertical arrow and its labels.
|
|
8512
8420
|
// The parent gets position: relative. The child gets position: absolute.
|
|
8513
8421
|
// So CSS can locate the label correctly.
|
|
8514
|
-
var parent =
|
|
8422
|
+
var parent = wrapFragment(buildGroup$1(group.fragment, options), options);
|
|
8515
8423
|
parent.classes.push("cd-vert-arrow");
|
|
8516
8424
|
return parent;
|
|
8517
8425
|
},
|
|
8518
8426
|
|
|
8519
8427
|
mathmlBuilder(group, options) {
|
|
8520
|
-
return new
|
|
8428
|
+
return new MathNode("mrow", [buildGroup(group.fragment, options)]);
|
|
8521
8429
|
}
|
|
8522
8430
|
|
|
8523
8431
|
});
|
|
@@ -8577,12 +8485,12 @@ var htmlBuilder$8 = (group, options) => {
|
|
|
8577
8485
|
// elements will be able to directly interact with their neighbors. For
|
|
8578
8486
|
// example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
|
|
8579
8487
|
|
|
8580
|
-
return
|
|
8488
|
+
return makeFragment(elements);
|
|
8581
8489
|
};
|
|
8582
8490
|
|
|
8583
8491
|
var mathmlBuilder$7 = (group, options) => {
|
|
8584
8492
|
var inner = buildExpression(group.body, options.withColor(group.color));
|
|
8585
|
-
var node = new
|
|
8493
|
+
var node = new MathNode("mstyle", inner);
|
|
8586
8494
|
node.setAttribute("mathcolor", group.color);
|
|
8587
8495
|
return node;
|
|
8588
8496
|
};
|
|
@@ -8675,7 +8583,7 @@ defineFunction({
|
|
|
8675
8583
|
// The following builders are called only at the top level,
|
|
8676
8584
|
// not within tabular/array environments.
|
|
8677
8585
|
htmlBuilder(group, options) {
|
|
8678
|
-
var span =
|
|
8586
|
+
var span = makeSpan(["mspace"], [], options);
|
|
8679
8587
|
|
|
8680
8588
|
if (group.newLine) {
|
|
8681
8589
|
span.classes.push("newline");
|
|
@@ -8689,7 +8597,7 @@ defineFunction({
|
|
|
8689
8597
|
},
|
|
8690
8598
|
|
|
8691
8599
|
mathmlBuilder(group, options) {
|
|
8692
|
-
var node = new
|
|
8600
|
+
var node = new MathNode("mspace");
|
|
8693
8601
|
|
|
8694
8602
|
if (group.newLine) {
|
|
8695
8603
|
node.setAttribute("linebreak", "newline");
|
|
@@ -8989,7 +8897,7 @@ var getMetrics = function getMetrics(symbol, font, mode) {
|
|
|
8989
8897
|
|
|
8990
8898
|
var styleWrap = function styleWrap(delim, toStyle, options, classes) {
|
|
8991
8899
|
var newOptions = options.havingBaseStyle(toStyle);
|
|
8992
|
-
var span =
|
|
8900
|
+
var span = makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
|
|
8993
8901
|
var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
|
|
8994
8902
|
span.height *= delimSizeMultiplier;
|
|
8995
8903
|
span.depth *= delimSizeMultiplier;
|
|
@@ -9013,7 +8921,7 @@ var centerSpan = function centerSpan(span, options, style) {
|
|
|
9013
8921
|
|
|
9014
8922
|
|
|
9015
8923
|
var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {
|
|
9016
|
-
var text =
|
|
8924
|
+
var text = makeSymbol(delim, "Main-Regular", mode, options);
|
|
9017
8925
|
var span = styleWrap(text, style, options, classes);
|
|
9018
8926
|
|
|
9019
8927
|
if (center) {
|
|
@@ -9028,7 +8936,7 @@ var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode
|
|
|
9028
8936
|
|
|
9029
8937
|
|
|
9030
8938
|
var mathrmSize = function mathrmSize(value, size, mode, options) {
|
|
9031
|
-
return
|
|
8939
|
+
return makeSymbol(value, "Size" + size + "-Regular", mode, options);
|
|
9032
8940
|
};
|
|
9033
8941
|
/**
|
|
9034
8942
|
* Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
|
|
@@ -9038,7 +8946,7 @@ var mathrmSize = function mathrmSize(value, size, mode, options) {
|
|
|
9038
8946
|
|
|
9039
8947
|
var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {
|
|
9040
8948
|
var inner = mathrmSize(delim, size, mode, options);
|
|
9041
|
-
var span = styleWrap(
|
|
8949
|
+
var span = styleWrap(makeSpan(["delimsizing", "size" + size], [inner], options), Style$1.TEXT, options, classes);
|
|
9042
8950
|
|
|
9043
8951
|
if (center) {
|
|
9044
8952
|
centerSpan(span, options, Style$1.TEXT);
|
|
@@ -9063,7 +8971,7 @@ var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) {
|
|
|
9063
8971
|
sizeClass = "delim-size4";
|
|
9064
8972
|
}
|
|
9065
8973
|
|
|
9066
|
-
var corner =
|
|
8974
|
+
var corner = makeSpan(["delimsizinginner", sizeClass], [makeSpan([], [makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element
|
|
9067
8975
|
// in the appropriate tag that VList uses.
|
|
9068
8976
|
|
|
9069
8977
|
return {
|
|
@@ -9084,7 +8992,7 @@ var makeInner = function makeInner(ch, height, options) {
|
|
|
9084
8992
|
"viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),
|
|
9085
8993
|
"preserveAspectRatio": "xMinYMin"
|
|
9086
8994
|
});
|
|
9087
|
-
var span =
|
|
8995
|
+
var span = makeSvgSpan([], [svgNode], options);
|
|
9088
8996
|
span.height = height;
|
|
9089
8997
|
span.style.height = makeEm(height);
|
|
9090
8998
|
span.style.width = makeEm(width);
|
|
@@ -9100,8 +9008,8 @@ var lap = {
|
|
|
9100
9008
|
type: "kern",
|
|
9101
9009
|
size: -1 * lapInEms
|
|
9102
9010
|
};
|
|
9103
|
-
var verts = ["|", "\\lvert", "\\rvert", "\\vert"];
|
|
9104
|
-
var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"];
|
|
9011
|
+
var verts = new Set(["|", "\\lvert", "\\rvert", "\\vert"]);
|
|
9012
|
+
var doubleVerts = new Set(["\\|", "\\lVert", "\\rVert", "\\Vert"]);
|
|
9105
9013
|
/**
|
|
9106
9014
|
* Make a stacked delimiter out of a given delimiter, with the total height at
|
|
9107
9015
|
* least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
|
|
@@ -9139,11 +9047,11 @@ var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, opt
|
|
|
9139
9047
|
top = "\\Uparrow";
|
|
9140
9048
|
repeat = "\u2016";
|
|
9141
9049
|
bottom = "\\Downarrow";
|
|
9142
|
-
} else if (verts.
|
|
9050
|
+
} else if (verts.has(delim)) {
|
|
9143
9051
|
repeat = "\u2223";
|
|
9144
9052
|
svgLabel = "vert";
|
|
9145
9053
|
viewBoxWidth = 333;
|
|
9146
|
-
} else if (doubleVerts.
|
|
9054
|
+
} else if (doubleVerts.has(delim)) {
|
|
9147
9055
|
repeat = "\u2225";
|
|
9148
9056
|
svgLabel = "doublevert";
|
|
9149
9057
|
viewBoxWidth = 556;
|
|
@@ -9286,7 +9194,7 @@ var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, opt
|
|
|
9286
9194
|
"height": height,
|
|
9287
9195
|
"viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight
|
|
9288
9196
|
});
|
|
9289
|
-
var wrapper =
|
|
9197
|
+
var wrapper = makeSvgSpan([], [svg], options);
|
|
9290
9198
|
wrapper.height = viewBoxHeight / 1000;
|
|
9291
9199
|
wrapper.style.width = width;
|
|
9292
9200
|
wrapper.style.height = height;
|
|
@@ -9325,12 +9233,12 @@ var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, opt
|
|
|
9325
9233
|
|
|
9326
9234
|
|
|
9327
9235
|
var newOptions = options.havingBaseStyle(Style$1.TEXT);
|
|
9328
|
-
var inner =
|
|
9236
|
+
var inner = makeVList({
|
|
9329
9237
|
positionType: "bottom",
|
|
9330
9238
|
positionData: depth,
|
|
9331
9239
|
children: stack
|
|
9332
|
-
}
|
|
9333
|
-
return styleWrap(
|
|
9240
|
+
});
|
|
9241
|
+
return styleWrap(makeSpan(["delimsizing", "mult"], [inner], newOptions), Style$1.TEXT, options, classes);
|
|
9334
9242
|
}; // All surds have 0.08em padding above the vinculum inside the SVG.
|
|
9335
9243
|
// That keeps browser span height rounding error from pinching the line.
|
|
9336
9244
|
|
|
@@ -9349,7 +9257,7 @@ var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraVinculum, o
|
|
|
9349
9257
|
"viewBox": "0 0 400000 " + viewBoxHeight,
|
|
9350
9258
|
"preserveAspectRatio": "xMinYMin slice"
|
|
9351
9259
|
});
|
|
9352
|
-
return
|
|
9260
|
+
return makeSvgSpan(["hide-tail"], [svg], options);
|
|
9353
9261
|
};
|
|
9354
9262
|
/**
|
|
9355
9263
|
* Make a sqrt image of the given height,
|
|
@@ -9427,12 +9335,11 @@ var makeSqrtImage = function makeSqrtImage(height, options) {
|
|
|
9427
9335
|
}; // There are three kinds of delimiters, delimiters that stack when they become
|
|
9428
9336
|
// too large
|
|
9429
9337
|
|
|
9338
|
+
var stackLargeDelimiters = new Set(["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]); // delimiters that always stack
|
|
9430
9339
|
|
|
9431
|
-
var
|
|
9340
|
+
var stackAlwaysDelimiters = new Set(["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1"]); // and delimiters that never stack
|
|
9432
9341
|
|
|
9433
|
-
var
|
|
9434
|
-
|
|
9435
|
-
var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of
|
|
9342
|
+
var stackNeverDelimiters = new Set(["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]); // Metrics of the different sizes. Found by looking at TeX's output of
|
|
9436
9343
|
// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
|
|
9437
9344
|
// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
|
|
9438
9345
|
|
|
@@ -9450,9 +9357,9 @@ var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes
|
|
|
9450
9357
|
} // Sized delimiters are never centered.
|
|
9451
9358
|
|
|
9452
9359
|
|
|
9453
|
-
if (stackLargeDelimiters.
|
|
9360
|
+
if (stackLargeDelimiters.has(delim) || stackNeverDelimiters.has(delim)) {
|
|
9454
9361
|
return makeLargeDelim(delim, size, false, options, mode, classes);
|
|
9455
|
-
} else if (stackAlwaysDelimiters.
|
|
9362
|
+
} else if (stackAlwaysDelimiters.has(delim)) {
|
|
9456
9363
|
return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
|
|
9457
9364
|
} else {
|
|
9458
9365
|
throw new ParseError("Illegal delimiter: '" + delim + "'");
|
|
@@ -9470,7 +9377,6 @@ var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes
|
|
|
9470
9377
|
* them explicitly here.
|
|
9471
9378
|
*/
|
|
9472
9379
|
|
|
9473
|
-
|
|
9474
9380
|
// Delimiters that never stack try small delimiters and large delimiters only
|
|
9475
9381
|
var stackNeverDelimiterSequence = [{
|
|
9476
9382
|
type: "small",
|
|
@@ -9602,9 +9508,9 @@ var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center,
|
|
|
9602
9508
|
|
|
9603
9509
|
var sequence;
|
|
9604
9510
|
|
|
9605
|
-
if (stackNeverDelimiters.
|
|
9511
|
+
if (stackNeverDelimiters.has(delim)) {
|
|
9606
9512
|
sequence = stackNeverDelimiterSequence;
|
|
9607
|
-
} else if (stackLargeDelimiters.
|
|
9513
|
+
} else if (stackLargeDelimiters.has(delim)) {
|
|
9608
9514
|
sequence = stackLargeDelimiterSequence;
|
|
9609
9515
|
} else {
|
|
9610
9516
|
sequence = stackAlwaysDelimiterSequence;
|
|
@@ -9630,7 +9536,6 @@ var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center,
|
|
|
9630
9536
|
* of an expression that the delimiters surround.
|
|
9631
9537
|
*/
|
|
9632
9538
|
|
|
9633
|
-
|
|
9634
9539
|
var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {
|
|
9635
9540
|
// We always center \left/\right delimiters, so the axis is always shifted
|
|
9636
9541
|
var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right
|
|
@@ -9653,14 +9558,6 @@ var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, optio
|
|
|
9653
9558
|
return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
|
|
9654
9559
|
};
|
|
9655
9560
|
|
|
9656
|
-
var delimiter = {
|
|
9657
|
-
sqrtImage: makeSqrtImage,
|
|
9658
|
-
sizedDelim: makeSizedDelim,
|
|
9659
|
-
sizeToMaxHeight: sizeToMaxHeight,
|
|
9660
|
-
customSizedDelim: makeCustomSizedDelim,
|
|
9661
|
-
leftRightDelim: makeLeftRightDelim
|
|
9662
|
-
};
|
|
9663
|
-
|
|
9664
9561
|
// Extra data needed for the delimiter handler down below
|
|
9665
9562
|
var delimiterSizes = {
|
|
9666
9563
|
"\\bigl": {
|
|
@@ -9728,13 +9625,13 @@ var delimiterSizes = {
|
|
|
9728
9625
|
size: 4
|
|
9729
9626
|
}
|
|
9730
9627
|
};
|
|
9731
|
-
var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."];
|
|
9628
|
+
var delimiters = new Set(["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]);
|
|
9732
9629
|
|
|
9733
9630
|
// Delimiter functions
|
|
9734
9631
|
function checkDelimiter(delim, context) {
|
|
9735
9632
|
var symDelim = checkSymbolNodeType(delim);
|
|
9736
9633
|
|
|
9737
|
-
if (symDelim && delimiters.
|
|
9634
|
+
if (symDelim && delimiters.has(symDelim.text)) {
|
|
9738
9635
|
return symDelim;
|
|
9739
9636
|
} else if (symDelim) {
|
|
9740
9637
|
throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
|
|
@@ -9764,11 +9661,10 @@ defineFunction({
|
|
|
9764
9661
|
if (group.delim === ".") {
|
|
9765
9662
|
// Empty delimiters still count as elements, even though they don't
|
|
9766
9663
|
// show anything.
|
|
9767
|
-
return
|
|
9768
|
-
}
|
|
9769
|
-
|
|
9664
|
+
return makeSpan([group.mclass]);
|
|
9665
|
+
}
|
|
9770
9666
|
|
|
9771
|
-
return
|
|
9667
|
+
return makeSizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
|
|
9772
9668
|
},
|
|
9773
9669
|
mathmlBuilder: group => {
|
|
9774
9670
|
var children = [];
|
|
@@ -9777,7 +9673,7 @@ defineFunction({
|
|
|
9777
9673
|
children.push(makeText(group.delim, group.mode));
|
|
9778
9674
|
}
|
|
9779
9675
|
|
|
9780
|
-
var node = new
|
|
9676
|
+
var node = new MathNode("mo", children);
|
|
9781
9677
|
|
|
9782
9678
|
if (group.mclass === "mopen" || group.mclass === "mclose") {
|
|
9783
9679
|
// Only some of the delimsizing functions act as fences, and they
|
|
@@ -9790,7 +9686,7 @@ defineFunction({
|
|
|
9790
9686
|
}
|
|
9791
9687
|
|
|
9792
9688
|
node.setAttribute("stretchy", "true");
|
|
9793
|
-
var size = makeEm(
|
|
9689
|
+
var size = makeEm(sizeToMaxHeight[group.size]);
|
|
9794
9690
|
node.setAttribute("minsize", size);
|
|
9795
9691
|
node.setAttribute("maxsize", size);
|
|
9796
9692
|
return node;
|
|
@@ -9889,7 +9785,7 @@ defineFunction({
|
|
|
9889
9785
|
} else {
|
|
9890
9786
|
// Otherwise, use leftRightDelim to generate the correct sized
|
|
9891
9787
|
// delimiter.
|
|
9892
|
-
leftDelim =
|
|
9788
|
+
leftDelim = makeLeftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
|
|
9893
9789
|
} // Add it to the beginning of the expression
|
|
9894
9790
|
|
|
9895
9791
|
|
|
@@ -9905,7 +9801,7 @@ defineFunction({
|
|
|
9905
9801
|
|
|
9906
9802
|
if (isMiddle) {
|
|
9907
9803
|
// Apply the options that were active when \middle was called
|
|
9908
|
-
inner[_i] =
|
|
9804
|
+
inner[_i] = makeLeftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
|
|
9909
9805
|
}
|
|
9910
9806
|
}
|
|
9911
9807
|
}
|
|
@@ -9916,25 +9812,25 @@ defineFunction({
|
|
|
9916
9812
|
rightDelim = makeNullDelimiter(options, ["mclose"]);
|
|
9917
9813
|
} else {
|
|
9918
9814
|
var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
|
|
9919
|
-
rightDelim =
|
|
9815
|
+
rightDelim = makeLeftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
|
|
9920
9816
|
} // Add it to the end of the expression.
|
|
9921
9817
|
|
|
9922
9818
|
|
|
9923
9819
|
inner.push(rightDelim);
|
|
9924
|
-
return
|
|
9820
|
+
return makeSpan(["minner"], inner, options);
|
|
9925
9821
|
},
|
|
9926
9822
|
mathmlBuilder: (group, options) => {
|
|
9927
9823
|
assertParsed(group);
|
|
9928
9824
|
var inner = buildExpression(group.body, options);
|
|
9929
9825
|
|
|
9930
9826
|
if (group.left !== ".") {
|
|
9931
|
-
var leftNode = new
|
|
9827
|
+
var leftNode = new MathNode("mo", [makeText(group.left, group.mode)]);
|
|
9932
9828
|
leftNode.setAttribute("fence", "true");
|
|
9933
9829
|
inner.unshift(leftNode);
|
|
9934
9830
|
}
|
|
9935
9831
|
|
|
9936
9832
|
if (group.right !== ".") {
|
|
9937
|
-
var rightNode = new
|
|
9833
|
+
var rightNode = new MathNode("mo", [makeText(group.right, group.mode)]);
|
|
9938
9834
|
rightNode.setAttribute("fence", "true");
|
|
9939
9835
|
|
|
9940
9836
|
if (group.rightColor) {
|
|
@@ -9973,7 +9869,7 @@ defineFunction({
|
|
|
9973
9869
|
if (group.delim === ".") {
|
|
9974
9870
|
middleDelim = makeNullDelimiter(options, []);
|
|
9975
9871
|
} else {
|
|
9976
|
-
middleDelim =
|
|
9872
|
+
middleDelim = makeSizedDelim(group.delim, 1, options, group.mode, []);
|
|
9977
9873
|
var isMiddle = {
|
|
9978
9874
|
delim: group.delim,
|
|
9979
9875
|
options
|
|
@@ -9994,7 +9890,7 @@ defineFunction({
|
|
|
9994
9890
|
// https://www.w3.org/TR/MathML3/appendixc.html.
|
|
9995
9891
|
// So we need to avoid U+2223 and use plain "|" instead.
|
|
9996
9892
|
var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
|
|
9997
|
-
var middleNode = new
|
|
9893
|
+
var middleNode = new MathNode("mo", [textNode]);
|
|
9998
9894
|
middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
|
|
9999
9895
|
// \middle should get delimiter spacing instead.
|
|
10000
9896
|
|
|
@@ -10008,7 +9904,7 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10008
9904
|
// \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase
|
|
10009
9905
|
// Some groups can return document fragments. Handle those by wrapping
|
|
10010
9906
|
// them in a span.
|
|
10011
|
-
var inner =
|
|
9907
|
+
var inner = wrapFragment(buildGroup$1(group.body, options), options);
|
|
10012
9908
|
var label = group.label.slice(1);
|
|
10013
9909
|
var scale = options.sizeMultiplier;
|
|
10014
9910
|
var img;
|
|
@@ -10018,10 +9914,10 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10018
9914
|
// the subject is a single character. This captures most of the
|
|
10019
9915
|
// subjects that should get the "tall" treatment.
|
|
10020
9916
|
|
|
10021
|
-
var isSingleChar =
|
|
9917
|
+
var isSingleChar = isCharacterBox(group.body);
|
|
10022
9918
|
|
|
10023
9919
|
if (label === "sout") {
|
|
10024
|
-
img =
|
|
9920
|
+
img = makeSpan(["stretchy", "sout"]);
|
|
10025
9921
|
img.height = options.fontMetrics().defaultRuleThickness / scale;
|
|
10026
9922
|
imgShift = -0.5 * options.fontMetrics().xHeight;
|
|
10027
9923
|
} else if (label === "phase") {
|
|
@@ -10050,7 +9946,7 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10050
9946
|
"preserveAspectRatio": "xMinYMin slice"
|
|
10051
9947
|
}); // Wrap it in a span with overflow: hidden.
|
|
10052
9948
|
|
|
10053
|
-
img =
|
|
9949
|
+
img = makeSvgSpan(["hide-tail"], [svgNode], options);
|
|
10054
9950
|
img.style.height = makeEm(angleHeight);
|
|
10055
9951
|
imgShift = inner.depth + lineWeight + clearance;
|
|
10056
9952
|
} else {
|
|
@@ -10086,7 +9982,7 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10086
9982
|
bottomPad = topPad;
|
|
10087
9983
|
}
|
|
10088
9984
|
|
|
10089
|
-
img =
|
|
9985
|
+
img = stretchyEnclose(inner, label, topPad, bottomPad, options);
|
|
10090
9986
|
|
|
10091
9987
|
if (/fbox|boxed|fcolorbox/.test(label)) {
|
|
10092
9988
|
img.style.borderStyle = "solid";
|
|
@@ -10110,7 +10006,7 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10110
10006
|
var vlist;
|
|
10111
10007
|
|
|
10112
10008
|
if (group.backgroundColor) {
|
|
10113
|
-
vlist =
|
|
10009
|
+
vlist = makeVList({
|
|
10114
10010
|
positionType: "individualShift",
|
|
10115
10011
|
children: [// Put the color background behind inner;
|
|
10116
10012
|
{
|
|
@@ -10122,10 +10018,10 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10122
10018
|
elem: inner,
|
|
10123
10019
|
shift: 0
|
|
10124
10020
|
}]
|
|
10125
|
-
}
|
|
10021
|
+
});
|
|
10126
10022
|
} else {
|
|
10127
10023
|
var classes = /cancel|phase/.test(label) ? ["svg-align"] : [];
|
|
10128
|
-
vlist =
|
|
10024
|
+
vlist = makeVList({
|
|
10129
10025
|
positionType: "individualShift",
|
|
10130
10026
|
children: [// Write the \cancel stroke on top of inner.
|
|
10131
10027
|
{
|
|
@@ -10138,7 +10034,7 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10138
10034
|
shift: imgShift,
|
|
10139
10035
|
wrapperClasses: classes
|
|
10140
10036
|
}]
|
|
10141
|
-
}
|
|
10037
|
+
});
|
|
10142
10038
|
}
|
|
10143
10039
|
|
|
10144
10040
|
if (/cancel/.test(label)) {
|
|
@@ -10150,15 +10046,15 @@ var htmlBuilder$7 = (group, options) => {
|
|
|
10150
10046
|
|
|
10151
10047
|
if (/cancel/.test(label) && !isSingleChar) {
|
|
10152
10048
|
// cancel does not create horiz space for its line extension.
|
|
10153
|
-
return
|
|
10049
|
+
return makeSpan(["mord", "cancel-lap"], [vlist], options);
|
|
10154
10050
|
} else {
|
|
10155
|
-
return
|
|
10051
|
+
return makeSpan(["mord"], [vlist], options);
|
|
10156
10052
|
}
|
|
10157
10053
|
};
|
|
10158
10054
|
|
|
10159
10055
|
var mathmlBuilder$6 = (group, options) => {
|
|
10160
10056
|
var fboxsep = 0;
|
|
10161
|
-
var node = new
|
|
10057
|
+
var node = new MathNode(group.label.includes("colorbox") ? "mpadded" : "menclose", [buildGroup(group.body, options)]);
|
|
10162
10058
|
|
|
10163
10059
|
switch (group.label) {
|
|
10164
10060
|
case "\\cancel":
|
|
@@ -10426,16 +10322,17 @@ var validateAmsEnvironmentContext = context => {
|
|
|
10426
10322
|
if (!settings.displayMode) {
|
|
10427
10323
|
throw new ParseError("{" + context.envName + "} can be used only in" + " display mode.");
|
|
10428
10324
|
}
|
|
10429
|
-
};
|
|
10325
|
+
};
|
|
10326
|
+
|
|
10327
|
+
var gatherEnvironments = new Set(["gather", "gather*"]); // autoTag (an argument to parseArray) can be one of three values:
|
|
10430
10328
|
// * undefined: Regular (not-top-level) array; no tags on each row
|
|
10431
10329
|
// * true: Automatic equation numbering, overridable by \tag
|
|
10432
10330
|
// * false: Tags allowed on each row, but no automatic numbering
|
|
10433
10331
|
// This function *doesn't* work with the "split" environment name.
|
|
10434
10332
|
|
|
10435
|
-
|
|
10436
10333
|
function getAutoTag(name) {
|
|
10437
|
-
if (name.
|
|
10438
|
-
return name.
|
|
10334
|
+
if (!name.includes("ed")) {
|
|
10335
|
+
return !name.includes("*");
|
|
10439
10336
|
} // return undefined;
|
|
10440
10337
|
|
|
10441
10338
|
}
|
|
@@ -10756,13 +10653,13 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
|
|
|
10756
10653
|
|
|
10757
10654
|
if (tag === true) {
|
|
10758
10655
|
// automatic numbering
|
|
10759
|
-
tagSpan =
|
|
10656
|
+
tagSpan = makeSpan(["eqn-num"], [], options);
|
|
10760
10657
|
} else if (tag === false) {
|
|
10761
10658
|
// \nonumber/\notag or starred environment
|
|
10762
|
-
tagSpan =
|
|
10659
|
+
tagSpan = makeSpan([], [], options);
|
|
10763
10660
|
} else {
|
|
10764
10661
|
// manual \tag
|
|
10765
|
-
tagSpan =
|
|
10662
|
+
tagSpan = makeSpan([], buildExpression$1(tag, options, true), options);
|
|
10766
10663
|
}
|
|
10767
10664
|
|
|
10768
10665
|
tagSpan.depth = rw.depth;
|
|
@@ -10785,14 +10682,14 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
|
|
|
10785
10682
|
// If there is more than one separator in a row, add a space
|
|
10786
10683
|
// between them.
|
|
10787
10684
|
if (!firstSeparator) {
|
|
10788
|
-
colSep =
|
|
10685
|
+
colSep = makeSpan(["arraycolsep"], []);
|
|
10789
10686
|
colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);
|
|
10790
10687
|
cols.push(colSep);
|
|
10791
10688
|
}
|
|
10792
10689
|
|
|
10793
10690
|
if (colDescr.separator === "|" || colDescr.separator === ":") {
|
|
10794
10691
|
var lineType = colDescr.separator === "|" ? "solid" : "dashed";
|
|
10795
|
-
var separator =
|
|
10692
|
+
var separator = makeSpan(["vertical-separator"], [], options);
|
|
10796
10693
|
separator.style.height = makeEm(totalHeight);
|
|
10797
10694
|
separator.style.borderRightWidth = makeEm(ruleThickness);
|
|
10798
10695
|
separator.style.borderRightStyle = lineType;
|
|
@@ -10821,10 +10718,12 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
|
|
|
10821
10718
|
var sepwidth = void 0;
|
|
10822
10719
|
|
|
10823
10720
|
if (c > 0 || group.hskipBeforeAndAfter) {
|
|
10824
|
-
|
|
10721
|
+
var _colDescr$pregap;
|
|
10722
|
+
|
|
10723
|
+
sepwidth = (_colDescr$pregap = colDescr.pregap) != null ? _colDescr$pregap : arraycolsep;
|
|
10825
10724
|
|
|
10826
10725
|
if (sepwidth !== 0) {
|
|
10827
|
-
colSep =
|
|
10726
|
+
colSep = makeSpan(["arraycolsep"], []);
|
|
10828
10727
|
colSep.style.width = makeEm(sepwidth);
|
|
10829
10728
|
cols.push(colSep);
|
|
10830
10729
|
}
|
|
@@ -10851,29 +10750,31 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
|
|
|
10851
10750
|
});
|
|
10852
10751
|
}
|
|
10853
10752
|
|
|
10854
|
-
col =
|
|
10753
|
+
col = makeVList({
|
|
10855
10754
|
positionType: "individualShift",
|
|
10856
10755
|
children: col
|
|
10857
|
-
}
|
|
10858
|
-
col =
|
|
10756
|
+
});
|
|
10757
|
+
col = makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
|
|
10859
10758
|
cols.push(col);
|
|
10860
10759
|
|
|
10861
10760
|
if (c < nc - 1 || group.hskipBeforeAndAfter) {
|
|
10862
|
-
|
|
10761
|
+
var _colDescr$postgap;
|
|
10762
|
+
|
|
10763
|
+
sepwidth = (_colDescr$postgap = colDescr.postgap) != null ? _colDescr$postgap : arraycolsep;
|
|
10863
10764
|
|
|
10864
10765
|
if (sepwidth !== 0) {
|
|
10865
|
-
colSep =
|
|
10766
|
+
colSep = makeSpan(["arraycolsep"], []);
|
|
10866
10767
|
colSep.style.width = makeEm(sepwidth);
|
|
10867
10768
|
cols.push(colSep);
|
|
10868
10769
|
}
|
|
10869
10770
|
}
|
|
10870
10771
|
}
|
|
10871
10772
|
|
|
10872
|
-
body =
|
|
10773
|
+
body = makeSpan(["mtable"], cols); // Add \hline(s), if any.
|
|
10873
10774
|
|
|
10874
10775
|
if (hlines.length > 0) {
|
|
10875
|
-
var line =
|
|
10876
|
-
var dashes =
|
|
10776
|
+
var line = makeLineSpan("hline", options, ruleThickness);
|
|
10777
|
+
var dashes = makeLineSpan("hdashline", options, ruleThickness);
|
|
10877
10778
|
var vListElems = [{
|
|
10878
10779
|
type: "elem",
|
|
10879
10780
|
elem: body,
|
|
@@ -10899,21 +10800,21 @@ var htmlBuilder$6 = function htmlBuilder(group, options) {
|
|
|
10899
10800
|
}
|
|
10900
10801
|
}
|
|
10901
10802
|
|
|
10902
|
-
body =
|
|
10803
|
+
body = makeVList({
|
|
10903
10804
|
positionType: "individualShift",
|
|
10904
10805
|
children: vListElems
|
|
10905
|
-
}
|
|
10806
|
+
});
|
|
10906
10807
|
}
|
|
10907
10808
|
|
|
10908
10809
|
if (tagSpans.length === 0) {
|
|
10909
|
-
return
|
|
10810
|
+
return makeSpan(["mord"], [body], options);
|
|
10910
10811
|
} else {
|
|
10911
|
-
var eqnNumCol =
|
|
10812
|
+
var eqnNumCol = makeVList({
|
|
10912
10813
|
positionType: "individualShift",
|
|
10913
10814
|
children: tagSpans
|
|
10914
|
-
}
|
|
10915
|
-
eqnNumCol =
|
|
10916
|
-
return
|
|
10815
|
+
});
|
|
10816
|
+
eqnNumCol = makeSpan(["tag"], [eqnNumCol], options);
|
|
10817
|
+
return makeFragment([body, eqnNumCol]);
|
|
10917
10818
|
}
|
|
10918
10819
|
};
|
|
10919
10820
|
|
|
@@ -10925,15 +10826,15 @@ var alignMap = {
|
|
|
10925
10826
|
|
|
10926
10827
|
var mathmlBuilder$5 = function mathmlBuilder(group, options) {
|
|
10927
10828
|
var tbl = [];
|
|
10928
|
-
var glue = new
|
|
10929
|
-
var tag = new
|
|
10829
|
+
var glue = new MathNode("mtd", [], ["mtr-glue"]);
|
|
10830
|
+
var tag = new MathNode("mtd", [], ["mml-eqn-num"]);
|
|
10930
10831
|
|
|
10931
10832
|
for (var i = 0; i < group.body.length; i++) {
|
|
10932
10833
|
var rw = group.body[i];
|
|
10933
10834
|
var row = [];
|
|
10934
10835
|
|
|
10935
10836
|
for (var j = 0; j < rw.length; j++) {
|
|
10936
|
-
row.push(new
|
|
10837
|
+
row.push(new MathNode("mtd", [buildGroup(rw[j], options)]));
|
|
10937
10838
|
}
|
|
10938
10839
|
|
|
10939
10840
|
if (group.tags && group.tags[i]) {
|
|
@@ -10947,10 +10848,10 @@ var mathmlBuilder$5 = function mathmlBuilder(group, options) {
|
|
|
10947
10848
|
}
|
|
10948
10849
|
}
|
|
10949
10850
|
|
|
10950
|
-
tbl.push(new
|
|
10851
|
+
tbl.push(new MathNode("mtr", row));
|
|
10951
10852
|
}
|
|
10952
10853
|
|
|
10953
|
-
var table = new
|
|
10854
|
+
var table = new MathNode("mtable", tbl); // Set column alignment, row spacing, column spacing, and
|
|
10954
10855
|
// array lines by setting attributes on the table element.
|
|
10955
10856
|
// Set the row spacing. In MathML, we specify a gap distance.
|
|
10956
10857
|
// We do not use rowGap[] because MathML automatically increases
|
|
@@ -11050,13 +10951,13 @@ var mathmlBuilder$5 = function mathmlBuilder(group, options) {
|
|
|
11050
10951
|
}
|
|
11051
10952
|
|
|
11052
10953
|
if (menclose !== "") {
|
|
11053
|
-
table = new
|
|
10954
|
+
table = new MathNode("menclose", [table]);
|
|
11054
10955
|
table.setAttribute("notation", menclose.trim());
|
|
11055
10956
|
}
|
|
11056
10957
|
|
|
11057
10958
|
if (group.arraystretch && group.arraystretch < 1) {
|
|
11058
10959
|
// A small array. Wrap in scriptstyle so row gap is not too large.
|
|
11059
|
-
table = new
|
|
10960
|
+
table = new MathNode("mstyle", [table]);
|
|
11060
10961
|
table.setAttribute("scriptlevel", "1");
|
|
11061
10962
|
}
|
|
11062
10963
|
|
|
@@ -11065,12 +10966,12 @@ var mathmlBuilder$5 = function mathmlBuilder(group, options) {
|
|
|
11065
10966
|
|
|
11066
10967
|
|
|
11067
10968
|
var alignedHandler = function alignedHandler(context, args) {
|
|
11068
|
-
if (context.envName.
|
|
10969
|
+
if (!context.envName.includes("ed")) {
|
|
11069
10970
|
validateAmsEnvironmentContext(context);
|
|
11070
10971
|
}
|
|
11071
10972
|
|
|
11072
10973
|
var cols = [];
|
|
11073
|
-
var separationType = context.envName.
|
|
10974
|
+
var separationType = context.envName.includes("at") ? "alignat" : "align";
|
|
11074
10975
|
var isSplit = context.envName === "split";
|
|
11075
10976
|
var res = parseArray(context.parser, {
|
|
11076
10977
|
cols,
|
|
@@ -11179,7 +11080,7 @@ defineEnvironment({
|
|
|
11179
11080
|
var node = assertSymbolNodeType(nde);
|
|
11180
11081
|
var ca = node.text;
|
|
11181
11082
|
|
|
11182
|
-
if ("lcr".
|
|
11083
|
+
if ("lcr".includes(ca)) {
|
|
11183
11084
|
return {
|
|
11184
11085
|
type: "align",
|
|
11185
11086
|
align: ca
|
|
@@ -11251,7 +11152,7 @@ defineEnvironment({
|
|
|
11251
11152
|
parser.consumeSpaces();
|
|
11252
11153
|
colAlign = parser.fetch().text;
|
|
11253
11154
|
|
|
11254
|
-
if ("lcr".
|
|
11155
|
+
if (!"lcr".includes(colAlign)) {
|
|
11255
11156
|
throw new ParseError("Expected l or c or r", parser.nextToken);
|
|
11256
11157
|
}
|
|
11257
11158
|
|
|
@@ -11321,7 +11222,7 @@ defineEnvironment({
|
|
|
11321
11222
|
var node = assertSymbolNodeType(nde);
|
|
11322
11223
|
var ca = node.text; // {subarray} only recognizes "l" & "c"
|
|
11323
11224
|
|
|
11324
|
-
if ("lc".
|
|
11225
|
+
if ("lc".includes(ca)) {
|
|
11325
11226
|
return {
|
|
11326
11227
|
type: "align",
|
|
11327
11228
|
align: ca
|
|
@@ -11391,8 +11292,8 @@ defineEnvironment({
|
|
|
11391
11292
|
type: "leftright",
|
|
11392
11293
|
mode: context.mode,
|
|
11393
11294
|
body: [res],
|
|
11394
|
-
left: context.envName.
|
|
11395
|
-
right: context.envName.
|
|
11295
|
+
left: context.envName.includes("r") ? "." : "\\{",
|
|
11296
|
+
right: context.envName.includes("r") ? "\\}" : ".",
|
|
11396
11297
|
rightColor: undefined
|
|
11397
11298
|
};
|
|
11398
11299
|
},
|
|
@@ -11427,7 +11328,7 @@ defineEnvironment({
|
|
|
11427
11328
|
},
|
|
11428
11329
|
|
|
11429
11330
|
handler(context) {
|
|
11430
|
-
if (
|
|
11331
|
+
if (gatherEnvironments.has(context.envName)) {
|
|
11431
11332
|
validateAmsEnvironmentContext(context);
|
|
11432
11333
|
}
|
|
11433
11334
|
|
|
@@ -11649,8 +11550,7 @@ defineFunction({
|
|
|
11649
11550
|
var {
|
|
11650
11551
|
parser
|
|
11651
11552
|
} = _ref2;
|
|
11652
|
-
var body = args[0];
|
|
11653
|
-
var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
|
|
11553
|
+
var body = args[0]; // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
|
|
11654
11554
|
// argument's bin|rel|ord status
|
|
11655
11555
|
|
|
11656
11556
|
return {
|
|
@@ -11663,7 +11563,7 @@ defineFunction({
|
|
|
11663
11563
|
font: "boldsymbol",
|
|
11664
11564
|
body
|
|
11665
11565
|
}],
|
|
11666
|
-
isCharacterBox: isCharacterBox
|
|
11566
|
+
isCharacterBox: isCharacterBox(body)
|
|
11667
11567
|
};
|
|
11668
11568
|
}
|
|
11669
11569
|
}); // Old font changing functions
|
|
@@ -11749,9 +11649,9 @@ var htmlBuilder$4 = (group, options) => {
|
|
|
11749
11649
|
if (group.hasBarLine) {
|
|
11750
11650
|
if (group.barSize) {
|
|
11751
11651
|
ruleWidth = calculateSize(group.barSize, options);
|
|
11752
|
-
rule =
|
|
11652
|
+
rule = makeLineSpan("frac-line", options, ruleWidth);
|
|
11753
11653
|
} else {
|
|
11754
|
-
rule =
|
|
11654
|
+
rule = makeLineSpan("frac-line", options);
|
|
11755
11655
|
}
|
|
11756
11656
|
|
|
11757
11657
|
ruleWidth = rule.height;
|
|
@@ -11800,7 +11700,7 @@ var htmlBuilder$4 = (group, options) => {
|
|
|
11800
11700
|
denomShift += 0.5 * (clearance - candidateClearance);
|
|
11801
11701
|
}
|
|
11802
11702
|
|
|
11803
|
-
frac =
|
|
11703
|
+
frac = makeVList({
|
|
11804
11704
|
positionType: "individualShift",
|
|
11805
11705
|
children: [{
|
|
11806
11706
|
type: "elem",
|
|
@@ -11811,7 +11711,7 @@ var htmlBuilder$4 = (group, options) => {
|
|
|
11811
11711
|
elem: numerm,
|
|
11812
11712
|
shift: -numShift
|
|
11813
11713
|
}]
|
|
11814
|
-
}
|
|
11714
|
+
});
|
|
11815
11715
|
} else {
|
|
11816
11716
|
// Rule 15d
|
|
11817
11717
|
var axisHeight = options.fontMetrics().axisHeight;
|
|
@@ -11825,7 +11725,7 @@ var htmlBuilder$4 = (group, options) => {
|
|
|
11825
11725
|
}
|
|
11826
11726
|
|
|
11827
11727
|
var midShift = -(axisHeight - 0.5 * ruleWidth);
|
|
11828
|
-
frac =
|
|
11728
|
+
frac = makeVList({
|
|
11829
11729
|
positionType: "individualShift",
|
|
11830
11730
|
children: [{
|
|
11831
11731
|
type: "elem",
|
|
@@ -11840,7 +11740,7 @@ var htmlBuilder$4 = (group, options) => {
|
|
|
11840
11740
|
elem: numerm,
|
|
11841
11741
|
shift: -numShift
|
|
11842
11742
|
}]
|
|
11843
|
-
}
|
|
11743
|
+
});
|
|
11844
11744
|
} // Since we manually change the style sometimes (with \dfrac or \tfrac),
|
|
11845
11745
|
// account for the possible size change here.
|
|
11846
11746
|
|
|
@@ -11865,22 +11765,22 @@ var htmlBuilder$4 = (group, options) => {
|
|
|
11865
11765
|
if (group.leftDelim == null) {
|
|
11866
11766
|
leftDelim = makeNullDelimiter(options, ["mopen"]);
|
|
11867
11767
|
} else {
|
|
11868
|
-
leftDelim =
|
|
11768
|
+
leftDelim = makeCustomSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
|
|
11869
11769
|
}
|
|
11870
11770
|
|
|
11871
11771
|
if (group.continued) {
|
|
11872
|
-
rightDelim =
|
|
11772
|
+
rightDelim = makeSpan([]); // zero width for \cfrac
|
|
11873
11773
|
} else if (group.rightDelim == null) {
|
|
11874
11774
|
rightDelim = makeNullDelimiter(options, ["mclose"]);
|
|
11875
11775
|
} else {
|
|
11876
|
-
rightDelim =
|
|
11776
|
+
rightDelim = makeCustomSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
|
|
11877
11777
|
}
|
|
11878
11778
|
|
|
11879
|
-
return
|
|
11779
|
+
return makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim], options);
|
|
11880
11780
|
};
|
|
11881
11781
|
|
|
11882
11782
|
var mathmlBuilder$3 = (group, options) => {
|
|
11883
|
-
var node = new
|
|
11783
|
+
var node = new MathNode("mfrac", [buildGroup(group.numer, options), buildGroup(group.denom, options)]);
|
|
11884
11784
|
|
|
11885
11785
|
if (!group.hasBarLine) {
|
|
11886
11786
|
node.setAttribute("linethickness", "0px");
|
|
@@ -11892,7 +11792,7 @@ var mathmlBuilder$3 = (group, options) => {
|
|
|
11892
11792
|
var style = adjustStyle(group.size, options.style);
|
|
11893
11793
|
|
|
11894
11794
|
if (style.size !== options.style.size) {
|
|
11895
|
-
node = new
|
|
11795
|
+
node = new MathNode("mstyle", [node]);
|
|
11896
11796
|
var isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false";
|
|
11897
11797
|
node.setAttribute("displaystyle", isDisplay);
|
|
11898
11798
|
node.setAttribute("scriptlevel", "0");
|
|
@@ -11902,7 +11802,7 @@ var mathmlBuilder$3 = (group, options) => {
|
|
|
11902
11802
|
var withDelims = [];
|
|
11903
11803
|
|
|
11904
11804
|
if (group.leftDelim != null) {
|
|
11905
|
-
var leftOp = new
|
|
11805
|
+
var leftOp = new MathNode("mo", [new TextNode(group.leftDelim.replace("\\", ""))]);
|
|
11906
11806
|
leftOp.setAttribute("fence", "true");
|
|
11907
11807
|
withDelims.push(leftOp);
|
|
11908
11808
|
}
|
|
@@ -11910,7 +11810,7 @@ var mathmlBuilder$3 = (group, options) => {
|
|
|
11910
11810
|
withDelims.push(node);
|
|
11911
11811
|
|
|
11912
11812
|
if (group.rightDelim != null) {
|
|
11913
|
-
var rightOp = new
|
|
11813
|
+
var rightOp = new MathNode("mo", [new TextNode(group.rightDelim.replace("\\", ""))]);
|
|
11914
11814
|
rightOp.setAttribute("fence", "true");
|
|
11915
11815
|
withDelims.push(rightOp);
|
|
11916
11816
|
}
|
|
@@ -12201,7 +12101,12 @@ defineFunction({
|
|
|
12201
12101
|
funcName
|
|
12202
12102
|
} = _ref6;
|
|
12203
12103
|
var numer = args[0];
|
|
12204
|
-
var barSize =
|
|
12104
|
+
var barSize = assertNodeType(args[1], "infix").size;
|
|
12105
|
+
|
|
12106
|
+
if (!barSize) {
|
|
12107
|
+
throw new Error("\\\\abovefrac expected size, but got " + String(barSize));
|
|
12108
|
+
}
|
|
12109
|
+
|
|
12205
12110
|
var denom = args[2];
|
|
12206
12111
|
var hasBarLine = barSize.number > 0;
|
|
12207
12112
|
return {
|
|
@@ -12242,13 +12147,13 @@ var htmlBuilder$3 = (grp, options) => {
|
|
|
12242
12147
|
|
|
12243
12148
|
var body = buildGroup$1(group.base, options.havingBaseStyle(Style$1.DISPLAY)); // Create the stretchy element
|
|
12244
12149
|
|
|
12245
|
-
var braceBody =
|
|
12150
|
+
var braceBody = stretchySvg(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓
|
|
12246
12151
|
// This first vlist contains the content and the brace: equation
|
|
12247
12152
|
|
|
12248
12153
|
var vlist;
|
|
12249
12154
|
|
|
12250
12155
|
if (group.isOver) {
|
|
12251
|
-
vlist =
|
|
12156
|
+
vlist = makeVList({
|
|
12252
12157
|
positionType: "firstBaseline",
|
|
12253
12158
|
children: [{
|
|
12254
12159
|
type: "elem",
|
|
@@ -12260,11 +12165,11 @@ var htmlBuilder$3 = (grp, options) => {
|
|
|
12260
12165
|
type: "elem",
|
|
12261
12166
|
elem: braceBody
|
|
12262
12167
|
}]
|
|
12263
|
-
}
|
|
12168
|
+
}); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
|
|
12264
12169
|
|
|
12265
12170
|
vlist.children[0].children[0].children[1].classes.push("svg-align");
|
|
12266
12171
|
} else {
|
|
12267
|
-
vlist =
|
|
12172
|
+
vlist = makeVList({
|
|
12268
12173
|
positionType: "bottom",
|
|
12269
12174
|
positionData: body.depth + 0.1 + braceBody.height,
|
|
12270
12175
|
children: [{
|
|
@@ -12277,7 +12182,7 @@ var htmlBuilder$3 = (grp, options) => {
|
|
|
12277
12182
|
type: "elem",
|
|
12278
12183
|
elem: body
|
|
12279
12184
|
}]
|
|
12280
|
-
}
|
|
12185
|
+
}); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
|
|
12281
12186
|
|
|
12282
12187
|
vlist.children[0].children[0].children[0].classes.push("svg-align");
|
|
12283
12188
|
}
|
|
@@ -12290,10 +12195,10 @@ var htmlBuilder$3 = (grp, options) => {
|
|
|
12290
12195
|
// note long note long note
|
|
12291
12196
|
// ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓
|
|
12292
12197
|
// equation eqn eqn
|
|
12293
|
-
var vSpan =
|
|
12198
|
+
var vSpan = makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
|
|
12294
12199
|
|
|
12295
12200
|
if (group.isOver) {
|
|
12296
|
-
vlist =
|
|
12201
|
+
vlist = makeVList({
|
|
12297
12202
|
positionType: "firstBaseline",
|
|
12298
12203
|
children: [{
|
|
12299
12204
|
type: "elem",
|
|
@@ -12305,9 +12210,9 @@ var htmlBuilder$3 = (grp, options) => {
|
|
|
12305
12210
|
type: "elem",
|
|
12306
12211
|
elem: supSubGroup
|
|
12307
12212
|
}]
|
|
12308
|
-
}
|
|
12213
|
+
});
|
|
12309
12214
|
} else {
|
|
12310
|
-
vlist =
|
|
12215
|
+
vlist = makeVList({
|
|
12311
12216
|
positionType: "bottom",
|
|
12312
12217
|
positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
|
|
12313
12218
|
children: [{
|
|
@@ -12320,16 +12225,16 @@ var htmlBuilder$3 = (grp, options) => {
|
|
|
12320
12225
|
type: "elem",
|
|
12321
12226
|
elem: vSpan
|
|
12322
12227
|
}]
|
|
12323
|
-
}
|
|
12228
|
+
});
|
|
12324
12229
|
}
|
|
12325
12230
|
}
|
|
12326
12231
|
|
|
12327
|
-
return
|
|
12232
|
+
return makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
|
|
12328
12233
|
};
|
|
12329
12234
|
|
|
12330
12235
|
var mathmlBuilder$2 = (group, options) => {
|
|
12331
|
-
var accentNode =
|
|
12332
|
-
return new
|
|
12236
|
+
var accentNode = stretchyMathML(group.label);
|
|
12237
|
+
return new MathNode(group.isOver ? "mover" : "munder", [buildGroup(group.base, options), accentNode]);
|
|
12333
12238
|
}; // Horizontal stretchy braces
|
|
12334
12239
|
|
|
12335
12240
|
|
|
@@ -12389,7 +12294,7 @@ defineFunction({
|
|
|
12389
12294
|
},
|
|
12390
12295
|
htmlBuilder: (group, options) => {
|
|
12391
12296
|
var elements = buildExpression$1(group.body, options, false);
|
|
12392
|
-
return
|
|
12297
|
+
return makeAnchor(group.href, [], elements, options);
|
|
12393
12298
|
},
|
|
12394
12299
|
mathmlBuilder: (group, options) => {
|
|
12395
12300
|
var math = buildExpressionRow(group.body, options);
|
|
@@ -12481,11 +12386,11 @@ defineFunction({
|
|
|
12481
12386
|
|
|
12482
12387
|
htmlBuilder(group, options) {
|
|
12483
12388
|
var elements = buildExpression$1(group.body, options, false);
|
|
12484
|
-
return
|
|
12389
|
+
return makeFragment(elements);
|
|
12485
12390
|
},
|
|
12486
12391
|
|
|
12487
12392
|
mathmlBuilder(group, options) {
|
|
12488
|
-
return new
|
|
12393
|
+
return new MathNode("mrow", buildExpression(group.body, options));
|
|
12489
12394
|
}
|
|
12490
12395
|
|
|
12491
12396
|
});
|
|
@@ -12588,7 +12493,7 @@ defineFunction({
|
|
|
12588
12493
|
classes.push(...group.attributes.class.trim().split(/\s+/));
|
|
12589
12494
|
}
|
|
12590
12495
|
|
|
12591
|
-
var span =
|
|
12496
|
+
var span = makeSpan(classes, elements, options);
|
|
12592
12497
|
|
|
12593
12498
|
for (var attr in group.attributes) {
|
|
12594
12499
|
if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
|
|
@@ -12608,6 +12513,7 @@ defineFunction({
|
|
|
12608
12513
|
names: ["\\html@mathml"],
|
|
12609
12514
|
props: {
|
|
12610
12515
|
numArgs: 2,
|
|
12516
|
+
allowedInArgument: true,
|
|
12611
12517
|
allowedInText: true
|
|
12612
12518
|
},
|
|
12613
12519
|
handler: (_ref, args) => {
|
|
@@ -12623,7 +12529,7 @@ defineFunction({
|
|
|
12623
12529
|
},
|
|
12624
12530
|
htmlBuilder: (group, options) => {
|
|
12625
12531
|
var elements = buildExpression$1(group.html, options, false);
|
|
12626
|
-
return
|
|
12532
|
+
return makeFragment(elements);
|
|
12627
12533
|
},
|
|
12628
12534
|
mathmlBuilder: (group, options) => {
|
|
12629
12535
|
return buildExpressionRow(group.mathml, options);
|
|
@@ -12780,7 +12686,7 @@ defineFunction({
|
|
|
12780
12686
|
return node;
|
|
12781
12687
|
},
|
|
12782
12688
|
mathmlBuilder: (group, options) => {
|
|
12783
|
-
var node = new
|
|
12689
|
+
var node = new MathNode("mglyph", []);
|
|
12784
12690
|
node.setAttribute("alt", group.alt);
|
|
12785
12691
|
var height = calculateSize(group.height, options);
|
|
12786
12692
|
var depth = 0;
|
|
@@ -12850,12 +12756,12 @@ defineFunction({
|
|
|
12850
12756
|
},
|
|
12851
12757
|
|
|
12852
12758
|
htmlBuilder(group, options) {
|
|
12853
|
-
return
|
|
12759
|
+
return makeGlue(group.dimension, options);
|
|
12854
12760
|
},
|
|
12855
12761
|
|
|
12856
12762
|
mathmlBuilder(group, options) {
|
|
12857
12763
|
var dimension = calculateSize(group.dimension, options);
|
|
12858
|
-
return new
|
|
12764
|
+
return new SpaceNode(dimension);
|
|
12859
12765
|
}
|
|
12860
12766
|
|
|
12861
12767
|
});
|
|
@@ -12887,21 +12793,21 @@ defineFunction({
|
|
|
12887
12793
|
|
|
12888
12794
|
if (group.alignment === "clap") {
|
|
12889
12795
|
// ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
|
|
12890
|
-
inner =
|
|
12796
|
+
inner = makeSpan([], [buildGroup$1(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span
|
|
12891
12797
|
|
|
12892
|
-
inner =
|
|
12798
|
+
inner = makeSpan(["inner"], [inner], options);
|
|
12893
12799
|
} else {
|
|
12894
|
-
inner =
|
|
12800
|
+
inner = makeSpan(["inner"], [buildGroup$1(group.body, options)]);
|
|
12895
12801
|
}
|
|
12896
12802
|
|
|
12897
|
-
var fix =
|
|
12898
|
-
var node =
|
|
12803
|
+
var fix = makeSpan(["fix"], []);
|
|
12804
|
+
var node = makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the
|
|
12899
12805
|
// two items involved in the lap.
|
|
12900
12806
|
// Next, use a strut to set the height of the HTML bounding box.
|
|
12901
12807
|
// Otherwise, a tall argument may be misplaced.
|
|
12902
12808
|
// This code resolved issue #1153
|
|
12903
12809
|
|
|
12904
|
-
var strut =
|
|
12810
|
+
var strut = makeSpan(["strut"]);
|
|
12905
12811
|
strut.style.height = makeEm(node.height + node.depth);
|
|
12906
12812
|
|
|
12907
12813
|
if (node.depth) {
|
|
@@ -12911,12 +12817,12 @@ defineFunction({
|
|
|
12911
12817
|
node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
|
|
12912
12818
|
// This code resolves issue #1234
|
|
12913
12819
|
|
|
12914
|
-
node =
|
|
12915
|
-
return
|
|
12820
|
+
node = makeSpan(["thinbox"], [node], options);
|
|
12821
|
+
return makeSpan(["mord", "vbox"], [node], options);
|
|
12916
12822
|
},
|
|
12917
12823
|
mathmlBuilder: (group, options) => {
|
|
12918
12824
|
// mathllap, mathrlap, mathclap
|
|
12919
|
-
var node = new
|
|
12825
|
+
var node = new MathNode("mpadded", [buildGroup(group.body, options)]);
|
|
12920
12826
|
|
|
12921
12827
|
if (group.alignment !== "rlap") {
|
|
12922
12828
|
var offset = group.alignment === "llap" ? "-1" : "-0.5";
|
|
@@ -13016,7 +12922,7 @@ defineFunction({
|
|
|
13016
12922
|
htmlBuilder: (group, options) => {
|
|
13017
12923
|
var body = chooseMathStyle(group, options);
|
|
13018
12924
|
var elements = buildExpression$1(body, options, false);
|
|
13019
|
-
return
|
|
12925
|
+
return makeFragment(elements);
|
|
13020
12926
|
},
|
|
13021
12927
|
mathmlBuilder: (group, options) => {
|
|
13022
12928
|
var body = chooseMathStyle(group, options);
|
|
@@ -13025,8 +12931,8 @@ defineFunction({
|
|
|
13025
12931
|
});
|
|
13026
12932
|
|
|
13027
12933
|
var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => {
|
|
13028
|
-
base =
|
|
13029
|
-
var subIsSingleCharacter = subGroup &&
|
|
12934
|
+
base = makeSpan([], [base]);
|
|
12935
|
+
var subIsSingleCharacter = subGroup && isCharacterBox(subGroup);
|
|
13030
12936
|
var sub;
|
|
13031
12937
|
var sup; // We manually have to handle the superscripts and subscripts. This,
|
|
13032
12938
|
// aside from the kern calculations, is copied from supsub.
|
|
@@ -13054,7 +12960,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
13054
12960
|
|
|
13055
12961
|
if (sup && sub) {
|
|
13056
12962
|
var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;
|
|
13057
|
-
finalGroup =
|
|
12963
|
+
finalGroup = makeVList({
|
|
13058
12964
|
positionType: "bottom",
|
|
13059
12965
|
positionData: bottom,
|
|
13060
12966
|
children: [{
|
|
@@ -13081,14 +12987,14 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
13081
12987
|
type: "kern",
|
|
13082
12988
|
size: options.fontMetrics().bigOpSpacing5
|
|
13083
12989
|
}]
|
|
13084
|
-
}
|
|
12990
|
+
});
|
|
13085
12991
|
} else if (sub) {
|
|
13086
12992
|
var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note
|
|
13087
12993
|
// that we are supposed to shift the limits by 1/2 of the slant,
|
|
13088
12994
|
// but since we are centering the limits adding a full slant of
|
|
13089
12995
|
// margin will shift by 1/2 that.
|
|
13090
12996
|
|
|
13091
|
-
finalGroup =
|
|
12997
|
+
finalGroup = makeVList({
|
|
13092
12998
|
positionType: "top",
|
|
13093
12999
|
positionData: top,
|
|
13094
13000
|
children: [{
|
|
@@ -13105,11 +13011,11 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
13105
13011
|
type: "elem",
|
|
13106
13012
|
elem: base
|
|
13107
13013
|
}]
|
|
13108
|
-
}
|
|
13014
|
+
});
|
|
13109
13015
|
} else if (sup) {
|
|
13110
13016
|
var _bottom = base.depth + baseShift;
|
|
13111
13017
|
|
|
13112
|
-
finalGroup =
|
|
13018
|
+
finalGroup = makeVList({
|
|
13113
13019
|
positionType: "bottom",
|
|
13114
13020
|
positionData: _bottom,
|
|
13115
13021
|
children: [{
|
|
@@ -13126,7 +13032,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
13126
13032
|
type: "kern",
|
|
13127
13033
|
size: options.fontMetrics().bigOpSpacing5
|
|
13128
13034
|
}]
|
|
13129
|
-
}
|
|
13035
|
+
});
|
|
13130
13036
|
} else {
|
|
13131
13037
|
// This case probably shouldn't occur (this would mean the
|
|
13132
13038
|
// supsub was sending us a group with no superscript or
|
|
@@ -13139,17 +13045,17 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
13139
13045
|
if (sub && slant !== 0 && !subIsSingleCharacter) {
|
|
13140
13046
|
// A negative margin-left was applied to the lower limit.
|
|
13141
13047
|
// Avoid an overlap by placing a spacer on the left on the group.
|
|
13142
|
-
var spacer =
|
|
13048
|
+
var spacer = makeSpan(["mspace"], [], options);
|
|
13143
13049
|
spacer.style.marginRight = makeEm(slant);
|
|
13144
13050
|
parts.unshift(spacer);
|
|
13145
13051
|
}
|
|
13146
13052
|
|
|
13147
|
-
return
|
|
13053
|
+
return makeSpan(["mop", "op-limits"], parts, options);
|
|
13148
13054
|
};
|
|
13149
13055
|
|
|
13150
13056
|
// Limits, symbols
|
|
13151
13057
|
// Most operators have a large successor symbol, but these don't.
|
|
13152
|
-
var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
|
|
13058
|
+
var noSuccessor = new Set(["\\smallint"]); // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
|
|
13153
13059
|
// "supsub" since some of them (like \int) can affect super/subscripting.
|
|
13154
13060
|
|
|
13155
13061
|
var htmlBuilder$2 = (grp, options) => {
|
|
@@ -13174,7 +13080,7 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
13174
13080
|
var style = options.style;
|
|
13175
13081
|
var large = false;
|
|
13176
13082
|
|
|
13177
|
-
if (style.size === Style$1.DISPLAY.size && group.symbol && !noSuccessor.
|
|
13083
|
+
if (style.size === Style$1.DISPLAY.size && group.symbol && !noSuccessor.has(group.name)) {
|
|
13178
13084
|
// Most symbol operators get larger in displaystyle (rule 13)
|
|
13179
13085
|
large = true;
|
|
13180
13086
|
}
|
|
@@ -13193,14 +13099,14 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
13193
13099
|
group.name = stash === "oiint" ? "\\iint" : "\\iiint";
|
|
13194
13100
|
}
|
|
13195
13101
|
|
|
13196
|
-
base =
|
|
13102
|
+
base = makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
|
|
13197
13103
|
|
|
13198
13104
|
if (stash.length > 0) {
|
|
13199
13105
|
// We're in \oiint or \oiiint. Overlay the oval.
|
|
13200
13106
|
// TODO: When font glyphs are available, delete this code.
|
|
13201
13107
|
var italic = base.italic;
|
|
13202
|
-
var oval =
|
|
13203
|
-
base =
|
|
13108
|
+
var oval = staticSvg(stash + "Size" + (large ? "2" : "1"), options);
|
|
13109
|
+
base = makeVList({
|
|
13204
13110
|
positionType: "individualShift",
|
|
13205
13111
|
children: [{
|
|
13206
13112
|
type: "elem",
|
|
@@ -13211,7 +13117,7 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
13211
13117
|
elem: oval,
|
|
13212
13118
|
shift: large ? 0.08 : 0
|
|
13213
13119
|
}]
|
|
13214
|
-
}
|
|
13120
|
+
});
|
|
13215
13121
|
group.name = "\\" + stash;
|
|
13216
13122
|
base.classes.unshift("mop"); // $FlowFixMe
|
|
13217
13123
|
|
|
@@ -13225,7 +13131,7 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
13225
13131
|
base = inner[0];
|
|
13226
13132
|
base.classes[0] = "mop"; // replace old mclass
|
|
13227
13133
|
} else {
|
|
13228
|
-
base =
|
|
13134
|
+
base = makeSpan(["mop"], inner, options);
|
|
13229
13135
|
}
|
|
13230
13136
|
} else {
|
|
13231
13137
|
// Otherwise, this is a text operator. Build the text from the
|
|
@@ -13233,10 +13139,10 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
13233
13139
|
var output = [];
|
|
13234
13140
|
|
|
13235
13141
|
for (var i = 1; i < group.name.length; i++) {
|
|
13236
|
-
output.push(
|
|
13142
|
+
output.push(mathsym(group.name[i], group.mode, options));
|
|
13237
13143
|
}
|
|
13238
13144
|
|
|
13239
|
-
base =
|
|
13145
|
+
base = makeSpan(["mop"], output, options);
|
|
13240
13146
|
} // If content of op is a single symbol, shift it vertically.
|
|
13241
13147
|
|
|
13242
13148
|
|
|
@@ -13275,14 +13181,14 @@ var mathmlBuilder$1 = (group, options) => {
|
|
|
13275
13181
|
// This is a symbol. Just add the symbol.
|
|
13276
13182
|
node = new MathNode("mo", [makeText(group.name, group.mode)]);
|
|
13277
13183
|
|
|
13278
|
-
if (noSuccessor.
|
|
13184
|
+
if (noSuccessor.has(group.name)) {
|
|
13279
13185
|
node.setAttribute("largeop", "false");
|
|
13280
13186
|
}
|
|
13281
13187
|
} else if (group.body) {
|
|
13282
13188
|
// This is an operator with children. Add them.
|
|
13283
13189
|
node = new MathNode("mo", buildExpression(group.body, options));
|
|
13284
13190
|
} else {
|
|
13285
|
-
// This is a text operator. Add all
|
|
13191
|
+
// This is a text operator. Add all the characters from the
|
|
13286
13192
|
// operator's name.
|
|
13287
13193
|
node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an <mo>⁡</mo>.
|
|
13288
13194
|
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
|
|
@@ -13517,9 +13423,9 @@ var htmlBuilder$1 = (grp, options) => {
|
|
|
13517
13423
|
}
|
|
13518
13424
|
}
|
|
13519
13425
|
|
|
13520
|
-
base =
|
|
13426
|
+
base = makeSpan(["mop"], expression, options);
|
|
13521
13427
|
} else {
|
|
13522
|
-
base =
|
|
13428
|
+
base = makeSpan(["mop"], [], options);
|
|
13523
13429
|
}
|
|
13524
13430
|
|
|
13525
13431
|
if (hasLimits) {
|
|
@@ -13538,7 +13444,7 @@ var mathmlBuilder = (group, options) => {
|
|
|
13538
13444
|
for (var i = 0; i < expression.length; i++) {
|
|
13539
13445
|
var node = expression[i];
|
|
13540
13446
|
|
|
13541
|
-
if (node instanceof
|
|
13447
|
+
if (node instanceof SpaceNode) ; else if (node instanceof MathNode) {
|
|
13542
13448
|
switch (node.type) {
|
|
13543
13449
|
case "mi":
|
|
13544
13450
|
case "mn":
|
|
@@ -13552,7 +13458,7 @@ var mathmlBuilder = (group, options) => {
|
|
|
13552
13458
|
{
|
|
13553
13459
|
var child = node.children[0];
|
|
13554
13460
|
|
|
13555
|
-
if (node.children.length === 1 && child instanceof
|
|
13461
|
+
if (node.children.length === 1 && child instanceof TextNode) {
|
|
13556
13462
|
child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
|
|
13557
13463
|
} else {
|
|
13558
13464
|
isAllString = false;
|
|
@@ -13572,19 +13478,19 @@ var mathmlBuilder = (group, options) => {
|
|
|
13572
13478
|
if (isAllString) {
|
|
13573
13479
|
// Write a single TextNode instead of multiple nested tags.
|
|
13574
13480
|
var word = expression.map(node => node.toText()).join("");
|
|
13575
|
-
expression = [new
|
|
13481
|
+
expression = [new TextNode(word)];
|
|
13576
13482
|
}
|
|
13577
13483
|
|
|
13578
|
-
var identifier = new
|
|
13484
|
+
var identifier = new MathNode("mi", expression);
|
|
13579
13485
|
identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡
|
|
13580
13486
|
// ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
|
|
13581
13487
|
|
|
13582
|
-
var operator = new
|
|
13488
|
+
var operator = new MathNode("mo", [makeText("\u2061", "text")]);
|
|
13583
13489
|
|
|
13584
13490
|
if (group.parentIsSupSub) {
|
|
13585
|
-
return new
|
|
13491
|
+
return new MathNode("mrow", [identifier, operator]);
|
|
13586
13492
|
} else {
|
|
13587
|
-
return
|
|
13493
|
+
return newDocumentFragment([identifier, operator]);
|
|
13588
13494
|
}
|
|
13589
13495
|
}; // \operatorname
|
|
13590
13496
|
// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
|
|
@@ -13621,10 +13527,10 @@ defineFunctionBuilders({
|
|
|
13621
13527
|
|
|
13622
13528
|
htmlBuilder(group, options) {
|
|
13623
13529
|
if (group.semisimple) {
|
|
13624
|
-
return
|
|
13530
|
+
return makeFragment(buildExpression$1(group.body, options, false));
|
|
13625
13531
|
}
|
|
13626
13532
|
|
|
13627
|
-
return
|
|
13533
|
+
return makeSpan(["mord"], buildExpression$1(group.body, options, true), options);
|
|
13628
13534
|
},
|
|
13629
13535
|
|
|
13630
13536
|
mathmlBuilder(group, options) {
|
|
@@ -13657,10 +13563,10 @@ defineFunction({
|
|
|
13657
13563
|
// Build the inner group in the cramped style.
|
|
13658
13564
|
var innerGroup = buildGroup$1(group.body, options.havingCrampedStyle()); // Create the line above the body
|
|
13659
13565
|
|
|
13660
|
-
var line =
|
|
13566
|
+
var line = makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns
|
|
13661
13567
|
|
|
13662
13568
|
var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
|
|
13663
|
-
var vlist =
|
|
13569
|
+
var vlist = makeVList({
|
|
13664
13570
|
positionType: "firstBaseline",
|
|
13665
13571
|
children: [{
|
|
13666
13572
|
type: "elem",
|
|
@@ -13675,14 +13581,14 @@ defineFunction({
|
|
|
13675
13581
|
type: "kern",
|
|
13676
13582
|
size: defaultRuleThickness
|
|
13677
13583
|
}]
|
|
13678
|
-
}
|
|
13679
|
-
return
|
|
13584
|
+
});
|
|
13585
|
+
return makeSpan(["mord", "overline"], [vlist], options);
|
|
13680
13586
|
},
|
|
13681
13587
|
|
|
13682
13588
|
mathmlBuilder(group, options) {
|
|
13683
|
-
var operator = new
|
|
13589
|
+
var operator = new MathNode("mo", [new TextNode("\u203e")]);
|
|
13684
13590
|
operator.setAttribute("stretchy", "true");
|
|
13685
|
-
var node = new
|
|
13591
|
+
var node = new MathNode("mover", [buildGroup(group.body, options), operator]);
|
|
13686
13592
|
node.setAttribute("accent", "true");
|
|
13687
13593
|
return node;
|
|
13688
13594
|
}
|
|
@@ -13711,11 +13617,11 @@ defineFunction({
|
|
|
13711
13617
|
var elements = buildExpression$1(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains.
|
|
13712
13618
|
// See "color" for more details.
|
|
13713
13619
|
|
|
13714
|
-
return
|
|
13620
|
+
return makeFragment(elements);
|
|
13715
13621
|
},
|
|
13716
13622
|
mathmlBuilder: (group, options) => {
|
|
13717
13623
|
var inner = buildExpression(group.body, options);
|
|
13718
|
-
return new
|
|
13624
|
+
return new MathNode("mphantom", inner);
|
|
13719
13625
|
}
|
|
13720
13626
|
});
|
|
13721
13627
|
defineFunction({
|
|
@@ -13737,7 +13643,7 @@ defineFunction({
|
|
|
13737
13643
|
};
|
|
13738
13644
|
},
|
|
13739
13645
|
htmlBuilder: (group, options) => {
|
|
13740
|
-
var node =
|
|
13646
|
+
var node = makeSpan([], [buildGroup$1(group.body, options.withPhantom())]);
|
|
13741
13647
|
node.height = 0;
|
|
13742
13648
|
node.depth = 0;
|
|
13743
13649
|
|
|
@@ -13749,20 +13655,20 @@ defineFunction({
|
|
|
13749
13655
|
} // See smash for comment re: use of makeVList
|
|
13750
13656
|
|
|
13751
13657
|
|
|
13752
|
-
node =
|
|
13658
|
+
node = makeVList({
|
|
13753
13659
|
positionType: "firstBaseline",
|
|
13754
13660
|
children: [{
|
|
13755
13661
|
type: "elem",
|
|
13756
13662
|
elem: node
|
|
13757
13663
|
}]
|
|
13758
|
-
}
|
|
13664
|
+
}); // For spacing, TeX treats \smash as a math group (same spacing as ord).
|
|
13759
13665
|
|
|
13760
|
-
return
|
|
13666
|
+
return makeSpan(["mord"], [node], options);
|
|
13761
13667
|
},
|
|
13762
13668
|
mathmlBuilder: (group, options) => {
|
|
13763
13669
|
var inner = buildExpression(ordargument(group.body), options);
|
|
13764
|
-
var phantom = new
|
|
13765
|
-
var node = new
|
|
13670
|
+
var phantom = new MathNode("mphantom", inner);
|
|
13671
|
+
var node = new MathNode("mpadded", [phantom]);
|
|
13766
13672
|
node.setAttribute("height", "0px");
|
|
13767
13673
|
node.setAttribute("depth", "0px");
|
|
13768
13674
|
return node;
|
|
@@ -13787,14 +13693,14 @@ defineFunction({
|
|
|
13787
13693
|
};
|
|
13788
13694
|
},
|
|
13789
13695
|
htmlBuilder: (group, options) => {
|
|
13790
|
-
var inner =
|
|
13791
|
-
var fix =
|
|
13792
|
-
return
|
|
13696
|
+
var inner = makeSpan(["inner"], [buildGroup$1(group.body, options.withPhantom())]);
|
|
13697
|
+
var fix = makeSpan(["fix"], []);
|
|
13698
|
+
return makeSpan(["mord", "rlap"], [inner, fix], options);
|
|
13793
13699
|
},
|
|
13794
13700
|
mathmlBuilder: (group, options) => {
|
|
13795
13701
|
var inner = buildExpression(ordargument(group.body), options);
|
|
13796
|
-
var phantom = new
|
|
13797
|
-
var node = new
|
|
13702
|
+
var phantom = new MathNode("mphantom", inner);
|
|
13703
|
+
var node = new MathNode("mpadded", [phantom]);
|
|
13798
13704
|
node.setAttribute("width", "0px");
|
|
13799
13705
|
return node;
|
|
13800
13706
|
}
|
|
@@ -13826,18 +13732,18 @@ defineFunction({
|
|
|
13826
13732
|
htmlBuilder(group, options) {
|
|
13827
13733
|
var body = buildGroup$1(group.body, options);
|
|
13828
13734
|
var dy = calculateSize(group.dy, options);
|
|
13829
|
-
return
|
|
13735
|
+
return makeVList({
|
|
13830
13736
|
positionType: "shift",
|
|
13831
13737
|
positionData: -dy,
|
|
13832
13738
|
children: [{
|
|
13833
13739
|
type: "elem",
|
|
13834
13740
|
elem: body
|
|
13835
13741
|
}]
|
|
13836
|
-
}
|
|
13742
|
+
});
|
|
13837
13743
|
},
|
|
13838
13744
|
|
|
13839
13745
|
mathmlBuilder(group, options) {
|
|
13840
|
-
var node = new
|
|
13746
|
+
var node = new MathNode("mpadded", [buildGroup(group.body, options)]);
|
|
13841
13747
|
var dy = group.dy.number + group.dy.unit;
|
|
13842
13748
|
node.setAttribute("voffset", dy);
|
|
13843
13749
|
return node;
|
|
@@ -13895,7 +13801,7 @@ defineFunction({
|
|
|
13895
13801
|
|
|
13896
13802
|
htmlBuilder(group, options) {
|
|
13897
13803
|
// Make an empty span for the rule
|
|
13898
|
-
var rule =
|
|
13804
|
+
var rule = makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
|
|
13899
13805
|
|
|
13900
13806
|
var width = calculateSize(group.width, options);
|
|
13901
13807
|
var height = calculateSize(group.height, options);
|
|
@@ -13920,11 +13826,11 @@ defineFunction({
|
|
|
13920
13826
|
var height = calculateSize(group.height, options);
|
|
13921
13827
|
var shift = group.shift ? calculateSize(group.shift, options) : 0;
|
|
13922
13828
|
var color = options.color && options.getColor() || "black";
|
|
13923
|
-
var rule = new
|
|
13829
|
+
var rule = new MathNode("mspace");
|
|
13924
13830
|
rule.setAttribute("mathbackground", color);
|
|
13925
13831
|
rule.setAttribute("width", makeEm(width));
|
|
13926
13832
|
rule.setAttribute("height", makeEm(height));
|
|
13927
|
-
var wrapper = new
|
|
13833
|
+
var wrapper = new MathNode("mpadded", [rule]);
|
|
13928
13834
|
|
|
13929
13835
|
if (shift >= 0) {
|
|
13930
13836
|
wrapper.setAttribute("height", makeEm(shift));
|
|
@@ -13960,7 +13866,7 @@ function sizingGroup(value, options, baseOptions) {
|
|
|
13960
13866
|
inner[i].depth *= multiplier;
|
|
13961
13867
|
}
|
|
13962
13868
|
|
|
13963
|
-
return
|
|
13869
|
+
return makeFragment(inner);
|
|
13964
13870
|
}
|
|
13965
13871
|
var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
|
|
13966
13872
|
var htmlBuilder = (group, options) => {
|
|
@@ -13996,7 +13902,7 @@ defineFunction({
|
|
|
13996
13902
|
mathmlBuilder: (group, options) => {
|
|
13997
13903
|
var newOptions = options.havingSize(group.size);
|
|
13998
13904
|
var inner = buildExpression(group.body, newOptions);
|
|
13999
|
-
var node = new
|
|
13905
|
+
var node = new MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size
|
|
14000
13906
|
// changes, because we don't keep state of what style we're currently
|
|
14001
13907
|
// in, so we can't reset the size to normal before changing it. Now
|
|
14002
13908
|
// that we're passing an options parameter we should be able to fix
|
|
@@ -14060,7 +13966,7 @@ defineFunction({
|
|
|
14060
13966
|
};
|
|
14061
13967
|
},
|
|
14062
13968
|
htmlBuilder: (group, options) => {
|
|
14063
|
-
var node =
|
|
13969
|
+
var node = makeSpan([], [buildGroup$1(group.body, options)]);
|
|
14064
13970
|
|
|
14065
13971
|
if (!group.smashHeight && !group.smashDepth) {
|
|
14066
13972
|
return node;
|
|
@@ -14090,18 +13996,18 @@ defineFunction({
|
|
|
14090
13996
|
// from acting on that line height. So we'll call makeVList now.
|
|
14091
13997
|
|
|
14092
13998
|
|
|
14093
|
-
var smashedNode =
|
|
13999
|
+
var smashedNode = makeVList({
|
|
14094
14000
|
positionType: "firstBaseline",
|
|
14095
14001
|
children: [{
|
|
14096
14002
|
type: "elem",
|
|
14097
14003
|
elem: node
|
|
14098
14004
|
}]
|
|
14099
|
-
}
|
|
14005
|
+
}); // For spacing, TeX treats \hphantom as a math group (same spacing as ord).
|
|
14100
14006
|
|
|
14101
|
-
return
|
|
14007
|
+
return makeSpan(["mord"], [smashedNode], options);
|
|
14102
14008
|
},
|
|
14103
14009
|
mathmlBuilder: (group, options) => {
|
|
14104
|
-
var node = new
|
|
14010
|
+
var node = new MathNode("mpadded", [buildGroup(group.body, options)]);
|
|
14105
14011
|
|
|
14106
14012
|
if (group.smashHeight) {
|
|
14107
14013
|
node.setAttribute("height", "0px");
|
|
@@ -14150,7 +14056,7 @@ defineFunction({
|
|
|
14150
14056
|
// them in a span.
|
|
14151
14057
|
|
|
14152
14058
|
|
|
14153
|
-
inner =
|
|
14059
|
+
inner = wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter
|
|
14154
14060
|
|
|
14155
14061
|
var metrics = options.fontMetrics();
|
|
14156
14062
|
var theta = metrics.defaultRuleThickness;
|
|
@@ -14168,7 +14074,7 @@ defineFunction({
|
|
|
14168
14074
|
span: img,
|
|
14169
14075
|
ruleWidth,
|
|
14170
14076
|
advanceWidth
|
|
14171
|
-
} =
|
|
14077
|
+
} = makeSqrtImage(minDelimiterHeight, options);
|
|
14172
14078
|
var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size
|
|
14173
14079
|
|
|
14174
14080
|
if (delimDepth > inner.height + inner.depth + lineClearance) {
|
|
@@ -14179,7 +14085,7 @@ defineFunction({
|
|
|
14179
14085
|
var imgShift = img.height - inner.height - lineClearance - ruleWidth;
|
|
14180
14086
|
inner.style.paddingLeft = makeEm(advanceWidth); // Overlay the image and the argument.
|
|
14181
14087
|
|
|
14182
|
-
var body =
|
|
14088
|
+
var body = makeVList({
|
|
14183
14089
|
positionType: "firstBaseline",
|
|
14184
14090
|
children: [{
|
|
14185
14091
|
type: "elem",
|
|
@@ -14195,10 +14101,10 @@ defineFunction({
|
|
|
14195
14101
|
type: "kern",
|
|
14196
14102
|
size: ruleWidth
|
|
14197
14103
|
}]
|
|
14198
|
-
}
|
|
14104
|
+
});
|
|
14199
14105
|
|
|
14200
14106
|
if (!group.index) {
|
|
14201
|
-
return
|
|
14107
|
+
return makeSpan(["mord", "sqrt"], [body], options);
|
|
14202
14108
|
} else {
|
|
14203
14109
|
// Handle the optional root index
|
|
14204
14110
|
// The index is always in scriptscript style
|
|
@@ -14208,18 +14114,18 @@ defineFunction({
|
|
|
14208
14114
|
|
|
14209
14115
|
var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly
|
|
14210
14116
|
|
|
14211
|
-
var rootVList =
|
|
14117
|
+
var rootVList = makeVList({
|
|
14212
14118
|
positionType: "shift",
|
|
14213
14119
|
positionData: -toShift,
|
|
14214
14120
|
children: [{
|
|
14215
14121
|
type: "elem",
|
|
14216
14122
|
elem: rootm
|
|
14217
14123
|
}]
|
|
14218
|
-
}
|
|
14124
|
+
}); // Add a class surrounding it so we can add on the appropriate
|
|
14219
14125
|
// kerning
|
|
14220
14126
|
|
|
14221
|
-
var rootVListWrap =
|
|
14222
|
-
return
|
|
14127
|
+
var rootVListWrap = makeSpan(["root"], [rootVList]);
|
|
14128
|
+
return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
|
|
14223
14129
|
}
|
|
14224
14130
|
},
|
|
14225
14131
|
|
|
@@ -14228,7 +14134,7 @@ defineFunction({
|
|
|
14228
14134
|
body,
|
|
14229
14135
|
index
|
|
14230
14136
|
} = group;
|
|
14231
|
-
return index ? new
|
|
14137
|
+
return index ? new MathNode("mroot", [buildGroup(body, options), buildGroup(index, options)]) : new MathNode("msqrt", [buildGroup(body, options)]);
|
|
14232
14138
|
}
|
|
14233
14139
|
|
|
14234
14140
|
});
|
|
@@ -14282,7 +14188,7 @@ defineFunction({
|
|
|
14282
14188
|
var newStyle = styleMap[group.style];
|
|
14283
14189
|
var newOptions = options.havingStyle(newStyle);
|
|
14284
14190
|
var inner = buildExpression(group.body, newOptions);
|
|
14285
|
-
var node = new
|
|
14191
|
+
var node = new MathNode("mstyle", inner);
|
|
14286
14192
|
var styleAttributes = {
|
|
14287
14193
|
"display": ["0", "true"],
|
|
14288
14194
|
"text": ["0", "false"],
|
|
@@ -14319,7 +14225,7 @@ var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) {
|
|
|
14319
14225
|
|
|
14320
14226
|
return _delegate ? htmlBuilder$1 : null;
|
|
14321
14227
|
} else if (base.type === "accent") {
|
|
14322
|
-
return
|
|
14228
|
+
return isCharacterBox(base.base) ? htmlBuilder$a : null;
|
|
14323
14229
|
} else if (base.type === "horizBrace") {
|
|
14324
14230
|
var isSup = !group.sub;
|
|
14325
14231
|
return isSup === base.isOver ? htmlBuilder$3 : null;
|
|
@@ -14356,13 +14262,13 @@ defineFunctionBuilders({
|
|
|
14356
14262
|
|
|
14357
14263
|
var supShift = 0;
|
|
14358
14264
|
var subShift = 0;
|
|
14359
|
-
var
|
|
14265
|
+
var isCharBox = valueBase && isCharacterBox(valueBase);
|
|
14360
14266
|
|
|
14361
14267
|
if (valueSup) {
|
|
14362
14268
|
var newOptions = options.havingStyle(options.style.sup());
|
|
14363
14269
|
supm = buildGroup$1(valueSup, newOptions, options);
|
|
14364
14270
|
|
|
14365
|
-
if (!
|
|
14271
|
+
if (!isCharBox) {
|
|
14366
14272
|
supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
|
|
14367
14273
|
}
|
|
14368
14274
|
}
|
|
@@ -14372,7 +14278,7 @@ defineFunctionBuilders({
|
|
|
14372
14278
|
|
|
14373
14279
|
subm = buildGroup$1(valueSub, _newOptions, options);
|
|
14374
14280
|
|
|
14375
|
-
if (!
|
|
14281
|
+
if (!isCharBox) {
|
|
14376
14282
|
subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;
|
|
14377
14283
|
}
|
|
14378
14284
|
} // Rule 18c
|
|
@@ -14437,10 +14343,10 @@ defineFunctionBuilders({
|
|
|
14437
14343
|
shift: -supShift,
|
|
14438
14344
|
marginRight
|
|
14439
14345
|
}];
|
|
14440
|
-
supsub =
|
|
14346
|
+
supsub = makeVList({
|
|
14441
14347
|
positionType: "individualShift",
|
|
14442
14348
|
children: vlistElem
|
|
14443
|
-
}
|
|
14349
|
+
});
|
|
14444
14350
|
} else if (subm) {
|
|
14445
14351
|
// Rule 18b
|
|
14446
14352
|
subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
|
|
@@ -14450,15 +14356,15 @@ defineFunctionBuilders({
|
|
|
14450
14356
|
marginLeft,
|
|
14451
14357
|
marginRight
|
|
14452
14358
|
}];
|
|
14453
|
-
supsub =
|
|
14359
|
+
supsub = makeVList({
|
|
14454
14360
|
positionType: "shift",
|
|
14455
14361
|
positionData: subShift,
|
|
14456
14362
|
children: _vlistElem
|
|
14457
|
-
}
|
|
14363
|
+
});
|
|
14458
14364
|
} else if (supm) {
|
|
14459
14365
|
// Rule 18c, d
|
|
14460
14366
|
supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
|
|
14461
|
-
supsub =
|
|
14367
|
+
supsub = makeVList({
|
|
14462
14368
|
positionType: "shift",
|
|
14463
14369
|
positionData: -supShift,
|
|
14464
14370
|
children: [{
|
|
@@ -14466,14 +14372,14 @@ defineFunctionBuilders({
|
|
|
14466
14372
|
elem: supm,
|
|
14467
14373
|
marginRight
|
|
14468
14374
|
}]
|
|
14469
|
-
}
|
|
14375
|
+
});
|
|
14470
14376
|
} else {
|
|
14471
14377
|
throw new Error("supsub must have either sup or sub.");
|
|
14472
14378
|
} // Wrap the supsub vlist in a span.msupsub to reset text-align.
|
|
14473
14379
|
|
|
14474
14380
|
|
|
14475
14381
|
var mclass = getTypeOfDomTree(base, "right") || "mord";
|
|
14476
|
-
return
|
|
14382
|
+
return makeSpan([mclass], [base, makeSpan(["msupsub"], [supsub])], options);
|
|
14477
14383
|
},
|
|
14478
14384
|
|
|
14479
14385
|
mathmlBuilder(group, options) {
|
|
@@ -14541,7 +14447,7 @@ defineFunctionBuilders({
|
|
|
14541
14447
|
}
|
|
14542
14448
|
}
|
|
14543
14449
|
|
|
14544
|
-
return new
|
|
14450
|
+
return new MathNode(nodeType, children);
|
|
14545
14451
|
}
|
|
14546
14452
|
|
|
14547
14453
|
});
|
|
@@ -14550,11 +14456,11 @@ defineFunctionBuilders({
|
|
|
14550
14456
|
type: "atom",
|
|
14551
14457
|
|
|
14552
14458
|
htmlBuilder(group, options) {
|
|
14553
|
-
return
|
|
14459
|
+
return mathsym(group.text, group.mode, options, ["m" + group.family]);
|
|
14554
14460
|
},
|
|
14555
14461
|
|
|
14556
14462
|
mathmlBuilder(group, options) {
|
|
14557
|
-
var node = new
|
|
14463
|
+
var node = new MathNode("mo", [makeText(group.text, group.mode)]);
|
|
14558
14464
|
|
|
14559
14465
|
if (group.family === "bin") {
|
|
14560
14466
|
var variant = getVariant(group, options);
|
|
@@ -14586,11 +14492,11 @@ defineFunctionBuilders({
|
|
|
14586
14492
|
type: "mathord",
|
|
14587
14493
|
|
|
14588
14494
|
htmlBuilder(group, options) {
|
|
14589
|
-
return
|
|
14495
|
+
return makeOrd(group, options, "mathord");
|
|
14590
14496
|
},
|
|
14591
14497
|
|
|
14592
14498
|
mathmlBuilder(group, options) {
|
|
14593
|
-
var node = new
|
|
14499
|
+
var node = new MathNode("mi", [makeText(group.text, group.mode, options)]);
|
|
14594
14500
|
var variant = getVariant(group, options) || "italic";
|
|
14595
14501
|
|
|
14596
14502
|
if (variant !== defaultVariant[node.type]) {
|
|
@@ -14605,7 +14511,7 @@ defineFunctionBuilders({
|
|
|
14605
14511
|
type: "textord",
|
|
14606
14512
|
|
|
14607
14513
|
htmlBuilder(group, options) {
|
|
14608
|
-
return
|
|
14514
|
+
return makeOrd(group, options, "textord");
|
|
14609
14515
|
},
|
|
14610
14516
|
|
|
14611
14517
|
mathmlBuilder(group, options) {
|
|
@@ -14614,13 +14520,13 @@ defineFunctionBuilders({
|
|
|
14614
14520
|
var node;
|
|
14615
14521
|
|
|
14616
14522
|
if (group.mode === 'text') {
|
|
14617
|
-
node = new
|
|
14523
|
+
node = new MathNode("mtext", [text]);
|
|
14618
14524
|
} else if (/[0-9]/.test(group.text)) {
|
|
14619
|
-
node = new
|
|
14525
|
+
node = new MathNode("mn", [text]);
|
|
14620
14526
|
} else if (group.text === "\\prime") {
|
|
14621
|
-
node = new
|
|
14527
|
+
node = new MathNode("mo", [text]);
|
|
14622
14528
|
} else {
|
|
14623
|
-
node = new
|
|
14529
|
+
node = new MathNode("mi", [text]);
|
|
14624
14530
|
}
|
|
14625
14531
|
|
|
14626
14532
|
if (variant !== defaultVariant[node.type]) {
|
|
@@ -14664,15 +14570,15 @@ defineFunctionBuilders({
|
|
|
14664
14570
|
// into appropriate outputs.
|
|
14665
14571
|
|
|
14666
14572
|
if (group.mode === "text") {
|
|
14667
|
-
var ord =
|
|
14573
|
+
var ord = makeOrd(group, options, "textord");
|
|
14668
14574
|
ord.classes.push(className);
|
|
14669
14575
|
return ord;
|
|
14670
14576
|
} else {
|
|
14671
|
-
return
|
|
14577
|
+
return makeSpan(["mspace", className], [mathsym(group.text, group.mode, options)], options);
|
|
14672
14578
|
}
|
|
14673
14579
|
} else if (cssSpace.hasOwnProperty(group.text)) {
|
|
14674
14580
|
// Spaces based on just a CSS class.
|
|
14675
|
-
return
|
|
14581
|
+
return makeSpan(["mspace", cssSpace[group.text]], [], options);
|
|
14676
14582
|
} else {
|
|
14677
14583
|
throw new ParseError("Unknown type of space \"" + group.text + "\"");
|
|
14678
14584
|
}
|
|
@@ -14682,10 +14588,10 @@ defineFunctionBuilders({
|
|
|
14682
14588
|
var node;
|
|
14683
14589
|
|
|
14684
14590
|
if (regularSpace.hasOwnProperty(group.text)) {
|
|
14685
|
-
node = new
|
|
14591
|
+
node = new MathNode("mtext", [new TextNode("\u00a0")]);
|
|
14686
14592
|
} else if (cssSpace.hasOwnProperty(group.text)) {
|
|
14687
14593
|
// CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
|
|
14688
|
-
return new
|
|
14594
|
+
return new MathNode("mspace");
|
|
14689
14595
|
} else {
|
|
14690
14596
|
throw new ParseError("Unknown type of space \"" + group.text + "\"");
|
|
14691
14597
|
}
|
|
@@ -14696,7 +14602,7 @@ defineFunctionBuilders({
|
|
|
14696
14602
|
});
|
|
14697
14603
|
|
|
14698
14604
|
var pad = () => {
|
|
14699
|
-
var padNode = new
|
|
14605
|
+
var padNode = new MathNode("mtd", []);
|
|
14700
14606
|
padNode.setAttribute("width", "50%");
|
|
14701
14607
|
return padNode;
|
|
14702
14608
|
};
|
|
@@ -14705,7 +14611,7 @@ defineFunctionBuilders({
|
|
|
14705
14611
|
type: "tag",
|
|
14706
14612
|
|
|
14707
14613
|
mathmlBuilder(group, options) {
|
|
14708
|
-
var table = new
|
|
14614
|
+
var table = new MathNode("mtable", [new MathNode("mtr", [pad(), new MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
|
|
14709
14615
|
table.setAttribute("width", "100%");
|
|
14710
14616
|
return table; // TODO: Left-aligned tags.
|
|
14711
14617
|
// Currently, the group and options passed here do not contain
|
|
@@ -14780,7 +14686,7 @@ defineFunction({
|
|
|
14780
14686
|
htmlBuilder(group, options) {
|
|
14781
14687
|
var newOptions = optionsWithFont(group, options);
|
|
14782
14688
|
var inner = buildExpression$1(group.body, newOptions, true);
|
|
14783
|
-
return
|
|
14689
|
+
return makeSpan(["mord", "text"], inner, newOptions);
|
|
14784
14690
|
},
|
|
14785
14691
|
|
|
14786
14692
|
mathmlBuilder(group, options) {
|
|
@@ -14814,10 +14720,10 @@ defineFunction({
|
|
|
14814
14720
|
// Build the inner group.
|
|
14815
14721
|
var innerGroup = buildGroup$1(group.body, options); // Create the line to go below the body
|
|
14816
14722
|
|
|
14817
|
-
var line =
|
|
14723
|
+
var line = makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns
|
|
14818
14724
|
|
|
14819
14725
|
var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
|
|
14820
|
-
var vlist =
|
|
14726
|
+
var vlist = makeVList({
|
|
14821
14727
|
positionType: "top",
|
|
14822
14728
|
positionData: innerGroup.height,
|
|
14823
14729
|
children: [{
|
|
@@ -14833,14 +14739,14 @@ defineFunction({
|
|
|
14833
14739
|
type: "elem",
|
|
14834
14740
|
elem: innerGroup
|
|
14835
14741
|
}]
|
|
14836
|
-
}
|
|
14837
|
-
return
|
|
14742
|
+
});
|
|
14743
|
+
return makeSpan(["mord", "underline"], [vlist], options);
|
|
14838
14744
|
},
|
|
14839
14745
|
|
|
14840
14746
|
mathmlBuilder(group, options) {
|
|
14841
|
-
var operator = new
|
|
14747
|
+
var operator = new MathNode("mo", [new TextNode("\u203e")]);
|
|
14842
14748
|
operator.setAttribute("stretchy", "true");
|
|
14843
|
-
var node = new
|
|
14749
|
+
var node = new MathNode("munder", [buildGroup(group.body, options), operator]);
|
|
14844
14750
|
node.setAttribute("accentunder", "true");
|
|
14845
14751
|
return node;
|
|
14846
14752
|
}
|
|
@@ -14872,21 +14778,21 @@ defineFunction({
|
|
|
14872
14778
|
var body = buildGroup$1(group.body, options);
|
|
14873
14779
|
var axisHeight = options.fontMetrics().axisHeight;
|
|
14874
14780
|
var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
|
|
14875
|
-
return
|
|
14781
|
+
return makeVList({
|
|
14876
14782
|
positionType: "shift",
|
|
14877
14783
|
positionData: dy,
|
|
14878
14784
|
children: [{
|
|
14879
14785
|
type: "elem",
|
|
14880
14786
|
elem: body
|
|
14881
14787
|
}]
|
|
14882
|
-
}
|
|
14788
|
+
});
|
|
14883
14789
|
},
|
|
14884
14790
|
|
|
14885
14791
|
mathmlBuilder(group, options) {
|
|
14886
14792
|
// There is no way to do this in MathML.
|
|
14887
14793
|
// Write a class as a breadcrumb in case some post-processor wants
|
|
14888
14794
|
// to perform a vcenter adjustment.
|
|
14889
|
-
return new
|
|
14795
|
+
return new MathNode("mpadded", [buildGroup(group.body, options)], ["vcenter"]);
|
|
14890
14796
|
}
|
|
14891
14797
|
|
|
14892
14798
|
});
|
|
@@ -14920,15 +14826,15 @@ defineFunction({
|
|
|
14920
14826
|
c = '\\textasciitilde';
|
|
14921
14827
|
}
|
|
14922
14828
|
|
|
14923
|
-
body.push(
|
|
14829
|
+
body.push(makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
|
|
14924
14830
|
}
|
|
14925
14831
|
|
|
14926
|
-
return
|
|
14832
|
+
return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), tryCombineChars(body), newOptions);
|
|
14927
14833
|
},
|
|
14928
14834
|
|
|
14929
14835
|
mathmlBuilder(group, options) {
|
|
14930
|
-
var text = new
|
|
14931
|
-
var node = new
|
|
14836
|
+
var text = new TextNode(makeVerb(group));
|
|
14837
|
+
var node = new MathNode("mtext", [text]);
|
|
14932
14838
|
node.setAttribute("mathvariant", "monospace");
|
|
14933
14839
|
return node;
|
|
14934
14840
|
}
|
|
@@ -15519,7 +15425,7 @@ defineMacro("\\underbar", "\\underline{\\text{#1}}"); // \not is defined by base
|
|
|
15519
15425
|
// width but extends to the right. We use \rlap to get that spacing.
|
|
15520
15426
|
// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
|
|
15521
15427
|
|
|
15522
|
-
defineMacro("\\not",
|
|
15428
|
+
defineMacro("\\not", "\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}" + "{\\char\"338}"); // Negated symbols from base/fontmath.ltx:
|
|
15523
15429
|
// \def\neq{\not=} \let\ne=\neq
|
|
15524
15430
|
// \DeclareRobustCommand
|
|
15525
15431
|
// \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
|
|
@@ -15653,6 +15559,7 @@ var dotsByToken = {
|
|
|
15653
15559
|
// Symbols whose definition starts with \DOTSX:
|
|
15654
15560
|
'\\DOTSX': '\\dotsx'
|
|
15655
15561
|
};
|
|
15562
|
+
var dotsbGroups = new Set(['bin', 'rel']);
|
|
15656
15563
|
defineMacro("\\dots", function (context) {
|
|
15657
15564
|
// TODO: If used in text mode, should expand to \textellipsis.
|
|
15658
15565
|
// However, in KaTeX, \textellipsis and \ldots behave the same
|
|
@@ -15667,7 +15574,7 @@ defineMacro("\\dots", function (context) {
|
|
|
15667
15574
|
} else if (next.slice(0, 4) === '\\not') {
|
|
15668
15575
|
thedots = '\\dotsb';
|
|
15669
15576
|
} else if (next in symbols.math) {
|
|
15670
|
-
if (
|
|
15577
|
+
if (dotsbGroups.has(symbols.math[next].group)) {
|
|
15671
15578
|
thedots = '\\dotsb';
|
|
15672
15579
|
}
|
|
15673
15580
|
}
|
|
@@ -16641,10 +16548,10 @@ class MacroExpander {
|
|
|
16641
16548
|
if (typeof expansion === "string") {
|
|
16642
16549
|
var numArgs = 0;
|
|
16643
16550
|
|
|
16644
|
-
if (expansion.
|
|
16551
|
+
if (expansion.includes("#")) {
|
|
16645
16552
|
var stripped = expansion.replace(/##/g, "");
|
|
16646
16553
|
|
|
16647
|
-
while (stripped.
|
|
16554
|
+
while (stripped.includes("#" + (numArgs + 1))) {
|
|
16648
16555
|
++numArgs;
|
|
16649
16556
|
}
|
|
16650
16557
|
}
|
|
@@ -17369,7 +17276,7 @@ class Parser {
|
|
|
17369
17276
|
|
|
17370
17277
|
var lex = this.fetch();
|
|
17371
17278
|
|
|
17372
|
-
if (Parser.endOfExpression.
|
|
17279
|
+
if (Parser.endOfExpression.has(lex.text)) {
|
|
17373
17280
|
break;
|
|
17374
17281
|
}
|
|
17375
17282
|
|
|
@@ -18221,7 +18128,7 @@ class Parser {
|
|
|
18221
18128
|
var symbol;
|
|
18222
18129
|
|
|
18223
18130
|
if (symbols[this.mode][text]) {
|
|
18224
|
-
if (this.settings.strict && this.mode === 'math' && extraLatin.
|
|
18131
|
+
if (this.settings.strict && this.mode === 'math' && extraLatin.includes(text)) {
|
|
18225
18132
|
this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
|
|
18226
18133
|
}
|
|
18227
18134
|
|
|
@@ -18312,7 +18219,7 @@ class Parser {
|
|
|
18312
18219
|
}
|
|
18313
18220
|
|
|
18314
18221
|
}
|
|
18315
|
-
Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
|
|
18222
|
+
Parser.endOfExpression = new Set(["}", "\\endgroup", "\\end", "\\right", "&"]);
|
|
18316
18223
|
|
|
18317
18224
|
/**
|
|
18318
18225
|
* Provides a single function for parsing an expression using a Parser
|
|
@@ -18405,7 +18312,7 @@ var renderError = function renderError(error, expression, options) {
|
|
|
18405
18312
|
throw error;
|
|
18406
18313
|
}
|
|
18407
18314
|
|
|
18408
|
-
var node =
|
|
18315
|
+
var node = makeSpan(["katex-error"], [new SymbolNode(expression)]);
|
|
18409
18316
|
node.setAttribute("title", error.toString());
|
|
18410
18317
|
node.setAttribute("style", "color:" + options.errorColor);
|
|
18411
18318
|
return node;
|
|
@@ -18443,7 +18350,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
|
|
|
18443
18350
|
}
|
|
18444
18351
|
};
|
|
18445
18352
|
|
|
18446
|
-
var version = "0.16.
|
|
18353
|
+
var version = "0.16.30";
|
|
18447
18354
|
var __domTree = {
|
|
18448
18355
|
Span,
|
|
18449
18356
|
Anchor,
|