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.js
CHANGED
|
@@ -39,7 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
"default": function() { return /* binding */ katex_webpack; }
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
;//
|
|
42
|
+
;// ./src/ParseError.js
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -124,27 +124,14 @@ class ParseError {
|
|
|
124
124
|
|
|
125
125
|
ParseError.prototype.__proto__ = Error.prototype;
|
|
126
126
|
/* harmony default export */ var src_ParseError = (ParseError);
|
|
127
|
-
;//
|
|
127
|
+
;// ./src/utils.js
|
|
128
128
|
/**
|
|
129
129
|
* This file contains a list of utility functions which are useful in other
|
|
130
130
|
* files.
|
|
131
131
|
*/
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Provide a default value if a setting is undefined
|
|
135
|
-
* NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
|
|
136
|
-
*/
|
|
137
|
-
const deflt = function (setting, defaultIfUndefined) {
|
|
138
|
-
return setting === undefined ? defaultIfUndefined : setting;
|
|
139
|
-
}; // hyphenate and escape adapted from Facebook's React under Apache 2 license
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
// hyphenate and escape adapted from Facebook's React under Apache 2 license
|
|
142
133
|
const uppercase = /([A-Z])/g;
|
|
143
|
-
|
|
144
|
-
const hyphenate = function (str) {
|
|
145
|
-
return str.replace(uppercase, "-$1").toLowerCase();
|
|
146
|
-
};
|
|
147
|
-
|
|
134
|
+
const hyphenate = str => str.replace(uppercase, "-$1").toLowerCase();
|
|
148
135
|
const ESCAPE_LOOKUP = {
|
|
149
136
|
"&": "&",
|
|
150
137
|
">": ">",
|
|
@@ -157,17 +144,14 @@ const ESCAPE_REGEX = /[&><"']/g;
|
|
|
157
144
|
* Escapes text to prevent scripting attacks.
|
|
158
145
|
*/
|
|
159
146
|
|
|
160
|
-
|
|
161
|
-
return String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
|
162
|
-
}
|
|
147
|
+
const utils_escape = text => String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
|
163
148
|
/**
|
|
164
149
|
* Sometimes we want to pull out the innermost element of a group. In most
|
|
165
150
|
* cases, this will just be the group itself, but when ordgroups and colors have
|
|
166
151
|
* a single element, we want to pull that out.
|
|
167
152
|
*/
|
|
168
153
|
|
|
169
|
-
|
|
170
|
-
const getBaseElem = function (group) {
|
|
154
|
+
const getBaseElem = group => {
|
|
171
155
|
if (group.type === "ordgroup") {
|
|
172
156
|
if (group.body.length === 1) {
|
|
173
157
|
return getBaseElem(group.body[0]);
|
|
@@ -186,33 +170,21 @@ const getBaseElem = function (group) {
|
|
|
186
170
|
return group;
|
|
187
171
|
}
|
|
188
172
|
};
|
|
173
|
+
const characterNodesTypes = new Set(["mathord", "textord", "atom"]);
|
|
189
174
|
/**
|
|
190
175
|
* TeXbook algorithms often reference "character boxes", which are simply groups
|
|
191
176
|
* with a single character in them. To decide if something is a character box,
|
|
192
177
|
* we find its innermost group, and see if it is a single character.
|
|
193
178
|
*/
|
|
194
179
|
|
|
195
|
-
|
|
196
|
-
const isCharacterBox = function (group) {
|
|
197
|
-
const baseElem = getBaseElem(group); // These are all they types of groups which hold single characters
|
|
198
|
-
|
|
199
|
-
return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const assert = function (value) {
|
|
203
|
-
if (!value) {
|
|
204
|
-
throw new Error('Expected non-null, but got ' + String(value));
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return value;
|
|
208
|
-
};
|
|
180
|
+
const isCharacterBox = group => characterNodesTypes.has(getBaseElem(group).type);
|
|
209
181
|
/**
|
|
210
182
|
* Return the protocol of a URL, or "_relative" if the URL does not specify a
|
|
211
183
|
* protocol (and thus is relative), or `null` if URL has invalid protocol
|
|
212
184
|
* (so should be outright rejected).
|
|
213
185
|
*/
|
|
214
186
|
|
|
215
|
-
const protocolFromUrl =
|
|
187
|
+
const protocolFromUrl = url => {
|
|
216
188
|
// Check for possible leading protocol.
|
|
217
189
|
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
|
|
218
190
|
// (U+20) or C0 control (U+00-U+1F) characters.
|
|
@@ -237,15 +209,7 @@ const protocolFromUrl = function (url) {
|
|
|
237
209
|
|
|
238
210
|
return protocol[1].toLowerCase();
|
|
239
211
|
};
|
|
240
|
-
|
|
241
|
-
deflt,
|
|
242
|
-
escape: utils_escape,
|
|
243
|
-
hyphenate,
|
|
244
|
-
getBaseElem,
|
|
245
|
-
isCharacterBox,
|
|
246
|
-
protocolFromUrl
|
|
247
|
-
});
|
|
248
|
-
;// CONCATENATED MODULE: ./src/Settings.js
|
|
212
|
+
;// ./src/Settings.js
|
|
249
213
|
/* eslint no-console:0 */
|
|
250
214
|
|
|
251
215
|
/**
|
|
@@ -492,7 +456,7 @@ class Settings {
|
|
|
492
456
|
|
|
493
457
|
isTrusted(context) {
|
|
494
458
|
if (context.url && !context.protocol) {
|
|
495
|
-
const protocol =
|
|
459
|
+
const protocol = protocolFromUrl(context.url);
|
|
496
460
|
|
|
497
461
|
if (protocol == null) {
|
|
498
462
|
return false;
|
|
@@ -506,7 +470,7 @@ class Settings {
|
|
|
506
470
|
}
|
|
507
471
|
|
|
508
472
|
}
|
|
509
|
-
;//
|
|
473
|
+
;// ./src/Style.js
|
|
510
474
|
/**
|
|
511
475
|
* This file contains information and classes for the various kinds of styles
|
|
512
476
|
* used in TeX. It provides a generic `Style` class, which holds information
|
|
@@ -617,7 +581,7 @@ const Style_text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the s
|
|
|
617
581
|
SCRIPT: styles[S],
|
|
618
582
|
SCRIPTSCRIPT: styles[SS]
|
|
619
583
|
});
|
|
620
|
-
;//
|
|
584
|
+
;// ./src/unicodeScripts.js
|
|
621
585
|
/*
|
|
622
586
|
* This file defines the Unicode scripts and script families that we
|
|
623
587
|
* support. To add new scripts or families, just add a new entry to the
|
|
@@ -732,7 +696,7 @@ function supportedCodepoint(codepoint) {
|
|
|
732
696
|
|
|
733
697
|
return false;
|
|
734
698
|
}
|
|
735
|
-
;//
|
|
699
|
+
;// ./src/svgGeometry.js
|
|
736
700
|
/**
|
|
737
701
|
* This file provides support to domTree.js and delimiter.js.
|
|
738
702
|
* It's a storehouse of path geometry for SVG images.
|
|
@@ -979,7 +943,7 @@ const tallDelim = function (label, midHeight) {
|
|
|
979
943
|
throw new Error("Unknown stretchy delimiter.");
|
|
980
944
|
}
|
|
981
945
|
};
|
|
982
|
-
;//
|
|
946
|
+
;// ./src/fontMetricsData.js
|
|
983
947
|
// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.
|
|
984
948
|
/* harmony default export */ var fontMetricsData = ({
|
|
985
949
|
"AMS-Regular": {
|
|
@@ -3057,7 +3021,7 @@ const tallDelim = function (label, midHeight) {
|
|
|
3057
3021
|
"9251": [0.11111, 0.21944, 0, 0, 0.525]
|
|
3058
3022
|
}
|
|
3059
3023
|
});
|
|
3060
|
-
;//
|
|
3024
|
+
;// ./src/fontMetrics.js
|
|
3061
3025
|
|
|
3062
3026
|
|
|
3063
3027
|
/**
|
|
@@ -3340,7 +3304,7 @@ function getGlobalMetrics(size) {
|
|
|
3340
3304
|
|
|
3341
3305
|
return fontMetricsBySizeIndex[sizeIndex];
|
|
3342
3306
|
}
|
|
3343
|
-
;//
|
|
3307
|
+
;// ./src/Options.js
|
|
3344
3308
|
/**
|
|
3345
3309
|
* This file contains information about the options that the Parser carries
|
|
3346
3310
|
* around with it while parsing. Data is held in an `Options` object, and when
|
|
@@ -3656,7 +3620,7 @@ class Options {
|
|
|
3656
3620
|
|
|
3657
3621
|
Options.BASESIZE = 6;
|
|
3658
3622
|
/* harmony default export */ var src_Options = (Options);
|
|
3659
|
-
;//
|
|
3623
|
+
;// ./src/units.js
|
|
3660
3624
|
/**
|
|
3661
3625
|
* This file does conversion between units. In particular, it provides
|
|
3662
3626
|
* calculateSize to convert other units into ems.
|
|
@@ -3773,7 +3737,7 @@ const calculateSize = function (sizeValue, options) {
|
|
|
3773
3737
|
const makeEm = function (n) {
|
|
3774
3738
|
return +n.toFixed(4) + "em";
|
|
3775
3739
|
};
|
|
3776
|
-
;//
|
|
3740
|
+
;// ./src/domTree.js
|
|
3777
3741
|
/**
|
|
3778
3742
|
* These objects store the data about the DOM nodes we create, as well as some
|
|
3779
3743
|
* extra data. They can then be transformed into real DOM nodes with the
|
|
@@ -3871,19 +3835,19 @@ const toMarkup = function (tagName) {
|
|
|
3871
3835
|
let markup = "<" + tagName; // Add the class
|
|
3872
3836
|
|
|
3873
3837
|
if (this.classes.length) {
|
|
3874
|
-
markup += " class=\"" +
|
|
3838
|
+
markup += " class=\"" + utils_escape(createClass(this.classes)) + "\"";
|
|
3875
3839
|
}
|
|
3876
3840
|
|
|
3877
3841
|
let styles = ""; // Add the styles, after hyphenation
|
|
3878
3842
|
|
|
3879
3843
|
for (const style in this.style) {
|
|
3880
3844
|
if (this.style.hasOwnProperty(style)) {
|
|
3881
|
-
styles +=
|
|
3845
|
+
styles += hyphenate(style) + ":" + this.style[style] + ";";
|
|
3882
3846
|
}
|
|
3883
3847
|
}
|
|
3884
3848
|
|
|
3885
3849
|
if (styles) {
|
|
3886
|
-
markup += " style=\"" +
|
|
3850
|
+
markup += " style=\"" + utils_escape(styles) + "\"";
|
|
3887
3851
|
} // Add the attributes
|
|
3888
3852
|
|
|
3889
3853
|
|
|
@@ -3893,7 +3857,7 @@ const toMarkup = function (tagName) {
|
|
|
3893
3857
|
throw new src_ParseError("Invalid attribute name '" + attr + "'");
|
|
3894
3858
|
}
|
|
3895
3859
|
|
|
3896
|
-
markup += " " + attr + "=\"" +
|
|
3860
|
+
markup += " " + attr + "=\"" + utils_escape(this.attributes[attr]) + "\"";
|
|
3897
3861
|
}
|
|
3898
3862
|
}
|
|
3899
3863
|
|
|
@@ -4036,18 +4000,18 @@ class Img {
|
|
|
4036
4000
|
}
|
|
4037
4001
|
|
|
4038
4002
|
toMarkup() {
|
|
4039
|
-
let markup = "<img src=\"" +
|
|
4003
|
+
let markup = "<img src=\"" + utils_escape(this.src) + "\"" + (" alt=\"" + utils_escape(this.alt) + "\""); // Add the styles, after hyphenation
|
|
4040
4004
|
|
|
4041
4005
|
let styles = "";
|
|
4042
4006
|
|
|
4043
4007
|
for (const style in this.style) {
|
|
4044
4008
|
if (this.style.hasOwnProperty(style)) {
|
|
4045
|
-
styles +=
|
|
4009
|
+
styles += hyphenate(style) + ":" + this.style[style] + ";";
|
|
4046
4010
|
}
|
|
4047
4011
|
}
|
|
4048
4012
|
|
|
4049
4013
|
if (styles) {
|
|
4050
|
-
markup += " style=\"" +
|
|
4014
|
+
markup += " style=\"" + utils_escape(styles) + "\"";
|
|
4051
4015
|
}
|
|
4052
4016
|
|
|
4053
4017
|
markup += "'/>";
|
|
@@ -4159,7 +4123,7 @@ class SymbolNode {
|
|
|
4159
4123
|
if (this.classes.length) {
|
|
4160
4124
|
needsSpan = true;
|
|
4161
4125
|
markup += " class=\"";
|
|
4162
|
-
markup +=
|
|
4126
|
+
markup += utils_escape(createClass(this.classes));
|
|
4163
4127
|
markup += "\"";
|
|
4164
4128
|
}
|
|
4165
4129
|
|
|
@@ -4171,16 +4135,16 @@ class SymbolNode {
|
|
|
4171
4135
|
|
|
4172
4136
|
for (const style in this.style) {
|
|
4173
4137
|
if (this.style.hasOwnProperty(style)) {
|
|
4174
|
-
styles +=
|
|
4138
|
+
styles += hyphenate(style) + ":" + this.style[style] + ";";
|
|
4175
4139
|
}
|
|
4176
4140
|
}
|
|
4177
4141
|
|
|
4178
4142
|
if (styles) {
|
|
4179
4143
|
needsSpan = true;
|
|
4180
|
-
markup += " style=\"" +
|
|
4144
|
+
markup += " style=\"" + utils_escape(styles) + "\"";
|
|
4181
4145
|
}
|
|
4182
4146
|
|
|
4183
|
-
const escaped =
|
|
4147
|
+
const escaped = utils_escape(this.text);
|
|
4184
4148
|
|
|
4185
4149
|
if (needsSpan) {
|
|
4186
4150
|
markup += ">";
|
|
@@ -4227,7 +4191,7 @@ class SvgNode {
|
|
|
4227
4191
|
|
|
4228
4192
|
for (const attr in this.attributes) {
|
|
4229
4193
|
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4230
|
-
markup += " " + attr + "=\"" +
|
|
4194
|
+
markup += " " + attr + "=\"" + utils_escape(this.attributes[attr]) + "\"";
|
|
4231
4195
|
}
|
|
4232
4196
|
}
|
|
4233
4197
|
|
|
@@ -4265,9 +4229,9 @@ class PathNode {
|
|
|
4265
4229
|
|
|
4266
4230
|
toMarkup() {
|
|
4267
4231
|
if (this.alternate) {
|
|
4268
|
-
return "<path d=\"" +
|
|
4232
|
+
return "<path d=\"" + utils_escape(this.alternate) + "\"/>";
|
|
4269
4233
|
} else {
|
|
4270
|
-
return "<path d=\"" +
|
|
4234
|
+
return "<path d=\"" + utils_escape(path[this.pathName]) + "\"/>";
|
|
4271
4235
|
}
|
|
4272
4236
|
}
|
|
4273
4237
|
|
|
@@ -4296,7 +4260,7 @@ class LineNode {
|
|
|
4296
4260
|
|
|
4297
4261
|
for (const attr in this.attributes) {
|
|
4298
4262
|
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4299
|
-
markup += " " + attr + "=\"" +
|
|
4263
|
+
markup += " " + attr + "=\"" + utils_escape(this.attributes[attr]) + "\"";
|
|
4300
4264
|
}
|
|
4301
4265
|
}
|
|
4302
4266
|
|
|
@@ -4319,7 +4283,7 @@ function assertSpan(group) {
|
|
|
4319
4283
|
throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
|
|
4320
4284
|
}
|
|
4321
4285
|
}
|
|
4322
|
-
;//
|
|
4286
|
+
;// ./src/symbols.js
|
|
4323
4287
|
/**
|
|
4324
4288
|
* This file holds a list of all no-argument functions and single-character
|
|
4325
4289
|
* symbols (like 'a' or ';').
|
|
@@ -5197,7 +5161,7 @@ for (let i = 0; i < extraLatin.length; i++) {
|
|
|
5197
5161
|
defineSymbol(math, main, mathord, ch, ch);
|
|
5198
5162
|
defineSymbol(symbols_text, main, textord, ch, ch);
|
|
5199
5163
|
}
|
|
5200
|
-
;//
|
|
5164
|
+
;// ./src/wide-character.js
|
|
5201
5165
|
/**
|
|
5202
5166
|
* This file provides support for Unicode range U+1D400 to U+1D7FF,
|
|
5203
5167
|
* Mathematical Alphanumeric Symbols.
|
|
@@ -5281,7 +5245,7 @@ const wideCharacterFont = function (wideChar, mode) {
|
|
|
5281
5245
|
throw new src_ParseError("Unsupported character: " + wideChar);
|
|
5282
5246
|
}
|
|
5283
5247
|
};
|
|
5284
|
-
;//
|
|
5248
|
+
;// ./src/tree.js
|
|
5285
5249
|
// To ensure that all nodes have compatible signatures for these methods.
|
|
5286
5250
|
|
|
5287
5251
|
/**
|
|
@@ -5349,7 +5313,7 @@ class DocumentFragment {
|
|
|
5349
5313
|
}
|
|
5350
5314
|
|
|
5351
5315
|
}
|
|
5352
|
-
;//
|
|
5316
|
+
;// ./src/buildCommon.js
|
|
5353
5317
|
/* eslint no-console:0 */
|
|
5354
5318
|
|
|
5355
5319
|
/**
|
|
@@ -5432,7 +5396,6 @@ const makeSymbol = function (value, fontName, mode, options, classes) {
|
|
|
5432
5396
|
* Used for rel, bin, open, close, inner, and punct.
|
|
5433
5397
|
*/
|
|
5434
5398
|
|
|
5435
|
-
|
|
5436
5399
|
const mathsym = function (value, mode, options, classes) {
|
|
5437
5400
|
if (classes === void 0) {
|
|
5438
5401
|
classes = [];
|
|
@@ -5460,7 +5423,6 @@ const mathsym = function (value, mode, options, classes) {
|
|
|
5460
5423
|
* "boldsymbol".
|
|
5461
5424
|
*/
|
|
5462
5425
|
|
|
5463
|
-
|
|
5464
5426
|
const boldsymbol = function (value, mode, options, classes, type) {
|
|
5465
5427
|
if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
|
|
5466
5428
|
return {
|
|
@@ -5555,7 +5517,6 @@ const makeOrd = function (group, options, type) {
|
|
|
5555
5517
|
* and styles.
|
|
5556
5518
|
*/
|
|
5557
5519
|
|
|
5558
|
-
|
|
5559
5520
|
const canCombine = (prev, next) => {
|
|
5560
5521
|
if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {
|
|
5561
5522
|
return false;
|
|
@@ -5616,7 +5577,6 @@ const tryCombineChars = chars => {
|
|
|
5616
5577
|
* children.
|
|
5617
5578
|
*/
|
|
5618
5579
|
|
|
5619
|
-
|
|
5620
5580
|
const sizeElementFromChildren = function (elem) {
|
|
5621
5581
|
let height = 0;
|
|
5622
5582
|
let depth = 0;
|
|
@@ -5659,9 +5619,7 @@ const makeSpan = function (classes, children, options, style) {
|
|
|
5659
5619
|
}; // SVG one is simpler -- doesn't require height, depth, max-font setting.
|
|
5660
5620
|
// This is also a separate method for typesafety.
|
|
5661
5621
|
|
|
5662
|
-
|
|
5663
5622
|
const makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style);
|
|
5664
|
-
|
|
5665
5623
|
const makeLineSpan = function (className, options, thickness) {
|
|
5666
5624
|
const line = makeSpan([className], [], options);
|
|
5667
5625
|
line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
|
|
@@ -5674,7 +5632,6 @@ const makeLineSpan = function (className, options, thickness) {
|
|
|
5674
5632
|
* and options.
|
|
5675
5633
|
*/
|
|
5676
5634
|
|
|
5677
|
-
|
|
5678
5635
|
const makeAnchor = function (href, classes, children, options) {
|
|
5679
5636
|
const anchor = new Anchor(href, classes, children, options);
|
|
5680
5637
|
sizeElementFromChildren(anchor);
|
|
@@ -5684,7 +5641,6 @@ const makeAnchor = function (href, classes, children, options) {
|
|
|
5684
5641
|
* Makes a document fragment with the given list of children.
|
|
5685
5642
|
*/
|
|
5686
5643
|
|
|
5687
|
-
|
|
5688
5644
|
const makeFragment = function (children) {
|
|
5689
5645
|
const fragment = new DocumentFragment(children);
|
|
5690
5646
|
sizeElementFromChildren(fragment);
|
|
@@ -5695,7 +5651,6 @@ const makeFragment = function (children) {
|
|
|
5695
5651
|
* and styles
|
|
5696
5652
|
*/
|
|
5697
5653
|
|
|
5698
|
-
|
|
5699
5654
|
const wrapFragment = function (group, options) {
|
|
5700
5655
|
if (group instanceof DocumentFragment) {
|
|
5701
5656
|
return makeSpan([], [group], options);
|
|
@@ -5704,7 +5659,6 @@ const wrapFragment = function (group, options) {
|
|
|
5704
5659
|
return group;
|
|
5705
5660
|
}; // These are exact object types to catch typos in the names of the optional fields.
|
|
5706
5661
|
|
|
5707
|
-
|
|
5708
5662
|
// Computes the updated `children` list and the overall depth.
|
|
5709
5663
|
//
|
|
5710
5664
|
// This helper function for makeVList makes it easier to enforce type safety by
|
|
@@ -5877,7 +5831,6 @@ const makeVList = function (params, options) {
|
|
|
5877
5831
|
// either a vertical or horizontal list. In KaTeX, at least for now, it's
|
|
5878
5832
|
// static space between elements in a horizontal layout.
|
|
5879
5833
|
|
|
5880
|
-
|
|
5881
5834
|
const makeGlue = (measurement, options) => {
|
|
5882
5835
|
// Make an empty span for the space
|
|
5883
5836
|
const rule = makeSpan(["mspace"], [], options);
|
|
@@ -5886,7 +5839,6 @@ const makeGlue = (measurement, options) => {
|
|
|
5886
5839
|
return rule;
|
|
5887
5840
|
}; // Takes font options, and returns the appropriate fontLookup name
|
|
5888
5841
|
|
|
5889
|
-
|
|
5890
5842
|
const retrieveTextFontName = function (fontFamily, fontWeight, fontShape) {
|
|
5891
5843
|
let baseFontName = "";
|
|
5892
5844
|
|
|
@@ -5999,7 +5951,6 @@ const svgData = {
|
|
|
5999
5951
|
oiiintSize1: ["oiiintSize1", 1.304, 0.499],
|
|
6000
5952
|
oiiintSize2: ["oiiintSize2", 1.98, 0.659]
|
|
6001
5953
|
};
|
|
6002
|
-
|
|
6003
5954
|
const staticSvg = function (value, options) {
|
|
6004
5955
|
// Create a span with inline SVG for the element.
|
|
6005
5956
|
const [pathName, width, height] = svgData[value];
|
|
@@ -6018,25 +5969,7 @@ const staticSvg = function (value, options) {
|
|
|
6018
5969
|
span.style.width = makeEm(width);
|
|
6019
5970
|
return span;
|
|
6020
5971
|
};
|
|
6021
|
-
|
|
6022
|
-
/* harmony default export */ var buildCommon = ({
|
|
6023
|
-
fontMap,
|
|
6024
|
-
makeSymbol,
|
|
6025
|
-
mathsym,
|
|
6026
|
-
makeSpan,
|
|
6027
|
-
makeSvgSpan,
|
|
6028
|
-
makeLineSpan,
|
|
6029
|
-
makeAnchor,
|
|
6030
|
-
makeFragment,
|
|
6031
|
-
wrapFragment,
|
|
6032
|
-
makeVList,
|
|
6033
|
-
makeOrd,
|
|
6034
|
-
makeGlue,
|
|
6035
|
-
staticSvg,
|
|
6036
|
-
svgData,
|
|
6037
|
-
tryCombineChars
|
|
6038
|
-
});
|
|
6039
|
-
;// CONCATENATED MODULE: ./src/spacingData.js
|
|
5972
|
+
;// ./src/spacingData.js
|
|
6040
5973
|
/**
|
|
6041
5974
|
* Describes spaces between different classes of atoms.
|
|
6042
5975
|
*/
|
|
@@ -6129,7 +6062,7 @@ const tightSpacings = {
|
|
|
6129
6062
|
mop: thinspace
|
|
6130
6063
|
}
|
|
6131
6064
|
};
|
|
6132
|
-
;//
|
|
6065
|
+
;// ./src/defineFunction.js
|
|
6133
6066
|
/** Context provided to function handlers for error messages. */
|
|
6134
6067
|
// Note: reverse the order of the return type union will cause a flow error.
|
|
6135
6068
|
// See https://github.com/facebook/flow/issues/3663.
|
|
@@ -6235,7 +6168,7 @@ const normalizeArgument = function (arg) {
|
|
|
6235
6168
|
const ordargument = function (arg) {
|
|
6236
6169
|
return arg.type === "ordgroup" ? arg.body : [arg];
|
|
6237
6170
|
};
|
|
6238
|
-
;//
|
|
6171
|
+
;// ./src/buildHTML.js
|
|
6239
6172
|
/**
|
|
6240
6173
|
* This file does the main work of building a domTree structure from a parse
|
|
6241
6174
|
* tree. The entry point is the `buildHTML` function, which takes a parse tree.
|
|
@@ -6250,12 +6183,11 @@ const ordargument = function (arg) {
|
|
|
6250
6183
|
|
|
6251
6184
|
|
|
6252
6185
|
|
|
6253
|
-
|
|
6186
|
+
// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
|
|
6254
6187
|
// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
|
|
6255
6188
|
// and the text before Rule 19.
|
|
6256
|
-
|
|
6257
|
-
const
|
|
6258
|
-
const binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
|
|
6189
|
+
const binLeftCanceller = new Set(["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]);
|
|
6190
|
+
const binRightCanceller = new Set(["rightmost", "mrel", "mclose", "mpunct"]);
|
|
6259
6191
|
const styleMap = {
|
|
6260
6192
|
"display": src_Style.DISPLAY,
|
|
6261
6193
|
"text": src_Style.TEXT,
|
|
@@ -6301,7 +6233,7 @@ const buildExpression = function (expression, options, isRealGroup, surrounding)
|
|
|
6301
6233
|
} // Combine consecutive domTree.symbolNodes into a single symbolNode.
|
|
6302
6234
|
|
|
6303
6235
|
|
|
6304
|
-
|
|
6236
|
+
tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings
|
|
6305
6237
|
// to avoid processing groups multiple times.
|
|
6306
6238
|
|
|
6307
6239
|
if (!isRealGroup) {
|
|
@@ -6323,8 +6255,8 @@ const buildExpression = function (expression, options, isRealGroup, surrounding)
|
|
|
6323
6255
|
// or "rightmost", respectively, is used to indicate it.
|
|
6324
6256
|
|
|
6325
6257
|
|
|
6326
|
-
const dummyPrev =
|
|
6327
|
-
const dummyNext =
|
|
6258
|
+
const dummyPrev = makeSpan([surrounding[0] || "leftmost"], [], options);
|
|
6259
|
+
const dummyNext = makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element
|
|
6328
6260
|
// of its `classes` array. A later cleanup should ensure this, for
|
|
6329
6261
|
// instance by changing the signature of `makeSpan`.
|
|
6330
6262
|
// Before determining what spaces to insert, perform bin cancellation.
|
|
@@ -6335,9 +6267,9 @@ const buildExpression = function (expression, options, isRealGroup, surrounding)
|
|
|
6335
6267
|
const prevType = prev.classes[0];
|
|
6336
6268
|
const type = node.classes[0];
|
|
6337
6269
|
|
|
6338
|
-
if (prevType === "mbin" && binRightCanceller.
|
|
6270
|
+
if (prevType === "mbin" && binRightCanceller.has(type)) {
|
|
6339
6271
|
prev.classes[0] = "mord";
|
|
6340
|
-
} else if (type === "mbin" && binLeftCanceller.
|
|
6272
|
+
} else if (type === "mbin" && binLeftCanceller.has(prevType)) {
|
|
6341
6273
|
node.classes[0] = "mord";
|
|
6342
6274
|
}
|
|
6343
6275
|
}, {
|
|
@@ -6351,7 +6283,7 @@ const buildExpression = function (expression, options, isRealGroup, surrounding)
|
|
|
6351
6283
|
|
|
6352
6284
|
if (space) {
|
|
6353
6285
|
// Insert glue (spacing) after the `prev`.
|
|
6354
|
-
return
|
|
6286
|
+
return makeGlue(space, glueOptions);
|
|
6355
6287
|
}
|
|
6356
6288
|
}, {
|
|
6357
6289
|
node: dummyPrev
|
|
@@ -6403,7 +6335,7 @@ const traverseNonSpaceNodes = function (nodes, callback, prev, next, isRoot) {
|
|
|
6403
6335
|
if (nonspace) {
|
|
6404
6336
|
prev.node = node;
|
|
6405
6337
|
} else if (isRoot && node.hasClass("newline")) {
|
|
6406
|
-
prev.node =
|
|
6338
|
+
prev.node = makeSpan(["leftmost"]); // treat like beginning of line
|
|
6407
6339
|
}
|
|
6408
6340
|
|
|
6409
6341
|
prev.insertAfter = (index => n => {
|
|
@@ -6462,7 +6394,7 @@ const getTypeOfDomTree = function (node, side) {
|
|
|
6462
6394
|
};
|
|
6463
6395
|
const makeNullDelimiter = function (options, classes) {
|
|
6464
6396
|
const moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
|
|
6465
|
-
return
|
|
6397
|
+
return makeSpan(classes.concat(moreClasses));
|
|
6466
6398
|
};
|
|
6467
6399
|
/**
|
|
6468
6400
|
* buildGroup is the function that takes a group and calls the correct groupType
|
|
@@ -6472,7 +6404,7 @@ const makeNullDelimiter = function (options, classes) {
|
|
|
6472
6404
|
|
|
6473
6405
|
const buildGroup = function (group, options, baseOptions) {
|
|
6474
6406
|
if (!group) {
|
|
6475
|
-
return
|
|
6407
|
+
return makeSpan();
|
|
6476
6408
|
}
|
|
6477
6409
|
|
|
6478
6410
|
if (_htmlGroupBuilders[group.type]) {
|
|
@@ -6482,7 +6414,7 @@ const buildGroup = function (group, options, baseOptions) {
|
|
|
6482
6414
|
// for that size difference.
|
|
6483
6415
|
|
|
6484
6416
|
if (baseOptions && options.size !== baseOptions.size) {
|
|
6485
|
-
groupNode =
|
|
6417
|
+
groupNode = makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
|
|
6486
6418
|
const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
|
|
6487
6419
|
groupNode.height *= multiplier;
|
|
6488
6420
|
groupNode.depth *= multiplier;
|
|
@@ -6502,11 +6434,11 @@ const buildGroup = function (group, options, baseOptions) {
|
|
|
6502
6434
|
|
|
6503
6435
|
function buildHTMLUnbreakable(children, options) {
|
|
6504
6436
|
// Compute height and depth of this chunk.
|
|
6505
|
-
const body =
|
|
6437
|
+
const body = makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at
|
|
6506
6438
|
// the height of the expression, and the bottom of the HTML element
|
|
6507
6439
|
// falls at the depth of the expression.
|
|
6508
6440
|
|
|
6509
|
-
const strut =
|
|
6441
|
+
const strut = makeSpan(["strut"]);
|
|
6510
6442
|
strut.style.height = makeEm(body.height + body.depth);
|
|
6511
6443
|
|
|
6512
6444
|
if (body.depth) {
|
|
@@ -6600,7 +6532,7 @@ function buildHTML(tree, options) {
|
|
|
6600
6532
|
children.push(eqnNum);
|
|
6601
6533
|
}
|
|
6602
6534
|
|
|
6603
|
-
const htmlNode =
|
|
6535
|
+
const htmlNode = makeSpan(["katex-html"], children);
|
|
6604
6536
|
htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children
|
|
6605
6537
|
// (the height of the enclosing htmlNode) for proper vertical alignment.
|
|
6606
6538
|
|
|
@@ -6615,7 +6547,7 @@ function buildHTML(tree, options) {
|
|
|
6615
6547
|
|
|
6616
6548
|
return htmlNode;
|
|
6617
6549
|
}
|
|
6618
|
-
;//
|
|
6550
|
+
;// ./src/mathMLTree.js
|
|
6619
6551
|
/**
|
|
6620
6552
|
* These objects store data about MathML nodes. This is the MathML equivalent
|
|
6621
6553
|
* of the types in domTree.js. Since MathML handles its own rendering, and
|
|
@@ -6713,13 +6645,13 @@ class MathNode {
|
|
|
6713
6645
|
for (const attr in this.attributes) {
|
|
6714
6646
|
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
6715
6647
|
markup += " " + attr + "=\"";
|
|
6716
|
-
markup +=
|
|
6648
|
+
markup += utils_escape(this.attributes[attr]);
|
|
6717
6649
|
markup += "\"";
|
|
6718
6650
|
}
|
|
6719
6651
|
}
|
|
6720
6652
|
|
|
6721
6653
|
if (this.classes.length > 0) {
|
|
6722
|
-
markup += " class =\"" +
|
|
6654
|
+
markup += " class =\"" + utils_escape(createClass(this.classes)) + "\"";
|
|
6723
6655
|
}
|
|
6724
6656
|
|
|
6725
6657
|
markup += ">";
|
|
@@ -6765,7 +6697,7 @@ class TextNode {
|
|
|
6765
6697
|
|
|
6766
6698
|
|
|
6767
6699
|
toMarkup() {
|
|
6768
|
-
return
|
|
6700
|
+
return utils_escape(this.toText());
|
|
6769
6701
|
}
|
|
6770
6702
|
/**
|
|
6771
6703
|
* Converts the text node into a string
|
|
@@ -6855,14 +6787,7 @@ class SpaceNode {
|
|
|
6855
6787
|
}
|
|
6856
6788
|
|
|
6857
6789
|
}
|
|
6858
|
-
|
|
6859
|
-
/* harmony default export */ var mathMLTree = ({
|
|
6860
|
-
MathNode,
|
|
6861
|
-
TextNode,
|
|
6862
|
-
SpaceNode,
|
|
6863
|
-
newDocumentFragment
|
|
6864
|
-
});
|
|
6865
|
-
;// CONCATENATED MODULE: ./src/buildMathML.js
|
|
6790
|
+
;// ./src/buildMathML.js
|
|
6866
6791
|
/**
|
|
6867
6792
|
* This file converts a parse tree into a corresponding MathML tree. The main
|
|
6868
6793
|
* entry point is the `buildMathML` function, which takes a parse tree from the
|
|
@@ -6874,18 +6799,19 @@ class SpaceNode {
|
|
|
6874
6799
|
|
|
6875
6800
|
|
|
6876
6801
|
|
|
6877
|
-
|
|
6878
|
-
|
|
6802
|
+
const noVariantSymbols = new Set(["\\imath", "\\jmath"]);
|
|
6803
|
+
const rowLikeTypes = new Set(["mrow", "mtable"]);
|
|
6879
6804
|
/**
|
|
6880
6805
|
* Takes a symbol and converts it into a MathML text node after performing
|
|
6881
6806
|
* optional replacement from symbols.js.
|
|
6882
6807
|
*/
|
|
6808
|
+
|
|
6883
6809
|
const makeText = function (text, mode, options) {
|
|
6884
6810
|
if (src_symbols[mode][text] && src_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"))) {
|
|
6885
6811
|
text = src_symbols[mode][text].replace;
|
|
6886
6812
|
}
|
|
6887
6813
|
|
|
6888
|
-
return new
|
|
6814
|
+
return new TextNode(text);
|
|
6889
6815
|
};
|
|
6890
6816
|
/**
|
|
6891
6817
|
* Wrap the given array of nodes in an <mrow> node if needed, i.e.,
|
|
@@ -6896,7 +6822,7 @@ const makeRow = function (body) {
|
|
|
6896
6822
|
if (body.length === 1) {
|
|
6897
6823
|
return body[0];
|
|
6898
6824
|
} else {
|
|
6899
|
-
return new
|
|
6825
|
+
return new MathNode("mrow", body);
|
|
6900
6826
|
}
|
|
6901
6827
|
};
|
|
6902
6828
|
/**
|
|
@@ -6958,7 +6884,7 @@ const getVariant = function (group, options) {
|
|
|
6958
6884
|
|
|
6959
6885
|
let text = group.text;
|
|
6960
6886
|
|
|
6961
|
-
if (
|
|
6887
|
+
if (noVariantSymbols.has(text)) {
|
|
6962
6888
|
return null;
|
|
6963
6889
|
}
|
|
6964
6890
|
|
|
@@ -6966,10 +6892,10 @@ const getVariant = function (group, options) {
|
|
|
6966
6892
|
text = src_symbols[mode][text].replace;
|
|
6967
6893
|
}
|
|
6968
6894
|
|
|
6969
|
-
const fontName =
|
|
6895
|
+
const fontName = fontMap[font].fontName;
|
|
6970
6896
|
|
|
6971
6897
|
if (getCharacterMetrics(text, fontName, mode)) {
|
|
6972
|
-
return
|
|
6898
|
+
return fontMap[font].variant;
|
|
6973
6899
|
}
|
|
6974
6900
|
|
|
6975
6901
|
return null;
|
|
@@ -7081,7 +7007,7 @@ const buildExpressionRow = function (expression, options, isOrdgroup) {
|
|
|
7081
7007
|
|
|
7082
7008
|
const buildMathML_buildGroup = function (group, options) {
|
|
7083
7009
|
if (!group) {
|
|
7084
|
-
return new
|
|
7010
|
+
return new MathNode("mrow");
|
|
7085
7011
|
}
|
|
7086
7012
|
|
|
7087
7013
|
if (_mathmlGroupBuilders[group.type]) {
|
|
@@ -7113,17 +7039,17 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly)
|
|
|
7113
7039
|
|
|
7114
7040
|
let wrapper;
|
|
7115
7041
|
|
|
7116
|
-
if (expression.length === 1 && expression[0] instanceof MathNode &&
|
|
7042
|
+
if (expression.length === 1 && expression[0] instanceof MathNode && rowLikeTypes.has(expression[0].type)) {
|
|
7117
7043
|
wrapper = expression[0];
|
|
7118
7044
|
} else {
|
|
7119
|
-
wrapper = new
|
|
7045
|
+
wrapper = new MathNode("mrow", expression);
|
|
7120
7046
|
} // Build a TeX annotation of the source
|
|
7121
7047
|
|
|
7122
7048
|
|
|
7123
|
-
const annotation = new
|
|
7049
|
+
const annotation = new MathNode("annotation", [new TextNode(texExpression)]);
|
|
7124
7050
|
annotation.setAttribute("encoding", "application/x-tex");
|
|
7125
|
-
const semantics = new
|
|
7126
|
-
const math = new
|
|
7051
|
+
const semantics = new MathNode("semantics", [wrapper, annotation]);
|
|
7052
|
+
const math = new MathNode("math", [semantics]);
|
|
7127
7053
|
math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
|
|
7128
7054
|
|
|
7129
7055
|
if (isDisplayMode) {
|
|
@@ -7136,9 +7062,9 @@ function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly)
|
|
|
7136
7062
|
|
|
7137
7063
|
const wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe
|
|
7138
7064
|
|
|
7139
|
-
return
|
|
7065
|
+
return makeSpan([wrapperClass], [math]);
|
|
7140
7066
|
}
|
|
7141
|
-
;//
|
|
7067
|
+
;// ./src/buildTree.js
|
|
7142
7068
|
|
|
7143
7069
|
|
|
7144
7070
|
|
|
@@ -7166,7 +7092,7 @@ const displayWrap = function (node, settings) {
|
|
|
7166
7092
|
classes.push("fleqn");
|
|
7167
7093
|
}
|
|
7168
7094
|
|
|
7169
|
-
node =
|
|
7095
|
+
node = makeSpan(classes, [node]);
|
|
7170
7096
|
}
|
|
7171
7097
|
|
|
7172
7098
|
return node;
|
|
@@ -7180,11 +7106,11 @@ const buildTree = function (tree, expression, settings) {
|
|
|
7180
7106
|
return buildMathML(tree, expression, options, settings.displayMode, true);
|
|
7181
7107
|
} else if (settings.output === "html") {
|
|
7182
7108
|
const htmlNode = buildHTML(tree, options);
|
|
7183
|
-
katexNode =
|
|
7109
|
+
katexNode = makeSpan(["katex"], [htmlNode]);
|
|
7184
7110
|
} else {
|
|
7185
7111
|
const mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);
|
|
7186
7112
|
const htmlNode = buildHTML(tree, options);
|
|
7187
|
-
katexNode =
|
|
7113
|
+
katexNode = makeSpan(["katex"], [mathMLNode, htmlNode]);
|
|
7188
7114
|
}
|
|
7189
7115
|
|
|
7190
7116
|
return displayWrap(katexNode, settings);
|
|
@@ -7192,11 +7118,11 @@ const buildTree = function (tree, expression, settings) {
|
|
|
7192
7118
|
const buildHTMLTree = function (tree, expression, settings) {
|
|
7193
7119
|
const options = optionsFromSettings(settings);
|
|
7194
7120
|
const htmlNode = buildHTML(tree, options);
|
|
7195
|
-
const katexNode =
|
|
7121
|
+
const katexNode = makeSpan(["katex"], [htmlNode]);
|
|
7196
7122
|
return displayWrap(katexNode, settings);
|
|
7197
7123
|
};
|
|
7198
7124
|
/* harmony default export */ var src_buildTree = ((/* unused pure expression or super */ null && (buildTree)));
|
|
7199
|
-
;//
|
|
7125
|
+
;// ./src/stretchy.js
|
|
7200
7126
|
/**
|
|
7201
7127
|
* This file provides support to buildMathML.js and buildHTML.js
|
|
7202
7128
|
* for stretchy wide elements rendered from SVG files
|
|
@@ -7252,9 +7178,8 @@ const stretchyCodePoint = {
|
|
|
7252
7178
|
"\\cdleftarrow": "\u2190",
|
|
7253
7179
|
"\\cdlongequal": "="
|
|
7254
7180
|
};
|
|
7255
|
-
|
|
7256
|
-
const
|
|
7257
|
-
const node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, '')])]);
|
|
7181
|
+
const stretchyMathML = function (label) {
|
|
7182
|
+
const node = new MathNode("mo", [new TextNode(stretchyCodePoint[label.replace(/^\\/, '')])]);
|
|
7258
7183
|
node.setAttribute("stretchy", "true");
|
|
7259
7184
|
return node;
|
|
7260
7185
|
}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
|
|
@@ -7294,7 +7219,6 @@ const mathMLnode = function (label) {
|
|
|
7294
7219
|
// That is, inside the font, that arrowhead is 522 units tall, which
|
|
7295
7220
|
// corresponds to 0.522 em inside the document.
|
|
7296
7221
|
|
|
7297
|
-
|
|
7298
7222
|
const katexImagesData = {
|
|
7299
7223
|
// path(s), minWidth, height, align
|
|
7300
7224
|
overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
|
|
@@ -7343,30 +7267,22 @@ const katexImagesData = {
|
|
|
7343
7267
|
xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
|
|
7344
7268
|
xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
|
|
7345
7269
|
};
|
|
7346
|
-
|
|
7347
|
-
const
|
|
7348
|
-
if (arg.type === "ordgroup") {
|
|
7349
|
-
return arg.body.length;
|
|
7350
|
-
} else {
|
|
7351
|
-
return 1;
|
|
7352
|
-
}
|
|
7353
|
-
};
|
|
7354
|
-
|
|
7355
|
-
const svgSpan = function (group, options) {
|
|
7270
|
+
const wideAccentLabels = new Set(["widehat", "widecheck", "widetilde", "utilde"]);
|
|
7271
|
+
const stretchySvg = function (group, options) {
|
|
7356
7272
|
// Create a span with inline SVG for the element.
|
|
7357
7273
|
function buildSvgSpan_() {
|
|
7358
7274
|
let viewBoxWidth = 400000; // default
|
|
7359
7275
|
|
|
7360
7276
|
const label = group.label.slice(1);
|
|
7361
7277
|
|
|
7362
|
-
if (
|
|
7278
|
+
if (wideAccentLabels.has(label)) {
|
|
7363
7279
|
// Each type in the `if` statement corresponds to one of the ParseNode
|
|
7364
7280
|
// types below. This narrowing is required to access `grp.base`.
|
|
7365
7281
|
// $FlowFixMe
|
|
7366
7282
|
const grp = group; // There are four SVG images available for each function.
|
|
7367
7283
|
// Choose a taller image when there are more characters.
|
|
7368
7284
|
|
|
7369
|
-
const numChars =
|
|
7285
|
+
const numChars = grp.base.type === "ordgroup" ? grp.base.body.length : 1;
|
|
7370
7286
|
let viewBoxHeight;
|
|
7371
7287
|
let pathName;
|
|
7372
7288
|
let height;
|
|
@@ -7407,7 +7323,7 @@ const svgSpan = function (group, options) {
|
|
|
7407
7323
|
"preserveAspectRatio": "none"
|
|
7408
7324
|
});
|
|
7409
7325
|
return {
|
|
7410
|
-
span:
|
|
7326
|
+
span: makeSvgSpan([], [svgNode], options),
|
|
7411
7327
|
minWidth: 0,
|
|
7412
7328
|
height
|
|
7413
7329
|
};
|
|
@@ -7443,7 +7359,7 @@ const svgSpan = function (group, options) {
|
|
|
7443
7359
|
"viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
|
|
7444
7360
|
"preserveAspectRatio": aligns[i] + " slice"
|
|
7445
7361
|
});
|
|
7446
|
-
const span =
|
|
7362
|
+
const span = makeSvgSpan([widthClasses[i]], [svgNode], options);
|
|
7447
7363
|
|
|
7448
7364
|
if (numSvgChildren === 1) {
|
|
7449
7365
|
return {
|
|
@@ -7458,7 +7374,7 @@ const svgSpan = function (group, options) {
|
|
|
7458
7374
|
}
|
|
7459
7375
|
|
|
7460
7376
|
return {
|
|
7461
|
-
span:
|
|
7377
|
+
span: makeSpan(["stretchy"], spans, options),
|
|
7462
7378
|
minWidth,
|
|
7463
7379
|
height
|
|
7464
7380
|
};
|
|
@@ -7482,14 +7398,13 @@ const svgSpan = function (group, options) {
|
|
|
7482
7398
|
|
|
7483
7399
|
return span;
|
|
7484
7400
|
};
|
|
7485
|
-
|
|
7486
|
-
const encloseSpan = function (inner, label, topPad, bottomPad, options) {
|
|
7401
|
+
const stretchyEnclose = function (inner, label, topPad, bottomPad, options) {
|
|
7487
7402
|
// Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl
|
|
7488
7403
|
let img;
|
|
7489
7404
|
const totalHeight = inner.height + inner.depth + topPad + bottomPad;
|
|
7490
7405
|
|
|
7491
7406
|
if (/fbox|color|angl/.test(label)) {
|
|
7492
|
-
img =
|
|
7407
|
+
img = makeSpan(["stretchy", label], [], options);
|
|
7493
7408
|
|
|
7494
7409
|
if (label === "fbox") {
|
|
7495
7410
|
const color = options.color && options.getColor();
|
|
@@ -7528,20 +7443,14 @@ const encloseSpan = function (inner, label, topPad, bottomPad, options) {
|
|
|
7528
7443
|
"width": "100%",
|
|
7529
7444
|
"height": makeEm(totalHeight)
|
|
7530
7445
|
});
|
|
7531
|
-
img =
|
|
7446
|
+
img = makeSvgSpan([], [svgNode], options);
|
|
7532
7447
|
}
|
|
7533
7448
|
|
|
7534
7449
|
img.height = totalHeight;
|
|
7535
7450
|
img.style.height = makeEm(totalHeight);
|
|
7536
7451
|
return img;
|
|
7537
7452
|
};
|
|
7538
|
-
|
|
7539
|
-
/* harmony default export */ var stretchy = ({
|
|
7540
|
-
encloseSpan,
|
|
7541
|
-
mathMLnode,
|
|
7542
|
-
svgSpan
|
|
7543
|
-
});
|
|
7544
|
-
;// CONCATENATED MODULE: ./src/parseNode.js
|
|
7453
|
+
;// ./src/parseNode.js
|
|
7545
7454
|
|
|
7546
7455
|
|
|
7547
7456
|
/**
|
|
@@ -7583,7 +7492,7 @@ function checkSymbolNodeType(node) {
|
|
|
7583
7492
|
|
|
7584
7493
|
return null;
|
|
7585
7494
|
}
|
|
7586
|
-
;//
|
|
7495
|
+
;// ./src/functions/accent.js
|
|
7587
7496
|
|
|
7588
7497
|
|
|
7589
7498
|
|
|
@@ -7629,7 +7538,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7629
7538
|
|
|
7630
7539
|
const body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?
|
|
7631
7540
|
|
|
7632
|
-
const mustShift = group.isShifty &&
|
|
7541
|
+
const mustShift = group.isShifty && isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the
|
|
7633
7542
|
// nucleus is not a single character, let s = 0; otherwise set s to the
|
|
7634
7543
|
// kern amount for the nucleus followed by the \skewchar of its font."
|
|
7635
7544
|
// Note that our skew metrics are just the kern between each character
|
|
@@ -7640,7 +7549,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7640
7549
|
if (mustShift) {
|
|
7641
7550
|
// If the base is a character box, then we want the skew of the
|
|
7642
7551
|
// innermost character. To do that, we find the innermost character:
|
|
7643
|
-
const baseChar =
|
|
7552
|
+
const baseChar = getBaseElem(base); // Then, we render its group to get the symbol inside it
|
|
7644
7553
|
|
|
7645
7554
|
const baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.
|
|
7646
7555
|
|
|
@@ -7666,10 +7575,10 @@ const htmlBuilder = (grp, options) => {
|
|
|
7666
7575
|
// render combining characters when not preceded by a character.
|
|
7667
7576
|
// So now we use an SVG.
|
|
7668
7577
|
// If Safari reforms, we should consider reverting to the glyph.
|
|
7669
|
-
accent =
|
|
7670
|
-
width =
|
|
7578
|
+
accent = staticSvg("vec", options);
|
|
7579
|
+
width = svgData.vec[1];
|
|
7671
7580
|
} else {
|
|
7672
|
-
accent =
|
|
7581
|
+
accent = makeOrd({
|
|
7673
7582
|
mode: group.mode,
|
|
7674
7583
|
text: group.label
|
|
7675
7584
|
}, options, "textord");
|
|
@@ -7684,7 +7593,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7684
7593
|
}
|
|
7685
7594
|
}
|
|
7686
7595
|
|
|
7687
|
-
accentBody =
|
|
7596
|
+
accentBody = makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be
|
|
7688
7597
|
// at least the width of the accent, and overlap directly onto the
|
|
7689
7598
|
// character without any vertical offset.
|
|
7690
7599
|
|
|
@@ -7712,7 +7621,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7712
7621
|
accentBody.style.top = ".2em";
|
|
7713
7622
|
}
|
|
7714
7623
|
|
|
7715
|
-
accentBody =
|
|
7624
|
+
accentBody = makeVList({
|
|
7716
7625
|
positionType: "firstBaseline",
|
|
7717
7626
|
children: [{
|
|
7718
7627
|
type: "elem",
|
|
@@ -7726,8 +7635,8 @@ const htmlBuilder = (grp, options) => {
|
|
|
7726
7635
|
}]
|
|
7727
7636
|
}, options);
|
|
7728
7637
|
} else {
|
|
7729
|
-
accentBody =
|
|
7730
|
-
accentBody =
|
|
7638
|
+
accentBody = stretchySvg(group, options);
|
|
7639
|
+
accentBody = makeVList({
|
|
7731
7640
|
positionType: "firstBaseline",
|
|
7732
7641
|
children: [{
|
|
7733
7642
|
type: "elem",
|
|
@@ -7744,7 +7653,7 @@ const htmlBuilder = (grp, options) => {
|
|
|
7744
7653
|
}, options);
|
|
7745
7654
|
}
|
|
7746
7655
|
|
|
7747
|
-
const accentWrap =
|
|
7656
|
+
const accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
|
|
7748
7657
|
|
|
7749
7658
|
if (supSubGroup) {
|
|
7750
7659
|
// Here, we replace the "base" child of the supsub with our newly
|
|
@@ -7762,8 +7671,8 @@ const htmlBuilder = (grp, options) => {
|
|
|
7762
7671
|
};
|
|
7763
7672
|
|
|
7764
7673
|
const mathmlBuilder = (group, options) => {
|
|
7765
|
-
const accentNode = group.isStretchy ?
|
|
7766
|
-
const node = new
|
|
7674
|
+
const accentNode = group.isStretchy ? stretchyMathML(group.label) : new MathNode("mo", [makeText(group.label, group.mode)]);
|
|
7675
|
+
const node = new MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]);
|
|
7767
7676
|
node.setAttribute("accent", "true");
|
|
7768
7677
|
return node;
|
|
7769
7678
|
};
|
|
@@ -7824,7 +7733,7 @@ defineFunction({
|
|
|
7824
7733
|
htmlBuilder,
|
|
7825
7734
|
mathmlBuilder
|
|
7826
7735
|
});
|
|
7827
|
-
;//
|
|
7736
|
+
;// ./src/functions/accentunder.js
|
|
7828
7737
|
// Horizontal overlap functions
|
|
7829
7738
|
|
|
7830
7739
|
|
|
@@ -7854,10 +7763,10 @@ defineFunction({
|
|
|
7854
7763
|
htmlBuilder: (group, options) => {
|
|
7855
7764
|
// Treat under accents much like underlines.
|
|
7856
7765
|
const innerGroup = buildGroup(group.base, options);
|
|
7857
|
-
const accentBody =
|
|
7766
|
+
const accentBody = stretchySvg(group, options);
|
|
7858
7767
|
const kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns
|
|
7859
7768
|
|
|
7860
|
-
const vlist =
|
|
7769
|
+
const vlist = makeVList({
|
|
7861
7770
|
positionType: "top",
|
|
7862
7771
|
positionData: innerGroup.height,
|
|
7863
7772
|
children: [{
|
|
@@ -7872,16 +7781,16 @@ defineFunction({
|
|
|
7872
7781
|
elem: innerGroup
|
|
7873
7782
|
}]
|
|
7874
7783
|
}, options);
|
|
7875
|
-
return
|
|
7784
|
+
return makeSpan(["mord", "accentunder"], [vlist], options);
|
|
7876
7785
|
},
|
|
7877
7786
|
mathmlBuilder: (group, options) => {
|
|
7878
|
-
const accentNode =
|
|
7879
|
-
const node = new
|
|
7787
|
+
const accentNode = stretchyMathML(group.label);
|
|
7788
|
+
const node = new MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]);
|
|
7880
7789
|
node.setAttribute("accentunder", "true");
|
|
7881
7790
|
return node;
|
|
7882
7791
|
}
|
|
7883
7792
|
});
|
|
7884
|
-
;//
|
|
7793
|
+
;// ./src/functions/arrow.js
|
|
7885
7794
|
|
|
7886
7795
|
|
|
7887
7796
|
|
|
@@ -7891,7 +7800,7 @@ defineFunction({
|
|
|
7891
7800
|
|
|
7892
7801
|
// Helper function
|
|
7893
7802
|
const paddedNode = group => {
|
|
7894
|
-
const node = new
|
|
7803
|
+
const node = new MathNode("mpadded", group ? [group] : []);
|
|
7895
7804
|
node.setAttribute("width", "+0.6em");
|
|
7896
7805
|
node.setAttribute("lspace", "0.3em");
|
|
7897
7806
|
return node;
|
|
@@ -7932,7 +7841,7 @@ defineFunction({
|
|
|
7932
7841
|
// them in a span.
|
|
7933
7842
|
|
|
7934
7843
|
let newOptions = options.havingStyle(style.sup());
|
|
7935
|
-
const upperGroup =
|
|
7844
|
+
const upperGroup = wrapFragment(buildGroup(group.body, newOptions, options), options);
|
|
7936
7845
|
const arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
|
|
7937
7846
|
upperGroup.classes.push(arrowPrefix + "-arrow-pad");
|
|
7938
7847
|
let lowerGroup;
|
|
@@ -7940,11 +7849,11 @@ defineFunction({
|
|
|
7940
7849
|
if (group.below) {
|
|
7941
7850
|
// Build the lower group
|
|
7942
7851
|
newOptions = options.havingStyle(style.sub());
|
|
7943
|
-
lowerGroup =
|
|
7852
|
+
lowerGroup = wrapFragment(buildGroup(group.below, newOptions, options), options);
|
|
7944
7853
|
lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
|
|
7945
7854
|
}
|
|
7946
7855
|
|
|
7947
|
-
const arrowBody =
|
|
7856
|
+
const arrowBody = stretchySvg(group, options); // Re shift: Note that stretchySvg returned arrowBody.depth = 0.
|
|
7948
7857
|
// The point we want on the math axis is at 0.5 * arrowBody.height.
|
|
7949
7858
|
|
|
7950
7859
|
const arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
|
|
@@ -7960,7 +7869,7 @@ defineFunction({
|
|
|
7960
7869
|
|
|
7961
7870
|
if (lowerGroup) {
|
|
7962
7871
|
const lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
|
|
7963
|
-
vlist =
|
|
7872
|
+
vlist = makeVList({
|
|
7964
7873
|
positionType: "individualShift",
|
|
7965
7874
|
children: [{
|
|
7966
7875
|
type: "elem",
|
|
@@ -7977,7 +7886,7 @@ defineFunction({
|
|
|
7977
7886
|
}]
|
|
7978
7887
|
}, options);
|
|
7979
7888
|
} else {
|
|
7980
|
-
vlist =
|
|
7889
|
+
vlist = makeVList({
|
|
7981
7890
|
positionType: "individualShift",
|
|
7982
7891
|
children: [{
|
|
7983
7892
|
type: "elem",
|
|
@@ -7993,11 +7902,11 @@ defineFunction({
|
|
|
7993
7902
|
|
|
7994
7903
|
|
|
7995
7904
|
vlist.children[0].children[0].children[1].classes.push("svg-align");
|
|
7996
|
-
return
|
|
7905
|
+
return makeSpan(["mrel", "x-arrow"], [vlist], options);
|
|
7997
7906
|
},
|
|
7998
7907
|
|
|
7999
7908
|
mathmlBuilder(group, options) {
|
|
8000
|
-
const arrowNode =
|
|
7909
|
+
const arrowNode = stretchyMathML(group.label);
|
|
8001
7910
|
arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em");
|
|
8002
7911
|
let node;
|
|
8003
7912
|
|
|
@@ -8006,36 +7915,35 @@ defineFunction({
|
|
|
8006
7915
|
|
|
8007
7916
|
if (group.below) {
|
|
8008
7917
|
const lowerNode = paddedNode(buildMathML_buildGroup(group.below, options));
|
|
8009
|
-
node = new
|
|
7918
|
+
node = new MathNode("munderover", [arrowNode, lowerNode, upperNode]);
|
|
8010
7919
|
} else {
|
|
8011
|
-
node = new
|
|
7920
|
+
node = new MathNode("mover", [arrowNode, upperNode]);
|
|
8012
7921
|
}
|
|
8013
7922
|
} else if (group.below) {
|
|
8014
7923
|
const lowerNode = paddedNode(buildMathML_buildGroup(group.below, options));
|
|
8015
|
-
node = new
|
|
7924
|
+
node = new MathNode("munder", [arrowNode, lowerNode]);
|
|
8016
7925
|
} else {
|
|
8017
7926
|
// This should never happen.
|
|
8018
7927
|
// Parser.js throws an error if there is no argument.
|
|
8019
7928
|
node = paddedNode();
|
|
8020
|
-
node = new
|
|
7929
|
+
node = new MathNode("mover", [arrowNode, node]);
|
|
8021
7930
|
}
|
|
8022
7931
|
|
|
8023
7932
|
return node;
|
|
8024
7933
|
}
|
|
8025
7934
|
|
|
8026
7935
|
});
|
|
8027
|
-
;//
|
|
7936
|
+
;// ./src/functions/mclass.js
|
|
8028
7937
|
|
|
8029
7938
|
|
|
8030
7939
|
|
|
8031
7940
|
|
|
8032
7941
|
|
|
8033
7942
|
|
|
8034
|
-
const mclass_makeSpan = buildCommon.makeSpan;
|
|
8035
7943
|
|
|
8036
7944
|
function mclass_htmlBuilder(group, options) {
|
|
8037
7945
|
const elements = buildExpression(group.body, options, true);
|
|
8038
|
-
return
|
|
7946
|
+
return makeSpan([group.mclass], elements, options);
|
|
8039
7947
|
}
|
|
8040
7948
|
|
|
8041
7949
|
function mclass_mathmlBuilder(group, options) {
|
|
@@ -8043,20 +7951,20 @@ function mclass_mathmlBuilder(group, options) {
|
|
|
8043
7951
|
const inner = buildMathML_buildExpression(group.body, options);
|
|
8044
7952
|
|
|
8045
7953
|
if (group.mclass === "minner") {
|
|
8046
|
-
node = new
|
|
7954
|
+
node = new MathNode("mpadded", inner);
|
|
8047
7955
|
} else if (group.mclass === "mord") {
|
|
8048
7956
|
if (group.isCharacterBox) {
|
|
8049
7957
|
node = inner[0];
|
|
8050
7958
|
node.type = "mi";
|
|
8051
7959
|
} else {
|
|
8052
|
-
node = new
|
|
7960
|
+
node = new MathNode("mi", inner);
|
|
8053
7961
|
}
|
|
8054
7962
|
} else {
|
|
8055
7963
|
if (group.isCharacterBox) {
|
|
8056
7964
|
node = inner[0];
|
|
8057
7965
|
node.type = "mo";
|
|
8058
7966
|
} else {
|
|
8059
|
-
node = new
|
|
7967
|
+
node = new MathNode("mo", inner);
|
|
8060
7968
|
} // Set spacing based on what is the most likely adjacent atom type.
|
|
8061
7969
|
// See TeXbook p170.
|
|
8062
7970
|
|
|
@@ -8104,7 +8012,7 @@ defineFunction({
|
|
|
8104
8012
|
mclass: "m" + funcName.slice(5),
|
|
8105
8013
|
// TODO(kevinb): don't prefix with 'm'
|
|
8106
8014
|
body: ordargument(body),
|
|
8107
|
-
isCharacterBox:
|
|
8015
|
+
isCharacterBox: isCharacterBox(body)
|
|
8108
8016
|
};
|
|
8109
8017
|
},
|
|
8110
8018
|
|
|
@@ -8142,7 +8050,7 @@ defineFunction({
|
|
|
8142
8050
|
mode: parser.mode,
|
|
8143
8051
|
mclass: binrelClass(args[0]),
|
|
8144
8052
|
body: ordargument(args[1]),
|
|
8145
|
-
isCharacterBox:
|
|
8053
|
+
isCharacterBox: isCharacterBox(args[1])
|
|
8146
8054
|
};
|
|
8147
8055
|
}
|
|
8148
8056
|
|
|
@@ -8193,14 +8101,14 @@ defineFunction({
|
|
|
8193
8101
|
mode: parser.mode,
|
|
8194
8102
|
mclass,
|
|
8195
8103
|
body: [supsub],
|
|
8196
|
-
isCharacterBox:
|
|
8104
|
+
isCharacterBox: isCharacterBox(supsub)
|
|
8197
8105
|
};
|
|
8198
8106
|
},
|
|
8199
8107
|
|
|
8200
8108
|
htmlBuilder: mclass_htmlBuilder,
|
|
8201
8109
|
mathmlBuilder: mclass_mathmlBuilder
|
|
8202
8110
|
});
|
|
8203
|
-
;//
|
|
8111
|
+
;// ./src/functions/pmb.js
|
|
8204
8112
|
|
|
8205
8113
|
|
|
8206
8114
|
|
|
@@ -8233,7 +8141,7 @@ defineFunction({
|
|
|
8233
8141
|
|
|
8234
8142
|
htmlBuilder(group, options) {
|
|
8235
8143
|
const elements = buildExpression(group.body, options, true);
|
|
8236
|
-
const node =
|
|
8144
|
+
const node = makeSpan([group.mclass], elements, options);
|
|
8237
8145
|
node.style.textShadow = "0.02em 0.01em 0.04px";
|
|
8238
8146
|
return node;
|
|
8239
8147
|
},
|
|
@@ -8241,13 +8149,13 @@ defineFunction({
|
|
|
8241
8149
|
mathmlBuilder(group, style) {
|
|
8242
8150
|
const inner = buildMathML_buildExpression(group.body, style); // Wrap with an <mstyle> element.
|
|
8243
8151
|
|
|
8244
|
-
const node = new
|
|
8152
|
+
const node = new MathNode("mstyle", inner);
|
|
8245
8153
|
node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px");
|
|
8246
8154
|
return node;
|
|
8247
8155
|
}
|
|
8248
8156
|
|
|
8249
8157
|
});
|
|
8250
|
-
;//
|
|
8158
|
+
;// ./src/environments/cd.js
|
|
8251
8159
|
|
|
8252
8160
|
|
|
8253
8161
|
|
|
@@ -8402,9 +8310,9 @@ function parseCD(parser) {
|
|
|
8402
8310
|
body: []
|
|
8403
8311
|
}; // Process the arrow.
|
|
8404
8312
|
|
|
8405
|
-
if ("=|.".
|
|
8313
|
+
if ("=|.".includes(arrowChar)) {// Three "arrows", ``@=`, `@|`, and `@.`, do not take labels.
|
|
8406
8314
|
// Do nothing here.
|
|
8407
|
-
} else if ("<>AV".
|
|
8315
|
+
} else if ("<>AV".includes(arrowChar)) {
|
|
8408
8316
|
// Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take
|
|
8409
8317
|
// two optional labels. E.g. the right-point arrow syntax is
|
|
8410
8318
|
// really: @>{optional label}>{optional label}>
|
|
@@ -8520,7 +8428,7 @@ defineFunction({
|
|
|
8520
8428
|
|
|
8521
8429
|
htmlBuilder(group, options) {
|
|
8522
8430
|
const newOptions = options.havingStyle(options.style.sup());
|
|
8523
|
-
const label =
|
|
8431
|
+
const label = wrapFragment(buildGroup(group.label, newOptions, options), options);
|
|
8524
8432
|
label.classes.push("cd-label-" + group.side);
|
|
8525
8433
|
label.style.bottom = makeEm(0.8 - label.depth); // Zero out label height & depth, so vertical align of arrow is set
|
|
8526
8434
|
// by the arrow height, not by the label.
|
|
@@ -8531,8 +8439,8 @@ defineFunction({
|
|
|
8531
8439
|
},
|
|
8532
8440
|
|
|
8533
8441
|
mathmlBuilder(group, options) {
|
|
8534
|
-
let label = new
|
|
8535
|
-
label = new
|
|
8442
|
+
let label = new MathNode("mrow", [buildMathML_buildGroup(group.label, options)]);
|
|
8443
|
+
label = new MathNode("mpadded", [label]);
|
|
8536
8444
|
label.setAttribute("width", "0");
|
|
8537
8445
|
|
|
8538
8446
|
if (group.side === "left") {
|
|
@@ -8542,7 +8450,7 @@ defineFunction({
|
|
|
8542
8450
|
|
|
8543
8451
|
|
|
8544
8452
|
label.setAttribute("voffset", "0.7em");
|
|
8545
|
-
label = new
|
|
8453
|
+
label = new MathNode("mstyle", [label]);
|
|
8546
8454
|
label.setAttribute("displaystyle", "false");
|
|
8547
8455
|
label.setAttribute("scriptlevel", "1");
|
|
8548
8456
|
return label;
|
|
@@ -8571,17 +8479,17 @@ defineFunction({
|
|
|
8571
8479
|
// Wrap the vertical arrow and its labels.
|
|
8572
8480
|
// The parent gets position: relative. The child gets position: absolute.
|
|
8573
8481
|
// So CSS can locate the label correctly.
|
|
8574
|
-
const parent =
|
|
8482
|
+
const parent = wrapFragment(buildGroup(group.fragment, options), options);
|
|
8575
8483
|
parent.classes.push("cd-vert-arrow");
|
|
8576
8484
|
return parent;
|
|
8577
8485
|
},
|
|
8578
8486
|
|
|
8579
8487
|
mathmlBuilder(group, options) {
|
|
8580
|
-
return new
|
|
8488
|
+
return new MathNode("mrow", [buildMathML_buildGroup(group.fragment, options)]);
|
|
8581
8489
|
}
|
|
8582
8490
|
|
|
8583
8491
|
});
|
|
8584
|
-
;//
|
|
8492
|
+
;// ./src/functions/char.js
|
|
8585
8493
|
|
|
8586
8494
|
|
|
8587
8495
|
// \@char is an internal function that takes a grouped decimal argument like
|
|
@@ -8633,7 +8541,7 @@ defineFunction({
|
|
|
8633
8541
|
}
|
|
8634
8542
|
|
|
8635
8543
|
});
|
|
8636
|
-
;//
|
|
8544
|
+
;// ./src/functions/color.js
|
|
8637
8545
|
|
|
8638
8546
|
|
|
8639
8547
|
|
|
@@ -8647,12 +8555,12 @@ const color_htmlBuilder = (group, options) => {
|
|
|
8647
8555
|
// elements will be able to directly interact with their neighbors. For
|
|
8648
8556
|
// example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
|
|
8649
8557
|
|
|
8650
|
-
return
|
|
8558
|
+
return makeFragment(elements);
|
|
8651
8559
|
};
|
|
8652
8560
|
|
|
8653
8561
|
const color_mathmlBuilder = (group, options) => {
|
|
8654
8562
|
const inner = buildMathML_buildExpression(group.body, options.withColor(group.color));
|
|
8655
|
-
const node = new
|
|
8563
|
+
const node = new MathNode("mstyle", inner);
|
|
8656
8564
|
node.setAttribute("mathcolor", group.color);
|
|
8657
8565
|
return node;
|
|
8658
8566
|
};
|
|
@@ -8716,7 +8624,7 @@ defineFunction({
|
|
|
8716
8624
|
htmlBuilder: color_htmlBuilder,
|
|
8717
8625
|
mathmlBuilder: color_mathmlBuilder
|
|
8718
8626
|
});
|
|
8719
|
-
;//
|
|
8627
|
+
;// ./src/functions/cr.js
|
|
8720
8628
|
// Row breaks within tabular environments, and line breaks at top level
|
|
8721
8629
|
|
|
8722
8630
|
|
|
@@ -8750,7 +8658,7 @@ defineFunction({
|
|
|
8750
8658
|
// The following builders are called only at the top level,
|
|
8751
8659
|
// not within tabular/array environments.
|
|
8752
8660
|
htmlBuilder(group, options) {
|
|
8753
|
-
const span =
|
|
8661
|
+
const span = makeSpan(["mspace"], [], options);
|
|
8754
8662
|
|
|
8755
8663
|
if (group.newLine) {
|
|
8756
8664
|
span.classes.push("newline");
|
|
@@ -8764,7 +8672,7 @@ defineFunction({
|
|
|
8764
8672
|
},
|
|
8765
8673
|
|
|
8766
8674
|
mathmlBuilder(group, options) {
|
|
8767
|
-
const node = new
|
|
8675
|
+
const node = new MathNode("mspace");
|
|
8768
8676
|
|
|
8769
8677
|
if (group.newLine) {
|
|
8770
8678
|
node.setAttribute("linebreak", "newline");
|
|
@@ -8778,7 +8686,7 @@ defineFunction({
|
|
|
8778
8686
|
}
|
|
8779
8687
|
|
|
8780
8688
|
});
|
|
8781
|
-
;//
|
|
8689
|
+
;// ./src/functions/def.js
|
|
8782
8690
|
|
|
8783
8691
|
|
|
8784
8692
|
|
|
@@ -9022,7 +8930,7 @@ defineFunction({
|
|
|
9022
8930
|
}
|
|
9023
8931
|
|
|
9024
8932
|
});
|
|
9025
|
-
;//
|
|
8933
|
+
;// ./src/delimiter.js
|
|
9026
8934
|
/**
|
|
9027
8935
|
* This file deals with creating delimiters of various sizes. The TeXbook
|
|
9028
8936
|
* discusses these routines on page 441-442, in the "Another subroutine sets box
|
|
@@ -9076,7 +8984,7 @@ const getMetrics = function (symbol, font, mode) {
|
|
|
9076
8984
|
|
|
9077
8985
|
const styleWrap = function (delim, toStyle, options, classes) {
|
|
9078
8986
|
const newOptions = options.havingBaseStyle(toStyle);
|
|
9079
|
-
const span =
|
|
8987
|
+
const span = makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
|
|
9080
8988
|
const delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
|
|
9081
8989
|
span.height *= delimSizeMultiplier;
|
|
9082
8990
|
span.depth *= delimSizeMultiplier;
|
|
@@ -9100,7 +9008,7 @@ const centerSpan = function (span, options, style) {
|
|
|
9100
9008
|
|
|
9101
9009
|
|
|
9102
9010
|
const makeSmallDelim = function (delim, style, center, options, mode, classes) {
|
|
9103
|
-
const text =
|
|
9011
|
+
const text = makeSymbol(delim, "Main-Regular", mode, options);
|
|
9104
9012
|
const span = styleWrap(text, style, options, classes);
|
|
9105
9013
|
|
|
9106
9014
|
if (center) {
|
|
@@ -9115,7 +9023,7 @@ const makeSmallDelim = function (delim, style, center, options, mode, classes) {
|
|
|
9115
9023
|
|
|
9116
9024
|
|
|
9117
9025
|
const mathrmSize = function (value, size, mode, options) {
|
|
9118
|
-
return
|
|
9026
|
+
return makeSymbol(value, "Size" + size + "-Regular", mode, options);
|
|
9119
9027
|
};
|
|
9120
9028
|
/**
|
|
9121
9029
|
* Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
|
|
@@ -9125,7 +9033,7 @@ const mathrmSize = function (value, size, mode, options) {
|
|
|
9125
9033
|
|
|
9126
9034
|
const makeLargeDelim = function (delim, size, center, options, mode, classes) {
|
|
9127
9035
|
const inner = mathrmSize(delim, size, mode, options);
|
|
9128
|
-
const span = styleWrap(
|
|
9036
|
+
const span = styleWrap(makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes);
|
|
9129
9037
|
|
|
9130
9038
|
if (center) {
|
|
9131
9039
|
centerSpan(span, options, src_Style.TEXT);
|
|
@@ -9150,7 +9058,7 @@ const makeGlyphSpan = function (symbol, font, mode) {
|
|
|
9150
9058
|
sizeClass = "delim-size4";
|
|
9151
9059
|
}
|
|
9152
9060
|
|
|
9153
|
-
const corner =
|
|
9061
|
+
const corner = makeSpan(["delimsizinginner", sizeClass], [makeSpan([], [makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element
|
|
9154
9062
|
// in the appropriate tag that VList uses.
|
|
9155
9063
|
|
|
9156
9064
|
return {
|
|
@@ -9171,7 +9079,7 @@ const makeInner = function (ch, height, options) {
|
|
|
9171
9079
|
"viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),
|
|
9172
9080
|
"preserveAspectRatio": "xMinYMin"
|
|
9173
9081
|
});
|
|
9174
|
-
const span =
|
|
9082
|
+
const span = makeSvgSpan([], [svgNode], options);
|
|
9175
9083
|
span.height = height;
|
|
9176
9084
|
span.style.height = makeEm(height);
|
|
9177
9085
|
span.style.width = makeEm(width);
|
|
@@ -9187,8 +9095,8 @@ const lap = {
|
|
|
9187
9095
|
type: "kern",
|
|
9188
9096
|
size: -1 * lapInEms
|
|
9189
9097
|
};
|
|
9190
|
-
const verts = ["|", "\\lvert", "\\rvert", "\\vert"];
|
|
9191
|
-
const doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"];
|
|
9098
|
+
const verts = new Set(["|", "\\lvert", "\\rvert", "\\vert"]);
|
|
9099
|
+
const doubleVerts = new Set(["\\|", "\\lVert", "\\rVert", "\\Vert"]);
|
|
9192
9100
|
/**
|
|
9193
9101
|
* Make a stacked delimiter out of a given delimiter, with the total height at
|
|
9194
9102
|
* least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
|
|
@@ -9226,11 +9134,11 @@ const makeStackedDelim = function (delim, heightTotal, center, options, mode, cl
|
|
|
9226
9134
|
top = "\\Uparrow";
|
|
9227
9135
|
repeat = "\u2016";
|
|
9228
9136
|
bottom = "\\Downarrow";
|
|
9229
|
-
} else if (verts.
|
|
9137
|
+
} else if (verts.has(delim)) {
|
|
9230
9138
|
repeat = "\u2223";
|
|
9231
9139
|
svgLabel = "vert";
|
|
9232
9140
|
viewBoxWidth = 333;
|
|
9233
|
-
} else if (doubleVerts.
|
|
9141
|
+
} else if (doubleVerts.has(delim)) {
|
|
9234
9142
|
repeat = "\u2225";
|
|
9235
9143
|
svgLabel = "doublevert";
|
|
9236
9144
|
viewBoxWidth = 556;
|
|
@@ -9373,7 +9281,7 @@ const makeStackedDelim = function (delim, heightTotal, center, options, mode, cl
|
|
|
9373
9281
|
"height": height,
|
|
9374
9282
|
"viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight
|
|
9375
9283
|
});
|
|
9376
|
-
const wrapper =
|
|
9284
|
+
const wrapper = makeSvgSpan([], [svg], options);
|
|
9377
9285
|
wrapper.height = viewBoxHeight / 1000;
|
|
9378
9286
|
wrapper.style.width = width;
|
|
9379
9287
|
wrapper.style.height = height;
|
|
@@ -9411,12 +9319,12 @@ const makeStackedDelim = function (delim, heightTotal, center, options, mode, cl
|
|
|
9411
9319
|
|
|
9412
9320
|
|
|
9413
9321
|
const newOptions = options.havingBaseStyle(src_Style.TEXT);
|
|
9414
|
-
const inner =
|
|
9322
|
+
const inner = makeVList({
|
|
9415
9323
|
positionType: "bottom",
|
|
9416
9324
|
positionData: depth,
|
|
9417
9325
|
children: stack
|
|
9418
9326
|
}, newOptions);
|
|
9419
|
-
return styleWrap(
|
|
9327
|
+
return styleWrap(makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes);
|
|
9420
9328
|
}; // All surds have 0.08em padding above the vinculum inside the SVG.
|
|
9421
9329
|
// That keeps browser span height rounding error from pinching the line.
|
|
9422
9330
|
|
|
@@ -9435,7 +9343,7 @@ const sqrtSvg = function (sqrtName, height, viewBoxHeight, extraVinculum, option
|
|
|
9435
9343
|
"viewBox": "0 0 400000 " + viewBoxHeight,
|
|
9436
9344
|
"preserveAspectRatio": "xMinYMin slice"
|
|
9437
9345
|
});
|
|
9438
|
-
return
|
|
9346
|
+
return makeSvgSpan(["hide-tail"], [svg], options);
|
|
9439
9347
|
};
|
|
9440
9348
|
/**
|
|
9441
9349
|
* Make a sqrt image of the given height,
|
|
@@ -9513,12 +9421,11 @@ const makeSqrtImage = function (height, options) {
|
|
|
9513
9421
|
}; // There are three kinds of delimiters, delimiters that stack when they become
|
|
9514
9422
|
// too large
|
|
9515
9423
|
|
|
9424
|
+
const stackLargeDelimiters = new Set(["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]); // delimiters that always stack
|
|
9516
9425
|
|
|
9517
|
-
const
|
|
9426
|
+
const 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
|
|
9518
9427
|
|
|
9519
|
-
const
|
|
9520
|
-
|
|
9521
|
-
const stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of
|
|
9428
|
+
const stackNeverDelimiters = new Set(["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]); // Metrics of the different sizes. Found by looking at TeX's output of
|
|
9522
9429
|
// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
|
|
9523
9430
|
// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
|
|
9524
9431
|
|
|
@@ -9536,9 +9443,9 @@ const makeSizedDelim = function (delim, size, options, mode, classes) {
|
|
|
9536
9443
|
} // Sized delimiters are never centered.
|
|
9537
9444
|
|
|
9538
9445
|
|
|
9539
|
-
if (stackLargeDelimiters.
|
|
9446
|
+
if (stackLargeDelimiters.has(delim) || stackNeverDelimiters.has(delim)) {
|
|
9540
9447
|
return makeLargeDelim(delim, size, false, options, mode, classes);
|
|
9541
|
-
} else if (stackAlwaysDelimiters.
|
|
9448
|
+
} else if (stackAlwaysDelimiters.has(delim)) {
|
|
9542
9449
|
return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
|
|
9543
9450
|
} else {
|
|
9544
9451
|
throw new src_ParseError("Illegal delimiter: '" + delim + "'");
|
|
@@ -9556,7 +9463,6 @@ const makeSizedDelim = function (delim, size, options, mode, classes) {
|
|
|
9556
9463
|
* them explicitly here.
|
|
9557
9464
|
*/
|
|
9558
9465
|
|
|
9559
|
-
|
|
9560
9466
|
// Delimiters that never stack try small delimiters and large delimiters only
|
|
9561
9467
|
const stackNeverDelimiterSequence = [{
|
|
9562
9468
|
type: "small",
|
|
@@ -9688,9 +9594,9 @@ const makeCustomSizedDelim = function (delim, height, center, options, mode, cla
|
|
|
9688
9594
|
|
|
9689
9595
|
let sequence;
|
|
9690
9596
|
|
|
9691
|
-
if (stackNeverDelimiters.
|
|
9597
|
+
if (stackNeverDelimiters.has(delim)) {
|
|
9692
9598
|
sequence = stackNeverDelimiterSequence;
|
|
9693
|
-
} else if (stackLargeDelimiters.
|
|
9599
|
+
} else if (stackLargeDelimiters.has(delim)) {
|
|
9694
9600
|
sequence = stackLargeDelimiterSequence;
|
|
9695
9601
|
} else {
|
|
9696
9602
|
sequence = stackAlwaysDelimiterSequence;
|
|
@@ -9716,7 +9622,6 @@ const makeCustomSizedDelim = function (delim, height, center, options, mode, cla
|
|
|
9716
9622
|
* of an expression that the delimiters surround.
|
|
9717
9623
|
*/
|
|
9718
9624
|
|
|
9719
|
-
|
|
9720
9625
|
const makeLeftRightDelim = function (delim, height, depth, options, mode, classes) {
|
|
9721
9626
|
// We always center \left/\right delimiters, so the axis is always shifted
|
|
9722
9627
|
const axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right
|
|
@@ -9738,15 +9643,7 @@ const makeLeftRightDelim = function (delim, height, depth, options, mode, classe
|
|
|
9738
9643
|
|
|
9739
9644
|
return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
|
|
9740
9645
|
};
|
|
9741
|
-
|
|
9742
|
-
/* harmony default export */ var delimiter = ({
|
|
9743
|
-
sqrtImage: makeSqrtImage,
|
|
9744
|
-
sizedDelim: makeSizedDelim,
|
|
9745
|
-
sizeToMaxHeight: sizeToMaxHeight,
|
|
9746
|
-
customSizedDelim: makeCustomSizedDelim,
|
|
9747
|
-
leftRightDelim: makeLeftRightDelim
|
|
9748
|
-
});
|
|
9749
|
-
;// CONCATENATED MODULE: ./src/functions/delimsizing.js
|
|
9646
|
+
;// ./src/functions/delimsizing.js
|
|
9750
9647
|
|
|
9751
9648
|
|
|
9752
9649
|
|
|
@@ -9823,13 +9720,13 @@ const delimiterSizes = {
|
|
|
9823
9720
|
size: 4
|
|
9824
9721
|
}
|
|
9825
9722
|
};
|
|
9826
|
-
const 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", "."];
|
|
9723
|
+
const 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", "."]);
|
|
9827
9724
|
|
|
9828
9725
|
// Delimiter functions
|
|
9829
9726
|
function checkDelimiter(delim, context) {
|
|
9830
9727
|
const symDelim = checkSymbolNodeType(delim);
|
|
9831
9728
|
|
|
9832
|
-
if (symDelim && delimiters.
|
|
9729
|
+
if (symDelim && delimiters.has(symDelim.text)) {
|
|
9833
9730
|
return symDelim;
|
|
9834
9731
|
} else if (symDelim) {
|
|
9835
9732
|
throw new src_ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
|
|
@@ -9859,11 +9756,10 @@ defineFunction({
|
|
|
9859
9756
|
if (group.delim === ".") {
|
|
9860
9757
|
// Empty delimiters still count as elements, even though they don't
|
|
9861
9758
|
// show anything.
|
|
9862
|
-
return
|
|
9863
|
-
}
|
|
9864
|
-
|
|
9759
|
+
return makeSpan([group.mclass]);
|
|
9760
|
+
}
|
|
9865
9761
|
|
|
9866
|
-
return
|
|
9762
|
+
return makeSizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
|
|
9867
9763
|
},
|
|
9868
9764
|
mathmlBuilder: group => {
|
|
9869
9765
|
const children = [];
|
|
@@ -9872,7 +9768,7 @@ defineFunction({
|
|
|
9872
9768
|
children.push(makeText(group.delim, group.mode));
|
|
9873
9769
|
}
|
|
9874
9770
|
|
|
9875
|
-
const node = new
|
|
9771
|
+
const node = new MathNode("mo", children);
|
|
9876
9772
|
|
|
9877
9773
|
if (group.mclass === "mopen" || group.mclass === "mclose") {
|
|
9878
9774
|
// Only some of the delimsizing functions act as fences, and they
|
|
@@ -9885,7 +9781,7 @@ defineFunction({
|
|
|
9885
9781
|
}
|
|
9886
9782
|
|
|
9887
9783
|
node.setAttribute("stretchy", "true");
|
|
9888
|
-
const size = makeEm(
|
|
9784
|
+
const size = makeEm(sizeToMaxHeight[group.size]);
|
|
9889
9785
|
node.setAttribute("minsize", size);
|
|
9890
9786
|
node.setAttribute("maxsize", size);
|
|
9891
9787
|
return node;
|
|
@@ -9984,7 +9880,7 @@ defineFunction({
|
|
|
9984
9880
|
} else {
|
|
9985
9881
|
// Otherwise, use leftRightDelim to generate the correct sized
|
|
9986
9882
|
// delimiter.
|
|
9987
|
-
leftDelim =
|
|
9883
|
+
leftDelim = makeLeftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
|
|
9988
9884
|
} // Add it to the beginning of the expression
|
|
9989
9885
|
|
|
9990
9886
|
|
|
@@ -10000,7 +9896,7 @@ defineFunction({
|
|
|
10000
9896
|
|
|
10001
9897
|
if (isMiddle) {
|
|
10002
9898
|
// Apply the options that were active when \middle was called
|
|
10003
|
-
inner[i] =
|
|
9899
|
+
inner[i] = makeLeftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
|
|
10004
9900
|
}
|
|
10005
9901
|
}
|
|
10006
9902
|
}
|
|
@@ -10011,25 +9907,25 @@ defineFunction({
|
|
|
10011
9907
|
rightDelim = makeNullDelimiter(options, ["mclose"]);
|
|
10012
9908
|
} else {
|
|
10013
9909
|
const colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
|
|
10014
|
-
rightDelim =
|
|
9910
|
+
rightDelim = makeLeftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
|
|
10015
9911
|
} // Add it to the end of the expression.
|
|
10016
9912
|
|
|
10017
9913
|
|
|
10018
9914
|
inner.push(rightDelim);
|
|
10019
|
-
return
|
|
9915
|
+
return makeSpan(["minner"], inner, options);
|
|
10020
9916
|
},
|
|
10021
9917
|
mathmlBuilder: (group, options) => {
|
|
10022
9918
|
assertParsed(group);
|
|
10023
9919
|
const inner = buildMathML_buildExpression(group.body, options);
|
|
10024
9920
|
|
|
10025
9921
|
if (group.left !== ".") {
|
|
10026
|
-
const leftNode = new
|
|
9922
|
+
const leftNode = new MathNode("mo", [makeText(group.left, group.mode)]);
|
|
10027
9923
|
leftNode.setAttribute("fence", "true");
|
|
10028
9924
|
inner.unshift(leftNode);
|
|
10029
9925
|
}
|
|
10030
9926
|
|
|
10031
9927
|
if (group.right !== ".") {
|
|
10032
|
-
const rightNode = new
|
|
9928
|
+
const rightNode = new MathNode("mo", [makeText(group.right, group.mode)]);
|
|
10033
9929
|
rightNode.setAttribute("fence", "true");
|
|
10034
9930
|
|
|
10035
9931
|
if (group.rightColor) {
|
|
@@ -10068,7 +9964,7 @@ defineFunction({
|
|
|
10068
9964
|
if (group.delim === ".") {
|
|
10069
9965
|
middleDelim = makeNullDelimiter(options, []);
|
|
10070
9966
|
} else {
|
|
10071
|
-
middleDelim =
|
|
9967
|
+
middleDelim = makeSizedDelim(group.delim, 1, options, group.mode, []);
|
|
10072
9968
|
const isMiddle = {
|
|
10073
9969
|
delim: group.delim,
|
|
10074
9970
|
options
|
|
@@ -10089,7 +9985,7 @@ defineFunction({
|
|
|
10089
9985
|
// https://www.w3.org/TR/MathML3/appendixc.html.
|
|
10090
9986
|
// So we need to avoid U+2223 and use plain "|" instead.
|
|
10091
9987
|
const textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
|
|
10092
|
-
const middleNode = new
|
|
9988
|
+
const middleNode = new MathNode("mo", [textNode]);
|
|
10093
9989
|
middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
|
|
10094
9990
|
// \middle should get delimiter spacing instead.
|
|
10095
9991
|
|
|
@@ -10098,7 +9994,7 @@ defineFunction({
|
|
|
10098
9994
|
return middleNode;
|
|
10099
9995
|
}
|
|
10100
9996
|
});
|
|
10101
|
-
;//
|
|
9997
|
+
;// ./src/functions/enclose.js
|
|
10102
9998
|
|
|
10103
9999
|
|
|
10104
10000
|
|
|
@@ -10115,7 +10011,7 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10115
10011
|
// \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase
|
|
10116
10012
|
// Some groups can return document fragments. Handle those by wrapping
|
|
10117
10013
|
// them in a span.
|
|
10118
|
-
const inner =
|
|
10014
|
+
const inner = wrapFragment(buildGroup(group.body, options), options);
|
|
10119
10015
|
const label = group.label.slice(1);
|
|
10120
10016
|
let scale = options.sizeMultiplier;
|
|
10121
10017
|
let img;
|
|
@@ -10125,10 +10021,10 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10125
10021
|
// the subject is a single character. This captures most of the
|
|
10126
10022
|
// subjects that should get the "tall" treatment.
|
|
10127
10023
|
|
|
10128
|
-
const isSingleChar =
|
|
10024
|
+
const isSingleChar = isCharacterBox(group.body);
|
|
10129
10025
|
|
|
10130
10026
|
if (label === "sout") {
|
|
10131
|
-
img =
|
|
10027
|
+
img = makeSpan(["stretchy", "sout"]);
|
|
10132
10028
|
img.height = options.fontMetrics().defaultRuleThickness / scale;
|
|
10133
10029
|
imgShift = -0.5 * options.fontMetrics().xHeight;
|
|
10134
10030
|
} else if (label === "phase") {
|
|
@@ -10157,7 +10053,7 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10157
10053
|
"preserveAspectRatio": "xMinYMin slice"
|
|
10158
10054
|
}); // Wrap it in a span with overflow: hidden.
|
|
10159
10055
|
|
|
10160
|
-
img =
|
|
10056
|
+
img = makeSvgSpan(["hide-tail"], [svgNode], options);
|
|
10161
10057
|
img.style.height = makeEm(angleHeight);
|
|
10162
10058
|
imgShift = inner.depth + lineWeight + clearance;
|
|
10163
10059
|
} else {
|
|
@@ -10193,7 +10089,7 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10193
10089
|
bottomPad = topPad;
|
|
10194
10090
|
}
|
|
10195
10091
|
|
|
10196
|
-
img =
|
|
10092
|
+
img = stretchyEnclose(inner, label, topPad, bottomPad, options);
|
|
10197
10093
|
|
|
10198
10094
|
if (/fbox|boxed|fcolorbox/.test(label)) {
|
|
10199
10095
|
img.style.borderStyle = "solid";
|
|
@@ -10217,7 +10113,7 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10217
10113
|
let vlist;
|
|
10218
10114
|
|
|
10219
10115
|
if (group.backgroundColor) {
|
|
10220
|
-
vlist =
|
|
10116
|
+
vlist = makeVList({
|
|
10221
10117
|
positionType: "individualShift",
|
|
10222
10118
|
children: [// Put the color background behind inner;
|
|
10223
10119
|
{
|
|
@@ -10232,7 +10128,7 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10232
10128
|
}, options);
|
|
10233
10129
|
} else {
|
|
10234
10130
|
const classes = /cancel|phase/.test(label) ? ["svg-align"] : [];
|
|
10235
|
-
vlist =
|
|
10131
|
+
vlist = makeVList({
|
|
10236
10132
|
positionType: "individualShift",
|
|
10237
10133
|
children: [// Write the \cancel stroke on top of inner.
|
|
10238
10134
|
{
|
|
@@ -10257,15 +10153,15 @@ const enclose_htmlBuilder = (group, options) => {
|
|
|
10257
10153
|
|
|
10258
10154
|
if (/cancel/.test(label) && !isSingleChar) {
|
|
10259
10155
|
// cancel does not create horiz space for its line extension.
|
|
10260
|
-
return
|
|
10156
|
+
return makeSpan(["mord", "cancel-lap"], [vlist], options);
|
|
10261
10157
|
} else {
|
|
10262
|
-
return
|
|
10158
|
+
return makeSpan(["mord"], [vlist], options);
|
|
10263
10159
|
}
|
|
10264
10160
|
};
|
|
10265
10161
|
|
|
10266
10162
|
const enclose_mathmlBuilder = (group, options) => {
|
|
10267
10163
|
let fboxsep = 0;
|
|
10268
|
-
const node = new
|
|
10164
|
+
const node = new MathNode(group.label.includes("colorbox") ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]);
|
|
10269
10165
|
|
|
10270
10166
|
switch (group.label) {
|
|
10271
10167
|
case "\\cancel":
|
|
@@ -10450,7 +10346,7 @@ defineFunction({
|
|
|
10450
10346
|
}
|
|
10451
10347
|
|
|
10452
10348
|
});
|
|
10453
|
-
;//
|
|
10349
|
+
;// ./src/defineEnvironment.js
|
|
10454
10350
|
|
|
10455
10351
|
|
|
10456
10352
|
/**
|
|
@@ -10492,7 +10388,7 @@ function defineEnvironment(_ref) {
|
|
|
10492
10388
|
_mathmlGroupBuilders[type] = mathmlBuilder;
|
|
10493
10389
|
}
|
|
10494
10390
|
}
|
|
10495
|
-
;//
|
|
10391
|
+
;// ./src/defineMacro.js
|
|
10496
10392
|
|
|
10497
10393
|
|
|
10498
10394
|
/**
|
|
@@ -10505,7 +10401,7 @@ const _macros = {}; // This function might one day accept an additional argument
|
|
|
10505
10401
|
function defineMacro(name, body) {
|
|
10506
10402
|
_macros[name] = body;
|
|
10507
10403
|
}
|
|
10508
|
-
;//
|
|
10404
|
+
;// ./src/SourceLocation.js
|
|
10509
10405
|
/**
|
|
10510
10406
|
* Lexing or parsing positional information for error reporting.
|
|
10511
10407
|
* This object is immutable.
|
|
@@ -10544,7 +10440,7 @@ class SourceLocation {
|
|
|
10544
10440
|
}
|
|
10545
10441
|
|
|
10546
10442
|
}
|
|
10547
|
-
;//
|
|
10443
|
+
;// ./src/Token.js
|
|
10548
10444
|
|
|
10549
10445
|
/**
|
|
10550
10446
|
* Interface required to break circular dependency between Token, Lexer, and
|
|
@@ -10589,8 +10485,7 @@ class Token {
|
|
|
10589
10485
|
}
|
|
10590
10486
|
|
|
10591
10487
|
}
|
|
10592
|
-
;//
|
|
10593
|
-
|
|
10488
|
+
;// ./src/environments/array.js
|
|
10594
10489
|
|
|
10595
10490
|
|
|
10596
10491
|
|
|
@@ -10637,16 +10532,17 @@ const validateAmsEnvironmentContext = context => {
|
|
|
10637
10532
|
if (!settings.displayMode) {
|
|
10638
10533
|
throw new src_ParseError("{" + context.envName + "} can be used only in" + " display mode.");
|
|
10639
10534
|
}
|
|
10640
|
-
};
|
|
10535
|
+
};
|
|
10536
|
+
|
|
10537
|
+
const gatherEnvironments = new Set(["gather", "gather*"]); // autoTag (an argument to parseArray) can be one of three values:
|
|
10641
10538
|
// * undefined: Regular (not-top-level) array; no tags on each row
|
|
10642
10539
|
// * true: Automatic equation numbering, overridable by \tag
|
|
10643
10540
|
// * false: Tags allowed on each row, but no automatic numbering
|
|
10644
10541
|
// This function *doesn't* work with the "split" environment name.
|
|
10645
10542
|
|
|
10646
|
-
|
|
10647
10543
|
function getAutoTag(name) {
|
|
10648
|
-
if (name.
|
|
10649
|
-
return name.
|
|
10544
|
+
if (!name.includes("ed")) {
|
|
10545
|
+
return !name.includes("*");
|
|
10650
10546
|
} // return undefined;
|
|
10651
10547
|
|
|
10652
10548
|
}
|
|
@@ -10967,13 +10863,13 @@ const array_htmlBuilder = function (group, options) {
|
|
|
10967
10863
|
|
|
10968
10864
|
if (tag === true) {
|
|
10969
10865
|
// automatic numbering
|
|
10970
|
-
tagSpan =
|
|
10866
|
+
tagSpan = makeSpan(["eqn-num"], [], options);
|
|
10971
10867
|
} else if (tag === false) {
|
|
10972
10868
|
// \nonumber/\notag or starred environment
|
|
10973
|
-
tagSpan =
|
|
10869
|
+
tagSpan = makeSpan([], [], options);
|
|
10974
10870
|
} else {
|
|
10975
10871
|
// manual \tag
|
|
10976
|
-
tagSpan =
|
|
10872
|
+
tagSpan = makeSpan([], buildExpression(tag, options, true), options);
|
|
10977
10873
|
}
|
|
10978
10874
|
|
|
10979
10875
|
tagSpan.depth = rw.depth;
|
|
@@ -10996,14 +10892,14 @@ const array_htmlBuilder = function (group, options) {
|
|
|
10996
10892
|
// If there is more than one separator in a row, add a space
|
|
10997
10893
|
// between them.
|
|
10998
10894
|
if (!firstSeparator) {
|
|
10999
|
-
colSep =
|
|
10895
|
+
colSep = makeSpan(["arraycolsep"], []);
|
|
11000
10896
|
colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);
|
|
11001
10897
|
cols.push(colSep);
|
|
11002
10898
|
}
|
|
11003
10899
|
|
|
11004
10900
|
if (colDescr.separator === "|" || colDescr.separator === ":") {
|
|
11005
10901
|
const lineType = colDescr.separator === "|" ? "solid" : "dashed";
|
|
11006
|
-
const separator =
|
|
10902
|
+
const separator = makeSpan(["vertical-separator"], [], options);
|
|
11007
10903
|
separator.style.height = makeEm(totalHeight);
|
|
11008
10904
|
separator.style.borderRightWidth = makeEm(ruleThickness);
|
|
11009
10905
|
separator.style.borderRightStyle = lineType;
|
|
@@ -11031,10 +10927,12 @@ const array_htmlBuilder = function (group, options) {
|
|
|
11031
10927
|
let sepwidth;
|
|
11032
10928
|
|
|
11033
10929
|
if (c > 0 || group.hskipBeforeAndAfter) {
|
|
11034
|
-
|
|
10930
|
+
var _colDescr$pregap;
|
|
10931
|
+
|
|
10932
|
+
sepwidth = (_colDescr$pregap = colDescr.pregap) != null ? _colDescr$pregap : arraycolsep;
|
|
11035
10933
|
|
|
11036
10934
|
if (sepwidth !== 0) {
|
|
11037
|
-
colSep =
|
|
10935
|
+
colSep = makeSpan(["arraycolsep"], []);
|
|
11038
10936
|
colSep.style.width = makeEm(sepwidth);
|
|
11039
10937
|
cols.push(colSep);
|
|
11040
10938
|
}
|
|
@@ -11060,29 +10958,31 @@ const array_htmlBuilder = function (group, options) {
|
|
|
11060
10958
|
});
|
|
11061
10959
|
}
|
|
11062
10960
|
|
|
11063
|
-
col =
|
|
10961
|
+
col = makeVList({
|
|
11064
10962
|
positionType: "individualShift",
|
|
11065
10963
|
children: col
|
|
11066
10964
|
}, options);
|
|
11067
|
-
col =
|
|
10965
|
+
col = makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
|
|
11068
10966
|
cols.push(col);
|
|
11069
10967
|
|
|
11070
10968
|
if (c < nc - 1 || group.hskipBeforeAndAfter) {
|
|
11071
|
-
|
|
10969
|
+
var _colDescr$postgap;
|
|
10970
|
+
|
|
10971
|
+
sepwidth = (_colDescr$postgap = colDescr.postgap) != null ? _colDescr$postgap : arraycolsep;
|
|
11072
10972
|
|
|
11073
10973
|
if (sepwidth !== 0) {
|
|
11074
|
-
colSep =
|
|
10974
|
+
colSep = makeSpan(["arraycolsep"], []);
|
|
11075
10975
|
colSep.style.width = makeEm(sepwidth);
|
|
11076
10976
|
cols.push(colSep);
|
|
11077
10977
|
}
|
|
11078
10978
|
}
|
|
11079
10979
|
}
|
|
11080
10980
|
|
|
11081
|
-
body =
|
|
10981
|
+
body = makeSpan(["mtable"], cols); // Add \hline(s), if any.
|
|
11082
10982
|
|
|
11083
10983
|
if (hlines.length > 0) {
|
|
11084
|
-
const line =
|
|
11085
|
-
const dashes =
|
|
10984
|
+
const line = makeLineSpan("hline", options, ruleThickness);
|
|
10985
|
+
const dashes = makeLineSpan("hdashline", options, ruleThickness);
|
|
11086
10986
|
const vListElems = [{
|
|
11087
10987
|
type: "elem",
|
|
11088
10988
|
elem: body,
|
|
@@ -11108,21 +11008,21 @@ const array_htmlBuilder = function (group, options) {
|
|
|
11108
11008
|
}
|
|
11109
11009
|
}
|
|
11110
11010
|
|
|
11111
|
-
body =
|
|
11011
|
+
body = makeVList({
|
|
11112
11012
|
positionType: "individualShift",
|
|
11113
11013
|
children: vListElems
|
|
11114
11014
|
}, options);
|
|
11115
11015
|
}
|
|
11116
11016
|
|
|
11117
11017
|
if (tagSpans.length === 0) {
|
|
11118
|
-
return
|
|
11018
|
+
return makeSpan(["mord"], [body], options);
|
|
11119
11019
|
} else {
|
|
11120
|
-
let eqnNumCol =
|
|
11020
|
+
let eqnNumCol = makeVList({
|
|
11121
11021
|
positionType: "individualShift",
|
|
11122
11022
|
children: tagSpans
|
|
11123
11023
|
}, options);
|
|
11124
|
-
eqnNumCol =
|
|
11125
|
-
return
|
|
11024
|
+
eqnNumCol = makeSpan(["tag"], [eqnNumCol], options);
|
|
11025
|
+
return makeFragment([body, eqnNumCol]);
|
|
11126
11026
|
}
|
|
11127
11027
|
};
|
|
11128
11028
|
|
|
@@ -11134,15 +11034,15 @@ const alignMap = {
|
|
|
11134
11034
|
|
|
11135
11035
|
const array_mathmlBuilder = function (group, options) {
|
|
11136
11036
|
const tbl = [];
|
|
11137
|
-
const glue = new
|
|
11138
|
-
const tag = new
|
|
11037
|
+
const glue = new MathNode("mtd", [], ["mtr-glue"]);
|
|
11038
|
+
const tag = new MathNode("mtd", [], ["mml-eqn-num"]);
|
|
11139
11039
|
|
|
11140
11040
|
for (let i = 0; i < group.body.length; i++) {
|
|
11141
11041
|
const rw = group.body[i];
|
|
11142
11042
|
const row = [];
|
|
11143
11043
|
|
|
11144
11044
|
for (let j = 0; j < rw.length; j++) {
|
|
11145
|
-
row.push(new
|
|
11045
|
+
row.push(new MathNode("mtd", [buildMathML_buildGroup(rw[j], options)]));
|
|
11146
11046
|
}
|
|
11147
11047
|
|
|
11148
11048
|
if (group.tags && group.tags[i]) {
|
|
@@ -11156,10 +11056,10 @@ const array_mathmlBuilder = function (group, options) {
|
|
|
11156
11056
|
}
|
|
11157
11057
|
}
|
|
11158
11058
|
|
|
11159
|
-
tbl.push(new
|
|
11059
|
+
tbl.push(new MathNode("mtr", row));
|
|
11160
11060
|
}
|
|
11161
11061
|
|
|
11162
|
-
let table = new
|
|
11062
|
+
let table = new MathNode("mtable", tbl); // Set column alignment, row spacing, column spacing, and
|
|
11163
11063
|
// array lines by setting attributes on the table element.
|
|
11164
11064
|
// Set the row spacing. In MathML, we specify a gap distance.
|
|
11165
11065
|
// We do not use rowGap[] because MathML automatically increases
|
|
@@ -11258,13 +11158,13 @@ const array_mathmlBuilder = function (group, options) {
|
|
|
11258
11158
|
}
|
|
11259
11159
|
|
|
11260
11160
|
if (menclose !== "") {
|
|
11261
|
-
table = new
|
|
11161
|
+
table = new MathNode("menclose", [table]);
|
|
11262
11162
|
table.setAttribute("notation", menclose.trim());
|
|
11263
11163
|
}
|
|
11264
11164
|
|
|
11265
11165
|
if (group.arraystretch && group.arraystretch < 1) {
|
|
11266
11166
|
// A small array. Wrap in scriptstyle so row gap is not too large.
|
|
11267
|
-
table = new
|
|
11167
|
+
table = new MathNode("mstyle", [table]);
|
|
11268
11168
|
table.setAttribute("scriptlevel", "1");
|
|
11269
11169
|
}
|
|
11270
11170
|
|
|
@@ -11273,12 +11173,12 @@ const array_mathmlBuilder = function (group, options) {
|
|
|
11273
11173
|
|
|
11274
11174
|
|
|
11275
11175
|
const alignedHandler = function (context, args) {
|
|
11276
|
-
if (context.envName.
|
|
11176
|
+
if (!context.envName.includes("ed")) {
|
|
11277
11177
|
validateAmsEnvironmentContext(context);
|
|
11278
11178
|
}
|
|
11279
11179
|
|
|
11280
11180
|
const cols = [];
|
|
11281
|
-
const separationType = context.envName.
|
|
11181
|
+
const separationType = context.envName.includes("at") ? "alignat" : "align";
|
|
11282
11182
|
const isSplit = context.envName === "split";
|
|
11283
11183
|
const res = parseArray(context.parser, {
|
|
11284
11184
|
cols,
|
|
@@ -11387,7 +11287,7 @@ defineEnvironment({
|
|
|
11387
11287
|
const node = assertSymbolNodeType(nde);
|
|
11388
11288
|
const ca = node.text;
|
|
11389
11289
|
|
|
11390
|
-
if ("lcr".
|
|
11290
|
+
if ("lcr".includes(ca)) {
|
|
11391
11291
|
return {
|
|
11392
11292
|
type: "align",
|
|
11393
11293
|
align: ca
|
|
@@ -11459,7 +11359,7 @@ defineEnvironment({
|
|
|
11459
11359
|
parser.consumeSpaces();
|
|
11460
11360
|
colAlign = parser.fetch().text;
|
|
11461
11361
|
|
|
11462
|
-
if ("lcr".
|
|
11362
|
+
if (!"lcr".includes(colAlign)) {
|
|
11463
11363
|
throw new src_ParseError("Expected l or c or r", parser.nextToken);
|
|
11464
11364
|
}
|
|
11465
11365
|
|
|
@@ -11529,7 +11429,7 @@ defineEnvironment({
|
|
|
11529
11429
|
const node = assertSymbolNodeType(nde);
|
|
11530
11430
|
const ca = node.text; // {subarray} only recognizes "l" & "c"
|
|
11531
11431
|
|
|
11532
|
-
if ("lc".
|
|
11432
|
+
if ("lc".includes(ca)) {
|
|
11533
11433
|
return {
|
|
11534
11434
|
type: "align",
|
|
11535
11435
|
align: ca
|
|
@@ -11599,8 +11499,8 @@ defineEnvironment({
|
|
|
11599
11499
|
type: "leftright",
|
|
11600
11500
|
mode: context.mode,
|
|
11601
11501
|
body: [res],
|
|
11602
|
-
left: context.envName.
|
|
11603
|
-
right: context.envName.
|
|
11502
|
+
left: context.envName.includes("r") ? "." : "\\{",
|
|
11503
|
+
right: context.envName.includes("r") ? "\\}" : ".",
|
|
11604
11504
|
rightColor: undefined
|
|
11605
11505
|
};
|
|
11606
11506
|
},
|
|
@@ -11635,7 +11535,7 @@ defineEnvironment({
|
|
|
11635
11535
|
},
|
|
11636
11536
|
|
|
11637
11537
|
handler(context) {
|
|
11638
|
-
if (
|
|
11538
|
+
if (gatherEnvironments.has(context.envName)) {
|
|
11639
11539
|
validateAmsEnvironmentContext(context);
|
|
11640
11540
|
}
|
|
11641
11541
|
|
|
@@ -11724,13 +11624,13 @@ defineFunction({
|
|
|
11724
11624
|
}
|
|
11725
11625
|
|
|
11726
11626
|
});
|
|
11727
|
-
;//
|
|
11627
|
+
;// ./src/environments.js
|
|
11728
11628
|
|
|
11729
11629
|
const environments = _environments;
|
|
11730
11630
|
/* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below
|
|
11731
11631
|
|
|
11732
11632
|
|
|
11733
|
-
;//
|
|
11633
|
+
;// ./src/functions/environment.js
|
|
11734
11634
|
|
|
11735
11635
|
|
|
11736
11636
|
|
|
@@ -11802,7 +11702,7 @@ defineFunction({
|
|
|
11802
11702
|
}
|
|
11803
11703
|
|
|
11804
11704
|
});
|
|
11805
|
-
;//
|
|
11705
|
+
;// ./src/functions/font.js
|
|
11806
11706
|
// TODO(kevinb): implement \\sl and \\sc
|
|
11807
11707
|
|
|
11808
11708
|
|
|
@@ -11870,8 +11770,7 @@ defineFunction({
|
|
|
11870
11770
|
let {
|
|
11871
11771
|
parser
|
|
11872
11772
|
} = _ref2;
|
|
11873
|
-
const body = args[0];
|
|
11874
|
-
const isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
|
|
11773
|
+
const body = args[0]; // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
|
|
11875
11774
|
// argument's bin|rel|ord status
|
|
11876
11775
|
|
|
11877
11776
|
return {
|
|
@@ -11884,7 +11783,7 @@ defineFunction({
|
|
|
11884
11783
|
font: "boldsymbol",
|
|
11885
11784
|
body
|
|
11886
11785
|
}],
|
|
11887
|
-
isCharacterBox: isCharacterBox
|
|
11786
|
+
isCharacterBox: isCharacterBox(body)
|
|
11888
11787
|
};
|
|
11889
11788
|
}
|
|
11890
11789
|
}); // Old font changing functions
|
|
@@ -11921,8 +11820,7 @@ defineFunction({
|
|
|
11921
11820
|
htmlBuilder: font_htmlBuilder,
|
|
11922
11821
|
mathmlBuilder: font_mathmlBuilder
|
|
11923
11822
|
});
|
|
11924
|
-
;//
|
|
11925
|
-
|
|
11823
|
+
;// ./src/functions/genfrac.js
|
|
11926
11824
|
|
|
11927
11825
|
|
|
11928
11826
|
|
|
@@ -11981,9 +11879,9 @@ const genfrac_htmlBuilder = (group, options) => {
|
|
|
11981
11879
|
if (group.hasBarLine) {
|
|
11982
11880
|
if (group.barSize) {
|
|
11983
11881
|
ruleWidth = calculateSize(group.barSize, options);
|
|
11984
|
-
rule =
|
|
11882
|
+
rule = makeLineSpan("frac-line", options, ruleWidth);
|
|
11985
11883
|
} else {
|
|
11986
|
-
rule =
|
|
11884
|
+
rule = makeLineSpan("frac-line", options);
|
|
11987
11885
|
}
|
|
11988
11886
|
|
|
11989
11887
|
ruleWidth = rule.height;
|
|
@@ -12032,7 +11930,7 @@ const genfrac_htmlBuilder = (group, options) => {
|
|
|
12032
11930
|
denomShift += 0.5 * (clearance - candidateClearance);
|
|
12033
11931
|
}
|
|
12034
11932
|
|
|
12035
|
-
frac =
|
|
11933
|
+
frac = makeVList({
|
|
12036
11934
|
positionType: "individualShift",
|
|
12037
11935
|
children: [{
|
|
12038
11936
|
type: "elem",
|
|
@@ -12057,7 +11955,7 @@ const genfrac_htmlBuilder = (group, options) => {
|
|
|
12057
11955
|
}
|
|
12058
11956
|
|
|
12059
11957
|
const midShift = -(axisHeight - 0.5 * ruleWidth);
|
|
12060
|
-
frac =
|
|
11958
|
+
frac = makeVList({
|
|
12061
11959
|
positionType: "individualShift",
|
|
12062
11960
|
children: [{
|
|
12063
11961
|
type: "elem",
|
|
@@ -12097,22 +11995,22 @@ const genfrac_htmlBuilder = (group, options) => {
|
|
|
12097
11995
|
if (group.leftDelim == null) {
|
|
12098
11996
|
leftDelim = makeNullDelimiter(options, ["mopen"]);
|
|
12099
11997
|
} else {
|
|
12100
|
-
leftDelim =
|
|
11998
|
+
leftDelim = makeCustomSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
|
|
12101
11999
|
}
|
|
12102
12000
|
|
|
12103
12001
|
if (group.continued) {
|
|
12104
|
-
rightDelim =
|
|
12002
|
+
rightDelim = makeSpan([]); // zero width for \cfrac
|
|
12105
12003
|
} else if (group.rightDelim == null) {
|
|
12106
12004
|
rightDelim = makeNullDelimiter(options, ["mclose"]);
|
|
12107
12005
|
} else {
|
|
12108
|
-
rightDelim =
|
|
12006
|
+
rightDelim = makeCustomSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
|
|
12109
12007
|
}
|
|
12110
12008
|
|
|
12111
|
-
return
|
|
12009
|
+
return makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim], options);
|
|
12112
12010
|
};
|
|
12113
12011
|
|
|
12114
12012
|
const genfrac_mathmlBuilder = (group, options) => {
|
|
12115
|
-
let node = new
|
|
12013
|
+
let node = new MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]);
|
|
12116
12014
|
|
|
12117
12015
|
if (!group.hasBarLine) {
|
|
12118
12016
|
node.setAttribute("linethickness", "0px");
|
|
@@ -12124,7 +12022,7 @@ const genfrac_mathmlBuilder = (group, options) => {
|
|
|
12124
12022
|
const style = adjustStyle(group.size, options.style);
|
|
12125
12023
|
|
|
12126
12024
|
if (style.size !== options.style.size) {
|
|
12127
|
-
node = new
|
|
12025
|
+
node = new MathNode("mstyle", [node]);
|
|
12128
12026
|
const isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false";
|
|
12129
12027
|
node.setAttribute("displaystyle", isDisplay);
|
|
12130
12028
|
node.setAttribute("scriptlevel", "0");
|
|
@@ -12134,7 +12032,7 @@ const genfrac_mathmlBuilder = (group, options) => {
|
|
|
12134
12032
|
const withDelims = [];
|
|
12135
12033
|
|
|
12136
12034
|
if (group.leftDelim != null) {
|
|
12137
|
-
const leftOp = new
|
|
12035
|
+
const leftOp = new MathNode("mo", [new TextNode(group.leftDelim.replace("\\", ""))]);
|
|
12138
12036
|
leftOp.setAttribute("fence", "true");
|
|
12139
12037
|
withDelims.push(leftOp);
|
|
12140
12038
|
}
|
|
@@ -12142,7 +12040,7 @@ const genfrac_mathmlBuilder = (group, options) => {
|
|
|
12142
12040
|
withDelims.push(node);
|
|
12143
12041
|
|
|
12144
12042
|
if (group.rightDelim != null) {
|
|
12145
|
-
const rightOp = new
|
|
12043
|
+
const rightOp = new MathNode("mo", [new TextNode(group.rightDelim.replace("\\", ""))]);
|
|
12146
12044
|
rightOp.setAttribute("fence", "true");
|
|
12147
12045
|
withDelims.push(rightOp);
|
|
12148
12046
|
}
|
|
@@ -12433,7 +12331,12 @@ defineFunction({
|
|
|
12433
12331
|
funcName
|
|
12434
12332
|
} = _ref6;
|
|
12435
12333
|
const numer = args[0];
|
|
12436
|
-
const barSize =
|
|
12334
|
+
const barSize = assertNodeType(args[1], "infix").size;
|
|
12335
|
+
|
|
12336
|
+
if (!barSize) {
|
|
12337
|
+
throw new Error("\\\\abovefrac expected size, but got " + String(barSize));
|
|
12338
|
+
}
|
|
12339
|
+
|
|
12437
12340
|
const denom = args[2];
|
|
12438
12341
|
const hasBarLine = barSize.number > 0;
|
|
12439
12342
|
return {
|
|
@@ -12452,7 +12355,7 @@ defineFunction({
|
|
|
12452
12355
|
htmlBuilder: genfrac_htmlBuilder,
|
|
12453
12356
|
mathmlBuilder: genfrac_mathmlBuilder
|
|
12454
12357
|
});
|
|
12455
|
-
;//
|
|
12358
|
+
;// ./src/functions/horizBrace.js
|
|
12456
12359
|
|
|
12457
12360
|
|
|
12458
12361
|
|
|
@@ -12482,13 +12385,13 @@ const horizBrace_htmlBuilder = (grp, options) => {
|
|
|
12482
12385
|
|
|
12483
12386
|
const body = buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element
|
|
12484
12387
|
|
|
12485
|
-
const braceBody =
|
|
12388
|
+
const braceBody = stretchySvg(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓
|
|
12486
12389
|
// This first vlist contains the content and the brace: equation
|
|
12487
12390
|
|
|
12488
12391
|
let vlist;
|
|
12489
12392
|
|
|
12490
12393
|
if (group.isOver) {
|
|
12491
|
-
vlist =
|
|
12394
|
+
vlist = makeVList({
|
|
12492
12395
|
positionType: "firstBaseline",
|
|
12493
12396
|
children: [{
|
|
12494
12397
|
type: "elem",
|
|
@@ -12504,7 +12407,7 @@ const horizBrace_htmlBuilder = (grp, options) => {
|
|
|
12504
12407
|
|
|
12505
12408
|
vlist.children[0].children[0].children[1].classes.push("svg-align");
|
|
12506
12409
|
} else {
|
|
12507
|
-
vlist =
|
|
12410
|
+
vlist = makeVList({
|
|
12508
12411
|
positionType: "bottom",
|
|
12509
12412
|
positionData: body.depth + 0.1 + braceBody.height,
|
|
12510
12413
|
children: [{
|
|
@@ -12530,10 +12433,10 @@ const horizBrace_htmlBuilder = (grp, options) => {
|
|
|
12530
12433
|
// note long note long note
|
|
12531
12434
|
// ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓
|
|
12532
12435
|
// equation eqn eqn
|
|
12533
|
-
const vSpan =
|
|
12436
|
+
const vSpan = makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
|
|
12534
12437
|
|
|
12535
12438
|
if (group.isOver) {
|
|
12536
|
-
vlist =
|
|
12439
|
+
vlist = makeVList({
|
|
12537
12440
|
positionType: "firstBaseline",
|
|
12538
12441
|
children: [{
|
|
12539
12442
|
type: "elem",
|
|
@@ -12547,7 +12450,7 @@ const horizBrace_htmlBuilder = (grp, options) => {
|
|
|
12547
12450
|
}]
|
|
12548
12451
|
}, options);
|
|
12549
12452
|
} else {
|
|
12550
|
-
vlist =
|
|
12453
|
+
vlist = makeVList({
|
|
12551
12454
|
positionType: "bottom",
|
|
12552
12455
|
positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
|
|
12553
12456
|
children: [{
|
|
@@ -12564,12 +12467,12 @@ const horizBrace_htmlBuilder = (grp, options) => {
|
|
|
12564
12467
|
}
|
|
12565
12468
|
}
|
|
12566
12469
|
|
|
12567
|
-
return
|
|
12470
|
+
return makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
|
|
12568
12471
|
};
|
|
12569
12472
|
|
|
12570
12473
|
const horizBrace_mathmlBuilder = (group, options) => {
|
|
12571
|
-
const accentNode =
|
|
12572
|
-
return new
|
|
12474
|
+
const accentNode = stretchyMathML(group.label);
|
|
12475
|
+
return new MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]);
|
|
12573
12476
|
}; // Horizontal stretchy braces
|
|
12574
12477
|
|
|
12575
12478
|
|
|
@@ -12597,7 +12500,7 @@ defineFunction({
|
|
|
12597
12500
|
htmlBuilder: horizBrace_htmlBuilder,
|
|
12598
12501
|
mathmlBuilder: horizBrace_mathmlBuilder
|
|
12599
12502
|
});
|
|
12600
|
-
;//
|
|
12503
|
+
;// ./src/functions/href.js
|
|
12601
12504
|
|
|
12602
12505
|
|
|
12603
12506
|
|
|
@@ -12635,7 +12538,7 @@ defineFunction({
|
|
|
12635
12538
|
},
|
|
12636
12539
|
htmlBuilder: (group, options) => {
|
|
12637
12540
|
const elements = buildExpression(group.body, options, false);
|
|
12638
|
-
return
|
|
12541
|
+
return makeAnchor(group.href, [], elements, options);
|
|
12639
12542
|
},
|
|
12640
12543
|
mathmlBuilder: (group, options) => {
|
|
12641
12544
|
let math = buildExpressionRow(group.body, options);
|
|
@@ -12699,7 +12602,7 @@ defineFunction({
|
|
|
12699
12602
|
};
|
|
12700
12603
|
}
|
|
12701
12604
|
});
|
|
12702
|
-
;//
|
|
12605
|
+
;// ./src/functions/hbox.js
|
|
12703
12606
|
|
|
12704
12607
|
|
|
12705
12608
|
|
|
@@ -12732,15 +12635,15 @@ defineFunction({
|
|
|
12732
12635
|
|
|
12733
12636
|
htmlBuilder(group, options) {
|
|
12734
12637
|
const elements = buildExpression(group.body, options, false);
|
|
12735
|
-
return
|
|
12638
|
+
return makeFragment(elements);
|
|
12736
12639
|
},
|
|
12737
12640
|
|
|
12738
12641
|
mathmlBuilder(group, options) {
|
|
12739
|
-
return new
|
|
12642
|
+
return new MathNode("mrow", buildMathML_buildExpression(group.body, options));
|
|
12740
12643
|
}
|
|
12741
12644
|
|
|
12742
12645
|
});
|
|
12743
|
-
;//
|
|
12646
|
+
;// ./src/functions/html.js
|
|
12744
12647
|
|
|
12745
12648
|
|
|
12746
12649
|
|
|
@@ -12843,7 +12746,7 @@ defineFunction({
|
|
|
12843
12746
|
classes.push(...group.attributes.class.trim().split(/\s+/));
|
|
12844
12747
|
}
|
|
12845
12748
|
|
|
12846
|
-
const span =
|
|
12749
|
+
const span = makeSpan(classes, elements, options);
|
|
12847
12750
|
|
|
12848
12751
|
for (const attr in group.attributes) {
|
|
12849
12752
|
if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
|
|
@@ -12857,7 +12760,7 @@ defineFunction({
|
|
|
12857
12760
|
return buildExpressionRow(group.body, options);
|
|
12858
12761
|
}
|
|
12859
12762
|
});
|
|
12860
|
-
;//
|
|
12763
|
+
;// ./src/functions/htmlmathml.js
|
|
12861
12764
|
|
|
12862
12765
|
|
|
12863
12766
|
|
|
@@ -12867,6 +12770,7 @@ defineFunction({
|
|
|
12867
12770
|
names: ["\\html@mathml"],
|
|
12868
12771
|
props: {
|
|
12869
12772
|
numArgs: 2,
|
|
12773
|
+
allowedInArgument: true,
|
|
12870
12774
|
allowedInText: true
|
|
12871
12775
|
},
|
|
12872
12776
|
handler: (_ref, args) => {
|
|
@@ -12882,13 +12786,13 @@ defineFunction({
|
|
|
12882
12786
|
},
|
|
12883
12787
|
htmlBuilder: (group, options) => {
|
|
12884
12788
|
const elements = buildExpression(group.html, options, false);
|
|
12885
|
-
return
|
|
12789
|
+
return makeFragment(elements);
|
|
12886
12790
|
},
|
|
12887
12791
|
mathmlBuilder: (group, options) => {
|
|
12888
12792
|
return buildExpressionRow(group.mathml, options);
|
|
12889
12793
|
}
|
|
12890
12794
|
});
|
|
12891
|
-
;//
|
|
12795
|
+
;// ./src/functions/includegraphics.js
|
|
12892
12796
|
|
|
12893
12797
|
|
|
12894
12798
|
|
|
@@ -13046,7 +12950,7 @@ defineFunction({
|
|
|
13046
12950
|
return node;
|
|
13047
12951
|
},
|
|
13048
12952
|
mathmlBuilder: (group, options) => {
|
|
13049
|
-
const node = new
|
|
12953
|
+
const node = new MathNode("mglyph", []);
|
|
13050
12954
|
node.setAttribute("alt", group.alt);
|
|
13051
12955
|
const height = calculateSize(group.height, options);
|
|
13052
12956
|
let depth = 0;
|
|
@@ -13067,7 +12971,7 @@ defineFunction({
|
|
|
13067
12971
|
return node;
|
|
13068
12972
|
}
|
|
13069
12973
|
});
|
|
13070
|
-
;//
|
|
12974
|
+
;// ./src/functions/kern.js
|
|
13071
12975
|
// Horizontal spacing commands
|
|
13072
12976
|
|
|
13073
12977
|
|
|
@@ -13121,16 +13025,16 @@ defineFunction({
|
|
|
13121
13025
|
},
|
|
13122
13026
|
|
|
13123
13027
|
htmlBuilder(group, options) {
|
|
13124
|
-
return
|
|
13028
|
+
return makeGlue(group.dimension, options);
|
|
13125
13029
|
},
|
|
13126
13030
|
|
|
13127
13031
|
mathmlBuilder(group, options) {
|
|
13128
13032
|
const dimension = calculateSize(group.dimension, options);
|
|
13129
|
-
return new
|
|
13033
|
+
return new SpaceNode(dimension);
|
|
13130
13034
|
}
|
|
13131
13035
|
|
|
13132
13036
|
});
|
|
13133
|
-
;//
|
|
13037
|
+
;// ./src/functions/lap.js
|
|
13134
13038
|
// Horizontal overlap functions
|
|
13135
13039
|
|
|
13136
13040
|
|
|
@@ -13164,21 +13068,21 @@ defineFunction({
|
|
|
13164
13068
|
|
|
13165
13069
|
if (group.alignment === "clap") {
|
|
13166
13070
|
// ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
|
|
13167
|
-
inner =
|
|
13071
|
+
inner = makeSpan([], [buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span
|
|
13168
13072
|
|
|
13169
|
-
inner =
|
|
13073
|
+
inner = makeSpan(["inner"], [inner], options);
|
|
13170
13074
|
} else {
|
|
13171
|
-
inner =
|
|
13075
|
+
inner = makeSpan(["inner"], [buildGroup(group.body, options)]);
|
|
13172
13076
|
}
|
|
13173
13077
|
|
|
13174
|
-
const fix =
|
|
13175
|
-
let node =
|
|
13078
|
+
const fix = makeSpan(["fix"], []);
|
|
13079
|
+
let node = makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the
|
|
13176
13080
|
// two items involved in the lap.
|
|
13177
13081
|
// Next, use a strut to set the height of the HTML bounding box.
|
|
13178
13082
|
// Otherwise, a tall argument may be misplaced.
|
|
13179
13083
|
// This code resolved issue #1153
|
|
13180
13084
|
|
|
13181
|
-
const strut =
|
|
13085
|
+
const strut = makeSpan(["strut"]);
|
|
13182
13086
|
strut.style.height = makeEm(node.height + node.depth);
|
|
13183
13087
|
|
|
13184
13088
|
if (node.depth) {
|
|
@@ -13188,12 +13092,12 @@ defineFunction({
|
|
|
13188
13092
|
node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
|
|
13189
13093
|
// This code resolves issue #1234
|
|
13190
13094
|
|
|
13191
|
-
node =
|
|
13192
|
-
return
|
|
13095
|
+
node = makeSpan(["thinbox"], [node], options);
|
|
13096
|
+
return makeSpan(["mord", "vbox"], [node], options);
|
|
13193
13097
|
},
|
|
13194
13098
|
mathmlBuilder: (group, options) => {
|
|
13195
13099
|
// mathllap, mathrlap, mathclap
|
|
13196
|
-
const node = new
|
|
13100
|
+
const node = new MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
|
|
13197
13101
|
|
|
13198
13102
|
if (group.alignment !== "rlap") {
|
|
13199
13103
|
const offset = group.alignment === "llap" ? "-1" : "-0.5";
|
|
@@ -13204,7 +13108,7 @@ defineFunction({
|
|
|
13204
13108
|
return node;
|
|
13205
13109
|
}
|
|
13206
13110
|
});
|
|
13207
|
-
;//
|
|
13111
|
+
;// ./src/functions/math.js
|
|
13208
13112
|
|
|
13209
13113
|
// Switching from text mode back to math mode
|
|
13210
13114
|
|
|
@@ -13253,7 +13157,7 @@ defineFunction({
|
|
|
13253
13157
|
}
|
|
13254
13158
|
|
|
13255
13159
|
});
|
|
13256
|
-
;//
|
|
13160
|
+
;// ./src/functions/mathchoice.js
|
|
13257
13161
|
|
|
13258
13162
|
|
|
13259
13163
|
|
|
@@ -13302,22 +13206,22 @@ defineFunction({
|
|
|
13302
13206
|
htmlBuilder: (group, options) => {
|
|
13303
13207
|
const body = chooseMathStyle(group, options);
|
|
13304
13208
|
const elements = buildExpression(body, options, false);
|
|
13305
|
-
return
|
|
13209
|
+
return makeFragment(elements);
|
|
13306
13210
|
},
|
|
13307
13211
|
mathmlBuilder: (group, options) => {
|
|
13308
13212
|
const body = chooseMathStyle(group, options);
|
|
13309
13213
|
return buildExpressionRow(body, options);
|
|
13310
13214
|
}
|
|
13311
13215
|
});
|
|
13312
|
-
;//
|
|
13216
|
+
;// ./src/functions/utils/assembleSupSub.js
|
|
13313
13217
|
|
|
13314
13218
|
|
|
13315
13219
|
|
|
13316
13220
|
// For an operator with limits, assemble the base, sup, and sub into a span.
|
|
13317
13221
|
|
|
13318
13222
|
const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => {
|
|
13319
|
-
base =
|
|
13320
|
-
const subIsSingleCharacter = subGroup &&
|
|
13223
|
+
base = makeSpan([], [base]);
|
|
13224
|
+
const subIsSingleCharacter = subGroup && isCharacterBox(subGroup);
|
|
13321
13225
|
let sub;
|
|
13322
13226
|
let sup; // We manually have to handle the superscripts and subscripts. This,
|
|
13323
13227
|
// aside from the kern calculations, is copied from supsub.
|
|
@@ -13344,7 +13248,7 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi
|
|
|
13344
13248
|
|
|
13345
13249
|
if (sup && sub) {
|
|
13346
13250
|
const bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;
|
|
13347
|
-
finalGroup =
|
|
13251
|
+
finalGroup = makeVList({
|
|
13348
13252
|
positionType: "bottom",
|
|
13349
13253
|
positionData: bottom,
|
|
13350
13254
|
children: [{
|
|
@@ -13378,7 +13282,7 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi
|
|
|
13378
13282
|
// but since we are centering the limits adding a full slant of
|
|
13379
13283
|
// margin will shift by 1/2 that.
|
|
13380
13284
|
|
|
13381
|
-
finalGroup =
|
|
13285
|
+
finalGroup = makeVList({
|
|
13382
13286
|
positionType: "top",
|
|
13383
13287
|
positionData: top,
|
|
13384
13288
|
children: [{
|
|
@@ -13398,7 +13302,7 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi
|
|
|
13398
13302
|
}, options);
|
|
13399
13303
|
} else if (sup) {
|
|
13400
13304
|
const bottom = base.depth + baseShift;
|
|
13401
|
-
finalGroup =
|
|
13305
|
+
finalGroup = makeVList({
|
|
13402
13306
|
positionType: "bottom",
|
|
13403
13307
|
positionData: bottom,
|
|
13404
13308
|
children: [{
|
|
@@ -13428,14 +13332,14 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi
|
|
|
13428
13332
|
if (sub && slant !== 0 && !subIsSingleCharacter) {
|
|
13429
13333
|
// A negative margin-left was applied to the lower limit.
|
|
13430
13334
|
// Avoid an overlap by placing a spacer on the left on the group.
|
|
13431
|
-
const spacer =
|
|
13335
|
+
const spacer = makeSpan(["mspace"], [], options);
|
|
13432
13336
|
spacer.style.marginRight = makeEm(slant);
|
|
13433
13337
|
parts.unshift(spacer);
|
|
13434
13338
|
}
|
|
13435
13339
|
|
|
13436
|
-
return
|
|
13340
|
+
return makeSpan(["mop", "op-limits"], parts, options);
|
|
13437
13341
|
};
|
|
13438
|
-
;//
|
|
13342
|
+
;// ./src/functions/op.js
|
|
13439
13343
|
// Limits, symbols
|
|
13440
13344
|
|
|
13441
13345
|
|
|
@@ -13448,7 +13352,7 @@ const assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShi
|
|
|
13448
13352
|
|
|
13449
13353
|
|
|
13450
13354
|
// Most operators have a large successor symbol, but these don't.
|
|
13451
|
-
const noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
|
|
13355
|
+
const noSuccessor = new Set(["\\smallint"]); // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
|
|
13452
13356
|
// "supsub" since some of them (like \int) can affect super/subscripting.
|
|
13453
13357
|
|
|
13454
13358
|
const op_htmlBuilder = (grp, options) => {
|
|
@@ -13473,7 +13377,7 @@ const op_htmlBuilder = (grp, options) => {
|
|
|
13473
13377
|
const style = options.style;
|
|
13474
13378
|
let large = false;
|
|
13475
13379
|
|
|
13476
|
-
if (style.size === src_Style.DISPLAY.size && group.symbol && !noSuccessor.
|
|
13380
|
+
if (style.size === src_Style.DISPLAY.size && group.symbol && !noSuccessor.has(group.name)) {
|
|
13477
13381
|
// Most symbol operators get larger in displaystyle (rule 13)
|
|
13478
13382
|
large = true;
|
|
13479
13383
|
}
|
|
@@ -13492,14 +13396,14 @@ const op_htmlBuilder = (grp, options) => {
|
|
|
13492
13396
|
group.name = stash === "oiint" ? "\\iint" : "\\iiint";
|
|
13493
13397
|
}
|
|
13494
13398
|
|
|
13495
|
-
base =
|
|
13399
|
+
base = makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
|
|
13496
13400
|
|
|
13497
13401
|
if (stash.length > 0) {
|
|
13498
13402
|
// We're in \oiint or \oiiint. Overlay the oval.
|
|
13499
13403
|
// TODO: When font glyphs are available, delete this code.
|
|
13500
13404
|
const italic = base.italic;
|
|
13501
|
-
const oval =
|
|
13502
|
-
base =
|
|
13405
|
+
const oval = staticSvg(stash + "Size" + (large ? "2" : "1"), options);
|
|
13406
|
+
base = makeVList({
|
|
13503
13407
|
positionType: "individualShift",
|
|
13504
13408
|
children: [{
|
|
13505
13409
|
type: "elem",
|
|
@@ -13524,7 +13428,7 @@ const op_htmlBuilder = (grp, options) => {
|
|
|
13524
13428
|
base = inner[0];
|
|
13525
13429
|
base.classes[0] = "mop"; // replace old mclass
|
|
13526
13430
|
} else {
|
|
13527
|
-
base =
|
|
13431
|
+
base = makeSpan(["mop"], inner, options);
|
|
13528
13432
|
}
|
|
13529
13433
|
} else {
|
|
13530
13434
|
// Otherwise, this is a text operator. Build the text from the
|
|
@@ -13532,10 +13436,10 @@ const op_htmlBuilder = (grp, options) => {
|
|
|
13532
13436
|
const output = [];
|
|
13533
13437
|
|
|
13534
13438
|
for (let i = 1; i < group.name.length; i++) {
|
|
13535
|
-
output.push(
|
|
13439
|
+
output.push(mathsym(group.name[i], group.mode, options));
|
|
13536
13440
|
}
|
|
13537
13441
|
|
|
13538
|
-
base =
|
|
13442
|
+
base = makeSpan(["mop"], output, options);
|
|
13539
13443
|
} // If content of op is a single symbol, shift it vertically.
|
|
13540
13444
|
|
|
13541
13445
|
|
|
@@ -13574,14 +13478,14 @@ const op_mathmlBuilder = (group, options) => {
|
|
|
13574
13478
|
// This is a symbol. Just add the symbol.
|
|
13575
13479
|
node = new MathNode("mo", [makeText(group.name, group.mode)]);
|
|
13576
13480
|
|
|
13577
|
-
if (noSuccessor.
|
|
13481
|
+
if (noSuccessor.has(group.name)) {
|
|
13578
13482
|
node.setAttribute("largeop", "false");
|
|
13579
13483
|
}
|
|
13580
13484
|
} else if (group.body) {
|
|
13581
13485
|
// This is an operator with children. Add them.
|
|
13582
13486
|
node = new MathNode("mo", buildMathML_buildExpression(group.body, options));
|
|
13583
13487
|
} else {
|
|
13584
|
-
// This is a text operator. Add all
|
|
13488
|
+
// This is a text operator. Add all the characters from the
|
|
13585
13489
|
// operator's name.
|
|
13586
13490
|
node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an <mo>⁡</mo>.
|
|
13587
13491
|
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
|
|
@@ -13763,7 +13667,7 @@ defineFunction({
|
|
|
13763
13667
|
htmlBuilder: op_htmlBuilder,
|
|
13764
13668
|
mathmlBuilder: op_mathmlBuilder
|
|
13765
13669
|
});
|
|
13766
|
-
;//
|
|
13670
|
+
;// ./src/functions/operatorname.js
|
|
13767
13671
|
|
|
13768
13672
|
|
|
13769
13673
|
|
|
@@ -13825,9 +13729,9 @@ const operatorname_htmlBuilder = (grp, options) => {
|
|
|
13825
13729
|
}
|
|
13826
13730
|
}
|
|
13827
13731
|
|
|
13828
|
-
base =
|
|
13732
|
+
base = makeSpan(["mop"], expression, options);
|
|
13829
13733
|
} else {
|
|
13830
|
-
base =
|
|
13734
|
+
base = makeSpan(["mop"], [], options);
|
|
13831
13735
|
}
|
|
13832
13736
|
|
|
13833
13737
|
if (hasLimits) {
|
|
@@ -13846,8 +13750,8 @@ const operatorname_mathmlBuilder = (group, options) => {
|
|
|
13846
13750
|
for (let i = 0; i < expression.length; i++) {
|
|
13847
13751
|
const node = expression[i];
|
|
13848
13752
|
|
|
13849
|
-
if (node instanceof
|
|
13850
|
-
} else if (node instanceof
|
|
13753
|
+
if (node instanceof SpaceNode) {// Do nothing
|
|
13754
|
+
} else if (node instanceof MathNode) {
|
|
13851
13755
|
switch (node.type) {
|
|
13852
13756
|
case "mi":
|
|
13853
13757
|
case "mn":
|
|
@@ -13861,7 +13765,7 @@ const operatorname_mathmlBuilder = (group, options) => {
|
|
|
13861
13765
|
{
|
|
13862
13766
|
const child = node.children[0];
|
|
13863
13767
|
|
|
13864
|
-
if (node.children.length === 1 && child instanceof
|
|
13768
|
+
if (node.children.length === 1 && child instanceof TextNode) {
|
|
13865
13769
|
child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
|
|
13866
13770
|
} else {
|
|
13867
13771
|
isAllString = false;
|
|
@@ -13881,19 +13785,19 @@ const operatorname_mathmlBuilder = (group, options) => {
|
|
|
13881
13785
|
if (isAllString) {
|
|
13882
13786
|
// Write a single TextNode instead of multiple nested tags.
|
|
13883
13787
|
const word = expression.map(node => node.toText()).join("");
|
|
13884
|
-
expression = [new
|
|
13788
|
+
expression = [new TextNode(word)];
|
|
13885
13789
|
}
|
|
13886
13790
|
|
|
13887
|
-
const identifier = new
|
|
13791
|
+
const identifier = new MathNode("mi", expression);
|
|
13888
13792
|
identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡
|
|
13889
13793
|
// ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
|
|
13890
13794
|
|
|
13891
|
-
const operator = new
|
|
13795
|
+
const operator = new MathNode("mo", [makeText("\u2061", "text")]);
|
|
13892
13796
|
|
|
13893
13797
|
if (group.parentIsSupSub) {
|
|
13894
|
-
return new
|
|
13798
|
+
return new MathNode("mrow", [identifier, operator]);
|
|
13895
13799
|
} else {
|
|
13896
|
-
return
|
|
13800
|
+
return newDocumentFragment([identifier, operator]);
|
|
13897
13801
|
}
|
|
13898
13802
|
}; // \operatorname
|
|
13899
13803
|
// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
|
|
@@ -13924,7 +13828,7 @@ defineFunction({
|
|
|
13924
13828
|
mathmlBuilder: operatorname_mathmlBuilder
|
|
13925
13829
|
});
|
|
13926
13830
|
defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
|
|
13927
|
-
;//
|
|
13831
|
+
;// ./src/functions/ordgroup.js
|
|
13928
13832
|
|
|
13929
13833
|
|
|
13930
13834
|
|
|
@@ -13934,10 +13838,10 @@ defineFunctionBuilders({
|
|
|
13934
13838
|
|
|
13935
13839
|
htmlBuilder(group, options) {
|
|
13936
13840
|
if (group.semisimple) {
|
|
13937
|
-
return
|
|
13841
|
+
return makeFragment(buildExpression(group.body, options, false));
|
|
13938
13842
|
}
|
|
13939
13843
|
|
|
13940
|
-
return
|
|
13844
|
+
return makeSpan(["mord"], buildExpression(group.body, options, true), options);
|
|
13941
13845
|
},
|
|
13942
13846
|
|
|
13943
13847
|
mathmlBuilder(group, options) {
|
|
@@ -13945,7 +13849,7 @@ defineFunctionBuilders({
|
|
|
13945
13849
|
}
|
|
13946
13850
|
|
|
13947
13851
|
});
|
|
13948
|
-
;//
|
|
13852
|
+
;// ./src/functions/overline.js
|
|
13949
13853
|
|
|
13950
13854
|
|
|
13951
13855
|
|
|
@@ -13975,10 +13879,10 @@ defineFunction({
|
|
|
13975
13879
|
// Build the inner group in the cramped style.
|
|
13976
13880
|
const innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body
|
|
13977
13881
|
|
|
13978
|
-
const line =
|
|
13882
|
+
const line = makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns
|
|
13979
13883
|
|
|
13980
13884
|
const defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
|
|
13981
|
-
const vlist =
|
|
13885
|
+
const vlist = makeVList({
|
|
13982
13886
|
positionType: "firstBaseline",
|
|
13983
13887
|
children: [{
|
|
13984
13888
|
type: "elem",
|
|
@@ -13994,19 +13898,19 @@ defineFunction({
|
|
|
13994
13898
|
size: defaultRuleThickness
|
|
13995
13899
|
}]
|
|
13996
13900
|
}, options);
|
|
13997
|
-
return
|
|
13901
|
+
return makeSpan(["mord", "overline"], [vlist], options);
|
|
13998
13902
|
},
|
|
13999
13903
|
|
|
14000
13904
|
mathmlBuilder(group, options) {
|
|
14001
|
-
const operator = new
|
|
13905
|
+
const operator = new MathNode("mo", [new TextNode("\u203e")]);
|
|
14002
13906
|
operator.setAttribute("stretchy", "true");
|
|
14003
|
-
const node = new
|
|
13907
|
+
const node = new MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]);
|
|
14004
13908
|
node.setAttribute("accent", "true");
|
|
14005
13909
|
return node;
|
|
14006
13910
|
}
|
|
14007
13911
|
|
|
14008
13912
|
});
|
|
14009
|
-
;//
|
|
13913
|
+
;// ./src/functions/phantom.js
|
|
14010
13914
|
|
|
14011
13915
|
|
|
14012
13916
|
|
|
@@ -14034,11 +13938,11 @@ defineFunction({
|
|
|
14034
13938
|
const elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains.
|
|
14035
13939
|
// See "color" for more details.
|
|
14036
13940
|
|
|
14037
|
-
return
|
|
13941
|
+
return makeFragment(elements);
|
|
14038
13942
|
},
|
|
14039
13943
|
mathmlBuilder: (group, options) => {
|
|
14040
13944
|
const inner = buildMathML_buildExpression(group.body, options);
|
|
14041
|
-
return new
|
|
13945
|
+
return new MathNode("mphantom", inner);
|
|
14042
13946
|
}
|
|
14043
13947
|
});
|
|
14044
13948
|
defineFunction({
|
|
@@ -14060,7 +13964,7 @@ defineFunction({
|
|
|
14060
13964
|
};
|
|
14061
13965
|
},
|
|
14062
13966
|
htmlBuilder: (group, options) => {
|
|
14063
|
-
let node =
|
|
13967
|
+
let node = makeSpan([], [buildGroup(group.body, options.withPhantom())]);
|
|
14064
13968
|
node.height = 0;
|
|
14065
13969
|
node.depth = 0;
|
|
14066
13970
|
|
|
@@ -14072,7 +13976,7 @@ defineFunction({
|
|
|
14072
13976
|
} // See smash for comment re: use of makeVList
|
|
14073
13977
|
|
|
14074
13978
|
|
|
14075
|
-
node =
|
|
13979
|
+
node = makeVList({
|
|
14076
13980
|
positionType: "firstBaseline",
|
|
14077
13981
|
children: [{
|
|
14078
13982
|
type: "elem",
|
|
@@ -14080,12 +13984,12 @@ defineFunction({
|
|
|
14080
13984
|
}]
|
|
14081
13985
|
}, options); // For spacing, TeX treats \smash as a math group (same spacing as ord).
|
|
14082
13986
|
|
|
14083
|
-
return
|
|
13987
|
+
return makeSpan(["mord"], [node], options);
|
|
14084
13988
|
},
|
|
14085
13989
|
mathmlBuilder: (group, options) => {
|
|
14086
13990
|
const inner = buildMathML_buildExpression(ordargument(group.body), options);
|
|
14087
|
-
const phantom = new
|
|
14088
|
-
const node = new
|
|
13991
|
+
const phantom = new MathNode("mphantom", inner);
|
|
13992
|
+
const node = new MathNode("mpadded", [phantom]);
|
|
14089
13993
|
node.setAttribute("height", "0px");
|
|
14090
13994
|
node.setAttribute("depth", "0px");
|
|
14091
13995
|
return node;
|
|
@@ -14110,19 +14014,19 @@ defineFunction({
|
|
|
14110
14014
|
};
|
|
14111
14015
|
},
|
|
14112
14016
|
htmlBuilder: (group, options) => {
|
|
14113
|
-
const inner =
|
|
14114
|
-
const fix =
|
|
14115
|
-
return
|
|
14017
|
+
const inner = makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]);
|
|
14018
|
+
const fix = makeSpan(["fix"], []);
|
|
14019
|
+
return makeSpan(["mord", "rlap"], [inner, fix], options);
|
|
14116
14020
|
},
|
|
14117
14021
|
mathmlBuilder: (group, options) => {
|
|
14118
14022
|
const inner = buildMathML_buildExpression(ordargument(group.body), options);
|
|
14119
|
-
const phantom = new
|
|
14120
|
-
const node = new
|
|
14023
|
+
const phantom = new MathNode("mphantom", inner);
|
|
14024
|
+
const node = new MathNode("mpadded", [phantom]);
|
|
14121
14025
|
node.setAttribute("width", "0px");
|
|
14122
14026
|
return node;
|
|
14123
14027
|
}
|
|
14124
14028
|
});
|
|
14125
|
-
;//
|
|
14029
|
+
;// ./src/functions/raisebox.js
|
|
14126
14030
|
|
|
14127
14031
|
|
|
14128
14032
|
|
|
@@ -14157,7 +14061,7 @@ defineFunction({
|
|
|
14157
14061
|
htmlBuilder(group, options) {
|
|
14158
14062
|
const body = buildGroup(group.body, options);
|
|
14159
14063
|
const dy = calculateSize(group.dy, options);
|
|
14160
|
-
return
|
|
14064
|
+
return makeVList({
|
|
14161
14065
|
positionType: "shift",
|
|
14162
14066
|
positionData: -dy,
|
|
14163
14067
|
children: [{
|
|
@@ -14168,14 +14072,14 @@ defineFunction({
|
|
|
14168
14072
|
},
|
|
14169
14073
|
|
|
14170
14074
|
mathmlBuilder(group, options) {
|
|
14171
|
-
const node = new
|
|
14075
|
+
const node = new MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
|
|
14172
14076
|
const dy = group.dy.number + group.dy.unit;
|
|
14173
14077
|
node.setAttribute("voffset", dy);
|
|
14174
14078
|
return node;
|
|
14175
14079
|
}
|
|
14176
14080
|
|
|
14177
14081
|
});
|
|
14178
|
-
;//
|
|
14082
|
+
;// ./src/functions/relax.js
|
|
14179
14083
|
|
|
14180
14084
|
defineFunction({
|
|
14181
14085
|
type: "internal",
|
|
@@ -14197,7 +14101,7 @@ defineFunction({
|
|
|
14197
14101
|
}
|
|
14198
14102
|
|
|
14199
14103
|
});
|
|
14200
|
-
;//
|
|
14104
|
+
;// ./src/functions/rule.js
|
|
14201
14105
|
|
|
14202
14106
|
|
|
14203
14107
|
|
|
@@ -14232,7 +14136,7 @@ defineFunction({
|
|
|
14232
14136
|
|
|
14233
14137
|
htmlBuilder(group, options) {
|
|
14234
14138
|
// Make an empty span for the rule
|
|
14235
|
-
const rule =
|
|
14139
|
+
const rule = makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
|
|
14236
14140
|
|
|
14237
14141
|
const width = calculateSize(group.width, options);
|
|
14238
14142
|
const height = calculateSize(group.height, options);
|
|
@@ -14257,11 +14161,11 @@ defineFunction({
|
|
|
14257
14161
|
const height = calculateSize(group.height, options);
|
|
14258
14162
|
const shift = group.shift ? calculateSize(group.shift, options) : 0;
|
|
14259
14163
|
const color = options.color && options.getColor() || "black";
|
|
14260
|
-
const rule = new
|
|
14164
|
+
const rule = new MathNode("mspace");
|
|
14261
14165
|
rule.setAttribute("mathbackground", color);
|
|
14262
14166
|
rule.setAttribute("width", makeEm(width));
|
|
14263
14167
|
rule.setAttribute("height", makeEm(height));
|
|
14264
|
-
const wrapper = new
|
|
14168
|
+
const wrapper = new MathNode("mpadded", [rule]);
|
|
14265
14169
|
|
|
14266
14170
|
if (shift >= 0) {
|
|
14267
14171
|
wrapper.setAttribute("height", makeEm(shift));
|
|
@@ -14275,7 +14179,7 @@ defineFunction({
|
|
|
14275
14179
|
}
|
|
14276
14180
|
|
|
14277
14181
|
});
|
|
14278
|
-
;//
|
|
14182
|
+
;// ./src/functions/sizing.js
|
|
14279
14183
|
|
|
14280
14184
|
|
|
14281
14185
|
|
|
@@ -14303,7 +14207,7 @@ function sizingGroup(value, options, baseOptions) {
|
|
|
14303
14207
|
inner[i].depth *= multiplier;
|
|
14304
14208
|
}
|
|
14305
14209
|
|
|
14306
|
-
return
|
|
14210
|
+
return makeFragment(inner);
|
|
14307
14211
|
}
|
|
14308
14212
|
const sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
|
|
14309
14213
|
const sizing_htmlBuilder = (group, options) => {
|
|
@@ -14339,7 +14243,7 @@ defineFunction({
|
|
|
14339
14243
|
mathmlBuilder: (group, options) => {
|
|
14340
14244
|
const newOptions = options.havingSize(group.size);
|
|
14341
14245
|
const inner = buildMathML_buildExpression(group.body, newOptions);
|
|
14342
|
-
const node = new
|
|
14246
|
+
const node = new MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size
|
|
14343
14247
|
// changes, because we don't keep state of what style we're currently
|
|
14344
14248
|
// in, so we can't reset the size to normal before changing it. Now
|
|
14345
14249
|
// that we're passing an options parameter we should be able to fix
|
|
@@ -14349,7 +14253,7 @@ defineFunction({
|
|
|
14349
14253
|
return node;
|
|
14350
14254
|
}
|
|
14351
14255
|
});
|
|
14352
|
-
;//
|
|
14256
|
+
;// ./src/functions/smash.js
|
|
14353
14257
|
// smash, with optional [tb], as in AMS
|
|
14354
14258
|
|
|
14355
14259
|
|
|
@@ -14409,7 +14313,7 @@ defineFunction({
|
|
|
14409
14313
|
};
|
|
14410
14314
|
},
|
|
14411
14315
|
htmlBuilder: (group, options) => {
|
|
14412
|
-
const node =
|
|
14316
|
+
const node = makeSpan([], [buildGroup(group.body, options)]);
|
|
14413
14317
|
|
|
14414
14318
|
if (!group.smashHeight && !group.smashDepth) {
|
|
14415
14319
|
return node;
|
|
@@ -14439,7 +14343,7 @@ defineFunction({
|
|
|
14439
14343
|
// from acting on that line height. So we'll call makeVList now.
|
|
14440
14344
|
|
|
14441
14345
|
|
|
14442
|
-
const smashedNode =
|
|
14346
|
+
const smashedNode = makeVList({
|
|
14443
14347
|
positionType: "firstBaseline",
|
|
14444
14348
|
children: [{
|
|
14445
14349
|
type: "elem",
|
|
@@ -14447,10 +14351,10 @@ defineFunction({
|
|
|
14447
14351
|
}]
|
|
14448
14352
|
}, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord).
|
|
14449
14353
|
|
|
14450
|
-
return
|
|
14354
|
+
return makeSpan(["mord"], [smashedNode], options);
|
|
14451
14355
|
},
|
|
14452
14356
|
mathmlBuilder: (group, options) => {
|
|
14453
|
-
const node = new
|
|
14357
|
+
const node = new MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
|
|
14454
14358
|
|
|
14455
14359
|
if (group.smashHeight) {
|
|
14456
14360
|
node.setAttribute("height", "0px");
|
|
@@ -14463,7 +14367,7 @@ defineFunction({
|
|
|
14463
14367
|
return node;
|
|
14464
14368
|
}
|
|
14465
14369
|
});
|
|
14466
|
-
;//
|
|
14370
|
+
;// ./src/functions/sqrt.js
|
|
14467
14371
|
|
|
14468
14372
|
|
|
14469
14373
|
|
|
@@ -14507,7 +14411,7 @@ defineFunction({
|
|
|
14507
14411
|
// them in a span.
|
|
14508
14412
|
|
|
14509
14413
|
|
|
14510
|
-
inner =
|
|
14414
|
+
inner = wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter
|
|
14511
14415
|
|
|
14512
14416
|
const metrics = options.fontMetrics();
|
|
14513
14417
|
const theta = metrics.defaultRuleThickness;
|
|
@@ -14525,7 +14429,7 @@ defineFunction({
|
|
|
14525
14429
|
span: img,
|
|
14526
14430
|
ruleWidth,
|
|
14527
14431
|
advanceWidth
|
|
14528
|
-
} =
|
|
14432
|
+
} = makeSqrtImage(minDelimiterHeight, options);
|
|
14529
14433
|
const delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size
|
|
14530
14434
|
|
|
14531
14435
|
if (delimDepth > inner.height + inner.depth + lineClearance) {
|
|
@@ -14536,7 +14440,7 @@ defineFunction({
|
|
|
14536
14440
|
const imgShift = img.height - inner.height - lineClearance - ruleWidth;
|
|
14537
14441
|
inner.style.paddingLeft = makeEm(advanceWidth); // Overlay the image and the argument.
|
|
14538
14442
|
|
|
14539
|
-
const body =
|
|
14443
|
+
const body = makeVList({
|
|
14540
14444
|
positionType: "firstBaseline",
|
|
14541
14445
|
children: [{
|
|
14542
14446
|
type: "elem",
|
|
@@ -14555,7 +14459,7 @@ defineFunction({
|
|
|
14555
14459
|
}, options);
|
|
14556
14460
|
|
|
14557
14461
|
if (!group.index) {
|
|
14558
|
-
return
|
|
14462
|
+
return makeSpan(["mord", "sqrt"], [body], options);
|
|
14559
14463
|
} else {
|
|
14560
14464
|
// Handle the optional root index
|
|
14561
14465
|
// The index is always in scriptscript style
|
|
@@ -14565,7 +14469,7 @@ defineFunction({
|
|
|
14565
14469
|
|
|
14566
14470
|
const toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly
|
|
14567
14471
|
|
|
14568
|
-
const rootVList =
|
|
14472
|
+
const rootVList = makeVList({
|
|
14569
14473
|
positionType: "shift",
|
|
14570
14474
|
positionData: -toShift,
|
|
14571
14475
|
children: [{
|
|
@@ -14575,8 +14479,8 @@ defineFunction({
|
|
|
14575
14479
|
}, options); // Add a class surrounding it so we can add on the appropriate
|
|
14576
14480
|
// kerning
|
|
14577
14481
|
|
|
14578
|
-
const rootVListWrap =
|
|
14579
|
-
return
|
|
14482
|
+
const rootVListWrap = makeSpan(["root"], [rootVList]);
|
|
14483
|
+
return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
|
|
14580
14484
|
}
|
|
14581
14485
|
},
|
|
14582
14486
|
|
|
@@ -14585,11 +14489,11 @@ defineFunction({
|
|
|
14585
14489
|
body,
|
|
14586
14490
|
index
|
|
14587
14491
|
} = group;
|
|
14588
|
-
return index ? new
|
|
14492
|
+
return index ? new MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new MathNode("msqrt", [buildMathML_buildGroup(body, options)]);
|
|
14589
14493
|
}
|
|
14590
14494
|
|
|
14591
14495
|
});
|
|
14592
|
-
;//
|
|
14496
|
+
;// ./src/functions/styling.js
|
|
14593
14497
|
|
|
14594
14498
|
|
|
14595
14499
|
|
|
@@ -14644,7 +14548,7 @@ defineFunction({
|
|
|
14644
14548
|
const newStyle = styling_styleMap[group.style];
|
|
14645
14549
|
const newOptions = options.havingStyle(newStyle);
|
|
14646
14550
|
const inner = buildMathML_buildExpression(group.body, newOptions);
|
|
14647
|
-
const node = new
|
|
14551
|
+
const node = new MathNode("mstyle", inner);
|
|
14648
14552
|
const styleAttributes = {
|
|
14649
14553
|
"display": ["0", "true"],
|
|
14650
14554
|
"text": ["0", "false"],
|
|
@@ -14658,7 +14562,7 @@ defineFunction({
|
|
|
14658
14562
|
}
|
|
14659
14563
|
|
|
14660
14564
|
});
|
|
14661
|
-
;//
|
|
14565
|
+
;// ./src/functions/supsub.js
|
|
14662
14566
|
|
|
14663
14567
|
|
|
14664
14568
|
|
|
@@ -14694,7 +14598,7 @@ const htmlBuilderDelegate = function (group, options) {
|
|
|
14694
14598
|
const delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits);
|
|
14695
14599
|
return delegate ? operatorname_htmlBuilder : null;
|
|
14696
14600
|
} else if (base.type === "accent") {
|
|
14697
|
-
return
|
|
14601
|
+
return isCharacterBox(base.base) ? htmlBuilder : null;
|
|
14698
14602
|
} else if (base.type === "horizBrace") {
|
|
14699
14603
|
const isSup = !group.sub;
|
|
14700
14604
|
return isSup === base.isOver ? horizBrace_htmlBuilder : null;
|
|
@@ -14731,13 +14635,13 @@ defineFunctionBuilders({
|
|
|
14731
14635
|
|
|
14732
14636
|
let supShift = 0;
|
|
14733
14637
|
let subShift = 0;
|
|
14734
|
-
const
|
|
14638
|
+
const isCharBox = valueBase && isCharacterBox(valueBase);
|
|
14735
14639
|
|
|
14736
14640
|
if (valueSup) {
|
|
14737
14641
|
const newOptions = options.havingStyle(options.style.sup());
|
|
14738
14642
|
supm = buildGroup(valueSup, newOptions, options);
|
|
14739
14643
|
|
|
14740
|
-
if (!
|
|
14644
|
+
if (!isCharBox) {
|
|
14741
14645
|
supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
|
|
14742
14646
|
}
|
|
14743
14647
|
}
|
|
@@ -14746,7 +14650,7 @@ defineFunctionBuilders({
|
|
|
14746
14650
|
const newOptions = options.havingStyle(options.style.sub());
|
|
14747
14651
|
subm = buildGroup(valueSub, newOptions, options);
|
|
14748
14652
|
|
|
14749
|
-
if (!
|
|
14653
|
+
if (!isCharBox) {
|
|
14750
14654
|
subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
|
|
14751
14655
|
}
|
|
14752
14656
|
} // Rule 18c
|
|
@@ -14811,7 +14715,7 @@ defineFunctionBuilders({
|
|
|
14811
14715
|
shift: -supShift,
|
|
14812
14716
|
marginRight
|
|
14813
14717
|
}];
|
|
14814
|
-
supsub =
|
|
14718
|
+
supsub = makeVList({
|
|
14815
14719
|
positionType: "individualShift",
|
|
14816
14720
|
children: vlistElem
|
|
14817
14721
|
}, options);
|
|
@@ -14824,7 +14728,7 @@ defineFunctionBuilders({
|
|
|
14824
14728
|
marginLeft,
|
|
14825
14729
|
marginRight
|
|
14826
14730
|
}];
|
|
14827
|
-
supsub =
|
|
14731
|
+
supsub = makeVList({
|
|
14828
14732
|
positionType: "shift",
|
|
14829
14733
|
positionData: subShift,
|
|
14830
14734
|
children: vlistElem
|
|
@@ -14832,7 +14736,7 @@ defineFunctionBuilders({
|
|
|
14832
14736
|
} else if (supm) {
|
|
14833
14737
|
// Rule 18c, d
|
|
14834
14738
|
supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
|
|
14835
|
-
supsub =
|
|
14739
|
+
supsub = makeVList({
|
|
14836
14740
|
positionType: "shift",
|
|
14837
14741
|
positionData: -supShift,
|
|
14838
14742
|
children: [{
|
|
@@ -14847,7 +14751,7 @@ defineFunctionBuilders({
|
|
|
14847
14751
|
|
|
14848
14752
|
|
|
14849
14753
|
const mclass = getTypeOfDomTree(base, "right") || "mord";
|
|
14850
|
-
return
|
|
14754
|
+
return makeSpan([mclass], [base, makeSpan(["msupsub"], [supsub])], options);
|
|
14851
14755
|
},
|
|
14852
14756
|
|
|
14853
14757
|
mathmlBuilder(group, options) {
|
|
@@ -14915,11 +14819,11 @@ defineFunctionBuilders({
|
|
|
14915
14819
|
}
|
|
14916
14820
|
}
|
|
14917
14821
|
|
|
14918
|
-
return new
|
|
14822
|
+
return new MathNode(nodeType, children);
|
|
14919
14823
|
}
|
|
14920
14824
|
|
|
14921
14825
|
});
|
|
14922
|
-
;//
|
|
14826
|
+
;// ./src/functions/symbolsOp.js
|
|
14923
14827
|
|
|
14924
14828
|
|
|
14925
14829
|
|
|
@@ -14929,11 +14833,11 @@ defineFunctionBuilders({
|
|
|
14929
14833
|
type: "atom",
|
|
14930
14834
|
|
|
14931
14835
|
htmlBuilder(group, options) {
|
|
14932
|
-
return
|
|
14836
|
+
return mathsym(group.text, group.mode, options, ["m" + group.family]);
|
|
14933
14837
|
},
|
|
14934
14838
|
|
|
14935
14839
|
mathmlBuilder(group, options) {
|
|
14936
|
-
const node = new
|
|
14840
|
+
const node = new MathNode("mo", [makeText(group.text, group.mode)]);
|
|
14937
14841
|
|
|
14938
14842
|
if (group.family === "bin") {
|
|
14939
14843
|
const variant = getVariant(group, options);
|
|
@@ -14953,7 +14857,7 @@ defineFunctionBuilders({
|
|
|
14953
14857
|
}
|
|
14954
14858
|
|
|
14955
14859
|
});
|
|
14956
|
-
;//
|
|
14860
|
+
;// ./src/functions/symbolsOrd.js
|
|
14957
14861
|
|
|
14958
14862
|
|
|
14959
14863
|
|
|
@@ -14969,11 +14873,11 @@ defineFunctionBuilders({
|
|
|
14969
14873
|
type: "mathord",
|
|
14970
14874
|
|
|
14971
14875
|
htmlBuilder(group, options) {
|
|
14972
|
-
return
|
|
14876
|
+
return makeOrd(group, options, "mathord");
|
|
14973
14877
|
},
|
|
14974
14878
|
|
|
14975
14879
|
mathmlBuilder(group, options) {
|
|
14976
|
-
const node = new
|
|
14880
|
+
const node = new MathNode("mi", [makeText(group.text, group.mode, options)]);
|
|
14977
14881
|
const variant = getVariant(group, options) || "italic";
|
|
14978
14882
|
|
|
14979
14883
|
if (variant !== defaultVariant[node.type]) {
|
|
@@ -14988,7 +14892,7 @@ defineFunctionBuilders({
|
|
|
14988
14892
|
type: "textord",
|
|
14989
14893
|
|
|
14990
14894
|
htmlBuilder(group, options) {
|
|
14991
|
-
return
|
|
14895
|
+
return makeOrd(group, options, "textord");
|
|
14992
14896
|
},
|
|
14993
14897
|
|
|
14994
14898
|
mathmlBuilder(group, options) {
|
|
@@ -14997,13 +14901,13 @@ defineFunctionBuilders({
|
|
|
14997
14901
|
let node;
|
|
14998
14902
|
|
|
14999
14903
|
if (group.mode === 'text') {
|
|
15000
|
-
node = new
|
|
14904
|
+
node = new MathNode("mtext", [text]);
|
|
15001
14905
|
} else if (/[0-9]/.test(group.text)) {
|
|
15002
|
-
node = new
|
|
14906
|
+
node = new MathNode("mn", [text]);
|
|
15003
14907
|
} else if (group.text === "\\prime") {
|
|
15004
|
-
node = new
|
|
14908
|
+
node = new MathNode("mo", [text]);
|
|
15005
14909
|
} else {
|
|
15006
|
-
node = new
|
|
14910
|
+
node = new MathNode("mi", [text]);
|
|
15007
14911
|
}
|
|
15008
14912
|
|
|
15009
14913
|
if (variant !== defaultVariant[node.type]) {
|
|
@@ -15014,7 +14918,7 @@ defineFunctionBuilders({
|
|
|
15014
14918
|
}
|
|
15015
14919
|
|
|
15016
14920
|
});
|
|
15017
|
-
;//
|
|
14921
|
+
;// ./src/functions/symbolsSpacing.js
|
|
15018
14922
|
|
|
15019
14923
|
|
|
15020
14924
|
|
|
@@ -15052,15 +14956,15 @@ defineFunctionBuilders({
|
|
|
15052
14956
|
// into appropriate outputs.
|
|
15053
14957
|
|
|
15054
14958
|
if (group.mode === "text") {
|
|
15055
|
-
const ord =
|
|
14959
|
+
const ord = makeOrd(group, options, "textord");
|
|
15056
14960
|
ord.classes.push(className);
|
|
15057
14961
|
return ord;
|
|
15058
14962
|
} else {
|
|
15059
|
-
return
|
|
14963
|
+
return makeSpan(["mspace", className], [mathsym(group.text, group.mode, options)], options);
|
|
15060
14964
|
}
|
|
15061
14965
|
} else if (cssSpace.hasOwnProperty(group.text)) {
|
|
15062
14966
|
// Spaces based on just a CSS class.
|
|
15063
|
-
return
|
|
14967
|
+
return makeSpan(["mspace", cssSpace[group.text]], [], options);
|
|
15064
14968
|
} else {
|
|
15065
14969
|
throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
|
|
15066
14970
|
}
|
|
@@ -15070,10 +14974,10 @@ defineFunctionBuilders({
|
|
|
15070
14974
|
let node;
|
|
15071
14975
|
|
|
15072
14976
|
if (regularSpace.hasOwnProperty(group.text)) {
|
|
15073
|
-
node = new
|
|
14977
|
+
node = new MathNode("mtext", [new TextNode("\u00a0")]);
|
|
15074
14978
|
} else if (cssSpace.hasOwnProperty(group.text)) {
|
|
15075
14979
|
// CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
|
|
15076
|
-
return new
|
|
14980
|
+
return new MathNode("mspace");
|
|
15077
14981
|
} else {
|
|
15078
14982
|
throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
|
|
15079
14983
|
}
|
|
@@ -15082,13 +14986,13 @@ defineFunctionBuilders({
|
|
|
15082
14986
|
}
|
|
15083
14987
|
|
|
15084
14988
|
});
|
|
15085
|
-
;//
|
|
14989
|
+
;// ./src/functions/tag.js
|
|
15086
14990
|
|
|
15087
14991
|
|
|
15088
14992
|
|
|
15089
14993
|
|
|
15090
14994
|
const pad = () => {
|
|
15091
|
-
const padNode = new
|
|
14995
|
+
const padNode = new MathNode("mtd", []);
|
|
15092
14996
|
padNode.setAttribute("width", "50%");
|
|
15093
14997
|
return padNode;
|
|
15094
14998
|
};
|
|
@@ -15097,7 +15001,7 @@ defineFunctionBuilders({
|
|
|
15097
15001
|
type: "tag",
|
|
15098
15002
|
|
|
15099
15003
|
mathmlBuilder(group, options) {
|
|
15100
|
-
const table = new
|
|
15004
|
+
const table = new MathNode("mtable", [new MathNode("mtr", [pad(), new MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
|
|
15101
15005
|
table.setAttribute("width", "100%");
|
|
15102
15006
|
return table; // TODO: Left-aligned tags.
|
|
15103
15007
|
// Currently, the group and options passed here do not contain
|
|
@@ -15109,7 +15013,7 @@ defineFunctionBuilders({
|
|
|
15109
15013
|
}
|
|
15110
15014
|
|
|
15111
15015
|
});
|
|
15112
|
-
;//
|
|
15016
|
+
;// ./src/functions/text.js
|
|
15113
15017
|
|
|
15114
15018
|
|
|
15115
15019
|
|
|
@@ -15177,7 +15081,7 @@ defineFunction({
|
|
|
15177
15081
|
htmlBuilder(group, options) {
|
|
15178
15082
|
const newOptions = optionsWithFont(group, options);
|
|
15179
15083
|
const inner = buildExpression(group.body, newOptions, true);
|
|
15180
|
-
return
|
|
15084
|
+
return makeSpan(["mord", "text"], inner, newOptions);
|
|
15181
15085
|
},
|
|
15182
15086
|
|
|
15183
15087
|
mathmlBuilder(group, options) {
|
|
@@ -15186,7 +15090,7 @@ defineFunction({
|
|
|
15186
15090
|
}
|
|
15187
15091
|
|
|
15188
15092
|
});
|
|
15189
|
-
;//
|
|
15093
|
+
;// ./src/functions/underline.js
|
|
15190
15094
|
|
|
15191
15095
|
|
|
15192
15096
|
|
|
@@ -15216,10 +15120,10 @@ defineFunction({
|
|
|
15216
15120
|
// Build the inner group.
|
|
15217
15121
|
const innerGroup = buildGroup(group.body, options); // Create the line to go below the body
|
|
15218
15122
|
|
|
15219
|
-
const line =
|
|
15123
|
+
const line = makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns
|
|
15220
15124
|
|
|
15221
15125
|
const defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
|
|
15222
|
-
const vlist =
|
|
15126
|
+
const vlist = makeVList({
|
|
15223
15127
|
positionType: "top",
|
|
15224
15128
|
positionData: innerGroup.height,
|
|
15225
15129
|
children: [{
|
|
@@ -15236,19 +15140,19 @@ defineFunction({
|
|
|
15236
15140
|
elem: innerGroup
|
|
15237
15141
|
}]
|
|
15238
15142
|
}, options);
|
|
15239
|
-
return
|
|
15143
|
+
return makeSpan(["mord", "underline"], [vlist], options);
|
|
15240
15144
|
},
|
|
15241
15145
|
|
|
15242
15146
|
mathmlBuilder(group, options) {
|
|
15243
|
-
const operator = new
|
|
15147
|
+
const operator = new MathNode("mo", [new TextNode("\u203e")]);
|
|
15244
15148
|
operator.setAttribute("stretchy", "true");
|
|
15245
|
-
const node = new
|
|
15149
|
+
const node = new MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]);
|
|
15246
15150
|
node.setAttribute("accentunder", "true");
|
|
15247
15151
|
return node;
|
|
15248
15152
|
}
|
|
15249
15153
|
|
|
15250
15154
|
});
|
|
15251
|
-
;//
|
|
15155
|
+
;// ./src/functions/vcenter.js
|
|
15252
15156
|
|
|
15253
15157
|
|
|
15254
15158
|
|
|
@@ -15280,7 +15184,7 @@ defineFunction({
|
|
|
15280
15184
|
const body = buildGroup(group.body, options);
|
|
15281
15185
|
const axisHeight = options.fontMetrics().axisHeight;
|
|
15282
15186
|
const dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
|
|
15283
|
-
return
|
|
15187
|
+
return makeVList({
|
|
15284
15188
|
positionType: "shift",
|
|
15285
15189
|
positionData: dy,
|
|
15286
15190
|
children: [{
|
|
@@ -15294,11 +15198,11 @@ defineFunction({
|
|
|
15294
15198
|
// There is no way to do this in MathML.
|
|
15295
15199
|
// Write a class as a breadcrumb in case some post-processor wants
|
|
15296
15200
|
// to perform a vcenter adjustment.
|
|
15297
|
-
return new
|
|
15201
|
+
return new MathNode("mpadded", [buildMathML_buildGroup(group.body, options)], ["vcenter"]);
|
|
15298
15202
|
}
|
|
15299
15203
|
|
|
15300
15204
|
});
|
|
15301
|
-
;//
|
|
15205
|
+
;// ./src/functions/verb.js
|
|
15302
15206
|
|
|
15303
15207
|
|
|
15304
15208
|
|
|
@@ -15332,15 +15236,15 @@ defineFunction({
|
|
|
15332
15236
|
c = '\\textasciitilde';
|
|
15333
15237
|
}
|
|
15334
15238
|
|
|
15335
|
-
body.push(
|
|
15239
|
+
body.push(makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
|
|
15336
15240
|
}
|
|
15337
15241
|
|
|
15338
|
-
return
|
|
15242
|
+
return makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), tryCombineChars(body), newOptions);
|
|
15339
15243
|
},
|
|
15340
15244
|
|
|
15341
15245
|
mathmlBuilder(group, options) {
|
|
15342
|
-
const text = new
|
|
15343
|
-
const node = new
|
|
15246
|
+
const text = new TextNode(makeVerb(group));
|
|
15247
|
+
const node = new MathNode("mtext", [text]);
|
|
15344
15248
|
node.setAttribute("mathvariant", "monospace");
|
|
15345
15249
|
return node;
|
|
15346
15250
|
}
|
|
@@ -15354,7 +15258,7 @@ defineFunction({
|
|
|
15354
15258
|
*/
|
|
15355
15259
|
|
|
15356
15260
|
const makeVerb = group => group.body.replace(/ /g, group.star ? '\u2423' : '\xA0');
|
|
15357
|
-
;//
|
|
15261
|
+
;// ./src/functions.js
|
|
15358
15262
|
/** Include this to ensure that all functions are defined. */
|
|
15359
15263
|
|
|
15360
15264
|
const functions = _functions;
|
|
@@ -15407,7 +15311,7 @@ const functions = _functions;
|
|
|
15407
15311
|
|
|
15408
15312
|
|
|
15409
15313
|
|
|
15410
|
-
;//
|
|
15314
|
+
;// ./src/Lexer.js
|
|
15411
15315
|
/**
|
|
15412
15316
|
* The Lexer class handles tokenizing the input in various ways. Since our
|
|
15413
15317
|
* parser expects us to be able to backtrack, the lexer allows lexing from any
|
|
@@ -15530,7 +15434,7 @@ class Lexer {
|
|
|
15530
15434
|
}
|
|
15531
15435
|
|
|
15532
15436
|
}
|
|
15533
|
-
;//
|
|
15437
|
+
;// ./src/Namespace.js
|
|
15534
15438
|
/**
|
|
15535
15439
|
* A `Namespace` refers to a space of nameable things like macros or lengths,
|
|
15536
15440
|
* which can be `set` either globally or local to a nested group, using an
|
|
@@ -15674,7 +15578,7 @@ class Namespace {
|
|
|
15674
15578
|
}
|
|
15675
15579
|
|
|
15676
15580
|
}
|
|
15677
|
-
;//
|
|
15581
|
+
;// ./src/macros.js
|
|
15678
15582
|
/**
|
|
15679
15583
|
* Predefined macros for KaTeX.
|
|
15680
15584
|
* This can be used to define some commands in terms of others.
|
|
@@ -15993,7 +15897,7 @@ defineMacro("\\underbar", "\\underline{\\text{#1}}"); // \not is defined by base
|
|
|
15993
15897
|
// width but extends to the right. We use \rlap to get that spacing.
|
|
15994
15898
|
// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
|
|
15995
15899
|
|
|
15996
|
-
defineMacro("\\not",
|
|
15900
|
+
defineMacro("\\not", "\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}" + "{\\char\"338}"); // Negated symbols from base/fontmath.ltx:
|
|
15997
15901
|
// \def\neq{\not=} \let\ne=\neq
|
|
15998
15902
|
// \DeclareRobustCommand
|
|
15999
15903
|
// \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
|
|
@@ -16127,6 +16031,7 @@ const dotsByToken = {
|
|
|
16127
16031
|
// Symbols whose definition starts with \DOTSX:
|
|
16128
16032
|
'\\DOTSX': '\\dotsx'
|
|
16129
16033
|
};
|
|
16034
|
+
const dotsbGroups = new Set(['bin', 'rel']);
|
|
16130
16035
|
defineMacro("\\dots", function (context) {
|
|
16131
16036
|
// TODO: If used in text mode, should expand to \textellipsis.
|
|
16132
16037
|
// However, in KaTeX, \textellipsis and \ldots behave the same
|
|
@@ -16141,7 +16046,7 @@ defineMacro("\\dots", function (context) {
|
|
|
16141
16046
|
} else if (next.slice(0, 4) === '\\not') {
|
|
16142
16047
|
thedots = '\\dotsb';
|
|
16143
16048
|
} else if (next in src_symbols.math) {
|
|
16144
|
-
if (
|
|
16049
|
+
if (dotsbGroups.has(src_symbols.math[next].group)) {
|
|
16145
16050
|
thedots = '\\dotsb';
|
|
16146
16051
|
}
|
|
16147
16052
|
}
|
|
@@ -16636,7 +16541,7 @@ defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
|
|
|
16636
16541
|
defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
|
|
16637
16542
|
defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
|
|
16638
16543
|
defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
|
|
16639
|
-
;//
|
|
16544
|
+
;// ./src/MacroExpander.js
|
|
16640
16545
|
/**
|
|
16641
16546
|
* This file contains the “gullet” where macros are expanded
|
|
16642
16547
|
* until only non-macro tokens remain.
|
|
@@ -17123,10 +17028,10 @@ class MacroExpander {
|
|
|
17123
17028
|
if (typeof expansion === "string") {
|
|
17124
17029
|
let numArgs = 0;
|
|
17125
17030
|
|
|
17126
|
-
if (expansion.
|
|
17031
|
+
if (expansion.includes("#")) {
|
|
17127
17032
|
const stripped = expansion.replace(/##/g, "");
|
|
17128
17033
|
|
|
17129
|
-
while (stripped.
|
|
17034
|
+
while (stripped.includes("#" + (numArgs + 1))) {
|
|
17130
17035
|
++numArgs;
|
|
17131
17036
|
}
|
|
17132
17037
|
}
|
|
@@ -17173,7 +17078,7 @@ class MacroExpander {
|
|
|
17173
17078
|
}
|
|
17174
17079
|
|
|
17175
17080
|
}
|
|
17176
|
-
;//
|
|
17081
|
+
;// ./src/unicodeSupOrSub.js
|
|
17177
17082
|
// Helpers for Parser.js handling of Unicode (sub|super)script characters.
|
|
17178
17083
|
const unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
|
|
17179
17084
|
const uSubsAndSups = Object.freeze({
|
|
@@ -17280,7 +17185,7 @@ const uSubsAndSups = Object.freeze({
|
|
|
17280
17185
|
'\u1D61': 'χ',
|
|
17281
17186
|
'\u1DBF': 'θ'
|
|
17282
17187
|
});
|
|
17283
|
-
;//
|
|
17188
|
+
;// ./src/Parser.js
|
|
17284
17189
|
/* eslint no-constant-condition:0 */
|
|
17285
17190
|
|
|
17286
17191
|
|
|
@@ -17862,7 +17767,7 @@ class Parser {
|
|
|
17862
17767
|
|
|
17863
17768
|
const lex = this.fetch();
|
|
17864
17769
|
|
|
17865
|
-
if (Parser.endOfExpression.
|
|
17770
|
+
if (Parser.endOfExpression.has(lex.text)) {
|
|
17866
17771
|
break;
|
|
17867
17772
|
}
|
|
17868
17773
|
|
|
@@ -18714,7 +18619,7 @@ class Parser {
|
|
|
18714
18619
|
let symbol;
|
|
18715
18620
|
|
|
18716
18621
|
if (src_symbols[this.mode][text]) {
|
|
18717
|
-
if (this.settings.strict && this.mode === 'math' && extraLatin.
|
|
18622
|
+
if (this.settings.strict && this.mode === 'math' && extraLatin.includes(text)) {
|
|
18718
18623
|
this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
|
|
18719
18624
|
}
|
|
18720
18625
|
|
|
@@ -18805,8 +18710,8 @@ class Parser {
|
|
|
18805
18710
|
}
|
|
18806
18711
|
|
|
18807
18712
|
}
|
|
18808
|
-
Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
|
|
18809
|
-
;//
|
|
18713
|
+
Parser.endOfExpression = new Set(["}", "\\endgroup", "\\end", "\\right", "&"]);
|
|
18714
|
+
;// ./src/parseTree.js
|
|
18810
18715
|
/**
|
|
18811
18716
|
* Provides a single function for parsing an expression using a Parser
|
|
18812
18717
|
* TODO(emily): Remove this
|
|
@@ -18849,7 +18754,7 @@ const parseTree = function (toParse, settings) {
|
|
|
18849
18754
|
};
|
|
18850
18755
|
|
|
18851
18756
|
/* harmony default export */ var src_parseTree = (parseTree);
|
|
18852
|
-
;//
|
|
18757
|
+
;// ./katex.js
|
|
18853
18758
|
/* eslint no-console:0 */
|
|
18854
18759
|
|
|
18855
18760
|
/**
|
|
@@ -18921,7 +18826,7 @@ const renderError = function (error, expression, options) {
|
|
|
18921
18826
|
throw error;
|
|
18922
18827
|
}
|
|
18923
18828
|
|
|
18924
|
-
const node =
|
|
18829
|
+
const node = makeSpan(["katex-error"], [new SymbolNode(expression)]);
|
|
18925
18830
|
node.setAttribute("title", error.toString());
|
|
18926
18831
|
node.setAttribute("style", "color:" + options.errorColor);
|
|
18927
18832
|
return node;
|
|
@@ -18959,7 +18864,7 @@ const renderToHTMLTree = function (expression, options) {
|
|
|
18959
18864
|
}
|
|
18960
18865
|
};
|
|
18961
18866
|
|
|
18962
|
-
const version = "0.16.
|
|
18867
|
+
const version = "0.16.30";
|
|
18963
18868
|
const __domTree = {
|
|
18964
18869
|
Span: Span,
|
|
18965
18870
|
Anchor: Anchor,
|
|
@@ -19061,7 +18966,7 @@ const __domTree = {
|
|
|
19061
18966
|
*/
|
|
19062
18967
|
__domTree
|
|
19063
18968
|
});
|
|
19064
|
-
;//
|
|
18969
|
+
;// ./katex.webpack.js
|
|
19065
18970
|
/**
|
|
19066
18971
|
* This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]
|
|
19067
18972
|
* doesn't support CSS modules natively, a separate entry point is used and
|