katex 0.13.20 → 0.13.24
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 +5 -5
- package/cli.js +1 -1
- package/contrib/copy-tex/README.md +3 -3
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +1 -1
- package/dist/README.md +5 -5
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +4 -4
- package/dist/katex.js +1625 -1602
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +2087 -2080
- package/package.json +16 -7
- package/src/buildCommon.js +12 -12
- package/src/buildHTML.js +5 -4
- package/src/delimiter.js +11 -10
- package/src/domTree.js +2 -1
- package/src/environments/array.js +9 -9
- package/src/environments/cd.js +2 -1
- package/src/fontMetricsData.js +2 -1
- package/src/fonts/generate_fonts.py +3 -6
- package/src/fonts/makeFF +2 -0
- package/src/functions/accent.js +4 -3
- package/src/functions/cr.js +3 -3
- package/src/functions/delimsizing.js +4 -2
- package/src/functions/enclose.js +7 -7
- package/src/functions/genfrac.js +2 -2
- package/src/functions/includegraphics.js +7 -9
- package/src/functions/lap.js +3 -2
- package/src/functions/op.js +2 -1
- package/src/functions/rule.js +10 -10
- package/src/functions/sizing.js +2 -1
- package/src/functions/sqrt.js +2 -1
- package/src/functions/supsub.js +3 -2
- package/src/functions/utils/assembleSupSub.js +6 -5
- package/src/katex.less +3 -3
- package/src/macros.js +3 -2
- package/src/mathMLTree.js +3 -2
- package/src/metrics/extract_ttfs.py +3 -0
- package/src/stretchy.js +8 -7
- package/src/units.js +8 -0
package/dist/katex.mjs
CHANGED
|
@@ -892,532 +892,6 @@ class DocumentFragment {
|
|
|
892
892
|
|
|
893
893
|
}
|
|
894
894
|
|
|
895
|
-
/**
|
|
896
|
-
* These objects store the data about the DOM nodes we create, as well as some
|
|
897
|
-
* extra data. They can then be transformed into real DOM nodes with the
|
|
898
|
-
* `toNode` function or HTML markup using `toMarkup`. They are useful for both
|
|
899
|
-
* storing extra properties on the nodes, as well as providing a way to easily
|
|
900
|
-
* work with the DOM.
|
|
901
|
-
*
|
|
902
|
-
* Similar functions for working with MathML nodes exist in mathMLTree.js.
|
|
903
|
-
*
|
|
904
|
-
* TODO: refactor `span` and `anchor` into common superclass when
|
|
905
|
-
* target environments support class inheritance
|
|
906
|
-
*/
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* Create an HTML className based on a list of classes. In addition to joining
|
|
910
|
-
* with spaces, we also remove empty classes.
|
|
911
|
-
*/
|
|
912
|
-
var createClass = function createClass(classes) {
|
|
913
|
-
return classes.filter(cls => cls).join(" ");
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
var initNode = function initNode(classes, options, style) {
|
|
917
|
-
this.classes = classes || [];
|
|
918
|
-
this.attributes = {};
|
|
919
|
-
this.height = 0;
|
|
920
|
-
this.depth = 0;
|
|
921
|
-
this.maxFontSize = 0;
|
|
922
|
-
this.style = style || {};
|
|
923
|
-
|
|
924
|
-
if (options) {
|
|
925
|
-
if (options.style.isTight()) {
|
|
926
|
-
this.classes.push("mtight");
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
var color = options.getColor();
|
|
930
|
-
|
|
931
|
-
if (color) {
|
|
932
|
-
this.style.color = color;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
};
|
|
936
|
-
/**
|
|
937
|
-
* Convert into an HTML node
|
|
938
|
-
*/
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
var toNode = function toNode(tagName) {
|
|
942
|
-
var node = document.createElement(tagName); // Apply the class
|
|
943
|
-
|
|
944
|
-
node.className = createClass(this.classes); // Apply inline styles
|
|
945
|
-
|
|
946
|
-
for (var style in this.style) {
|
|
947
|
-
if (this.style.hasOwnProperty(style)) {
|
|
948
|
-
// $FlowFixMe Flow doesn't seem to understand span.style's type.
|
|
949
|
-
node.style[style] = this.style[style];
|
|
950
|
-
}
|
|
951
|
-
} // Apply attributes
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
for (var attr in this.attributes) {
|
|
955
|
-
if (this.attributes.hasOwnProperty(attr)) {
|
|
956
|
-
node.setAttribute(attr, this.attributes[attr]);
|
|
957
|
-
}
|
|
958
|
-
} // Append the children, also as HTML nodes
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
for (var i = 0; i < this.children.length; i++) {
|
|
962
|
-
node.appendChild(this.children[i].toNode());
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
return node;
|
|
966
|
-
};
|
|
967
|
-
/**
|
|
968
|
-
* Convert into an HTML markup string
|
|
969
|
-
*/
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
var toMarkup = function toMarkup(tagName) {
|
|
973
|
-
var markup = "<" + tagName; // Add the class
|
|
974
|
-
|
|
975
|
-
if (this.classes.length) {
|
|
976
|
-
markup += " class=\"" + utils.escape(createClass(this.classes)) + "\"";
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
var styles = ""; // Add the styles, after hyphenation
|
|
980
|
-
|
|
981
|
-
for (var style in this.style) {
|
|
982
|
-
if (this.style.hasOwnProperty(style)) {
|
|
983
|
-
styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
if (styles) {
|
|
988
|
-
markup += " style=\"" + utils.escape(styles) + "\"";
|
|
989
|
-
} // Add the attributes
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
for (var attr in this.attributes) {
|
|
993
|
-
if (this.attributes.hasOwnProperty(attr)) {
|
|
994
|
-
markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
markup += ">"; // Add the markup of the children, also as markup
|
|
999
|
-
|
|
1000
|
-
for (var i = 0; i < this.children.length; i++) {
|
|
1001
|
-
markup += this.children[i].toMarkup();
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
markup += "</" + tagName + ">";
|
|
1005
|
-
return markup;
|
|
1006
|
-
}; // Making the type below exact with all optional fields doesn't work due to
|
|
1007
|
-
// - https://github.com/facebook/flow/issues/4582
|
|
1008
|
-
// - https://github.com/facebook/flow/issues/5688
|
|
1009
|
-
// However, since *all* fields are optional, $Shape<> works as suggested in 5688
|
|
1010
|
-
// above.
|
|
1011
|
-
// This type does not include all CSS properties. Additional properties should
|
|
1012
|
-
// be added as needed.
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
* This node represents a span node, with a className, a list of children, and
|
|
1017
|
-
* an inline style. It also contains information about its height, depth, and
|
|
1018
|
-
* maxFontSize.
|
|
1019
|
-
*
|
|
1020
|
-
* Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan
|
|
1021
|
-
* otherwise. This typesafety is important when HTML builders access a span's
|
|
1022
|
-
* children.
|
|
1023
|
-
*/
|
|
1024
|
-
class Span {
|
|
1025
|
-
constructor(classes, children, options, style) {
|
|
1026
|
-
this.children = void 0;
|
|
1027
|
-
this.attributes = void 0;
|
|
1028
|
-
this.classes = void 0;
|
|
1029
|
-
this.height = void 0;
|
|
1030
|
-
this.depth = void 0;
|
|
1031
|
-
this.width = void 0;
|
|
1032
|
-
this.maxFontSize = void 0;
|
|
1033
|
-
this.style = void 0;
|
|
1034
|
-
initNode.call(this, classes, options, style);
|
|
1035
|
-
this.children = children || [];
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Sets an arbitrary attribute on the span. Warning: use this wisely. Not
|
|
1039
|
-
* all browsers support attributes the same, and having too many custom
|
|
1040
|
-
* attributes is probably bad.
|
|
1041
|
-
*/
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
setAttribute(attribute, value) {
|
|
1045
|
-
this.attributes[attribute] = value;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
hasClass(className) {
|
|
1049
|
-
return utils.contains(this.classes, className);
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
toNode() {
|
|
1053
|
-
return toNode.call(this, "span");
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
toMarkup() {
|
|
1057
|
-
return toMarkup.call(this, "span");
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* This node represents an anchor (<a>) element with a hyperlink. See `span`
|
|
1063
|
-
* for further details.
|
|
1064
|
-
*/
|
|
1065
|
-
|
|
1066
|
-
class Anchor {
|
|
1067
|
-
constructor(href, classes, children, options) {
|
|
1068
|
-
this.children = void 0;
|
|
1069
|
-
this.attributes = void 0;
|
|
1070
|
-
this.classes = void 0;
|
|
1071
|
-
this.height = void 0;
|
|
1072
|
-
this.depth = void 0;
|
|
1073
|
-
this.maxFontSize = void 0;
|
|
1074
|
-
this.style = void 0;
|
|
1075
|
-
initNode.call(this, classes, options);
|
|
1076
|
-
this.children = children || [];
|
|
1077
|
-
this.setAttribute('href', href);
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
setAttribute(attribute, value) {
|
|
1081
|
-
this.attributes[attribute] = value;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
hasClass(className) {
|
|
1085
|
-
return utils.contains(this.classes, className);
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
toNode() {
|
|
1089
|
-
return toNode.call(this, "a");
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
toMarkup() {
|
|
1093
|
-
return toMarkup.call(this, "a");
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* This node represents an image embed (<img>) element.
|
|
1099
|
-
*/
|
|
1100
|
-
|
|
1101
|
-
class Img {
|
|
1102
|
-
constructor(src, alt, style) {
|
|
1103
|
-
this.src = void 0;
|
|
1104
|
-
this.alt = void 0;
|
|
1105
|
-
this.classes = void 0;
|
|
1106
|
-
this.height = void 0;
|
|
1107
|
-
this.depth = void 0;
|
|
1108
|
-
this.maxFontSize = void 0;
|
|
1109
|
-
this.style = void 0;
|
|
1110
|
-
this.alt = alt;
|
|
1111
|
-
this.src = src;
|
|
1112
|
-
this.classes = ["mord"];
|
|
1113
|
-
this.style = style;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
hasClass(className) {
|
|
1117
|
-
return utils.contains(this.classes, className);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
toNode() {
|
|
1121
|
-
var node = document.createElement("img");
|
|
1122
|
-
node.src = this.src;
|
|
1123
|
-
node.alt = this.alt;
|
|
1124
|
-
node.className = "mord"; // Apply inline styles
|
|
1125
|
-
|
|
1126
|
-
for (var style in this.style) {
|
|
1127
|
-
if (this.style.hasOwnProperty(style)) {
|
|
1128
|
-
// $FlowFixMe
|
|
1129
|
-
node.style[style] = this.style[style];
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
return node;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
toMarkup() {
|
|
1137
|
-
var markup = "<img src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
|
|
1138
|
-
|
|
1139
|
-
var styles = "";
|
|
1140
|
-
|
|
1141
|
-
for (var style in this.style) {
|
|
1142
|
-
if (this.style.hasOwnProperty(style)) {
|
|
1143
|
-
styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
if (styles) {
|
|
1148
|
-
markup += " style=\"" + utils.escape(styles) + "\"";
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
markup += "'/>";
|
|
1152
|
-
return markup;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
}
|
|
1156
|
-
var iCombinations = {
|
|
1157
|
-
'î': '\u0131\u0302',
|
|
1158
|
-
'ï': '\u0131\u0308',
|
|
1159
|
-
'í': '\u0131\u0301',
|
|
1160
|
-
// 'ī': '\u0131\u0304', // enable when we add Extended Latin
|
|
1161
|
-
'ì': '\u0131\u0300'
|
|
1162
|
-
};
|
|
1163
|
-
/**
|
|
1164
|
-
* A symbol node contains information about a single symbol. It either renders
|
|
1165
|
-
* to a single text node, or a span with a single text node in it, depending on
|
|
1166
|
-
* whether it has CSS classes, styles, or needs italic correction.
|
|
1167
|
-
*/
|
|
1168
|
-
|
|
1169
|
-
class SymbolNode {
|
|
1170
|
-
constructor(text, height, depth, italic, skew, width, classes, style) {
|
|
1171
|
-
this.text = void 0;
|
|
1172
|
-
this.height = void 0;
|
|
1173
|
-
this.depth = void 0;
|
|
1174
|
-
this.italic = void 0;
|
|
1175
|
-
this.skew = void 0;
|
|
1176
|
-
this.width = void 0;
|
|
1177
|
-
this.maxFontSize = void 0;
|
|
1178
|
-
this.classes = void 0;
|
|
1179
|
-
this.style = void 0;
|
|
1180
|
-
this.text = text;
|
|
1181
|
-
this.height = height || 0;
|
|
1182
|
-
this.depth = depth || 0;
|
|
1183
|
-
this.italic = italic || 0;
|
|
1184
|
-
this.skew = skew || 0;
|
|
1185
|
-
this.width = width || 0;
|
|
1186
|
-
this.classes = classes || [];
|
|
1187
|
-
this.style = style || {};
|
|
1188
|
-
this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we
|
|
1189
|
-
// can specify which fonts to use. This allows us to render these
|
|
1190
|
-
// characters with a serif font in situations where the browser would
|
|
1191
|
-
// either default to a sans serif or render a placeholder character.
|
|
1192
|
-
// We use CSS class names like cjk_fallback, hangul_fallback and
|
|
1193
|
-
// brahmic_fallback. See ./unicodeScripts.js for the set of possible
|
|
1194
|
-
// script names
|
|
1195
|
-
|
|
1196
|
-
var script = scriptFromCodepoint(this.text.charCodeAt(0));
|
|
1197
|
-
|
|
1198
|
-
if (script) {
|
|
1199
|
-
this.classes.push(script + "_fallback");
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
if (/[îïíì]/.test(this.text)) {
|
|
1203
|
-
// add ī when we add Extended Latin
|
|
1204
|
-
this.text = iCombinations[this.text];
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
hasClass(className) {
|
|
1209
|
-
return utils.contains(this.classes, className);
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Creates a text node or span from a symbol node. Note that a span is only
|
|
1213
|
-
* created if it is needed.
|
|
1214
|
-
*/
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
toNode() {
|
|
1218
|
-
var node = document.createTextNode(this.text);
|
|
1219
|
-
var span = null;
|
|
1220
|
-
|
|
1221
|
-
if (this.italic > 0) {
|
|
1222
|
-
span = document.createElement("span");
|
|
1223
|
-
span.style.marginRight = this.italic + "em";
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
if (this.classes.length > 0) {
|
|
1227
|
-
span = span || document.createElement("span");
|
|
1228
|
-
span.className = createClass(this.classes);
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
for (var style in this.style) {
|
|
1232
|
-
if (this.style.hasOwnProperty(style)) {
|
|
1233
|
-
span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type.
|
|
1234
|
-
|
|
1235
|
-
span.style[style] = this.style[style];
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
if (span) {
|
|
1240
|
-
span.appendChild(node);
|
|
1241
|
-
return span;
|
|
1242
|
-
} else {
|
|
1243
|
-
return node;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* Creates markup for a symbol node.
|
|
1248
|
-
*/
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
toMarkup() {
|
|
1252
|
-
// TODO(alpert): More duplication than I'd like from
|
|
1253
|
-
// span.prototype.toMarkup and symbolNode.prototype.toNode...
|
|
1254
|
-
var needsSpan = false;
|
|
1255
|
-
var markup = "<span";
|
|
1256
|
-
|
|
1257
|
-
if (this.classes.length) {
|
|
1258
|
-
needsSpan = true;
|
|
1259
|
-
markup += " class=\"";
|
|
1260
|
-
markup += utils.escape(createClass(this.classes));
|
|
1261
|
-
markup += "\"";
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
var styles = "";
|
|
1265
|
-
|
|
1266
|
-
if (this.italic > 0) {
|
|
1267
|
-
styles += "margin-right:" + this.italic + "em;";
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
for (var style in this.style) {
|
|
1271
|
-
if (this.style.hasOwnProperty(style)) {
|
|
1272
|
-
styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
if (styles) {
|
|
1277
|
-
needsSpan = true;
|
|
1278
|
-
markup += " style=\"" + utils.escape(styles) + "\"";
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
var escaped = utils.escape(this.text);
|
|
1282
|
-
|
|
1283
|
-
if (needsSpan) {
|
|
1284
|
-
markup += ">";
|
|
1285
|
-
markup += escaped;
|
|
1286
|
-
markup += "</span>";
|
|
1287
|
-
return markup;
|
|
1288
|
-
} else {
|
|
1289
|
-
return escaped;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
}
|
|
1294
|
-
/**
|
|
1295
|
-
* SVG nodes are used to render stretchy wide elements.
|
|
1296
|
-
*/
|
|
1297
|
-
|
|
1298
|
-
class SvgNode {
|
|
1299
|
-
constructor(children, attributes) {
|
|
1300
|
-
this.children = void 0;
|
|
1301
|
-
this.attributes = void 0;
|
|
1302
|
-
this.children = children || [];
|
|
1303
|
-
this.attributes = attributes || {};
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
toNode() {
|
|
1307
|
-
var svgNS = "http://www.w3.org/2000/svg";
|
|
1308
|
-
var node = document.createElementNS(svgNS, "svg"); // Apply attributes
|
|
1309
|
-
|
|
1310
|
-
for (var attr in this.attributes) {
|
|
1311
|
-
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
1312
|
-
node.setAttribute(attr, this.attributes[attr]);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
for (var i = 0; i < this.children.length; i++) {
|
|
1317
|
-
node.appendChild(this.children[i].toNode());
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
return node;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
toMarkup() {
|
|
1324
|
-
var markup = "<svg xmlns=\"http://www.w3.org/2000/svg\""; // Apply attributes
|
|
1325
|
-
|
|
1326
|
-
for (var attr in this.attributes) {
|
|
1327
|
-
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
1328
|
-
markup += " " + attr + "='" + this.attributes[attr] + "'";
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
markup += ">";
|
|
1333
|
-
|
|
1334
|
-
for (var i = 0; i < this.children.length; i++) {
|
|
1335
|
-
markup += this.children[i].toMarkup();
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
markup += "</svg>";
|
|
1339
|
-
return markup;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
}
|
|
1343
|
-
class PathNode {
|
|
1344
|
-
constructor(pathName, alternate) {
|
|
1345
|
-
this.pathName = void 0;
|
|
1346
|
-
this.alternate = void 0;
|
|
1347
|
-
this.pathName = pathName;
|
|
1348
|
-
this.alternate = alternate; // Used only for \sqrt, \phase, & tall delims
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
toNode() {
|
|
1352
|
-
var svgNS = "http://www.w3.org/2000/svg";
|
|
1353
|
-
var node = document.createElementNS(svgNS, "path");
|
|
1354
|
-
|
|
1355
|
-
if (this.alternate) {
|
|
1356
|
-
node.setAttribute("d", this.alternate);
|
|
1357
|
-
} else {
|
|
1358
|
-
node.setAttribute("d", path[this.pathName]);
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
return node;
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
toMarkup() {
|
|
1365
|
-
if (this.alternate) {
|
|
1366
|
-
return "<path d='" + this.alternate + "'/>";
|
|
1367
|
-
} else {
|
|
1368
|
-
return "<path d='" + path[this.pathName] + "'/>";
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1373
|
-
class LineNode {
|
|
1374
|
-
constructor(attributes) {
|
|
1375
|
-
this.attributes = void 0;
|
|
1376
|
-
this.attributes = attributes || {};
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
toNode() {
|
|
1380
|
-
var svgNS = "http://www.w3.org/2000/svg";
|
|
1381
|
-
var node = document.createElementNS(svgNS, "line"); // Apply attributes
|
|
1382
|
-
|
|
1383
|
-
for (var attr in this.attributes) {
|
|
1384
|
-
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
1385
|
-
node.setAttribute(attr, this.attributes[attr]);
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
return node;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
toMarkup() {
|
|
1393
|
-
var markup = "<line";
|
|
1394
|
-
|
|
1395
|
-
for (var attr in this.attributes) {
|
|
1396
|
-
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
1397
|
-
markup += " " + attr + "='" + this.attributes[attr] + "'";
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
markup += "/>";
|
|
1402
|
-
return markup;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
}
|
|
1406
|
-
function assertSymbolDomNode(group) {
|
|
1407
|
-
if (group instanceof SymbolNode) {
|
|
1408
|
-
return group;
|
|
1409
|
-
} else {
|
|
1410
|
-
throw new Error("Expected symbolNode but got " + String(group) + ".");
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
function assertSpan(group) {
|
|
1414
|
-
if (group instanceof Span) {
|
|
1415
|
-
return group;
|
|
1416
|
-
} else {
|
|
1417
|
-
throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
895
|
// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.
|
|
1422
896
|
var fontMetricsData = {
|
|
1423
897
|
"AMS-Regular": {
|
|
@@ -2002,6 +1476,7 @@ var fontMetricsData = {
|
|
|
2002
1476
|
"8764": [-0.10889, 0.39111, 0, 0, 0.89444],
|
|
2003
1477
|
"8768": [0.19444, 0.69444, 0, 0, 0.31944],
|
|
2004
1478
|
"8771": [0.00222, 0.50222, 0, 0, 0.89444],
|
|
1479
|
+
"8773": [0.027, 0.638, 0, 0, 0.894],
|
|
2005
1480
|
"8776": [0.02444, 0.52444, 0, 0, 0.89444],
|
|
2006
1481
|
"8781": [0.00222, 0.50222, 0, 0, 0.89444],
|
|
2007
1482
|
"8801": [0.00222, 0.50222, 0, 0, 0.89444],
|
|
@@ -2519,7 +1994,7 @@ var fontMetricsData = {
|
|
|
2519
1994
|
"8764": [-0.13313, 0.36687, 0, 0, 0.77778],
|
|
2520
1995
|
"8768": [0.19444, 0.69444, 0, 0, 0.27778],
|
|
2521
1996
|
"8771": [-0.03625, 0.46375, 0, 0, 0.77778],
|
|
2522
|
-
"8773": [-0.022, 0.589, 0, 0,
|
|
1997
|
+
"8773": [-0.022, 0.589, 0, 0, 0.778],
|
|
2523
1998
|
"8776": [-0.01688, 0.48312, 0, 0, 0.77778],
|
|
2524
1999
|
"8781": [-0.03625, 0.46375, 0, 0, 0.77778],
|
|
2525
2000
|
"8784": [-0.133, 0.673, 0, 0, 0.778],
|
|
@@ -3496,1660 +2971,2194 @@ var fontMetricsData = {
|
|
|
3496
2971
|
};
|
|
3497
2972
|
|
|
3498
2973
|
/**
|
|
3499
|
-
* This file contains metrics regarding fonts and individual symbols. The sigma
|
|
3500
|
-
* and xi variables, as well as the metricMap map contain data extracted from
|
|
3501
|
-
* TeX, TeX font metrics, and the TTF files. These data are then exposed via the
|
|
3502
|
-
* `metrics` variable and the getCharacterMetrics function.
|
|
2974
|
+
* This file contains metrics regarding fonts and individual symbols. The sigma
|
|
2975
|
+
* and xi variables, as well as the metricMap map contain data extracted from
|
|
2976
|
+
* TeX, TeX font metrics, and the TTF files. These data are then exposed via the
|
|
2977
|
+
* `metrics` variable and the getCharacterMetrics function.
|
|
2978
|
+
*/
|
|
2979
|
+
// In TeX, there are actually three sets of dimensions, one for each of
|
|
2980
|
+
// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
|
|
2981
|
+
// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are
|
|
2982
|
+
// provided in the the arrays below, in that order.
|
|
2983
|
+
//
|
|
2984
|
+
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
|
|
2985
|
+
// This was determined by running the following script:
|
|
2986
|
+
//
|
|
2987
|
+
// latex -interaction=nonstopmode \
|
|
2988
|
+
// '\documentclass{article}\usepackage{amsmath}\begin{document}' \
|
|
2989
|
+
// '$a$ \expandafter\show\the\textfont2' \
|
|
2990
|
+
// '\expandafter\show\the\scriptfont2' \
|
|
2991
|
+
// '\expandafter\show\the\scriptscriptfont2' \
|
|
2992
|
+
// '\stop'
|
|
2993
|
+
//
|
|
2994
|
+
// The metrics themselves were retreived using the following commands:
|
|
2995
|
+
//
|
|
2996
|
+
// tftopl cmsy10
|
|
2997
|
+
// tftopl cmsy7
|
|
2998
|
+
// tftopl cmsy5
|
|
2999
|
+
//
|
|
3000
|
+
// The output of each of these commands is quite lengthy. The only part we
|
|
3001
|
+
// care about is the FONTDIMEN section. Each value is measured in EMs.
|
|
3002
|
+
var sigmasAndXis = {
|
|
3003
|
+
slant: [0.250, 0.250, 0.250],
|
|
3004
|
+
// sigma1
|
|
3005
|
+
space: [0.000, 0.000, 0.000],
|
|
3006
|
+
// sigma2
|
|
3007
|
+
stretch: [0.000, 0.000, 0.000],
|
|
3008
|
+
// sigma3
|
|
3009
|
+
shrink: [0.000, 0.000, 0.000],
|
|
3010
|
+
// sigma4
|
|
3011
|
+
xHeight: [0.431, 0.431, 0.431],
|
|
3012
|
+
// sigma5
|
|
3013
|
+
quad: [1.000, 1.171, 1.472],
|
|
3014
|
+
// sigma6
|
|
3015
|
+
extraSpace: [0.000, 0.000, 0.000],
|
|
3016
|
+
// sigma7
|
|
3017
|
+
num1: [0.677, 0.732, 0.925],
|
|
3018
|
+
// sigma8
|
|
3019
|
+
num2: [0.394, 0.384, 0.387],
|
|
3020
|
+
// sigma9
|
|
3021
|
+
num3: [0.444, 0.471, 0.504],
|
|
3022
|
+
// sigma10
|
|
3023
|
+
denom1: [0.686, 0.752, 1.025],
|
|
3024
|
+
// sigma11
|
|
3025
|
+
denom2: [0.345, 0.344, 0.532],
|
|
3026
|
+
// sigma12
|
|
3027
|
+
sup1: [0.413, 0.503, 0.504],
|
|
3028
|
+
// sigma13
|
|
3029
|
+
sup2: [0.363, 0.431, 0.404],
|
|
3030
|
+
// sigma14
|
|
3031
|
+
sup3: [0.289, 0.286, 0.294],
|
|
3032
|
+
// sigma15
|
|
3033
|
+
sub1: [0.150, 0.143, 0.200],
|
|
3034
|
+
// sigma16
|
|
3035
|
+
sub2: [0.247, 0.286, 0.400],
|
|
3036
|
+
// sigma17
|
|
3037
|
+
supDrop: [0.386, 0.353, 0.494],
|
|
3038
|
+
// sigma18
|
|
3039
|
+
subDrop: [0.050, 0.071, 0.100],
|
|
3040
|
+
// sigma19
|
|
3041
|
+
delim1: [2.390, 1.700, 1.980],
|
|
3042
|
+
// sigma20
|
|
3043
|
+
delim2: [1.010, 1.157, 1.420],
|
|
3044
|
+
// sigma21
|
|
3045
|
+
axisHeight: [0.250, 0.250, 0.250],
|
|
3046
|
+
// sigma22
|
|
3047
|
+
// These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
|
|
3048
|
+
// they correspond to the font parameters of the extension fonts (family 3).
|
|
3049
|
+
// See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
|
|
3050
|
+
// match cmex7, we'd use cmex7.tfm values for script and scriptscript
|
|
3051
|
+
// values.
|
|
3052
|
+
defaultRuleThickness: [0.04, 0.049, 0.049],
|
|
3053
|
+
// xi8; cmex7: 0.049
|
|
3054
|
+
bigOpSpacing1: [0.111, 0.111, 0.111],
|
|
3055
|
+
// xi9
|
|
3056
|
+
bigOpSpacing2: [0.166, 0.166, 0.166],
|
|
3057
|
+
// xi10
|
|
3058
|
+
bigOpSpacing3: [0.2, 0.2, 0.2],
|
|
3059
|
+
// xi11
|
|
3060
|
+
bigOpSpacing4: [0.6, 0.611, 0.611],
|
|
3061
|
+
// xi12; cmex7: 0.611
|
|
3062
|
+
bigOpSpacing5: [0.1, 0.143, 0.143],
|
|
3063
|
+
// xi13; cmex7: 0.143
|
|
3064
|
+
// The \sqrt rule width is taken from the height of the surd character.
|
|
3065
|
+
// Since we use the same font at all sizes, this thickness doesn't scale.
|
|
3066
|
+
sqrtRuleThickness: [0.04, 0.04, 0.04],
|
|
3067
|
+
// This value determines how large a pt is, for metrics which are defined
|
|
3068
|
+
// in terms of pts.
|
|
3069
|
+
// This value is also used in katex.less; if you change it make sure the
|
|
3070
|
+
// values match.
|
|
3071
|
+
ptPerEm: [10.0, 10.0, 10.0],
|
|
3072
|
+
// The space between adjacent `|` columns in an array definition. From
|
|
3073
|
+
// `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
|
|
3074
|
+
doubleRuleSep: [0.2, 0.2, 0.2],
|
|
3075
|
+
// The width of separator lines in {array} environments. From
|
|
3076
|
+
// `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
|
|
3077
|
+
arrayRuleWidth: [0.04, 0.04, 0.04],
|
|
3078
|
+
// Two values from LaTeX source2e:
|
|
3079
|
+
fboxsep: [0.3, 0.3, 0.3],
|
|
3080
|
+
// 3 pt / ptPerEm
|
|
3081
|
+
fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm
|
|
3082
|
+
|
|
3083
|
+
}; // This map contains a mapping from font name and character code to character
|
|
3084
|
+
// should have Latin-1 and Cyrillic characters, but may not depending on the
|
|
3085
|
+
// operating system. The metrics do not account for extra height from the
|
|
3086
|
+
// accents. In the case of Cyrillic characters which have both ascenders and
|
|
3087
|
+
// descenders we prefer approximations with ascenders, primarily to prevent
|
|
3088
|
+
// the fraction bar or root line from intersecting the glyph.
|
|
3089
|
+
// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
|
|
3090
|
+
|
|
3091
|
+
var extraCharacterMap = {
|
|
3092
|
+
// Latin-1
|
|
3093
|
+
'Å': 'A',
|
|
3094
|
+
'Ð': 'D',
|
|
3095
|
+
'Þ': 'o',
|
|
3096
|
+
'å': 'a',
|
|
3097
|
+
'ð': 'd',
|
|
3098
|
+
'þ': 'o',
|
|
3099
|
+
// Cyrillic
|
|
3100
|
+
'А': 'A',
|
|
3101
|
+
'Б': 'B',
|
|
3102
|
+
'В': 'B',
|
|
3103
|
+
'Г': 'F',
|
|
3104
|
+
'Д': 'A',
|
|
3105
|
+
'Е': 'E',
|
|
3106
|
+
'Ж': 'K',
|
|
3107
|
+
'З': '3',
|
|
3108
|
+
'И': 'N',
|
|
3109
|
+
'Й': 'N',
|
|
3110
|
+
'К': 'K',
|
|
3111
|
+
'Л': 'N',
|
|
3112
|
+
'М': 'M',
|
|
3113
|
+
'Н': 'H',
|
|
3114
|
+
'О': 'O',
|
|
3115
|
+
'П': 'N',
|
|
3116
|
+
'Р': 'P',
|
|
3117
|
+
'С': 'C',
|
|
3118
|
+
'Т': 'T',
|
|
3119
|
+
'У': 'y',
|
|
3120
|
+
'Ф': 'O',
|
|
3121
|
+
'Х': 'X',
|
|
3122
|
+
'Ц': 'U',
|
|
3123
|
+
'Ч': 'h',
|
|
3124
|
+
'Ш': 'W',
|
|
3125
|
+
'Щ': 'W',
|
|
3126
|
+
'Ъ': 'B',
|
|
3127
|
+
'Ы': 'X',
|
|
3128
|
+
'Ь': 'B',
|
|
3129
|
+
'Э': '3',
|
|
3130
|
+
'Ю': 'X',
|
|
3131
|
+
'Я': 'R',
|
|
3132
|
+
'а': 'a',
|
|
3133
|
+
'б': 'b',
|
|
3134
|
+
'в': 'a',
|
|
3135
|
+
'г': 'r',
|
|
3136
|
+
'д': 'y',
|
|
3137
|
+
'е': 'e',
|
|
3138
|
+
'ж': 'm',
|
|
3139
|
+
'з': 'e',
|
|
3140
|
+
'и': 'n',
|
|
3141
|
+
'й': 'n',
|
|
3142
|
+
'к': 'n',
|
|
3143
|
+
'л': 'n',
|
|
3144
|
+
'м': 'm',
|
|
3145
|
+
'н': 'n',
|
|
3146
|
+
'о': 'o',
|
|
3147
|
+
'п': 'n',
|
|
3148
|
+
'р': 'p',
|
|
3149
|
+
'с': 'c',
|
|
3150
|
+
'т': 'o',
|
|
3151
|
+
'у': 'y',
|
|
3152
|
+
'ф': 'b',
|
|
3153
|
+
'х': 'x',
|
|
3154
|
+
'ц': 'n',
|
|
3155
|
+
'ч': 'n',
|
|
3156
|
+
'ш': 'w',
|
|
3157
|
+
'щ': 'w',
|
|
3158
|
+
'ъ': 'a',
|
|
3159
|
+
'ы': 'm',
|
|
3160
|
+
'ь': 'a',
|
|
3161
|
+
'э': 'e',
|
|
3162
|
+
'ю': 'm',
|
|
3163
|
+
'я': 'r'
|
|
3164
|
+
};
|
|
3165
|
+
|
|
3166
|
+
/**
|
|
3167
|
+
* This function adds new font metrics to default metricMap
|
|
3168
|
+
* It can also override existing metrics
|
|
3169
|
+
*/
|
|
3170
|
+
function setFontMetrics(fontName, metrics) {
|
|
3171
|
+
fontMetricsData[fontName] = metrics;
|
|
3172
|
+
}
|
|
3173
|
+
/**
|
|
3174
|
+
* This function is a convenience function for looking up information in the
|
|
3175
|
+
* metricMap table. It takes a character as a string, and a font.
|
|
3176
|
+
*
|
|
3177
|
+
* Note: the `width` property may be undefined if fontMetricsData.js wasn't
|
|
3178
|
+
* built using `Make extended_metrics`.
|
|
3179
|
+
*/
|
|
3180
|
+
|
|
3181
|
+
function getCharacterMetrics(character, font, mode) {
|
|
3182
|
+
if (!fontMetricsData[font]) {
|
|
3183
|
+
throw new Error("Font metrics not found for font: " + font + ".");
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
var ch = character.charCodeAt(0);
|
|
3187
|
+
var metrics = fontMetricsData[font][ch];
|
|
3188
|
+
|
|
3189
|
+
if (!metrics && character[0] in extraCharacterMap) {
|
|
3190
|
+
ch = extraCharacterMap[character[0]].charCodeAt(0);
|
|
3191
|
+
metrics = fontMetricsData[font][ch];
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
if (!metrics && mode === 'text') {
|
|
3195
|
+
// We don't typically have font metrics for Asian scripts.
|
|
3196
|
+
// But since we support them in text mode, we need to return
|
|
3197
|
+
// some sort of metrics.
|
|
3198
|
+
// So if the character is in a script we support but we
|
|
3199
|
+
// don't have metrics for it, just use the metrics for
|
|
3200
|
+
// the Latin capital letter M. This is close enough because
|
|
3201
|
+
// we (currently) only care about the height of the glpyh
|
|
3202
|
+
// not its width.
|
|
3203
|
+
if (supportedCodepoint(ch)) {
|
|
3204
|
+
metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
if (metrics) {
|
|
3209
|
+
return {
|
|
3210
|
+
depth: metrics[0],
|
|
3211
|
+
height: metrics[1],
|
|
3212
|
+
italic: metrics[2],
|
|
3213
|
+
skew: metrics[3],
|
|
3214
|
+
width: metrics[4]
|
|
3215
|
+
};
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
var fontMetricsBySizeIndex = {};
|
|
3219
|
+
/**
|
|
3220
|
+
* Get the font metrics for a given size.
|
|
3221
|
+
*/
|
|
3222
|
+
|
|
3223
|
+
function getGlobalMetrics(size) {
|
|
3224
|
+
var sizeIndex;
|
|
3225
|
+
|
|
3226
|
+
if (size >= 5) {
|
|
3227
|
+
sizeIndex = 0;
|
|
3228
|
+
} else if (size >= 3) {
|
|
3229
|
+
sizeIndex = 1;
|
|
3230
|
+
} else {
|
|
3231
|
+
sizeIndex = 2;
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
if (!fontMetricsBySizeIndex[sizeIndex]) {
|
|
3235
|
+
var metrics = fontMetricsBySizeIndex[sizeIndex] = {
|
|
3236
|
+
cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
|
|
3237
|
+
};
|
|
3238
|
+
|
|
3239
|
+
for (var key in sigmasAndXis) {
|
|
3240
|
+
if (sigmasAndXis.hasOwnProperty(key)) {
|
|
3241
|
+
metrics[key] = sigmasAndXis[key][sizeIndex];
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
return fontMetricsBySizeIndex[sizeIndex];
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
/**
|
|
3250
|
+
* This file contains information about the options that the Parser carries
|
|
3251
|
+
* around with it while parsing. Data is held in an `Options` object, and when
|
|
3252
|
+
* recursing, a new `Options` object can be created with the `.with*` and
|
|
3253
|
+
* `.reset` functions.
|
|
3254
|
+
*/
|
|
3255
|
+
var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize].
|
|
3256
|
+
// The size mappings are taken from TeX with \normalsize=10pt.
|
|
3257
|
+
[1, 1, 1], // size1: [5, 5, 5] \tiny
|
|
3258
|
+
[2, 1, 1], // size2: [6, 5, 5]
|
|
3259
|
+
[3, 1, 1], // size3: [7, 5, 5] \scriptsize
|
|
3260
|
+
[4, 2, 1], // size4: [8, 6, 5] \footnotesize
|
|
3261
|
+
[5, 2, 1], // size5: [9, 6, 5] \small
|
|
3262
|
+
[6, 3, 1], // size6: [10, 7, 5] \normalsize
|
|
3263
|
+
[7, 4, 2], // size7: [12, 8, 6] \large
|
|
3264
|
+
[8, 6, 3], // size8: [14.4, 10, 7] \Large
|
|
3265
|
+
[9, 7, 6], // size9: [17.28, 12, 10] \LARGE
|
|
3266
|
+
[10, 8, 7], // size10: [20.74, 14.4, 12] \huge
|
|
3267
|
+
[11, 10, 9] // size11: [24.88, 20.74, 17.28] \HUGE
|
|
3268
|
+
];
|
|
3269
|
+
var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if
|
|
3270
|
+
// you change size indexes, change that function.
|
|
3271
|
+
0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];
|
|
3272
|
+
|
|
3273
|
+
var sizeAtStyle = function sizeAtStyle(size, style) {
|
|
3274
|
+
return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
|
|
3275
|
+
}; // In these types, "" (empty string) means "no change".
|
|
3276
|
+
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* This is the main options class. It contains the current style, size, color,
|
|
3280
|
+
* and font.
|
|
3281
|
+
*
|
|
3282
|
+
* Options objects should not be modified. To create a new Options with
|
|
3283
|
+
* different properties, call a `.having*` method.
|
|
3284
|
+
*/
|
|
3285
|
+
class Options {
|
|
3286
|
+
// A font family applies to a group of fonts (i.e. SansSerif), while a font
|
|
3287
|
+
// represents a specific font (i.e. SansSerif Bold).
|
|
3288
|
+
// See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
|
|
3289
|
+
|
|
3290
|
+
/**
|
|
3291
|
+
* The base size index.
|
|
3292
|
+
*/
|
|
3293
|
+
constructor(data) {
|
|
3294
|
+
this.style = void 0;
|
|
3295
|
+
this.color = void 0;
|
|
3296
|
+
this.size = void 0;
|
|
3297
|
+
this.textSize = void 0;
|
|
3298
|
+
this.phantom = void 0;
|
|
3299
|
+
this.font = void 0;
|
|
3300
|
+
this.fontFamily = void 0;
|
|
3301
|
+
this.fontWeight = void 0;
|
|
3302
|
+
this.fontShape = void 0;
|
|
3303
|
+
this.sizeMultiplier = void 0;
|
|
3304
|
+
this.maxSize = void 0;
|
|
3305
|
+
this.minRuleThickness = void 0;
|
|
3306
|
+
this._fontMetrics = void 0;
|
|
3307
|
+
this.style = data.style;
|
|
3308
|
+
this.color = data.color;
|
|
3309
|
+
this.size = data.size || Options.BASESIZE;
|
|
3310
|
+
this.textSize = data.textSize || this.size;
|
|
3311
|
+
this.phantom = !!data.phantom;
|
|
3312
|
+
this.font = data.font || "";
|
|
3313
|
+
this.fontFamily = data.fontFamily || "";
|
|
3314
|
+
this.fontWeight = data.fontWeight || '';
|
|
3315
|
+
this.fontShape = data.fontShape || '';
|
|
3316
|
+
this.sizeMultiplier = sizeMultipliers[this.size - 1];
|
|
3317
|
+
this.maxSize = data.maxSize;
|
|
3318
|
+
this.minRuleThickness = data.minRuleThickness;
|
|
3319
|
+
this._fontMetrics = undefined;
|
|
3320
|
+
}
|
|
3321
|
+
/**
|
|
3322
|
+
* Returns a new options object with the same properties as "this". Properties
|
|
3323
|
+
* from "extension" will be copied to the new options object.
|
|
3324
|
+
*/
|
|
3325
|
+
|
|
3326
|
+
|
|
3327
|
+
extend(extension) {
|
|
3328
|
+
var data = {
|
|
3329
|
+
style: this.style,
|
|
3330
|
+
size: this.size,
|
|
3331
|
+
textSize: this.textSize,
|
|
3332
|
+
color: this.color,
|
|
3333
|
+
phantom: this.phantom,
|
|
3334
|
+
font: this.font,
|
|
3335
|
+
fontFamily: this.fontFamily,
|
|
3336
|
+
fontWeight: this.fontWeight,
|
|
3337
|
+
fontShape: this.fontShape,
|
|
3338
|
+
maxSize: this.maxSize,
|
|
3339
|
+
minRuleThickness: this.minRuleThickness
|
|
3340
|
+
};
|
|
3341
|
+
|
|
3342
|
+
for (var key in extension) {
|
|
3343
|
+
if (extension.hasOwnProperty(key)) {
|
|
3344
|
+
data[key] = extension[key];
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
return new Options(data);
|
|
3349
|
+
}
|
|
3350
|
+
/**
|
|
3351
|
+
* Return an options object with the given style. If `this.style === style`,
|
|
3352
|
+
* returns `this`.
|
|
3353
|
+
*/
|
|
3354
|
+
|
|
3355
|
+
|
|
3356
|
+
havingStyle(style) {
|
|
3357
|
+
if (this.style === style) {
|
|
3358
|
+
return this;
|
|
3359
|
+
} else {
|
|
3360
|
+
return this.extend({
|
|
3361
|
+
style: style,
|
|
3362
|
+
size: sizeAtStyle(this.textSize, style)
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
/**
|
|
3367
|
+
* Return an options object with a cramped version of the current style. If
|
|
3368
|
+
* the current style is cramped, returns `this`.
|
|
3369
|
+
*/
|
|
3370
|
+
|
|
3371
|
+
|
|
3372
|
+
havingCrampedStyle() {
|
|
3373
|
+
return this.havingStyle(this.style.cramp());
|
|
3374
|
+
}
|
|
3375
|
+
/**
|
|
3376
|
+
* Return an options object with the given size and in at least `\textstyle`.
|
|
3377
|
+
* Returns `this` if appropriate.
|
|
3378
|
+
*/
|
|
3379
|
+
|
|
3380
|
+
|
|
3381
|
+
havingSize(size) {
|
|
3382
|
+
if (this.size === size && this.textSize === size) {
|
|
3383
|
+
return this;
|
|
3384
|
+
} else {
|
|
3385
|
+
return this.extend({
|
|
3386
|
+
style: this.style.text(),
|
|
3387
|
+
size: size,
|
|
3388
|
+
textSize: size,
|
|
3389
|
+
sizeMultiplier: sizeMultipliers[size - 1]
|
|
3390
|
+
});
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
/**
|
|
3394
|
+
* Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
|
|
3395
|
+
* changes to at least `\textstyle`.
|
|
3396
|
+
*/
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
havingBaseStyle(style) {
|
|
3400
|
+
style = style || this.style.text();
|
|
3401
|
+
var wantSize = sizeAtStyle(Options.BASESIZE, style);
|
|
3402
|
+
|
|
3403
|
+
if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {
|
|
3404
|
+
return this;
|
|
3405
|
+
} else {
|
|
3406
|
+
return this.extend({
|
|
3407
|
+
style: style,
|
|
3408
|
+
size: wantSize
|
|
3409
|
+
});
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
/**
|
|
3413
|
+
* Remove the effect of sizing changes such as \Huge.
|
|
3414
|
+
* Keep the effect of the current style, such as \scriptstyle.
|
|
3415
|
+
*/
|
|
3416
|
+
|
|
3417
|
+
|
|
3418
|
+
havingBaseSizing() {
|
|
3419
|
+
var size;
|
|
3420
|
+
|
|
3421
|
+
switch (this.style.id) {
|
|
3422
|
+
case 4:
|
|
3423
|
+
case 5:
|
|
3424
|
+
size = 3; // normalsize in scriptstyle
|
|
3425
|
+
|
|
3426
|
+
break;
|
|
3427
|
+
|
|
3428
|
+
case 6:
|
|
3429
|
+
case 7:
|
|
3430
|
+
size = 1; // normalsize in scriptscriptstyle
|
|
3431
|
+
|
|
3432
|
+
break;
|
|
3433
|
+
|
|
3434
|
+
default:
|
|
3435
|
+
size = 6;
|
|
3436
|
+
// normalsize in textstyle or displaystyle
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
return this.extend({
|
|
3440
|
+
style: this.style.text(),
|
|
3441
|
+
size: size
|
|
3442
|
+
});
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* Create a new options object with the given color.
|
|
3446
|
+
*/
|
|
3447
|
+
|
|
3448
|
+
|
|
3449
|
+
withColor(color) {
|
|
3450
|
+
return this.extend({
|
|
3451
|
+
color: color
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Create a new options object with "phantom" set to true.
|
|
3456
|
+
*/
|
|
3457
|
+
|
|
3458
|
+
|
|
3459
|
+
withPhantom() {
|
|
3460
|
+
return this.extend({
|
|
3461
|
+
phantom: true
|
|
3462
|
+
});
|
|
3463
|
+
}
|
|
3464
|
+
/**
|
|
3465
|
+
* Creates a new options object with the given math font or old text font.
|
|
3466
|
+
* @type {[type]}
|
|
3467
|
+
*/
|
|
3468
|
+
|
|
3469
|
+
|
|
3470
|
+
withFont(font) {
|
|
3471
|
+
return this.extend({
|
|
3472
|
+
font
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Create a new options objects with the given fontFamily.
|
|
3477
|
+
*/
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
withTextFontFamily(fontFamily) {
|
|
3481
|
+
return this.extend({
|
|
3482
|
+
fontFamily,
|
|
3483
|
+
font: ""
|
|
3484
|
+
});
|
|
3485
|
+
}
|
|
3486
|
+
/**
|
|
3487
|
+
* Creates a new options object with the given font weight
|
|
3488
|
+
*/
|
|
3489
|
+
|
|
3490
|
+
|
|
3491
|
+
withTextFontWeight(fontWeight) {
|
|
3492
|
+
return this.extend({
|
|
3493
|
+
fontWeight,
|
|
3494
|
+
font: ""
|
|
3495
|
+
});
|
|
3496
|
+
}
|
|
3497
|
+
/**
|
|
3498
|
+
* Creates a new options object with the given font weight
|
|
3499
|
+
*/
|
|
3500
|
+
|
|
3501
|
+
|
|
3502
|
+
withTextFontShape(fontShape) {
|
|
3503
|
+
return this.extend({
|
|
3504
|
+
fontShape,
|
|
3505
|
+
font: ""
|
|
3506
|
+
});
|
|
3507
|
+
}
|
|
3508
|
+
/**
|
|
3509
|
+
* Return the CSS sizing classes required to switch from enclosing options
|
|
3510
|
+
* `oldOptions` to `this`. Returns an array of classes.
|
|
3511
|
+
*/
|
|
3512
|
+
|
|
3513
|
+
|
|
3514
|
+
sizingClasses(oldOptions) {
|
|
3515
|
+
if (oldOptions.size !== this.size) {
|
|
3516
|
+
return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
|
|
3517
|
+
} else {
|
|
3518
|
+
return [];
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
/**
|
|
3522
|
+
* Return the CSS sizing classes required to switch to the base size. Like
|
|
3523
|
+
* `this.havingSize(BASESIZE).sizingClasses(this)`.
|
|
3524
|
+
*/
|
|
3525
|
+
|
|
3526
|
+
|
|
3527
|
+
baseSizingClasses() {
|
|
3528
|
+
if (this.size !== Options.BASESIZE) {
|
|
3529
|
+
return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
|
|
3530
|
+
} else {
|
|
3531
|
+
return [];
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
/**
|
|
3535
|
+
* Return the font metrics for this size.
|
|
3536
|
+
*/
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
fontMetrics() {
|
|
3540
|
+
if (!this._fontMetrics) {
|
|
3541
|
+
this._fontMetrics = getGlobalMetrics(this.size);
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3544
|
+
return this._fontMetrics;
|
|
3545
|
+
}
|
|
3546
|
+
/**
|
|
3547
|
+
* Gets the CSS color of the current options object
|
|
3548
|
+
*/
|
|
3549
|
+
|
|
3550
|
+
|
|
3551
|
+
getColor() {
|
|
3552
|
+
if (this.phantom) {
|
|
3553
|
+
return "transparent";
|
|
3554
|
+
} else {
|
|
3555
|
+
return this.color;
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
Options.BASESIZE = 6;
|
|
3562
|
+
|
|
3563
|
+
/**
|
|
3564
|
+
* This file does conversion between units. In particular, it provides
|
|
3565
|
+
* calculateSize to convert other units into ems.
|
|
3566
|
+
*/
|
|
3567
|
+
// Thus, multiplying a length by this number converts the length from units
|
|
3568
|
+
// into pts. Dividing the result by ptPerEm gives the number of ems
|
|
3569
|
+
// *assuming* a font size of ptPerEm (normal size, normal style).
|
|
3570
|
+
|
|
3571
|
+
var ptPerUnit = {
|
|
3572
|
+
// https://en.wikibooks.org/wiki/LaTeX/Lengths and
|
|
3573
|
+
// https://tex.stackexchange.com/a/8263
|
|
3574
|
+
"pt": 1,
|
|
3575
|
+
// TeX point
|
|
3576
|
+
"mm": 7227 / 2540,
|
|
3577
|
+
// millimeter
|
|
3578
|
+
"cm": 7227 / 254,
|
|
3579
|
+
// centimeter
|
|
3580
|
+
"in": 72.27,
|
|
3581
|
+
// inch
|
|
3582
|
+
"bp": 803 / 800,
|
|
3583
|
+
// big (PostScript) points
|
|
3584
|
+
"pc": 12,
|
|
3585
|
+
// pica
|
|
3586
|
+
"dd": 1238 / 1157,
|
|
3587
|
+
// didot
|
|
3588
|
+
"cc": 14856 / 1157,
|
|
3589
|
+
// cicero (12 didot)
|
|
3590
|
+
"nd": 685 / 642,
|
|
3591
|
+
// new didot
|
|
3592
|
+
"nc": 1370 / 107,
|
|
3593
|
+
// new cicero (12 new didot)
|
|
3594
|
+
"sp": 1 / 65536,
|
|
3595
|
+
// scaled point (TeX's internal smallest unit)
|
|
3596
|
+
// https://tex.stackexchange.com/a/41371
|
|
3597
|
+
"px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
|
|
3598
|
+
|
|
3599
|
+
}; // Dictionary of relative units, for fast validity testing.
|
|
3600
|
+
|
|
3601
|
+
var relativeUnit = {
|
|
3602
|
+
"ex": true,
|
|
3603
|
+
"em": true,
|
|
3604
|
+
"mu": true
|
|
3605
|
+
};
|
|
3606
|
+
|
|
3607
|
+
/**
|
|
3608
|
+
* Determine whether the specified unit (either a string defining the unit
|
|
3609
|
+
* or a "size" parse node containing a unit field) is valid.
|
|
3610
|
+
*/
|
|
3611
|
+
var validUnit = function validUnit(unit) {
|
|
3612
|
+
if (typeof unit !== "string") {
|
|
3613
|
+
unit = unit.unit;
|
|
3614
|
+
}
|
|
3615
|
+
|
|
3616
|
+
return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
|
|
3617
|
+
};
|
|
3618
|
+
/*
|
|
3619
|
+
* Convert a "size" parse node (with numeric "number" and string "unit" fields,
|
|
3620
|
+
* as parsed by functions.js argType "size") into a CSS em value for the
|
|
3621
|
+
* current style/scale. `options` gives the current options.
|
|
3622
|
+
*/
|
|
3623
|
+
|
|
3624
|
+
var calculateSize = function calculateSize(sizeValue, options) {
|
|
3625
|
+
var scale;
|
|
3626
|
+
|
|
3627
|
+
if (sizeValue.unit in ptPerUnit) {
|
|
3628
|
+
// Absolute units
|
|
3629
|
+
scale = ptPerUnit[sizeValue.unit] // Convert unit to pt
|
|
3630
|
+
/ options.fontMetrics().ptPerEm // Convert pt to CSS em
|
|
3631
|
+
/ options.sizeMultiplier; // Unscale to make absolute units
|
|
3632
|
+
} else if (sizeValue.unit === "mu") {
|
|
3633
|
+
// `mu` units scale with scriptstyle/scriptscriptstyle.
|
|
3634
|
+
scale = options.fontMetrics().cssEmPerMu;
|
|
3635
|
+
} else {
|
|
3636
|
+
// Other relative units always refer to the *textstyle* font
|
|
3637
|
+
// in the current size.
|
|
3638
|
+
var unitOptions;
|
|
3639
|
+
|
|
3640
|
+
if (options.style.isTight()) {
|
|
3641
|
+
// isTight() means current style is script/scriptscript.
|
|
3642
|
+
unitOptions = options.havingStyle(options.style.text());
|
|
3643
|
+
} else {
|
|
3644
|
+
unitOptions = options;
|
|
3645
|
+
} // TODO: In TeX these units are relative to the quad of the current
|
|
3646
|
+
// *text* font, e.g. cmr10. KaTeX instead uses values from the
|
|
3647
|
+
// comparably-sized *Computer Modern symbol* font. At 10pt, these
|
|
3648
|
+
// match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
|
|
3649
|
+
// cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
|
|
3650
|
+
// TeX \showlists shows a kern of 1.13889 * fontsize;
|
|
3651
|
+
// KaTeX shows a kern of 1.171 * fontsize.
|
|
3652
|
+
|
|
3653
|
+
|
|
3654
|
+
if (sizeValue.unit === "ex") {
|
|
3655
|
+
scale = unitOptions.fontMetrics().xHeight;
|
|
3656
|
+
} else if (sizeValue.unit === "em") {
|
|
3657
|
+
scale = unitOptions.fontMetrics().quad;
|
|
3658
|
+
} else {
|
|
3659
|
+
throw new ParseError("Invalid unit: '" + sizeValue.unit + "'");
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3662
|
+
if (unitOptions !== options) {
|
|
3663
|
+
scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
return Math.min(sizeValue.number * scale, options.maxSize);
|
|
3668
|
+
};
|
|
3669
|
+
/**
|
|
3670
|
+
* Round `n` to 4 decimal places, or to the nearest 1/10,000th em. See
|
|
3671
|
+
* https://github.com/KaTeX/KaTeX/pull/2460.
|
|
3503
3672
|
*/
|
|
3504
|
-
// In TeX, there are actually three sets of dimensions, one for each of
|
|
3505
|
-
// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
|
|
3506
|
-
// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are
|
|
3507
|
-
// provided in the the arrays below, in that order.
|
|
3508
|
-
//
|
|
3509
|
-
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
|
|
3510
|
-
// This was determined by running the following script:
|
|
3511
|
-
//
|
|
3512
|
-
// latex -interaction=nonstopmode \
|
|
3513
|
-
// '\documentclass{article}\usepackage{amsmath}\begin{document}' \
|
|
3514
|
-
// '$a$ \expandafter\show\the\textfont2' \
|
|
3515
|
-
// '\expandafter\show\the\scriptfont2' \
|
|
3516
|
-
// '\expandafter\show\the\scriptscriptfont2' \
|
|
3517
|
-
// '\stop'
|
|
3518
|
-
//
|
|
3519
|
-
// The metrics themselves were retreived using the following commands:
|
|
3520
|
-
//
|
|
3521
|
-
// tftopl cmsy10
|
|
3522
|
-
// tftopl cmsy7
|
|
3523
|
-
// tftopl cmsy5
|
|
3524
|
-
//
|
|
3525
|
-
// The output of each of these commands is quite lengthy. The only part we
|
|
3526
|
-
// care about is the FONTDIMEN section. Each value is measured in EMs.
|
|
3527
|
-
var sigmasAndXis = {
|
|
3528
|
-
slant: [0.250, 0.250, 0.250],
|
|
3529
|
-
// sigma1
|
|
3530
|
-
space: [0.000, 0.000, 0.000],
|
|
3531
|
-
// sigma2
|
|
3532
|
-
stretch: [0.000, 0.000, 0.000],
|
|
3533
|
-
// sigma3
|
|
3534
|
-
shrink: [0.000, 0.000, 0.000],
|
|
3535
|
-
// sigma4
|
|
3536
|
-
xHeight: [0.431, 0.431, 0.431],
|
|
3537
|
-
// sigma5
|
|
3538
|
-
quad: [1.000, 1.171, 1.472],
|
|
3539
|
-
// sigma6
|
|
3540
|
-
extraSpace: [0.000, 0.000, 0.000],
|
|
3541
|
-
// sigma7
|
|
3542
|
-
num1: [0.677, 0.732, 0.925],
|
|
3543
|
-
// sigma8
|
|
3544
|
-
num2: [0.394, 0.384, 0.387],
|
|
3545
|
-
// sigma9
|
|
3546
|
-
num3: [0.444, 0.471, 0.504],
|
|
3547
|
-
// sigma10
|
|
3548
|
-
denom1: [0.686, 0.752, 1.025],
|
|
3549
|
-
// sigma11
|
|
3550
|
-
denom2: [0.345, 0.344, 0.532],
|
|
3551
|
-
// sigma12
|
|
3552
|
-
sup1: [0.413, 0.503, 0.504],
|
|
3553
|
-
// sigma13
|
|
3554
|
-
sup2: [0.363, 0.431, 0.404],
|
|
3555
|
-
// sigma14
|
|
3556
|
-
sup3: [0.289, 0.286, 0.294],
|
|
3557
|
-
// sigma15
|
|
3558
|
-
sub1: [0.150, 0.143, 0.200],
|
|
3559
|
-
// sigma16
|
|
3560
|
-
sub2: [0.247, 0.286, 0.400],
|
|
3561
|
-
// sigma17
|
|
3562
|
-
supDrop: [0.386, 0.353, 0.494],
|
|
3563
|
-
// sigma18
|
|
3564
|
-
subDrop: [0.050, 0.071, 0.100],
|
|
3565
|
-
// sigma19
|
|
3566
|
-
delim1: [2.390, 1.700, 1.980],
|
|
3567
|
-
// sigma20
|
|
3568
|
-
delim2: [1.010, 1.157, 1.420],
|
|
3569
|
-
// sigma21
|
|
3570
|
-
axisHeight: [0.250, 0.250, 0.250],
|
|
3571
|
-
// sigma22
|
|
3572
|
-
// These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
|
|
3573
|
-
// they correspond to the font parameters of the extension fonts (family 3).
|
|
3574
|
-
// See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
|
|
3575
|
-
// match cmex7, we'd use cmex7.tfm values for script and scriptscript
|
|
3576
|
-
// values.
|
|
3577
|
-
defaultRuleThickness: [0.04, 0.049, 0.049],
|
|
3578
|
-
// xi8; cmex7: 0.049
|
|
3579
|
-
bigOpSpacing1: [0.111, 0.111, 0.111],
|
|
3580
|
-
// xi9
|
|
3581
|
-
bigOpSpacing2: [0.166, 0.166, 0.166],
|
|
3582
|
-
// xi10
|
|
3583
|
-
bigOpSpacing3: [0.2, 0.2, 0.2],
|
|
3584
|
-
// xi11
|
|
3585
|
-
bigOpSpacing4: [0.6, 0.611, 0.611],
|
|
3586
|
-
// xi12; cmex7: 0.611
|
|
3587
|
-
bigOpSpacing5: [0.1, 0.143, 0.143],
|
|
3588
|
-
// xi13; cmex7: 0.143
|
|
3589
|
-
// The \sqrt rule width is taken from the height of the surd character.
|
|
3590
|
-
// Since we use the same font at all sizes, this thickness doesn't scale.
|
|
3591
|
-
sqrtRuleThickness: [0.04, 0.04, 0.04],
|
|
3592
|
-
// This value determines how large a pt is, for metrics which are defined
|
|
3593
|
-
// in terms of pts.
|
|
3594
|
-
// This value is also used in katex.less; if you change it make sure the
|
|
3595
|
-
// values match.
|
|
3596
|
-
ptPerEm: [10.0, 10.0, 10.0],
|
|
3597
|
-
// The space between adjacent `|` columns in an array definition. From
|
|
3598
|
-
// `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
|
|
3599
|
-
doubleRuleSep: [0.2, 0.2, 0.2],
|
|
3600
|
-
// The width of separator lines in {array} environments. From
|
|
3601
|
-
// `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
|
|
3602
|
-
arrayRuleWidth: [0.04, 0.04, 0.04],
|
|
3603
|
-
// Two values from LaTeX source2e:
|
|
3604
|
-
fboxsep: [0.3, 0.3, 0.3],
|
|
3605
|
-
// 3 pt / ptPerEm
|
|
3606
|
-
fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm
|
|
3607
3673
|
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
// operating system. The metrics do not account for extra height from the
|
|
3611
|
-
// accents. In the case of Cyrillic characters which have both ascenders and
|
|
3612
|
-
// descenders we prefer approximations with ascenders, primarily to prevent
|
|
3613
|
-
// the fraction bar or root line from intersecting the glyph.
|
|
3614
|
-
// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
|
|
3615
|
-
|
|
3616
|
-
var extraCharacterMap = {
|
|
3617
|
-
// Latin-1
|
|
3618
|
-
'Å': 'A',
|
|
3619
|
-
'Ð': 'D',
|
|
3620
|
-
'Þ': 'o',
|
|
3621
|
-
'å': 'a',
|
|
3622
|
-
'ð': 'd',
|
|
3623
|
-
'þ': 'o',
|
|
3624
|
-
// Cyrillic
|
|
3625
|
-
'А': 'A',
|
|
3626
|
-
'Б': 'B',
|
|
3627
|
-
'В': 'B',
|
|
3628
|
-
'Г': 'F',
|
|
3629
|
-
'Д': 'A',
|
|
3630
|
-
'Е': 'E',
|
|
3631
|
-
'Ж': 'K',
|
|
3632
|
-
'З': '3',
|
|
3633
|
-
'И': 'N',
|
|
3634
|
-
'Й': 'N',
|
|
3635
|
-
'К': 'K',
|
|
3636
|
-
'Л': 'N',
|
|
3637
|
-
'М': 'M',
|
|
3638
|
-
'Н': 'H',
|
|
3639
|
-
'О': 'O',
|
|
3640
|
-
'П': 'N',
|
|
3641
|
-
'Р': 'P',
|
|
3642
|
-
'С': 'C',
|
|
3643
|
-
'Т': 'T',
|
|
3644
|
-
'У': 'y',
|
|
3645
|
-
'Ф': 'O',
|
|
3646
|
-
'Х': 'X',
|
|
3647
|
-
'Ц': 'U',
|
|
3648
|
-
'Ч': 'h',
|
|
3649
|
-
'Ш': 'W',
|
|
3650
|
-
'Щ': 'W',
|
|
3651
|
-
'Ъ': 'B',
|
|
3652
|
-
'Ы': 'X',
|
|
3653
|
-
'Ь': 'B',
|
|
3654
|
-
'Э': '3',
|
|
3655
|
-
'Ю': 'X',
|
|
3656
|
-
'Я': 'R',
|
|
3657
|
-
'а': 'a',
|
|
3658
|
-
'б': 'b',
|
|
3659
|
-
'в': 'a',
|
|
3660
|
-
'г': 'r',
|
|
3661
|
-
'д': 'y',
|
|
3662
|
-
'е': 'e',
|
|
3663
|
-
'ж': 'm',
|
|
3664
|
-
'з': 'e',
|
|
3665
|
-
'и': 'n',
|
|
3666
|
-
'й': 'n',
|
|
3667
|
-
'к': 'n',
|
|
3668
|
-
'л': 'n',
|
|
3669
|
-
'м': 'm',
|
|
3670
|
-
'н': 'n',
|
|
3671
|
-
'о': 'o',
|
|
3672
|
-
'п': 'n',
|
|
3673
|
-
'р': 'p',
|
|
3674
|
-
'с': 'c',
|
|
3675
|
-
'т': 'o',
|
|
3676
|
-
'у': 'y',
|
|
3677
|
-
'ф': 'b',
|
|
3678
|
-
'х': 'x',
|
|
3679
|
-
'ц': 'n',
|
|
3680
|
-
'ч': 'n',
|
|
3681
|
-
'ш': 'w',
|
|
3682
|
-
'щ': 'w',
|
|
3683
|
-
'ъ': 'a',
|
|
3684
|
-
'ы': 'm',
|
|
3685
|
-
'ь': 'a',
|
|
3686
|
-
'э': 'e',
|
|
3687
|
-
'ю': 'm',
|
|
3688
|
-
'я': 'r'
|
|
3674
|
+
var makeEm = function makeEm(n) {
|
|
3675
|
+
return +n.toFixed(4) + "em";
|
|
3689
3676
|
};
|
|
3690
3677
|
|
|
3691
3678
|
/**
|
|
3692
|
-
*
|
|
3693
|
-
*
|
|
3679
|
+
* These objects store the data about the DOM nodes we create, as well as some
|
|
3680
|
+
* extra data. They can then be transformed into real DOM nodes with the
|
|
3681
|
+
* `toNode` function or HTML markup using `toMarkup`. They are useful for both
|
|
3682
|
+
* storing extra properties on the nodes, as well as providing a way to easily
|
|
3683
|
+
* work with the DOM.
|
|
3684
|
+
*
|
|
3685
|
+
* Similar functions for working with MathML nodes exist in mathMLTree.js.
|
|
3686
|
+
*
|
|
3687
|
+
* TODO: refactor `span` and `anchor` into common superclass when
|
|
3688
|
+
* target environments support class inheritance
|
|
3694
3689
|
*/
|
|
3695
|
-
|
|
3696
|
-
fontMetricsData[fontName] = metrics;
|
|
3697
|
-
}
|
|
3690
|
+
|
|
3698
3691
|
/**
|
|
3699
|
-
*
|
|
3700
|
-
*
|
|
3701
|
-
*
|
|
3702
|
-
* Note: the `width` property may be undefined if fontMetricsData.js wasn't
|
|
3703
|
-
* built using `Make extended_metrics`.
|
|
3692
|
+
* Create an HTML className based on a list of classes. In addition to joining
|
|
3693
|
+
* with spaces, we also remove empty classes.
|
|
3704
3694
|
*/
|
|
3695
|
+
var createClass = function createClass(classes) {
|
|
3696
|
+
return classes.filter(cls => cls).join(" ");
|
|
3697
|
+
};
|
|
3705
3698
|
|
|
3706
|
-
function
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3699
|
+
var initNode = function initNode(classes, options, style) {
|
|
3700
|
+
this.classes = classes || [];
|
|
3701
|
+
this.attributes = {};
|
|
3702
|
+
this.height = 0;
|
|
3703
|
+
this.depth = 0;
|
|
3704
|
+
this.maxFontSize = 0;
|
|
3705
|
+
this.style = style || {};
|
|
3710
3706
|
|
|
3711
|
-
|
|
3712
|
-
|
|
3707
|
+
if (options) {
|
|
3708
|
+
if (options.style.isTight()) {
|
|
3709
|
+
this.classes.push("mtight");
|
|
3710
|
+
}
|
|
3713
3711
|
|
|
3714
|
-
|
|
3715
|
-
ch = extraCharacterMap[character[0]].charCodeAt(0);
|
|
3716
|
-
metrics = fontMetricsData[font][ch];
|
|
3717
|
-
}
|
|
3712
|
+
var color = options.getColor();
|
|
3718
3713
|
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
// But since we support them in text mode, we need to return
|
|
3722
|
-
// some sort of metrics.
|
|
3723
|
-
// So if the character is in a script we support but we
|
|
3724
|
-
// don't have metrics for it, just use the metrics for
|
|
3725
|
-
// the Latin capital letter M. This is close enough because
|
|
3726
|
-
// we (currently) only care about the height of the glpyh
|
|
3727
|
-
// not its width.
|
|
3728
|
-
if (supportedCodepoint(ch)) {
|
|
3729
|
-
metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'
|
|
3714
|
+
if (color) {
|
|
3715
|
+
this.style.color = color;
|
|
3730
3716
|
}
|
|
3731
3717
|
}
|
|
3732
|
-
|
|
3733
|
-
if (metrics) {
|
|
3734
|
-
return {
|
|
3735
|
-
depth: metrics[0],
|
|
3736
|
-
height: metrics[1],
|
|
3737
|
-
italic: metrics[2],
|
|
3738
|
-
skew: metrics[3],
|
|
3739
|
-
width: metrics[4]
|
|
3740
|
-
};
|
|
3741
|
-
}
|
|
3742
|
-
}
|
|
3743
|
-
var fontMetricsBySizeIndex = {};
|
|
3718
|
+
};
|
|
3744
3719
|
/**
|
|
3745
|
-
*
|
|
3720
|
+
* Convert into an HTML node
|
|
3746
3721
|
*/
|
|
3747
3722
|
|
|
3748
|
-
function getGlobalMetrics(size) {
|
|
3749
|
-
var sizeIndex;
|
|
3750
3723
|
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
} else if (size >= 3) {
|
|
3754
|
-
sizeIndex = 1;
|
|
3755
|
-
} else {
|
|
3756
|
-
sizeIndex = 2;
|
|
3757
|
-
}
|
|
3724
|
+
var toNode = function toNode(tagName) {
|
|
3725
|
+
var node = document.createElement(tagName); // Apply the class
|
|
3758
3726
|
|
|
3759
|
-
|
|
3760
|
-
var metrics = fontMetricsBySizeIndex[sizeIndex] = {
|
|
3761
|
-
cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
|
|
3762
|
-
};
|
|
3727
|
+
node.className = createClass(this.classes); // Apply inline styles
|
|
3763
3728
|
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3729
|
+
for (var style in this.style) {
|
|
3730
|
+
if (this.style.hasOwnProperty(style)) {
|
|
3731
|
+
// $FlowFixMe Flow doesn't seem to understand span.style's type.
|
|
3732
|
+
node.style[style] = this.style[style];
|
|
3768
3733
|
}
|
|
3769
|
-
}
|
|
3734
|
+
} // Apply attributes
|
|
3770
3735
|
|
|
3771
|
-
return fontMetricsBySizeIndex[sizeIndex];
|
|
3772
|
-
}
|
|
3773
3736
|
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
* - font (required): the font to be used for this symbol. Either "main" (the
|
|
3780
|
-
normal font), or "ams" (the ams fonts).
|
|
3781
|
-
* - group (required): the ParseNode group type the symbol should have (i.e.
|
|
3782
|
-
"textord", "mathord", etc).
|
|
3783
|
-
See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
|
|
3784
|
-
* - replace: the character that this symbol or function should be
|
|
3785
|
-
* replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
|
|
3786
|
-
* character in the main font).
|
|
3787
|
-
*
|
|
3788
|
-
* The outermost map in the table indicates what mode the symbols should be
|
|
3789
|
-
* accepted in (e.g. "math" or "text").
|
|
3790
|
-
*/
|
|
3791
|
-
// Some of these have a "-token" suffix since these are also used as `ParseNode`
|
|
3792
|
-
// types for raw text tokens, and we want to avoid conflicts with higher-level
|
|
3793
|
-
// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
|
|
3794
|
-
// looking up the `symbols` map.
|
|
3795
|
-
var ATOMS = {
|
|
3796
|
-
"bin": 1,
|
|
3797
|
-
"close": 1,
|
|
3798
|
-
"inner": 1,
|
|
3799
|
-
"open": 1,
|
|
3800
|
-
"punct": 1,
|
|
3801
|
-
"rel": 1
|
|
3802
|
-
};
|
|
3803
|
-
var NON_ATOMS = {
|
|
3804
|
-
"accent-token": 1,
|
|
3805
|
-
"mathord": 1,
|
|
3806
|
-
"op-token": 1,
|
|
3807
|
-
"spacing": 1,
|
|
3808
|
-
"textord": 1
|
|
3809
|
-
};
|
|
3810
|
-
var symbols = {
|
|
3811
|
-
"math": {},
|
|
3812
|
-
"text": {}
|
|
3813
|
-
};
|
|
3814
|
-
/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
|
|
3737
|
+
for (var attr in this.attributes) {
|
|
3738
|
+
if (this.attributes.hasOwnProperty(attr)) {
|
|
3739
|
+
node.setAttribute(attr, this.attributes[attr]);
|
|
3740
|
+
}
|
|
3741
|
+
} // Append the children, also as HTML nodes
|
|
3815
3742
|
|
|
3816
|
-
function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
|
|
3817
|
-
symbols[mode][name] = {
|
|
3818
|
-
font,
|
|
3819
|
-
group,
|
|
3820
|
-
replace
|
|
3821
|
-
};
|
|
3822
3743
|
|
|
3823
|
-
|
|
3824
|
-
|
|
3744
|
+
for (var i = 0; i < this.children.length; i++) {
|
|
3745
|
+
node.appendChild(this.children[i].toNode());
|
|
3825
3746
|
}
|
|
3826
|
-
} // Some abbreviations for commonly used strings.
|
|
3827
|
-
// This helps minify the code, and also spotting typos using jshint.
|
|
3828
|
-
// modes:
|
|
3829
|
-
|
|
3830
|
-
var math = "math";
|
|
3831
|
-
var text = "text"; // fonts:
|
|
3832
|
-
|
|
3833
|
-
var main = "main";
|
|
3834
|
-
var ams = "ams"; // groups:
|
|
3835
|
-
|
|
3836
|
-
var accent = "accent-token";
|
|
3837
|
-
var bin = "bin";
|
|
3838
|
-
var close = "close";
|
|
3839
|
-
var inner = "inner";
|
|
3840
|
-
var mathord = "mathord";
|
|
3841
|
-
var op = "op-token";
|
|
3842
|
-
var open = "open";
|
|
3843
|
-
var punct = "punct";
|
|
3844
|
-
var rel = "rel";
|
|
3845
|
-
var spacing = "spacing";
|
|
3846
|
-
var textord = "textord"; // Now comes the symbol table
|
|
3847
|
-
// Relation Symbols
|
|
3848
3747
|
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
defineSymbol(math, main, rel, "\u2aaf", "\\preceq", true);
|
|
3855
|
-
defineSymbol(math, main, rel, "\u2ab0", "\\succeq", true);
|
|
3856
|
-
defineSymbol(math, main, rel, "\u2243", "\\simeq", true);
|
|
3857
|
-
defineSymbol(math, main, rel, "\u2223", "\\mid", true);
|
|
3858
|
-
defineSymbol(math, main, rel, "\u226a", "\\ll", true);
|
|
3859
|
-
defineSymbol(math, main, rel, "\u226b", "\\gg", true);
|
|
3860
|
-
defineSymbol(math, main, rel, "\u224d", "\\asymp", true);
|
|
3861
|
-
defineSymbol(math, main, rel, "\u2225", "\\parallel");
|
|
3862
|
-
defineSymbol(math, main, rel, "\u22c8", "\\bowtie", true);
|
|
3863
|
-
defineSymbol(math, main, rel, "\u2323", "\\smile", true);
|
|
3864
|
-
defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true);
|
|
3865
|
-
defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true);
|
|
3866
|
-
defineSymbol(math, main, rel, "\u2250", "\\doteq", true);
|
|
3867
|
-
defineSymbol(math, main, rel, "\u2322", "\\frown", true);
|
|
3868
|
-
defineSymbol(math, main, rel, "\u220b", "\\ni", true);
|
|
3869
|
-
defineSymbol(math, main, rel, "\u221d", "\\propto", true);
|
|
3870
|
-
defineSymbol(math, main, rel, "\u22a2", "\\vdash", true);
|
|
3871
|
-
defineSymbol(math, main, rel, "\u22a3", "\\dashv", true);
|
|
3872
|
-
defineSymbol(math, main, rel, "\u220b", "\\owns"); // Punctuation
|
|
3748
|
+
return node;
|
|
3749
|
+
};
|
|
3750
|
+
/**
|
|
3751
|
+
* Convert into an HTML markup string
|
|
3752
|
+
*/
|
|
3873
3753
|
|
|
3874
|
-
defineSymbol(math, main, punct, "\u002e", "\\ldotp");
|
|
3875
|
-
defineSymbol(math, main, punct, "\u22c5", "\\cdotp"); // Misc Symbols
|
|
3876
3754
|
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
defineSymbol(math, main, textord, "\u0026", "\\&");
|
|
3880
|
-
defineSymbol(text, main, textord, "\u0026", "\\&");
|
|
3881
|
-
defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
|
|
3882
|
-
defineSymbol(math, main, textord, "\u2200", "\\forall", true);
|
|
3883
|
-
defineSymbol(math, main, textord, "\u210f", "\\hbar", true);
|
|
3884
|
-
defineSymbol(math, main, textord, "\u2203", "\\exists", true);
|
|
3885
|
-
defineSymbol(math, main, textord, "\u2207", "\\nabla", true);
|
|
3886
|
-
defineSymbol(math, main, textord, "\u266d", "\\flat", true);
|
|
3887
|
-
defineSymbol(math, main, textord, "\u2113", "\\ell", true);
|
|
3888
|
-
defineSymbol(math, main, textord, "\u266e", "\\natural", true);
|
|
3889
|
-
defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true);
|
|
3890
|
-
defineSymbol(math, main, textord, "\u2118", "\\wp", true);
|
|
3891
|
-
defineSymbol(math, main, textord, "\u266f", "\\sharp", true);
|
|
3892
|
-
defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true);
|
|
3893
|
-
defineSymbol(math, main, textord, "\u211c", "\\Re", true);
|
|
3894
|
-
defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
|
|
3895
|
-
defineSymbol(math, main, textord, "\u2111", "\\Im", true);
|
|
3896
|
-
defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
|
|
3897
|
-
defineSymbol(math, main, textord, "\u00a7", "\\S", true);
|
|
3898
|
-
defineSymbol(text, main, textord, "\u00a7", "\\S");
|
|
3899
|
-
defineSymbol(math, main, textord, "\u00b6", "\\P", true);
|
|
3900
|
-
defineSymbol(text, main, textord, "\u00b6", "\\P"); // Math and Text
|
|
3755
|
+
var toMarkup = function toMarkup(tagName) {
|
|
3756
|
+
var markup = "<" + tagName; // Add the class
|
|
3901
3757
|
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
defineSymbol(math, main, textord, "\u2021", "\\ddag");
|
|
3906
|
-
defineSymbol(text, main, textord, "\u2021", "\\ddag");
|
|
3907
|
-
defineSymbol(text, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters
|
|
3758
|
+
if (this.classes.length) {
|
|
3759
|
+
markup += " class=\"" + utils.escape(createClass(this.classes)) + "\"";
|
|
3760
|
+
}
|
|
3908
3761
|
|
|
3909
|
-
|
|
3910
|
-
defineSymbol(math, main, open, "\u23b0", "\\lmoustache", true);
|
|
3911
|
-
defineSymbol(math, main, close, "\u27ef", "\\rgroup", true);
|
|
3912
|
-
defineSymbol(math, main, open, "\u27ee", "\\lgroup", true); // Binary Operators
|
|
3762
|
+
var styles = ""; // Add the styles, after hyphenation
|
|
3913
3763
|
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
|
|
3920
|
-
defineSymbol(math, main, bin, "\u25ef", "\\bigcirc", true);
|
|
3921
|
-
defineSymbol(math, main, bin, "\u2219", "\\bullet");
|
|
3922
|
-
defineSymbol(math, main, bin, "\u2021", "\\ddagger");
|
|
3923
|
-
defineSymbol(math, main, bin, "\u2240", "\\wr", true);
|
|
3924
|
-
defineSymbol(math, main, bin, "\u2a3f", "\\amalg");
|
|
3925
|
-
defineSymbol(math, main, bin, "\u0026", "\\And"); // from amsmath
|
|
3926
|
-
// Arrow Symbols
|
|
3764
|
+
for (var style in this.style) {
|
|
3765
|
+
if (this.style.hasOwnProperty(style)) {
|
|
3766
|
+
styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3927
3769
|
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow", true);
|
|
3932
|
-
defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow", true);
|
|
3933
|
-
defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow", true);
|
|
3934
|
-
defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true);
|
|
3935
|
-
defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow", true);
|
|
3936
|
-
defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow", true);
|
|
3937
|
-
defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow", true);
|
|
3938
|
-
defineSymbol(math, main, rel, "\u21a6", "\\mapsto", true);
|
|
3939
|
-
defineSymbol(math, main, rel, "\u27fc", "\\longmapsto", true);
|
|
3940
|
-
defineSymbol(math, main, rel, "\u2197", "\\nearrow", true);
|
|
3941
|
-
defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow", true);
|
|
3942
|
-
defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow", true);
|
|
3943
|
-
defineSymbol(math, main, rel, "\u2198", "\\searrow", true);
|
|
3944
|
-
defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup", true);
|
|
3945
|
-
defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup", true);
|
|
3946
|
-
defineSymbol(math, main, rel, "\u2199", "\\swarrow", true);
|
|
3947
|
-
defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown", true);
|
|
3948
|
-
defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true);
|
|
3949
|
-
defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
|
|
3950
|
-
defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true); // AMS Negated Binary Relations
|
|
3770
|
+
if (styles) {
|
|
3771
|
+
markup += " style=\"" + utils.escape(styles) + "\"";
|
|
3772
|
+
} // Add the attributes
|
|
3951
3773
|
|
|
3952
|
-
defineSymbol(math, ams, rel, "\u226e", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
|
|
3953
3774
|
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
defineSymbol(math, ams, rel, "\u22e6", "\\lnsim", true);
|
|
3960
|
-
defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox", true);
|
|
3961
|
-
defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
|
|
3775
|
+
for (var attr in this.attributes) {
|
|
3776
|
+
if (this.attributes.hasOwnProperty(attr)) {
|
|
3777
|
+
markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3962
3780
|
|
|
3963
|
-
|
|
3964
|
-
defineSymbol(math, ams, rel, "\u22e8", "\\precnsim", true);
|
|
3965
|
-
defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox", true);
|
|
3966
|
-
defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
|
|
3967
|
-
defineSymbol(math, ams, rel, "\ue006", "\\@nshortmid");
|
|
3968
|
-
defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
|
|
3969
|
-
defineSymbol(math, ams, rel, "\u22ac", "\\nvdash", true);
|
|
3970
|
-
defineSymbol(math, ams, rel, "\u22ad", "\\nvDash", true);
|
|
3971
|
-
defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft");
|
|
3972
|
-
defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq", true);
|
|
3973
|
-
defineSymbol(math, ams, rel, "\u228a", "\\subsetneq", true);
|
|
3974
|
-
defineSymbol(math, ams, rel, "\ue01a", "\\@varsubsetneq");
|
|
3975
|
-
defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq", true);
|
|
3976
|
-
defineSymbol(math, ams, rel, "\ue017", "\\@varsubsetneqq");
|
|
3977
|
-
defineSymbol(math, ams, rel, "\u226f", "\\ngtr", true);
|
|
3978
|
-
defineSymbol(math, ams, rel, "\ue00f", "\\@ngeqslant");
|
|
3979
|
-
defineSymbol(math, ams, rel, "\ue00e", "\\@ngeqq");
|
|
3980
|
-
defineSymbol(math, ams, rel, "\u2a88", "\\gneq", true);
|
|
3981
|
-
defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
|
|
3982
|
-
defineSymbol(math, ams, rel, "\ue00d", "\\@gvertneqq");
|
|
3983
|
-
defineSymbol(math, ams, rel, "\u22e7", "\\gnsim", true);
|
|
3984
|
-
defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox", true);
|
|
3985
|
-
defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
|
|
3781
|
+
markup += ">"; // Add the markup of the children, also as markup
|
|
3986
3782
|
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3783
|
+
for (var i = 0; i < this.children.length; i++) {
|
|
3784
|
+
markup += this.children[i].toMarkup();
|
|
3785
|
+
}
|
|
3990
3786
|
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq", true);
|
|
4001
|
-
defineSymbol(math, ams, rel, "\ue019", "\\@varsupsetneqq");
|
|
4002
|
-
defineSymbol(math, ams, rel, "\u22ae", "\\nVdash", true);
|
|
4003
|
-
defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq", true);
|
|
4004
|
-
defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq", true);
|
|
4005
|
-
defineSymbol(math, ams, rel, "\ue016", "\\@nsubseteqq");
|
|
4006
|
-
defineSymbol(math, ams, bin, "\u22b4", "\\unlhd");
|
|
4007
|
-
defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); // AMS Negated Arrows
|
|
3787
|
+
markup += "</" + tagName + ">";
|
|
3788
|
+
return markup;
|
|
3789
|
+
}; // Making the type below exact with all optional fields doesn't work due to
|
|
3790
|
+
// - https://github.com/facebook/flow/issues/4582
|
|
3791
|
+
// - https://github.com/facebook/flow/issues/5688
|
|
3792
|
+
// However, since *all* fields are optional, $Shape<> works as suggested in 5688
|
|
3793
|
+
// above.
|
|
3794
|
+
// This type does not include all CSS properties. Additional properties should
|
|
3795
|
+
// be added as needed.
|
|
4008
3796
|
|
|
4009
|
-
defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow", true);
|
|
4010
|
-
defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow", true);
|
|
4011
|
-
defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow", true);
|
|
4012
|
-
defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow", true);
|
|
4013
|
-
defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow", true);
|
|
4014
|
-
defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow", true); // AMS Misc
|
|
4015
3797
|
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
3798
|
+
/**
|
|
3799
|
+
* This node represents a span node, with a className, a list of children, and
|
|
3800
|
+
* an inline style. It also contains information about its height, depth, and
|
|
3801
|
+
* maxFontSize.
|
|
3802
|
+
*
|
|
3803
|
+
* Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan
|
|
3804
|
+
* otherwise. This typesafety is important when HTML builders access a span's
|
|
3805
|
+
* children.
|
|
3806
|
+
*/
|
|
3807
|
+
class Span {
|
|
3808
|
+
constructor(classes, children, options, style) {
|
|
3809
|
+
this.children = void 0;
|
|
3810
|
+
this.attributes = void 0;
|
|
3811
|
+
this.classes = void 0;
|
|
3812
|
+
this.height = void 0;
|
|
3813
|
+
this.depth = void 0;
|
|
3814
|
+
this.width = void 0;
|
|
3815
|
+
this.maxFontSize = void 0;
|
|
3816
|
+
this.style = void 0;
|
|
3817
|
+
initNode.call(this, classes, options, style);
|
|
3818
|
+
this.children = children || [];
|
|
3819
|
+
}
|
|
3820
|
+
/**
|
|
3821
|
+
* Sets an arbitrary attribute on the span. Warning: use this wisely. Not
|
|
3822
|
+
* all browsers support attributes the same, and having too many custom
|
|
3823
|
+
* attributes is probably bad.
|
|
3824
|
+
*/
|
|
4036
3825
|
|
|
4037
|
-
defineSymbol(math, ams, textord, "\u00f0", "\\eth", true);
|
|
4038
|
-
defineSymbol(text, main, textord, "\u00f0", "\u00f0");
|
|
4039
|
-
defineSymbol(math, ams, textord, "\u2571", "\\diagup");
|
|
4040
|
-
defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
|
|
4041
|
-
defineSymbol(math, ams, textord, "\u25a1", "\\square");
|
|
4042
|
-
defineSymbol(math, ams, textord, "\u25a1", "\\Box");
|
|
4043
|
-
defineSymbol(math, ams, textord, "\u25ca", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
|
|
4044
3826
|
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
defineSymbol(text, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew
|
|
3827
|
+
setAttribute(attribute, value) {
|
|
3828
|
+
this.attributes[attribute] = value;
|
|
3829
|
+
}
|
|
4049
3830
|
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
3831
|
+
hasClass(className) {
|
|
3832
|
+
return utils.contains(this.classes, className);
|
|
3833
|
+
}
|
|
4053
3834
|
|
|
4054
|
-
|
|
4055
|
-
|
|
3835
|
+
toNode() {
|
|
3836
|
+
return toNode.call(this, "span");
|
|
3837
|
+
}
|
|
4056
3838
|
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
defineSymbol(math, ams, close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations
|
|
3839
|
+
toMarkup() {
|
|
3840
|
+
return toMarkup.call(this, "span");
|
|
3841
|
+
}
|
|
4061
3842
|
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq", true);
|
|
4082
|
-
defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec", true);
|
|
4083
|
-
defineSymbol(math, ams, rel, "\u227e", "\\precsim", true);
|
|
4084
|
-
defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox", true);
|
|
4085
|
-
defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft");
|
|
4086
|
-
defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq");
|
|
4087
|
-
defineSymbol(math, ams, rel, "\u22a8", "\\vDash", true);
|
|
4088
|
-
defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash", true);
|
|
4089
|
-
defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
|
|
4090
|
-
defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
|
|
4091
|
-
defineSymbol(math, ams, rel, "\u224f", "\\bumpeq", true);
|
|
4092
|
-
defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq", true);
|
|
4093
|
-
defineSymbol(math, ams, rel, "\u2267", "\\geqq", true);
|
|
4094
|
-
defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant", true);
|
|
4095
|
-
defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr", true);
|
|
4096
|
-
defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true);
|
|
4097
|
-
defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox", true);
|
|
4098
|
-
defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot");
|
|
4099
|
-
defineSymbol(math, ams, rel, "\u22d9", "\\ggg", true);
|
|
4100
|
-
defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true);
|
|
4101
|
-
defineSymbol(math, ams, rel, "\u22db", "\\gtreqless", true);
|
|
4102
|
-
defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless", true);
|
|
4103
|
-
defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true);
|
|
4104
|
-
defineSymbol(math, ams, rel, "\u2257", "\\circeq", true);
|
|
4105
|
-
defineSymbol(math, ams, rel, "\u225c", "\\triangleq", true);
|
|
4106
|
-
defineSymbol(math, ams, rel, "\u223c", "\\thicksim");
|
|
4107
|
-
defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
|
|
4108
|
-
defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq", true);
|
|
4109
|
-
defineSymbol(math, ams, rel, "\u22d1", "\\Supset", true);
|
|
4110
|
-
defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true);
|
|
4111
|
-
defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq", true);
|
|
4112
|
-
defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc", true);
|
|
4113
|
-
defineSymbol(math, ams, rel, "\u227f", "\\succsim", true);
|
|
4114
|
-
defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox", true);
|
|
4115
|
-
defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright");
|
|
4116
|
-
defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq");
|
|
4117
|
-
defineSymbol(math, ams, rel, "\u22a9", "\\Vdash", true);
|
|
4118
|
-
defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
|
|
4119
|
-
defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
|
|
4120
|
-
defineSymbol(math, ams, rel, "\u226c", "\\between", true);
|
|
4121
|
-
defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork", true);
|
|
4122
|
-
defineSymbol(math, ams, rel, "\u221d", "\\varpropto");
|
|
4123
|
-
defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom.
|
|
4124
|
-
// We kept the amssymb atom type, which is rel.
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* This node represents an anchor (<a>) element with a hyperlink. See `span`
|
|
3846
|
+
* for further details.
|
|
3847
|
+
*/
|
|
3848
|
+
|
|
3849
|
+
class Anchor {
|
|
3850
|
+
constructor(href, classes, children, options) {
|
|
3851
|
+
this.children = void 0;
|
|
3852
|
+
this.attributes = void 0;
|
|
3853
|
+
this.classes = void 0;
|
|
3854
|
+
this.height = void 0;
|
|
3855
|
+
this.depth = void 0;
|
|
3856
|
+
this.maxFontSize = void 0;
|
|
3857
|
+
this.style = void 0;
|
|
3858
|
+
initNode.call(this, classes, options);
|
|
3859
|
+
this.children = children || [];
|
|
3860
|
+
this.setAttribute('href', href);
|
|
3861
|
+
}
|
|
4125
3862
|
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
// We kept the amssymb atom type, which is rel.
|
|
3863
|
+
setAttribute(attribute, value) {
|
|
3864
|
+
this.attributes[attribute] = value;
|
|
3865
|
+
}
|
|
4130
3866
|
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
defineSymbol(math, ams, bin, "\u22b2", "\\lhd");
|
|
4135
|
-
defineSymbol(math, ams, bin, "\u22b3", "\\rhd");
|
|
4136
|
-
defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true);
|
|
4137
|
-
defineSymbol(math, main, rel, "\u22c8", "\\Join");
|
|
4138
|
-
defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators
|
|
3867
|
+
hasClass(className) {
|
|
3868
|
+
return utils.contains(this.classes, className);
|
|
3869
|
+
}
|
|
4139
3870
|
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
defineSymbol(math, ams, bin, "\u22d3", "\\Cup", true);
|
|
4144
|
-
defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge", true);
|
|
4145
|
-
defineSymbol(math, ams, bin, "\u229f", "\\boxminus", true);
|
|
4146
|
-
defineSymbol(math, ams, bin, "\u229e", "\\boxplus", true);
|
|
4147
|
-
defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes", true);
|
|
4148
|
-
defineSymbol(math, ams, bin, "\u22c9", "\\ltimes", true);
|
|
4149
|
-
defineSymbol(math, ams, bin, "\u22ca", "\\rtimes", true);
|
|
4150
|
-
defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes", true);
|
|
4151
|
-
defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes", true);
|
|
4152
|
-
defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge", true);
|
|
4153
|
-
defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee", true);
|
|
4154
|
-
defineSymbol(math, ams, bin, "\u229d", "\\circleddash", true);
|
|
4155
|
-
defineSymbol(math, ams, bin, "\u229b", "\\circledast", true);
|
|
4156
|
-
defineSymbol(math, ams, bin, "\u22c5", "\\centerdot");
|
|
4157
|
-
defineSymbol(math, ams, bin, "\u22ba", "\\intercal", true);
|
|
4158
|
-
defineSymbol(math, ams, bin, "\u22d2", "\\doublecap");
|
|
4159
|
-
defineSymbol(math, ams, bin, "\u22d3", "\\doublecup");
|
|
4160
|
-
defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes", true); // AMS Arrows
|
|
4161
|
-
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
|
|
4162
|
-
// We'll map it to AMS function \dashrightarrow. It produces the same atom.
|
|
3871
|
+
toNode() {
|
|
3872
|
+
return toNode.call(this, "a");
|
|
3873
|
+
}
|
|
4163
3874
|
|
|
4164
|
-
|
|
3875
|
+
toMarkup() {
|
|
3876
|
+
return toMarkup.call(this, "a");
|
|
3877
|
+
}
|
|
4165
3878
|
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow", true);
|
|
4171
|
-
defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail", true);
|
|
4172
|
-
defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft", true);
|
|
4173
|
-
defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons", true);
|
|
4174
|
-
defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
|
|
3879
|
+
}
|
|
3880
|
+
/**
|
|
3881
|
+
* This node represents an image embed (<img>) element.
|
|
3882
|
+
*/
|
|
4175
3883
|
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
3884
|
+
class Img {
|
|
3885
|
+
constructor(src, alt, style) {
|
|
3886
|
+
this.src = void 0;
|
|
3887
|
+
this.alt = void 0;
|
|
3888
|
+
this.classes = void 0;
|
|
3889
|
+
this.height = void 0;
|
|
3890
|
+
this.depth = void 0;
|
|
3891
|
+
this.maxFontSize = void 0;
|
|
3892
|
+
this.style = void 0;
|
|
3893
|
+
this.alt = alt;
|
|
3894
|
+
this.src = src;
|
|
3895
|
+
this.classes = ["mord"];
|
|
3896
|
+
this.style = style;
|
|
3897
|
+
}
|
|
4182
3898
|
|
|
4183
|
-
|
|
3899
|
+
hasClass(className) {
|
|
3900
|
+
return utils.contains(this.classes, className);
|
|
3901
|
+
}
|
|
4184
3902
|
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail", true);
|
|
4191
|
-
defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright", true);
|
|
4192
|
-
defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
|
|
3903
|
+
toNode() {
|
|
3904
|
+
var node = document.createElement("img");
|
|
3905
|
+
node.src = this.src;
|
|
3906
|
+
node.alt = this.alt;
|
|
3907
|
+
node.className = "mord"; // Apply inline styles
|
|
4193
3908
|
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
defineSymbol(math, main, textord, "\u2032", "\\prime");
|
|
4215
|
-
defineSymbol(math, main, textord, "\u25b3", "\\triangle");
|
|
4216
|
-
defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
|
|
4217
|
-
defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
|
|
4218
|
-
defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
|
|
4219
|
-
defineSymbol(math, main, textord, "\u039b", "\\Lambda", true);
|
|
4220
|
-
defineSymbol(math, main, textord, "\u039e", "\\Xi", true);
|
|
4221
|
-
defineSymbol(math, main, textord, "\u03a0", "\\Pi", true);
|
|
4222
|
-
defineSymbol(math, main, textord, "\u03a3", "\\Sigma", true);
|
|
4223
|
-
defineSymbol(math, main, textord, "\u03a5", "\\Upsilon", true);
|
|
4224
|
-
defineSymbol(math, main, textord, "\u03a6", "\\Phi", true);
|
|
4225
|
-
defineSymbol(math, main, textord, "\u03a8", "\\Psi", true);
|
|
4226
|
-
defineSymbol(math, main, textord, "\u03a9", "\\Omega", true);
|
|
4227
|
-
defineSymbol(math, main, textord, "A", "\u0391");
|
|
4228
|
-
defineSymbol(math, main, textord, "B", "\u0392");
|
|
4229
|
-
defineSymbol(math, main, textord, "E", "\u0395");
|
|
4230
|
-
defineSymbol(math, main, textord, "Z", "\u0396");
|
|
4231
|
-
defineSymbol(math, main, textord, "H", "\u0397");
|
|
4232
|
-
defineSymbol(math, main, textord, "I", "\u0399");
|
|
4233
|
-
defineSymbol(math, main, textord, "K", "\u039A");
|
|
4234
|
-
defineSymbol(math, main, textord, "M", "\u039C");
|
|
4235
|
-
defineSymbol(math, main, textord, "N", "\u039D");
|
|
4236
|
-
defineSymbol(math, main, textord, "O", "\u039F");
|
|
4237
|
-
defineSymbol(math, main, textord, "P", "\u03A1");
|
|
4238
|
-
defineSymbol(math, main, textord, "T", "\u03A4");
|
|
4239
|
-
defineSymbol(math, main, textord, "X", "\u03A7");
|
|
4240
|
-
defineSymbol(math, main, textord, "\u00ac", "\\neg", true);
|
|
4241
|
-
defineSymbol(math, main, textord, "\u00ac", "\\lnot");
|
|
4242
|
-
defineSymbol(math, main, textord, "\u22a4", "\\top");
|
|
4243
|
-
defineSymbol(math, main, textord, "\u22a5", "\\bot");
|
|
4244
|
-
defineSymbol(math, main, textord, "\u2205", "\\emptyset");
|
|
4245
|
-
defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
|
|
4246
|
-
defineSymbol(math, main, mathord, "\u03b1", "\\alpha", true);
|
|
4247
|
-
defineSymbol(math, main, mathord, "\u03b2", "\\beta", true);
|
|
4248
|
-
defineSymbol(math, main, mathord, "\u03b3", "\\gamma", true);
|
|
4249
|
-
defineSymbol(math, main, mathord, "\u03b4", "\\delta", true);
|
|
4250
|
-
defineSymbol(math, main, mathord, "\u03f5", "\\epsilon", true);
|
|
4251
|
-
defineSymbol(math, main, mathord, "\u03b6", "\\zeta", true);
|
|
4252
|
-
defineSymbol(math, main, mathord, "\u03b7", "\\eta", true);
|
|
4253
|
-
defineSymbol(math, main, mathord, "\u03b8", "\\theta", true);
|
|
4254
|
-
defineSymbol(math, main, mathord, "\u03b9", "\\iota", true);
|
|
4255
|
-
defineSymbol(math, main, mathord, "\u03ba", "\\kappa", true);
|
|
4256
|
-
defineSymbol(math, main, mathord, "\u03bb", "\\lambda", true);
|
|
4257
|
-
defineSymbol(math, main, mathord, "\u03bc", "\\mu", true);
|
|
4258
|
-
defineSymbol(math, main, mathord, "\u03bd", "\\nu", true);
|
|
4259
|
-
defineSymbol(math, main, mathord, "\u03be", "\\xi", true);
|
|
4260
|
-
defineSymbol(math, main, mathord, "\u03bf", "\\omicron", true);
|
|
4261
|
-
defineSymbol(math, main, mathord, "\u03c0", "\\pi", true);
|
|
4262
|
-
defineSymbol(math, main, mathord, "\u03c1", "\\rho", true);
|
|
4263
|
-
defineSymbol(math, main, mathord, "\u03c3", "\\sigma", true);
|
|
4264
|
-
defineSymbol(math, main, mathord, "\u03c4", "\\tau", true);
|
|
4265
|
-
defineSymbol(math, main, mathord, "\u03c5", "\\upsilon", true);
|
|
4266
|
-
defineSymbol(math, main, mathord, "\u03d5", "\\phi", true);
|
|
4267
|
-
defineSymbol(math, main, mathord, "\u03c7", "\\chi", true);
|
|
4268
|
-
defineSymbol(math, main, mathord, "\u03c8", "\\psi", true);
|
|
4269
|
-
defineSymbol(math, main, mathord, "\u03c9", "\\omega", true);
|
|
4270
|
-
defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon", true);
|
|
4271
|
-
defineSymbol(math, main, mathord, "\u03d1", "\\vartheta", true);
|
|
4272
|
-
defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true);
|
|
4273
|
-
defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true);
|
|
4274
|
-
defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true);
|
|
4275
|
-
defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true);
|
|
4276
|
-
defineSymbol(math, main, bin, "\u2217", "*", true);
|
|
4277
|
-
defineSymbol(math, main, bin, "+", "+");
|
|
4278
|
-
defineSymbol(math, main, bin, "\u2212", "-", true);
|
|
4279
|
-
defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
|
|
4280
|
-
defineSymbol(math, main, bin, "\u2218", "\\circ");
|
|
4281
|
-
defineSymbol(math, main, bin, "\u00f7", "\\div", true);
|
|
4282
|
-
defineSymbol(math, main, bin, "\u00b1", "\\pm", true);
|
|
4283
|
-
defineSymbol(math, main, bin, "\u00d7", "\\times", true);
|
|
4284
|
-
defineSymbol(math, main, bin, "\u2229", "\\cap", true);
|
|
4285
|
-
defineSymbol(math, main, bin, "\u222a", "\\cup", true);
|
|
4286
|
-
defineSymbol(math, main, bin, "\u2216", "\\setminus");
|
|
4287
|
-
defineSymbol(math, main, bin, "\u2227", "\\land");
|
|
4288
|
-
defineSymbol(math, main, bin, "\u2228", "\\lor");
|
|
4289
|
-
defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
|
|
4290
|
-
defineSymbol(math, main, bin, "\u2228", "\\vee", true);
|
|
4291
|
-
defineSymbol(math, main, textord, "\u221a", "\\surd");
|
|
4292
|
-
defineSymbol(math, main, open, "\u27e8", "\\langle", true);
|
|
4293
|
-
defineSymbol(math, main, open, "\u2223", "\\lvert");
|
|
4294
|
-
defineSymbol(math, main, open, "\u2225", "\\lVert");
|
|
4295
|
-
defineSymbol(math, main, close, "?", "?");
|
|
4296
|
-
defineSymbol(math, main, close, "!", "!");
|
|
4297
|
-
defineSymbol(math, main, close, "\u27e9", "\\rangle", true);
|
|
4298
|
-
defineSymbol(math, main, close, "\u2223", "\\rvert");
|
|
4299
|
-
defineSymbol(math, main, close, "\u2225", "\\rVert");
|
|
4300
|
-
defineSymbol(math, main, rel, "=", "=");
|
|
4301
|
-
defineSymbol(math, main, rel, ":", ":");
|
|
4302
|
-
defineSymbol(math, main, rel, "\u2248", "\\approx", true);
|
|
4303
|
-
defineSymbol(math, main, rel, "\u2245", "\\cong", true);
|
|
4304
|
-
defineSymbol(math, main, rel, "\u2265", "\\ge");
|
|
4305
|
-
defineSymbol(math, main, rel, "\u2265", "\\geq", true);
|
|
4306
|
-
defineSymbol(math, main, rel, "\u2190", "\\gets");
|
|
4307
|
-
defineSymbol(math, main, rel, ">", "\\gt", true);
|
|
4308
|
-
defineSymbol(math, main, rel, "\u2208", "\\in", true);
|
|
4309
|
-
defineSymbol(math, main, rel, "\ue020", "\\@not");
|
|
4310
|
-
defineSymbol(math, main, rel, "\u2282", "\\subset", true);
|
|
4311
|
-
defineSymbol(math, main, rel, "\u2283", "\\supset", true);
|
|
4312
|
-
defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
|
|
4313
|
-
defineSymbol(math, main, rel, "\u2287", "\\supseteq", true);
|
|
4314
|
-
defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true);
|
|
4315
|
-
defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true);
|
|
4316
|
-
defineSymbol(math, main, rel, "\u22a8", "\\models");
|
|
4317
|
-
defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true);
|
|
4318
|
-
defineSymbol(math, main, rel, "\u2264", "\\le");
|
|
4319
|
-
defineSymbol(math, main, rel, "\u2264", "\\leq", true);
|
|
4320
|
-
defineSymbol(math, main, rel, "<", "\\lt", true);
|
|
4321
|
-
defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true);
|
|
4322
|
-
defineSymbol(math, main, rel, "\u2192", "\\to");
|
|
4323
|
-
defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true);
|
|
4324
|
-
defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
|
|
4325
|
-
defineSymbol(math, main, spacing, "\u00a0", "\\ ");
|
|
4326
|
-
defineSymbol(math, main, spacing, "\u00a0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
|
|
3909
|
+
for (var style in this.style) {
|
|
3910
|
+
if (this.style.hasOwnProperty(style)) {
|
|
3911
|
+
// $FlowFixMe
|
|
3912
|
+
node.style[style] = this.style[style];
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
return node;
|
|
3917
|
+
}
|
|
3918
|
+
|
|
3919
|
+
toMarkup() {
|
|
3920
|
+
var markup = "<img src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
|
|
3921
|
+
|
|
3922
|
+
var styles = "";
|
|
3923
|
+
|
|
3924
|
+
for (var style in this.style) {
|
|
3925
|
+
if (this.style.hasOwnProperty(style)) {
|
|
3926
|
+
styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
4327
3929
|
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
defineSymbol(text, main, spacing, "\u00a0", "\\space");
|
|
4332
|
-
defineSymbol(text, main, spacing, "\u00a0", "\\nobreakspace");
|
|
4333
|
-
defineSymbol(math, main, spacing, null, "\\nobreak");
|
|
4334
|
-
defineSymbol(math, main, spacing, null, "\\allowbreak");
|
|
4335
|
-
defineSymbol(math, main, punct, ",", ",");
|
|
4336
|
-
defineSymbol(math, main, punct, ";", ";");
|
|
4337
|
-
defineSymbol(math, ams, bin, "\u22bc", "\\barwedge", true);
|
|
4338
|
-
defineSymbol(math, ams, bin, "\u22bb", "\\veebar", true);
|
|
4339
|
-
defineSymbol(math, main, bin, "\u2299", "\\odot", true);
|
|
4340
|
-
defineSymbol(math, main, bin, "\u2295", "\\oplus", true);
|
|
4341
|
-
defineSymbol(math, main, bin, "\u2297", "\\otimes", true);
|
|
4342
|
-
defineSymbol(math, main, textord, "\u2202", "\\partial", true);
|
|
4343
|
-
defineSymbol(math, main, bin, "\u2298", "\\oslash", true);
|
|
4344
|
-
defineSymbol(math, ams, bin, "\u229a", "\\circledcirc", true);
|
|
4345
|
-
defineSymbol(math, ams, bin, "\u22a1", "\\boxdot", true);
|
|
4346
|
-
defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup");
|
|
4347
|
-
defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown");
|
|
4348
|
-
defineSymbol(math, main, bin, "\u2020", "\\dagger");
|
|
4349
|
-
defineSymbol(math, main, bin, "\u22c4", "\\diamond");
|
|
4350
|
-
defineSymbol(math, main, bin, "\u22c6", "\\star");
|
|
4351
|
-
defineSymbol(math, main, bin, "\u25c3", "\\triangleleft");
|
|
4352
|
-
defineSymbol(math, main, bin, "\u25b9", "\\triangleright");
|
|
4353
|
-
defineSymbol(math, main, open, "{", "\\{");
|
|
4354
|
-
defineSymbol(text, main, textord, "{", "\\{");
|
|
4355
|
-
defineSymbol(text, main, textord, "{", "\\textbraceleft");
|
|
4356
|
-
defineSymbol(math, main, close, "}", "\\}");
|
|
4357
|
-
defineSymbol(text, main, textord, "}", "\\}");
|
|
4358
|
-
defineSymbol(text, main, textord, "}", "\\textbraceright");
|
|
4359
|
-
defineSymbol(math, main, open, "{", "\\lbrace");
|
|
4360
|
-
defineSymbol(math, main, close, "}", "\\rbrace");
|
|
4361
|
-
defineSymbol(math, main, open, "[", "\\lbrack", true);
|
|
4362
|
-
defineSymbol(text, main, textord, "[", "\\lbrack", true);
|
|
4363
|
-
defineSymbol(math, main, close, "]", "\\rbrack", true);
|
|
4364
|
-
defineSymbol(text, main, textord, "]", "\\rbrack", true);
|
|
4365
|
-
defineSymbol(math, main, open, "(", "\\lparen", true);
|
|
4366
|
-
defineSymbol(math, main, close, ")", "\\rparen", true);
|
|
4367
|
-
defineSymbol(text, main, textord, "<", "\\textless", true); // in T1 fontenc
|
|
3930
|
+
if (styles) {
|
|
3931
|
+
markup += " style=\"" + utils.escape(styles) + "\"";
|
|
3932
|
+
}
|
|
4368
3933
|
|
|
4369
|
-
|
|
3934
|
+
markup += "'/>";
|
|
3935
|
+
return markup;
|
|
3936
|
+
}
|
|
4370
3937
|
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
3938
|
+
}
|
|
3939
|
+
var iCombinations = {
|
|
3940
|
+
'î': '\u0131\u0302',
|
|
3941
|
+
'ï': '\u0131\u0308',
|
|
3942
|
+
'í': '\u0131\u0301',
|
|
3943
|
+
// 'ī': '\u0131\u0304', // enable when we add Extended Latin
|
|
3944
|
+
'ì': '\u0131\u0300'
|
|
3945
|
+
};
|
|
3946
|
+
/**
|
|
3947
|
+
* A symbol node contains information about a single symbol. It either renders
|
|
3948
|
+
* to a single text node, or a span with a single text node in it, depending on
|
|
3949
|
+
* whether it has CSS classes, styles, or needs italic correction.
|
|
3950
|
+
*/
|
|
4379
3951
|
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
defineSymbol(math, main, op, "\u2a00", "\\bigodot");
|
|
4407
|
-
defineSymbol(math, main, op, "\u222e", "\\oint");
|
|
4408
|
-
defineSymbol(math, main, op, "\u222f", "\\oiint");
|
|
4409
|
-
defineSymbol(math, main, op, "\u2230", "\\oiiint");
|
|
4410
|
-
defineSymbol(math, main, op, "\u2a06", "\\bigsqcup");
|
|
4411
|
-
defineSymbol(math, main, op, "\u222b", "\\smallint");
|
|
4412
|
-
defineSymbol(text, main, inner, "\u2026", "\\textellipsis");
|
|
4413
|
-
defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
|
|
4414
|
-
defineSymbol(text, main, inner, "\u2026", "\\ldots", true);
|
|
4415
|
-
defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
|
|
4416
|
-
defineSymbol(math, main, inner, "\u22ef", "\\@cdots", true);
|
|
4417
|
-
defineSymbol(math, main, inner, "\u22f1", "\\ddots", true);
|
|
4418
|
-
defineSymbol(math, main, textord, "\u22ee", "\\varvdots"); // \vdots is a macro
|
|
3952
|
+
class SymbolNode {
|
|
3953
|
+
constructor(text, height, depth, italic, skew, width, classes, style) {
|
|
3954
|
+
this.text = void 0;
|
|
3955
|
+
this.height = void 0;
|
|
3956
|
+
this.depth = void 0;
|
|
3957
|
+
this.italic = void 0;
|
|
3958
|
+
this.skew = void 0;
|
|
3959
|
+
this.width = void 0;
|
|
3960
|
+
this.maxFontSize = void 0;
|
|
3961
|
+
this.classes = void 0;
|
|
3962
|
+
this.style = void 0;
|
|
3963
|
+
this.text = text;
|
|
3964
|
+
this.height = height || 0;
|
|
3965
|
+
this.depth = depth || 0;
|
|
3966
|
+
this.italic = italic || 0;
|
|
3967
|
+
this.skew = skew || 0;
|
|
3968
|
+
this.width = width || 0;
|
|
3969
|
+
this.classes = classes || [];
|
|
3970
|
+
this.style = style || {};
|
|
3971
|
+
this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we
|
|
3972
|
+
// can specify which fonts to use. This allows us to render these
|
|
3973
|
+
// characters with a serif font in situations where the browser would
|
|
3974
|
+
// either default to a sans serif or render a placeholder character.
|
|
3975
|
+
// We use CSS class names like cjk_fallback, hangul_fallback and
|
|
3976
|
+
// brahmic_fallback. See ./unicodeScripts.js for the set of possible
|
|
3977
|
+
// script names
|
|
4419
3978
|
|
|
4420
|
-
|
|
4421
|
-
defineSymbol(math, main, accent, "\u02cb", "\\grave");
|
|
4422
|
-
defineSymbol(math, main, accent, "\u00a8", "\\ddot");
|
|
4423
|
-
defineSymbol(math, main, accent, "\u007e", "\\tilde");
|
|
4424
|
-
defineSymbol(math, main, accent, "\u02c9", "\\bar");
|
|
4425
|
-
defineSymbol(math, main, accent, "\u02d8", "\\breve");
|
|
4426
|
-
defineSymbol(math, main, accent, "\u02c7", "\\check");
|
|
4427
|
-
defineSymbol(math, main, accent, "\u005e", "\\hat");
|
|
4428
|
-
defineSymbol(math, main, accent, "\u20d7", "\\vec");
|
|
4429
|
-
defineSymbol(math, main, accent, "\u02d9", "\\dot");
|
|
4430
|
-
defineSymbol(math, main, accent, "\u02da", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA
|
|
3979
|
+
var script = scriptFromCodepoint(this.text.charCodeAt(0));
|
|
4431
3980
|
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
defineSymbol(math, main, textord, "\u0237", "\u0237");
|
|
4436
|
-
defineSymbol(text, main, textord, "\u0131", "\\i", true);
|
|
4437
|
-
defineSymbol(text, main, textord, "\u0237", "\\j", true);
|
|
4438
|
-
defineSymbol(text, main, textord, "\u00df", "\\ss", true);
|
|
4439
|
-
defineSymbol(text, main, textord, "\u00e6", "\\ae", true);
|
|
4440
|
-
defineSymbol(text, main, textord, "\u0153", "\\oe", true);
|
|
4441
|
-
defineSymbol(text, main, textord, "\u00f8", "\\o", true);
|
|
4442
|
-
defineSymbol(text, main, textord, "\u00c6", "\\AE", true);
|
|
4443
|
-
defineSymbol(text, main, textord, "\u0152", "\\OE", true);
|
|
4444
|
-
defineSymbol(text, main, textord, "\u00d8", "\\O", true);
|
|
4445
|
-
defineSymbol(text, main, accent, "\u02ca", "\\'"); // acute
|
|
3981
|
+
if (script) {
|
|
3982
|
+
this.classes.push(script + "_fallback");
|
|
3983
|
+
}
|
|
4446
3984
|
|
|
4447
|
-
|
|
3985
|
+
if (/[îïíì]/.test(this.text)) {
|
|
3986
|
+
// add ī when we add Extended Latin
|
|
3987
|
+
this.text = iCombinations[this.text];
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
4448
3990
|
|
|
4449
|
-
|
|
3991
|
+
hasClass(className) {
|
|
3992
|
+
return utils.contains(this.classes, className);
|
|
3993
|
+
}
|
|
3994
|
+
/**
|
|
3995
|
+
* Creates a text node or span from a symbol node. Note that a span is only
|
|
3996
|
+
* created if it is needed.
|
|
3997
|
+
*/
|
|
4450
3998
|
|
|
4451
|
-
defineSymbol(text, main, accent, "\u02dc", "\\~"); // tilde
|
|
4452
3999
|
|
|
4453
|
-
|
|
4000
|
+
toNode() {
|
|
4001
|
+
var node = document.createTextNode(this.text);
|
|
4002
|
+
var span = null;
|
|
4454
4003
|
|
|
4455
|
-
|
|
4004
|
+
if (this.italic > 0) {
|
|
4005
|
+
span = document.createElement("span");
|
|
4006
|
+
span.style.marginRight = makeEm(this.italic);
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
if (this.classes.length > 0) {
|
|
4010
|
+
span = span || document.createElement("span");
|
|
4011
|
+
span.className = createClass(this.classes);
|
|
4012
|
+
}
|
|
4013
|
+
|
|
4014
|
+
for (var style in this.style) {
|
|
4015
|
+
if (this.style.hasOwnProperty(style)) {
|
|
4016
|
+
span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type.
|
|
4017
|
+
|
|
4018
|
+
span.style[style] = this.style[style];
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
if (span) {
|
|
4023
|
+
span.appendChild(node);
|
|
4024
|
+
return span;
|
|
4025
|
+
} else {
|
|
4026
|
+
return node;
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
/**
|
|
4030
|
+
* Creates markup for a symbol node.
|
|
4031
|
+
*/
|
|
4032
|
+
|
|
4033
|
+
|
|
4034
|
+
toMarkup() {
|
|
4035
|
+
// TODO(alpert): More duplication than I'd like from
|
|
4036
|
+
// span.prototype.toMarkup and symbolNode.prototype.toNode...
|
|
4037
|
+
var needsSpan = false;
|
|
4038
|
+
var markup = "<span";
|
|
4039
|
+
|
|
4040
|
+
if (this.classes.length) {
|
|
4041
|
+
needsSpan = true;
|
|
4042
|
+
markup += " class=\"";
|
|
4043
|
+
markup += utils.escape(createClass(this.classes));
|
|
4044
|
+
markup += "\"";
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
var styles = "";
|
|
4048
|
+
|
|
4049
|
+
if (this.italic > 0) {
|
|
4050
|
+
styles += "margin-right:" + this.italic + "em;";
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
for (var style in this.style) {
|
|
4054
|
+
if (this.style.hasOwnProperty(style)) {
|
|
4055
|
+
styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
if (styles) {
|
|
4060
|
+
needsSpan = true;
|
|
4061
|
+
markup += " style=\"" + utils.escape(styles) + "\"";
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
var escaped = utils.escape(this.text);
|
|
4065
|
+
|
|
4066
|
+
if (needsSpan) {
|
|
4067
|
+
markup += ">";
|
|
4068
|
+
markup += escaped;
|
|
4069
|
+
markup += "</span>";
|
|
4070
|
+
return markup;
|
|
4071
|
+
} else {
|
|
4072
|
+
return escaped;
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
|
|
4076
|
+
}
|
|
4077
|
+
/**
|
|
4078
|
+
* SVG nodes are used to render stretchy wide elements.
|
|
4079
|
+
*/
|
|
4456
4080
|
|
|
4457
|
-
|
|
4081
|
+
class SvgNode {
|
|
4082
|
+
constructor(children, attributes) {
|
|
4083
|
+
this.children = void 0;
|
|
4084
|
+
this.attributes = void 0;
|
|
4085
|
+
this.children = children || [];
|
|
4086
|
+
this.attributes = attributes || {};
|
|
4087
|
+
}
|
|
4458
4088
|
|
|
4459
|
-
|
|
4089
|
+
toNode() {
|
|
4090
|
+
var svgNS = "http://www.w3.org/2000/svg";
|
|
4091
|
+
var node = document.createElementNS(svgNS, "svg"); // Apply attributes
|
|
4460
4092
|
|
|
4461
|
-
|
|
4093
|
+
for (var attr in this.attributes) {
|
|
4094
|
+
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4095
|
+
node.setAttribute(attr, this.attributes[attr]);
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4462
4098
|
|
|
4463
|
-
|
|
4099
|
+
for (var i = 0; i < this.children.length; i++) {
|
|
4100
|
+
node.appendChild(this.children[i].toNode());
|
|
4101
|
+
}
|
|
4464
4102
|
|
|
4465
|
-
|
|
4103
|
+
return node;
|
|
4104
|
+
}
|
|
4466
4105
|
|
|
4467
|
-
|
|
4106
|
+
toMarkup() {
|
|
4107
|
+
var markup = "<svg xmlns=\"http://www.w3.org/2000/svg\""; // Apply attributes
|
|
4468
4108
|
|
|
4469
|
-
|
|
4470
|
-
|
|
4109
|
+
for (var attr in this.attributes) {
|
|
4110
|
+
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4111
|
+
markup += " " + attr + "='" + this.attributes[attr] + "'";
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4471
4114
|
|
|
4472
|
-
|
|
4473
|
-
"--": true,
|
|
4474
|
-
"---": true,
|
|
4475
|
-
"``": true,
|
|
4476
|
-
"''": true
|
|
4477
|
-
};
|
|
4478
|
-
defineSymbol(text, main, textord, "\u2013", "--", true);
|
|
4479
|
-
defineSymbol(text, main, textord, "\u2013", "\\textendash");
|
|
4480
|
-
defineSymbol(text, main, textord, "\u2014", "---", true);
|
|
4481
|
-
defineSymbol(text, main, textord, "\u2014", "\\textemdash");
|
|
4482
|
-
defineSymbol(text, main, textord, "\u2018", "`", true);
|
|
4483
|
-
defineSymbol(text, main, textord, "\u2018", "\\textquoteleft");
|
|
4484
|
-
defineSymbol(text, main, textord, "\u2019", "'", true);
|
|
4485
|
-
defineSymbol(text, main, textord, "\u2019", "\\textquoteright");
|
|
4486
|
-
defineSymbol(text, main, textord, "\u201c", "``", true);
|
|
4487
|
-
defineSymbol(text, main, textord, "\u201c", "\\textquotedblleft");
|
|
4488
|
-
defineSymbol(text, main, textord, "\u201d", "''", true);
|
|
4489
|
-
defineSymbol(text, main, textord, "\u201d", "\\textquotedblright"); // \degree from gensymb package
|
|
4115
|
+
markup += ">";
|
|
4490
4116
|
|
|
4491
|
-
|
|
4492
|
-
|
|
4117
|
+
for (var i = 0; i < this.children.length; i++) {
|
|
4118
|
+
markup += this.children[i].toMarkup();
|
|
4119
|
+
}
|
|
4493
4120
|
|
|
4494
|
-
|
|
4495
|
-
|
|
4121
|
+
markup += "</svg>";
|
|
4122
|
+
return markup;
|
|
4123
|
+
}
|
|
4496
4124
|
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
//
|
|
4125
|
+
}
|
|
4126
|
+
class PathNode {
|
|
4127
|
+
constructor(pathName, alternate) {
|
|
4128
|
+
this.pathName = void 0;
|
|
4129
|
+
this.alternate = void 0;
|
|
4130
|
+
this.pathName = pathName;
|
|
4131
|
+
this.alternate = alternate; // Used only for \sqrt, \phase, & tall delims
|
|
4132
|
+
}
|
|
4504
4133
|
|
|
4505
|
-
|
|
4134
|
+
toNode() {
|
|
4135
|
+
var svgNS = "http://www.w3.org/2000/svg";
|
|
4136
|
+
var node = document.createElementNS(svgNS, "path");
|
|
4506
4137
|
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4138
|
+
if (this.alternate) {
|
|
4139
|
+
node.setAttribute("d", this.alternate);
|
|
4140
|
+
} else {
|
|
4141
|
+
node.setAttribute("d", path[this.pathName]);
|
|
4142
|
+
}
|
|
4511
4143
|
|
|
4144
|
+
return node;
|
|
4145
|
+
}
|
|
4512
4146
|
|
|
4513
|
-
|
|
4147
|
+
toMarkup() {
|
|
4148
|
+
if (this.alternate) {
|
|
4149
|
+
return "<path d='" + this.alternate + "'/>";
|
|
4150
|
+
} else {
|
|
4151
|
+
return "<path d='" + path[this.pathName] + "'/>";
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4514
4154
|
|
|
4515
|
-
|
|
4516
|
-
|
|
4155
|
+
}
|
|
4156
|
+
class LineNode {
|
|
4157
|
+
constructor(attributes) {
|
|
4158
|
+
this.attributes = void 0;
|
|
4159
|
+
this.attributes = attributes || {};
|
|
4160
|
+
}
|
|
4517
4161
|
|
|
4518
|
-
|
|
4519
|
-
|
|
4162
|
+
toNode() {
|
|
4163
|
+
var svgNS = "http://www.w3.org/2000/svg";
|
|
4164
|
+
var node = document.createElementNS(svgNS, "line"); // Apply attributes
|
|
4520
4165
|
|
|
4166
|
+
for (var attr in this.attributes) {
|
|
4167
|
+
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4168
|
+
node.setAttribute(attr, this.attributes[attr]);
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4521
4171
|
|
|
4522
|
-
|
|
4172
|
+
return node;
|
|
4173
|
+
}
|
|
4523
4174
|
|
|
4524
|
-
|
|
4525
|
-
|
|
4175
|
+
toMarkup() {
|
|
4176
|
+
var markup = "<line";
|
|
4526
4177
|
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4178
|
+
for (var attr in this.attributes) {
|
|
4179
|
+
if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
|
|
4180
|
+
markup += " " + attr + "='" + this.attributes[attr] + "'";
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4530
4183
|
|
|
4184
|
+
markup += "/>";
|
|
4185
|
+
return markup;
|
|
4186
|
+
}
|
|
4531
4187
|
|
|
4532
|
-
|
|
4188
|
+
}
|
|
4189
|
+
function assertSymbolDomNode(group) {
|
|
4190
|
+
if (group instanceof SymbolNode) {
|
|
4191
|
+
return group;
|
|
4192
|
+
} else {
|
|
4193
|
+
throw new Error("Expected symbolNode but got " + String(group) + ".");
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
function assertSpan(group) {
|
|
4197
|
+
if (group instanceof Span) {
|
|
4198
|
+
return group;
|
|
4199
|
+
} else {
|
|
4200
|
+
throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4533
4203
|
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4204
|
+
/**
|
|
4205
|
+
* This file holds a list of all no-argument functions and single-character
|
|
4206
|
+
* symbols (like 'a' or ';').
|
|
4207
|
+
*
|
|
4208
|
+
* For each of the symbols, there are three properties they can have:
|
|
4209
|
+
* - font (required): the font to be used for this symbol. Either "main" (the
|
|
4210
|
+
normal font), or "ams" (the ams fonts).
|
|
4211
|
+
* - group (required): the ParseNode group type the symbol should have (i.e.
|
|
4212
|
+
"textord", "mathord", etc).
|
|
4213
|
+
See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
|
|
4214
|
+
* - replace: the character that this symbol or function should be
|
|
4215
|
+
* replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
|
|
4216
|
+
* character in the main font).
|
|
4217
|
+
*
|
|
4218
|
+
* The outermost map in the table indicates what mode the symbols should be
|
|
4219
|
+
* accepted in (e.g. "math" or "text").
|
|
4220
|
+
*/
|
|
4221
|
+
// Some of these have a "-token" suffix since these are also used as `ParseNode`
|
|
4222
|
+
// types for raw text tokens, and we want to avoid conflicts with higher-level
|
|
4223
|
+
// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
|
|
4224
|
+
// looking up the `symbols` map.
|
|
4225
|
+
var ATOMS = {
|
|
4226
|
+
"bin": 1,
|
|
4227
|
+
"close": 1,
|
|
4228
|
+
"inner": 1,
|
|
4229
|
+
"open": 1,
|
|
4230
|
+
"punct": 1,
|
|
4231
|
+
"rel": 1
|
|
4232
|
+
};
|
|
4233
|
+
var NON_ATOMS = {
|
|
4234
|
+
"accent-token": 1,
|
|
4235
|
+
"mathord": 1,
|
|
4236
|
+
"op-token": 1,
|
|
4237
|
+
"spacing": 1,
|
|
4238
|
+
"textord": 1
|
|
4239
|
+
};
|
|
4240
|
+
var symbols = {
|
|
4241
|
+
"math": {},
|
|
4242
|
+
"text": {}
|
|
4243
|
+
};
|
|
4244
|
+
/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
|
|
4548
4245
|
|
|
4549
|
-
defineSymbol(
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4246
|
+
function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
|
|
4247
|
+
symbols[mode][name] = {
|
|
4248
|
+
font,
|
|
4249
|
+
group,
|
|
4250
|
+
replace
|
|
4251
|
+
};
|
|
4554
4252
|
|
|
4555
|
-
|
|
4253
|
+
if (acceptUnicodeChar && replace) {
|
|
4254
|
+
symbols[mode][replace] = symbols[mode][name];
|
|
4255
|
+
}
|
|
4256
|
+
} // Some abbreviations for commonly used strings.
|
|
4257
|
+
// This helps minify the code, and also spotting typos using jshint.
|
|
4258
|
+
// modes:
|
|
4556
4259
|
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
// 0xD835 is the high surrogate for all letters in the range we support.
|
|
4560
|
-
// 0xDC00 is the low surrogate for bold A.
|
|
4260
|
+
var math = "math";
|
|
4261
|
+
var text = "text"; // fonts:
|
|
4561
4262
|
|
|
4263
|
+
var main = "main";
|
|
4264
|
+
var ams = "ams"; // groups:
|
|
4562
4265
|
|
|
4563
|
-
|
|
4266
|
+
var accent = "accent-token";
|
|
4267
|
+
var bin = "bin";
|
|
4268
|
+
var close = "close";
|
|
4269
|
+
var inner = "inner";
|
|
4270
|
+
var mathord = "mathord";
|
|
4271
|
+
var op = "op-token";
|
|
4272
|
+
var open = "open";
|
|
4273
|
+
var punct = "punct";
|
|
4274
|
+
var rel = "rel";
|
|
4275
|
+
var spacing = "spacing";
|
|
4276
|
+
var textord = "textord"; // Now comes the symbol table
|
|
4277
|
+
// Relation Symbols
|
|
4564
4278
|
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4279
|
+
defineSymbol(math, main, rel, "\u2261", "\\equiv", true);
|
|
4280
|
+
defineSymbol(math, main, rel, "\u227a", "\\prec", true);
|
|
4281
|
+
defineSymbol(math, main, rel, "\u227b", "\\succ", true);
|
|
4282
|
+
defineSymbol(math, main, rel, "\u223c", "\\sim", true);
|
|
4283
|
+
defineSymbol(math, main, rel, "\u22a5", "\\perp");
|
|
4284
|
+
defineSymbol(math, main, rel, "\u2aaf", "\\preceq", true);
|
|
4285
|
+
defineSymbol(math, main, rel, "\u2ab0", "\\succeq", true);
|
|
4286
|
+
defineSymbol(math, main, rel, "\u2243", "\\simeq", true);
|
|
4287
|
+
defineSymbol(math, main, rel, "\u2223", "\\mid", true);
|
|
4288
|
+
defineSymbol(math, main, rel, "\u226a", "\\ll", true);
|
|
4289
|
+
defineSymbol(math, main, rel, "\u226b", "\\gg", true);
|
|
4290
|
+
defineSymbol(math, main, rel, "\u224d", "\\asymp", true);
|
|
4291
|
+
defineSymbol(math, main, rel, "\u2225", "\\parallel");
|
|
4292
|
+
defineSymbol(math, main, rel, "\u22c8", "\\bowtie", true);
|
|
4293
|
+
defineSymbol(math, main, rel, "\u2323", "\\smile", true);
|
|
4294
|
+
defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true);
|
|
4295
|
+
defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true);
|
|
4296
|
+
defineSymbol(math, main, rel, "\u2250", "\\doteq", true);
|
|
4297
|
+
defineSymbol(math, main, rel, "\u2322", "\\frown", true);
|
|
4298
|
+
defineSymbol(math, main, rel, "\u220b", "\\ni", true);
|
|
4299
|
+
defineSymbol(math, main, rel, "\u221d", "\\propto", true);
|
|
4300
|
+
defineSymbol(math, main, rel, "\u22a2", "\\vdash", true);
|
|
4301
|
+
defineSymbol(math, main, rel, "\u22a3", "\\dashv", true);
|
|
4302
|
+
defineSymbol(math, main, rel, "\u220b", "\\owns"); // Punctuation
|
|
4568
4303
|
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic
|
|
4304
|
+
defineSymbol(math, main, punct, "\u002e", "\\ldotp");
|
|
4305
|
+
defineSymbol(math, main, punct, "\u22c5", "\\cdotp"); // Misc Symbols
|
|
4572
4306
|
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4307
|
+
defineSymbol(math, main, textord, "\u0023", "\\#");
|
|
4308
|
+
defineSymbol(text, main, textord, "\u0023", "\\#");
|
|
4309
|
+
defineSymbol(math, main, textord, "\u0026", "\\&");
|
|
4310
|
+
defineSymbol(text, main, textord, "\u0026", "\\&");
|
|
4311
|
+
defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
|
|
4312
|
+
defineSymbol(math, main, textord, "\u2200", "\\forall", true);
|
|
4313
|
+
defineSymbol(math, main, textord, "\u210f", "\\hbar", true);
|
|
4314
|
+
defineSymbol(math, main, textord, "\u2203", "\\exists", true);
|
|
4315
|
+
defineSymbol(math, main, textord, "\u2207", "\\nabla", true);
|
|
4316
|
+
defineSymbol(math, main, textord, "\u266d", "\\flat", true);
|
|
4317
|
+
defineSymbol(math, main, textord, "\u2113", "\\ell", true);
|
|
4318
|
+
defineSymbol(math, main, textord, "\u266e", "\\natural", true);
|
|
4319
|
+
defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true);
|
|
4320
|
+
defineSymbol(math, main, textord, "\u2118", "\\wp", true);
|
|
4321
|
+
defineSymbol(math, main, textord, "\u266f", "\\sharp", true);
|
|
4322
|
+
defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true);
|
|
4323
|
+
defineSymbol(math, main, textord, "\u211c", "\\Re", true);
|
|
4324
|
+
defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
|
|
4325
|
+
defineSymbol(math, main, textord, "\u2111", "\\Im", true);
|
|
4326
|
+
defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
|
|
4327
|
+
defineSymbol(math, main, textord, "\u00a7", "\\S", true);
|
|
4328
|
+
defineSymbol(text, main, textord, "\u00a7", "\\S");
|
|
4329
|
+
defineSymbol(math, main, textord, "\u00b6", "\\P", true);
|
|
4330
|
+
defineSymbol(text, main, textord, "\u00b6", "\\P"); // Math and Text
|
|
4576
4331
|
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4332
|
+
defineSymbol(math, main, textord, "\u2020", "\\dag");
|
|
4333
|
+
defineSymbol(text, main, textord, "\u2020", "\\dag");
|
|
4334
|
+
defineSymbol(text, main, textord, "\u2020", "\\textdagger");
|
|
4335
|
+
defineSymbol(math, main, textord, "\u2021", "\\ddag");
|
|
4336
|
+
defineSymbol(text, main, textord, "\u2021", "\\ddag");
|
|
4337
|
+
defineSymbol(text, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters
|
|
4580
4338
|
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4339
|
+
defineSymbol(math, main, close, "\u23b1", "\\rmoustache", true);
|
|
4340
|
+
defineSymbol(math, main, open, "\u23b0", "\\lmoustache", true);
|
|
4341
|
+
defineSymbol(math, main, close, "\u27ef", "\\rgroup", true);
|
|
4342
|
+
defineSymbol(math, main, open, "\u27ee", "\\lgroup", true); // Binary Operators
|
|
4584
4343
|
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4344
|
+
defineSymbol(math, main, bin, "\u2213", "\\mp", true);
|
|
4345
|
+
defineSymbol(math, main, bin, "\u2296", "\\ominus", true);
|
|
4346
|
+
defineSymbol(math, main, bin, "\u228e", "\\uplus", true);
|
|
4347
|
+
defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
|
|
4348
|
+
defineSymbol(math, main, bin, "\u2217", "\\ast");
|
|
4349
|
+
defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
|
|
4350
|
+
defineSymbol(math, main, bin, "\u25ef", "\\bigcirc", true);
|
|
4351
|
+
defineSymbol(math, main, bin, "\u2219", "\\bullet");
|
|
4352
|
+
defineSymbol(math, main, bin, "\u2021", "\\ddagger");
|
|
4353
|
+
defineSymbol(math, main, bin, "\u2240", "\\wr", true);
|
|
4354
|
+
defineSymbol(math, main, bin, "\u2a3f", "\\amalg");
|
|
4355
|
+
defineSymbol(math, main, bin, "\u0026", "\\And"); // from amsmath
|
|
4356
|
+
// Arrow Symbols
|
|
4588
4357
|
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4358
|
+
defineSymbol(math, main, rel, "\u27f5", "\\longleftarrow", true);
|
|
4359
|
+
defineSymbol(math, main, rel, "\u21d0", "\\Leftarrow", true);
|
|
4360
|
+
defineSymbol(math, main, rel, "\u27f8", "\\Longleftarrow", true);
|
|
4361
|
+
defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow", true);
|
|
4362
|
+
defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow", true);
|
|
4363
|
+
defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow", true);
|
|
4364
|
+
defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true);
|
|
4365
|
+
defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow", true);
|
|
4366
|
+
defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow", true);
|
|
4367
|
+
defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow", true);
|
|
4368
|
+
defineSymbol(math, main, rel, "\u21a6", "\\mapsto", true);
|
|
4369
|
+
defineSymbol(math, main, rel, "\u27fc", "\\longmapsto", true);
|
|
4370
|
+
defineSymbol(math, main, rel, "\u2197", "\\nearrow", true);
|
|
4371
|
+
defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow", true);
|
|
4372
|
+
defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow", true);
|
|
4373
|
+
defineSymbol(math, main, rel, "\u2198", "\\searrow", true);
|
|
4374
|
+
defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup", true);
|
|
4375
|
+
defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup", true);
|
|
4376
|
+
defineSymbol(math, main, rel, "\u2199", "\\swarrow", true);
|
|
4377
|
+
defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown", true);
|
|
4378
|
+
defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true);
|
|
4379
|
+
defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
|
|
4380
|
+
defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true); // AMS Negated Binary Relations
|
|
4592
4381
|
|
|
4593
|
-
|
|
4594
|
-
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
4382
|
+
defineSymbol(math, ams, rel, "\u226e", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
|
|
4595
4383
|
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4384
|
+
defineSymbol(math, ams, rel, "\ue010", "\\@nleqslant");
|
|
4385
|
+
defineSymbol(math, ams, rel, "\ue011", "\\@nleqq");
|
|
4386
|
+
defineSymbol(math, ams, rel, "\u2a87", "\\lneq", true);
|
|
4387
|
+
defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true);
|
|
4388
|
+
defineSymbol(math, ams, rel, "\ue00c", "\\@lvertneqq");
|
|
4389
|
+
defineSymbol(math, ams, rel, "\u22e6", "\\lnsim", true);
|
|
4390
|
+
defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox", true);
|
|
4391
|
+
defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
|
|
4600
4392
|
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4393
|
+
defineSymbol(math, ams, rel, "\u22e0", "\\npreceq", true);
|
|
4394
|
+
defineSymbol(math, ams, rel, "\u22e8", "\\precnsim", true);
|
|
4395
|
+
defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox", true);
|
|
4396
|
+
defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
|
|
4397
|
+
defineSymbol(math, ams, rel, "\ue006", "\\@nshortmid");
|
|
4398
|
+
defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
|
|
4399
|
+
defineSymbol(math, ams, rel, "\u22ac", "\\nvdash", true);
|
|
4400
|
+
defineSymbol(math, ams, rel, "\u22ad", "\\nvDash", true);
|
|
4401
|
+
defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft");
|
|
4402
|
+
defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq", true);
|
|
4403
|
+
defineSymbol(math, ams, rel, "\u228a", "\\subsetneq", true);
|
|
4404
|
+
defineSymbol(math, ams, rel, "\ue01a", "\\@varsubsetneq");
|
|
4405
|
+
defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq", true);
|
|
4406
|
+
defineSymbol(math, ams, rel, "\ue017", "\\@varsubsetneqq");
|
|
4407
|
+
defineSymbol(math, ams, rel, "\u226f", "\\ngtr", true);
|
|
4408
|
+
defineSymbol(math, ams, rel, "\ue00f", "\\@ngeqslant");
|
|
4409
|
+
defineSymbol(math, ams, rel, "\ue00e", "\\@ngeqq");
|
|
4410
|
+
defineSymbol(math, ams, rel, "\u2a88", "\\gneq", true);
|
|
4411
|
+
defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
|
|
4412
|
+
defineSymbol(math, ams, rel, "\ue00d", "\\@gvertneqq");
|
|
4413
|
+
defineSymbol(math, ams, rel, "\u22e7", "\\gnsim", true);
|
|
4414
|
+
defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox", true);
|
|
4415
|
+
defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
|
|
4604
4416
|
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4417
|
+
defineSymbol(math, ams, rel, "\u22e1", "\\nsucceq", true);
|
|
4418
|
+
defineSymbol(math, ams, rel, "\u22e9", "\\succnsim", true);
|
|
4419
|
+
defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
|
|
4608
4420
|
|
|
4609
|
-
|
|
4421
|
+
defineSymbol(math, ams, rel, "\u2246", "\\ncong", true);
|
|
4422
|
+
defineSymbol(math, ams, rel, "\ue007", "\\@nshortparallel");
|
|
4423
|
+
defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true);
|
|
4424
|
+
defineSymbol(math, ams, rel, "\u22af", "\\nVDash", true);
|
|
4425
|
+
defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright");
|
|
4426
|
+
defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq", true);
|
|
4427
|
+
defineSymbol(math, ams, rel, "\ue018", "\\@nsupseteqq");
|
|
4428
|
+
defineSymbol(math, ams, rel, "\u228b", "\\supsetneq", true);
|
|
4429
|
+
defineSymbol(math, ams, rel, "\ue01b", "\\@varsupsetneq");
|
|
4430
|
+
defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq", true);
|
|
4431
|
+
defineSymbol(math, ams, rel, "\ue019", "\\@varsupsetneqq");
|
|
4432
|
+
defineSymbol(math, ams, rel, "\u22ae", "\\nVdash", true);
|
|
4433
|
+
defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq", true);
|
|
4434
|
+
defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq", true);
|
|
4435
|
+
defineSymbol(math, ams, rel, "\ue016", "\\@nsubseteqq");
|
|
4436
|
+
defineSymbol(math, ams, bin, "\u22b4", "\\unlhd");
|
|
4437
|
+
defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); // AMS Negated Arrows
|
|
4610
4438
|
|
|
4439
|
+
defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow", true);
|
|
4440
|
+
defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow", true);
|
|
4441
|
+
defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow", true);
|
|
4442
|
+
defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow", true);
|
|
4443
|
+
defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow", true);
|
|
4444
|
+
defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow", true); // AMS Misc
|
|
4611
4445
|
|
|
4612
|
-
|
|
4446
|
+
defineSymbol(math, ams, rel, "\u25b3", "\\vartriangle");
|
|
4447
|
+
defineSymbol(math, ams, textord, "\u210f", "\\hslash");
|
|
4448
|
+
defineSymbol(math, ams, textord, "\u25bd", "\\triangledown");
|
|
4449
|
+
defineSymbol(math, ams, textord, "\u25ca", "\\lozenge");
|
|
4450
|
+
defineSymbol(math, ams, textord, "\u24c8", "\\circledS");
|
|
4451
|
+
defineSymbol(math, ams, textord, "\u00ae", "\\circledR");
|
|
4452
|
+
defineSymbol(text, ams, textord, "\u00ae", "\\circledR");
|
|
4453
|
+
defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true);
|
|
4454
|
+
defineSymbol(math, ams, textord, "\u2204", "\\nexists");
|
|
4455
|
+
defineSymbol(math, ams, textord, "\u2127", "\\mho");
|
|
4456
|
+
defineSymbol(math, ams, textord, "\u2132", "\\Finv", true);
|
|
4457
|
+
defineSymbol(math, ams, textord, "\u2141", "\\Game", true);
|
|
4458
|
+
defineSymbol(math, ams, textord, "\u2035", "\\backprime");
|
|
4459
|
+
defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle");
|
|
4460
|
+
defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown");
|
|
4461
|
+
defineSymbol(math, ams, textord, "\u25a0", "\\blacksquare");
|
|
4462
|
+
defineSymbol(math, ams, textord, "\u29eb", "\\blacklozenge");
|
|
4463
|
+
defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
|
|
4464
|
+
defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true);
|
|
4465
|
+
defineSymbol(math, ams, textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth
|
|
4613
4466
|
|
|
4614
|
-
defineSymbol(math,
|
|
4615
|
-
defineSymbol(text, main, textord, "
|
|
4467
|
+
defineSymbol(math, ams, textord, "\u00f0", "\\eth", true);
|
|
4468
|
+
defineSymbol(text, main, textord, "\u00f0", "\u00f0");
|
|
4469
|
+
defineSymbol(math, ams, textord, "\u2571", "\\diagup");
|
|
4470
|
+
defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
|
|
4471
|
+
defineSymbol(math, ams, textord, "\u25a1", "\\square");
|
|
4472
|
+
defineSymbol(math, ams, textord, "\u25a1", "\\Box");
|
|
4473
|
+
defineSymbol(math, ams, textord, "\u25ca", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
|
|
4616
4474
|
|
|
4617
|
-
|
|
4618
|
-
|
|
4475
|
+
defineSymbol(math, ams, textord, "\u00a5", "\\yen", true);
|
|
4476
|
+
defineSymbol(text, ams, textord, "\u00a5", "\\yen", true);
|
|
4477
|
+
defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true);
|
|
4478
|
+
defineSymbol(text, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew
|
|
4619
4479
|
|
|
4620
|
-
|
|
4480
|
+
defineSymbol(math, ams, textord, "\u2136", "\\beth", true);
|
|
4481
|
+
defineSymbol(math, ams, textord, "\u2138", "\\daleth", true);
|
|
4482
|
+
defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek
|
|
4621
4483
|
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif
|
|
4484
|
+
defineSymbol(math, ams, textord, "\u03dd", "\\digamma", true);
|
|
4485
|
+
defineSymbol(math, ams, textord, "\u03f0", "\\varkappa"); // AMS Delimiters
|
|
4625
4486
|
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4487
|
+
defineSymbol(math, ams, open, "\u250c", "\\@ulcorner", true);
|
|
4488
|
+
defineSymbol(math, ams, close, "\u2510", "\\@urcorner", true);
|
|
4489
|
+
defineSymbol(math, ams, open, "\u2514", "\\@llcorner", true);
|
|
4490
|
+
defineSymbol(math, ams, close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations
|
|
4629
4491
|
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4492
|
+
defineSymbol(math, ams, rel, "\u2266", "\\leqq", true);
|
|
4493
|
+
defineSymbol(math, ams, rel, "\u2a7d", "\\leqslant", true);
|
|
4494
|
+
defineSymbol(math, ams, rel, "\u2a95", "\\eqslantless", true);
|
|
4495
|
+
defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true);
|
|
4496
|
+
defineSymbol(math, ams, rel, "\u2a85", "\\lessapprox", true);
|
|
4497
|
+
defineSymbol(math, ams, rel, "\u224a", "\\approxeq", true);
|
|
4498
|
+
defineSymbol(math, ams, bin, "\u22d6", "\\lessdot");
|
|
4499
|
+
defineSymbol(math, ams, rel, "\u22d8", "\\lll", true);
|
|
4500
|
+
defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true);
|
|
4501
|
+
defineSymbol(math, ams, rel, "\u22da", "\\lesseqgtr", true);
|
|
4502
|
+
defineSymbol(math, ams, rel, "\u2a8b", "\\lesseqqgtr", true);
|
|
4503
|
+
defineSymbol(math, ams, rel, "\u2251", "\\doteqdot");
|
|
4504
|
+
defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true);
|
|
4505
|
+
defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true);
|
|
4506
|
+
defineSymbol(math, ams, rel, "\u223d", "\\backsim", true);
|
|
4507
|
+
defineSymbol(math, ams, rel, "\u22cd", "\\backsimeq", true);
|
|
4508
|
+
defineSymbol(math, ams, rel, "\u2ac5", "\\subseteqq", true);
|
|
4509
|
+
defineSymbol(math, ams, rel, "\u22d0", "\\Subset", true);
|
|
4510
|
+
defineSymbol(math, ams, rel, "\u228f", "\\sqsubset", true);
|
|
4511
|
+
defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq", true);
|
|
4512
|
+
defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec", true);
|
|
4513
|
+
defineSymbol(math, ams, rel, "\u227e", "\\precsim", true);
|
|
4514
|
+
defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox", true);
|
|
4515
|
+
defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft");
|
|
4516
|
+
defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq");
|
|
4517
|
+
defineSymbol(math, ams, rel, "\u22a8", "\\vDash", true);
|
|
4518
|
+
defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash", true);
|
|
4519
|
+
defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
|
|
4520
|
+
defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
|
|
4521
|
+
defineSymbol(math, ams, rel, "\u224f", "\\bumpeq", true);
|
|
4522
|
+
defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq", true);
|
|
4523
|
+
defineSymbol(math, ams, rel, "\u2267", "\\geqq", true);
|
|
4524
|
+
defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant", true);
|
|
4525
|
+
defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr", true);
|
|
4526
|
+
defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true);
|
|
4527
|
+
defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox", true);
|
|
4528
|
+
defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot");
|
|
4529
|
+
defineSymbol(math, ams, rel, "\u22d9", "\\ggg", true);
|
|
4530
|
+
defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true);
|
|
4531
|
+
defineSymbol(math, ams, rel, "\u22db", "\\gtreqless", true);
|
|
4532
|
+
defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless", true);
|
|
4533
|
+
defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true);
|
|
4534
|
+
defineSymbol(math, ams, rel, "\u2257", "\\circeq", true);
|
|
4535
|
+
defineSymbol(math, ams, rel, "\u225c", "\\triangleq", true);
|
|
4536
|
+
defineSymbol(math, ams, rel, "\u223c", "\\thicksim");
|
|
4537
|
+
defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
|
|
4538
|
+
defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq", true);
|
|
4539
|
+
defineSymbol(math, ams, rel, "\u22d1", "\\Supset", true);
|
|
4540
|
+
defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true);
|
|
4541
|
+
defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq", true);
|
|
4542
|
+
defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc", true);
|
|
4543
|
+
defineSymbol(math, ams, rel, "\u227f", "\\succsim", true);
|
|
4544
|
+
defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox", true);
|
|
4545
|
+
defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright");
|
|
4546
|
+
defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq");
|
|
4547
|
+
defineSymbol(math, ams, rel, "\u22a9", "\\Vdash", true);
|
|
4548
|
+
defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
|
|
4549
|
+
defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
|
|
4550
|
+
defineSymbol(math, ams, rel, "\u226c", "\\between", true);
|
|
4551
|
+
defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork", true);
|
|
4552
|
+
defineSymbol(math, ams, rel, "\u221d", "\\varpropto");
|
|
4553
|
+
defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom.
|
|
4554
|
+
// We kept the amssymb atom type, which is rel.
|
|
4633
4555
|
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
//
|
|
4638
|
-
// Unicode accent mechanism, so they fall back to Times font and look ugly.
|
|
4639
|
-
// TODO(edemaine): Fix this.
|
|
4556
|
+
defineSymbol(math, ams, rel, "\u2234", "\\therefore", true);
|
|
4557
|
+
defineSymbol(math, ams, rel, "\u220d", "\\backepsilon");
|
|
4558
|
+
defineSymbol(math, ams, rel, "\u25b6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom.
|
|
4559
|
+
// We kept the amssymb atom type, which is rel.
|
|
4640
4560
|
|
|
4561
|
+
defineSymbol(math, ams, rel, "\u2235", "\\because", true);
|
|
4562
|
+
defineSymbol(math, ams, rel, "\u22d8", "\\llless");
|
|
4563
|
+
defineSymbol(math, ams, rel, "\u22d9", "\\gggtr");
|
|
4564
|
+
defineSymbol(math, ams, bin, "\u22b2", "\\lhd");
|
|
4565
|
+
defineSymbol(math, ams, bin, "\u22b3", "\\rhd");
|
|
4566
|
+
defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true);
|
|
4567
|
+
defineSymbol(math, main, rel, "\u22c8", "\\Join");
|
|
4568
|
+
defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators
|
|
4641
4569
|
|
|
4642
|
-
|
|
4570
|
+
defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true);
|
|
4571
|
+
defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus");
|
|
4572
|
+
defineSymbol(math, ams, bin, "\u22d2", "\\Cap", true);
|
|
4573
|
+
defineSymbol(math, ams, bin, "\u22d3", "\\Cup", true);
|
|
4574
|
+
defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge", true);
|
|
4575
|
+
defineSymbol(math, ams, bin, "\u229f", "\\boxminus", true);
|
|
4576
|
+
defineSymbol(math, ams, bin, "\u229e", "\\boxplus", true);
|
|
4577
|
+
defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes", true);
|
|
4578
|
+
defineSymbol(math, ams, bin, "\u22c9", "\\ltimes", true);
|
|
4579
|
+
defineSymbol(math, ams, bin, "\u22ca", "\\rtimes", true);
|
|
4580
|
+
defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes", true);
|
|
4581
|
+
defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes", true);
|
|
4582
|
+
defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge", true);
|
|
4583
|
+
defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee", true);
|
|
4584
|
+
defineSymbol(math, ams, bin, "\u229d", "\\circleddash", true);
|
|
4585
|
+
defineSymbol(math, ams, bin, "\u229b", "\\circledast", true);
|
|
4586
|
+
defineSymbol(math, ams, bin, "\u22c5", "\\centerdot");
|
|
4587
|
+
defineSymbol(math, ams, bin, "\u22ba", "\\intercal", true);
|
|
4588
|
+
defineSymbol(math, ams, bin, "\u22d2", "\\doublecap");
|
|
4589
|
+
defineSymbol(math, ams, bin, "\u22d3", "\\doublecup");
|
|
4590
|
+
defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes", true); // AMS Arrows
|
|
4591
|
+
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
|
|
4592
|
+
// We'll map it to AMS function \dashrightarrow. It produces the same atom.
|
|
4643
4593
|
|
|
4644
|
-
|
|
4645
|
-
var _ch5 = extraLatin.charAt(_i5);
|
|
4594
|
+
defineSymbol(math, ams, rel, "\u21e2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym.
|
|
4646
4595
|
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4596
|
+
defineSymbol(math, ams, rel, "\u21e0", "\\dashleftarrow", true);
|
|
4597
|
+
defineSymbol(math, ams, rel, "\u21c7", "\\leftleftarrows", true);
|
|
4598
|
+
defineSymbol(math, ams, rel, "\u21c6", "\\leftrightarrows", true);
|
|
4599
|
+
defineSymbol(math, ams, rel, "\u21da", "\\Lleftarrow", true);
|
|
4600
|
+
defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow", true);
|
|
4601
|
+
defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail", true);
|
|
4602
|
+
defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft", true);
|
|
4603
|
+
defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons", true);
|
|
4604
|
+
defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
|
|
4650
4605
|
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
*/
|
|
4658
|
-
/**
|
|
4659
|
-
* Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf
|
|
4660
|
-
* That document sorts characters into groups by font type, say bold or italic.
|
|
4661
|
-
*
|
|
4662
|
-
* In the arrays below, each subarray consists three elements:
|
|
4663
|
-
* * The CSS class of that group when in math mode.
|
|
4664
|
-
* * The CSS class of that group when in text mode.
|
|
4665
|
-
* * The font name, so that KaTeX can get font metrics.
|
|
4666
|
-
*/
|
|
4606
|
+
defineSymbol(math, ams, rel, "\u21ba", "\\circlearrowleft", true);
|
|
4607
|
+
defineSymbol(math, ams, rel, "\u21b0", "\\Lsh", true);
|
|
4608
|
+
defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows", true);
|
|
4609
|
+
defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft", true);
|
|
4610
|
+
defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft", true);
|
|
4611
|
+
defineSymbol(math, main, rel, "\u22b6", "\\origof", true); // not in font
|
|
4667
4612
|
|
|
4668
|
-
|
|
4669
|
-
["mathbf", "textbf", "Main-Bold"], // a-z bold upright
|
|
4670
|
-
["mathnormal", "textit", "Math-Italic"], // A-Z italic
|
|
4671
|
-
["mathnormal", "textit", "Math-Italic"], // a-z italic
|
|
4672
|
-
["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic
|
|
4673
|
-
["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic
|
|
4674
|
-
// Map fancy A-Z letters to script, not calligraphic.
|
|
4675
|
-
// This aligns with unicode-math and math fonts (except Cambria Math).
|
|
4676
|
-
["mathscr", "textscr", "Script-Regular"], // A-Z script
|
|
4677
|
-
["", "", ""], // a-z script. No font
|
|
4678
|
-
["", "", ""], // A-Z bold script. No font
|
|
4679
|
-
["", "", ""], // a-z bold script. No font
|
|
4680
|
-
["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur
|
|
4681
|
-
["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur
|
|
4682
|
-
["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck
|
|
4683
|
-
["mathbb", "textbb", "AMS-Regular"], // k double-struck
|
|
4684
|
-
["", "", ""], // A-Z bold Fraktur No font metrics
|
|
4685
|
-
["", "", ""], // a-z bold Fraktur. No font.
|
|
4686
|
-
["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif
|
|
4687
|
-
["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif
|
|
4688
|
-
["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif
|
|
4689
|
-
["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif
|
|
4690
|
-
["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif
|
|
4691
|
-
["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif
|
|
4692
|
-
["", "", ""], // A-Z bold italic sans. No font
|
|
4693
|
-
["", "", ""], // a-z bold italic sans. No font
|
|
4694
|
-
["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace
|
|
4695
|
-
["mathtt", "texttt", "Typewriter-Regular"] // a-z monospace
|
|
4696
|
-
];
|
|
4697
|
-
var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold
|
|
4698
|
-
["", "", ""], // 0-9 double-struck. No KaTeX font.
|
|
4699
|
-
["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif
|
|
4700
|
-
["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif
|
|
4701
|
-
["mathtt", "texttt", "Typewriter-Regular"] // 0-9 monospace
|
|
4702
|
-
];
|
|
4703
|
-
var wideCharacterFont = function wideCharacterFont(wideChar, mode) {
|
|
4704
|
-
// IE doesn't support codePointAt(). So work with the surrogate pair.
|
|
4705
|
-
var H = wideChar.charCodeAt(0); // high surrogate
|
|
4613
|
+
defineSymbol(math, main, rel, "\u22b7", "\\imageof", true); // not in font
|
|
4706
4614
|
|
|
4707
|
-
|
|
4615
|
+
defineSymbol(math, ams, rel, "\u22b8", "\\multimap", true);
|
|
4616
|
+
defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow", true);
|
|
4617
|
+
defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows", true);
|
|
4618
|
+
defineSymbol(math, ams, rel, "\u21c4", "\\rightleftarrows", true);
|
|
4619
|
+
defineSymbol(math, ams, rel, "\u21a0", "\\twoheadrightarrow", true);
|
|
4620
|
+
defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail", true);
|
|
4621
|
+
defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright", true);
|
|
4622
|
+
defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
|
|
4708
4623
|
|
|
4709
|
-
|
|
4710
|
-
|
|
4624
|
+
defineSymbol(math, ams, rel, "\u21bb", "\\circlearrowright", true);
|
|
4625
|
+
defineSymbol(math, ams, rel, "\u21b1", "\\Rsh", true);
|
|
4626
|
+
defineSymbol(math, ams, rel, "\u21ca", "\\downdownarrows", true);
|
|
4627
|
+
defineSymbol(math, ams, rel, "\u21be", "\\upharpoonright", true);
|
|
4628
|
+
defineSymbol(math, ams, rel, "\u21c2", "\\downharpoonright", true);
|
|
4629
|
+
defineSymbol(math, ams, rel, "\u21dd", "\\rightsquigarrow", true);
|
|
4630
|
+
defineSymbol(math, ams, rel, "\u21dd", "\\leadsto");
|
|
4631
|
+
defineSymbol(math, ams, rel, "\u21db", "\\Rrightarrow", true);
|
|
4632
|
+
defineSymbol(math, ams, rel, "\u21be", "\\restriction");
|
|
4633
|
+
defineSymbol(math, main, textord, "\u2018", "`");
|
|
4634
|
+
defineSymbol(math, main, textord, "$", "\\$");
|
|
4635
|
+
defineSymbol(text, main, textord, "$", "\\$");
|
|
4636
|
+
defineSymbol(text, main, textord, "$", "\\textdollar");
|
|
4637
|
+
defineSymbol(math, main, textord, "%", "\\%");
|
|
4638
|
+
defineSymbol(text, main, textord, "%", "\\%");
|
|
4639
|
+
defineSymbol(math, main, textord, "_", "\\_");
|
|
4640
|
+
defineSymbol(text, main, textord, "_", "\\_");
|
|
4641
|
+
defineSymbol(text, main, textord, "_", "\\textunderscore");
|
|
4642
|
+
defineSymbol(math, main, textord, "\u2220", "\\angle", true);
|
|
4643
|
+
defineSymbol(math, main, textord, "\u221e", "\\infty", true);
|
|
4644
|
+
defineSymbol(math, main, textord, "\u2032", "\\prime");
|
|
4645
|
+
defineSymbol(math, main, textord, "\u25b3", "\\triangle");
|
|
4646
|
+
defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
|
|
4647
|
+
defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
|
|
4648
|
+
defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
|
|
4649
|
+
defineSymbol(math, main, textord, "\u039b", "\\Lambda", true);
|
|
4650
|
+
defineSymbol(math, main, textord, "\u039e", "\\Xi", true);
|
|
4651
|
+
defineSymbol(math, main, textord, "\u03a0", "\\Pi", true);
|
|
4652
|
+
defineSymbol(math, main, textord, "\u03a3", "\\Sigma", true);
|
|
4653
|
+
defineSymbol(math, main, textord, "\u03a5", "\\Upsilon", true);
|
|
4654
|
+
defineSymbol(math, main, textord, "\u03a6", "\\Phi", true);
|
|
4655
|
+
defineSymbol(math, main, textord, "\u03a8", "\\Psi", true);
|
|
4656
|
+
defineSymbol(math, main, textord, "\u03a9", "\\Omega", true);
|
|
4657
|
+
defineSymbol(math, main, textord, "A", "\u0391");
|
|
4658
|
+
defineSymbol(math, main, textord, "B", "\u0392");
|
|
4659
|
+
defineSymbol(math, main, textord, "E", "\u0395");
|
|
4660
|
+
defineSymbol(math, main, textord, "Z", "\u0396");
|
|
4661
|
+
defineSymbol(math, main, textord, "H", "\u0397");
|
|
4662
|
+
defineSymbol(math, main, textord, "I", "\u0399");
|
|
4663
|
+
defineSymbol(math, main, textord, "K", "\u039A");
|
|
4664
|
+
defineSymbol(math, main, textord, "M", "\u039C");
|
|
4665
|
+
defineSymbol(math, main, textord, "N", "\u039D");
|
|
4666
|
+
defineSymbol(math, main, textord, "O", "\u039F");
|
|
4667
|
+
defineSymbol(math, main, textord, "P", "\u03A1");
|
|
4668
|
+
defineSymbol(math, main, textord, "T", "\u03A4");
|
|
4669
|
+
defineSymbol(math, main, textord, "X", "\u03A7");
|
|
4670
|
+
defineSymbol(math, main, textord, "\u00ac", "\\neg", true);
|
|
4671
|
+
defineSymbol(math, main, textord, "\u00ac", "\\lnot");
|
|
4672
|
+
defineSymbol(math, main, textord, "\u22a4", "\\top");
|
|
4673
|
+
defineSymbol(math, main, textord, "\u22a5", "\\bot");
|
|
4674
|
+
defineSymbol(math, main, textord, "\u2205", "\\emptyset");
|
|
4675
|
+
defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
|
|
4676
|
+
defineSymbol(math, main, mathord, "\u03b1", "\\alpha", true);
|
|
4677
|
+
defineSymbol(math, main, mathord, "\u03b2", "\\beta", true);
|
|
4678
|
+
defineSymbol(math, main, mathord, "\u03b3", "\\gamma", true);
|
|
4679
|
+
defineSymbol(math, main, mathord, "\u03b4", "\\delta", true);
|
|
4680
|
+
defineSymbol(math, main, mathord, "\u03f5", "\\epsilon", true);
|
|
4681
|
+
defineSymbol(math, main, mathord, "\u03b6", "\\zeta", true);
|
|
4682
|
+
defineSymbol(math, main, mathord, "\u03b7", "\\eta", true);
|
|
4683
|
+
defineSymbol(math, main, mathord, "\u03b8", "\\theta", true);
|
|
4684
|
+
defineSymbol(math, main, mathord, "\u03b9", "\\iota", true);
|
|
4685
|
+
defineSymbol(math, main, mathord, "\u03ba", "\\kappa", true);
|
|
4686
|
+
defineSymbol(math, main, mathord, "\u03bb", "\\lambda", true);
|
|
4687
|
+
defineSymbol(math, main, mathord, "\u03bc", "\\mu", true);
|
|
4688
|
+
defineSymbol(math, main, mathord, "\u03bd", "\\nu", true);
|
|
4689
|
+
defineSymbol(math, main, mathord, "\u03be", "\\xi", true);
|
|
4690
|
+
defineSymbol(math, main, mathord, "\u03bf", "\\omicron", true);
|
|
4691
|
+
defineSymbol(math, main, mathord, "\u03c0", "\\pi", true);
|
|
4692
|
+
defineSymbol(math, main, mathord, "\u03c1", "\\rho", true);
|
|
4693
|
+
defineSymbol(math, main, mathord, "\u03c3", "\\sigma", true);
|
|
4694
|
+
defineSymbol(math, main, mathord, "\u03c4", "\\tau", true);
|
|
4695
|
+
defineSymbol(math, main, mathord, "\u03c5", "\\upsilon", true);
|
|
4696
|
+
defineSymbol(math, main, mathord, "\u03d5", "\\phi", true);
|
|
4697
|
+
defineSymbol(math, main, mathord, "\u03c7", "\\chi", true);
|
|
4698
|
+
defineSymbol(math, main, mathord, "\u03c8", "\\psi", true);
|
|
4699
|
+
defineSymbol(math, main, mathord, "\u03c9", "\\omega", true);
|
|
4700
|
+
defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon", true);
|
|
4701
|
+
defineSymbol(math, main, mathord, "\u03d1", "\\vartheta", true);
|
|
4702
|
+
defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true);
|
|
4703
|
+
defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true);
|
|
4704
|
+
defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true);
|
|
4705
|
+
defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true);
|
|
4706
|
+
defineSymbol(math, main, bin, "\u2217", "*", true);
|
|
4707
|
+
defineSymbol(math, main, bin, "+", "+");
|
|
4708
|
+
defineSymbol(math, main, bin, "\u2212", "-", true);
|
|
4709
|
+
defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
|
|
4710
|
+
defineSymbol(math, main, bin, "\u2218", "\\circ");
|
|
4711
|
+
defineSymbol(math, main, bin, "\u00f7", "\\div", true);
|
|
4712
|
+
defineSymbol(math, main, bin, "\u00b1", "\\pm", true);
|
|
4713
|
+
defineSymbol(math, main, bin, "\u00d7", "\\times", true);
|
|
4714
|
+
defineSymbol(math, main, bin, "\u2229", "\\cap", true);
|
|
4715
|
+
defineSymbol(math, main, bin, "\u222a", "\\cup", true);
|
|
4716
|
+
defineSymbol(math, main, bin, "\u2216", "\\setminus");
|
|
4717
|
+
defineSymbol(math, main, bin, "\u2227", "\\land");
|
|
4718
|
+
defineSymbol(math, main, bin, "\u2228", "\\lor");
|
|
4719
|
+
defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
|
|
4720
|
+
defineSymbol(math, main, bin, "\u2228", "\\vee", true);
|
|
4721
|
+
defineSymbol(math, main, textord, "\u221a", "\\surd");
|
|
4722
|
+
defineSymbol(math, main, open, "\u27e8", "\\langle", true);
|
|
4723
|
+
defineSymbol(math, main, open, "\u2223", "\\lvert");
|
|
4724
|
+
defineSymbol(math, main, open, "\u2225", "\\lVert");
|
|
4725
|
+
defineSymbol(math, main, close, "?", "?");
|
|
4726
|
+
defineSymbol(math, main, close, "!", "!");
|
|
4727
|
+
defineSymbol(math, main, close, "\u27e9", "\\rangle", true);
|
|
4728
|
+
defineSymbol(math, main, close, "\u2223", "\\rvert");
|
|
4729
|
+
defineSymbol(math, main, close, "\u2225", "\\rVert");
|
|
4730
|
+
defineSymbol(math, main, rel, "=", "=");
|
|
4731
|
+
defineSymbol(math, main, rel, ":", ":");
|
|
4732
|
+
defineSymbol(math, main, rel, "\u2248", "\\approx", true);
|
|
4733
|
+
defineSymbol(math, main, rel, "\u2245", "\\cong", true);
|
|
4734
|
+
defineSymbol(math, main, rel, "\u2265", "\\ge");
|
|
4735
|
+
defineSymbol(math, main, rel, "\u2265", "\\geq", true);
|
|
4736
|
+
defineSymbol(math, main, rel, "\u2190", "\\gets");
|
|
4737
|
+
defineSymbol(math, main, rel, ">", "\\gt", true);
|
|
4738
|
+
defineSymbol(math, main, rel, "\u2208", "\\in", true);
|
|
4739
|
+
defineSymbol(math, main, rel, "\ue020", "\\@not");
|
|
4740
|
+
defineSymbol(math, main, rel, "\u2282", "\\subset", true);
|
|
4741
|
+
defineSymbol(math, main, rel, "\u2283", "\\supset", true);
|
|
4742
|
+
defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
|
|
4743
|
+
defineSymbol(math, main, rel, "\u2287", "\\supseteq", true);
|
|
4744
|
+
defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true);
|
|
4745
|
+
defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true);
|
|
4746
|
+
defineSymbol(math, main, rel, "\u22a8", "\\models");
|
|
4747
|
+
defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true);
|
|
4748
|
+
defineSymbol(math, main, rel, "\u2264", "\\le");
|
|
4749
|
+
defineSymbol(math, main, rel, "\u2264", "\\leq", true);
|
|
4750
|
+
defineSymbol(math, main, rel, "<", "\\lt", true);
|
|
4751
|
+
defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true);
|
|
4752
|
+
defineSymbol(math, main, rel, "\u2192", "\\to");
|
|
4753
|
+
defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true);
|
|
4754
|
+
defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
|
|
4755
|
+
defineSymbol(math, main, spacing, "\u00a0", "\\ ");
|
|
4756
|
+
defineSymbol(math, main, spacing, "\u00a0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
|
|
4711
4757
|
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4758
|
+
defineSymbol(math, main, spacing, "\u00a0", "\\nobreakspace");
|
|
4759
|
+
defineSymbol(text, main, spacing, "\u00a0", "\\ ");
|
|
4760
|
+
defineSymbol(text, main, spacing, "\u00a0", " ");
|
|
4761
|
+
defineSymbol(text, main, spacing, "\u00a0", "\\space");
|
|
4762
|
+
defineSymbol(text, main, spacing, "\u00a0", "\\nobreakspace");
|
|
4763
|
+
defineSymbol(math, main, spacing, null, "\\nobreak");
|
|
4764
|
+
defineSymbol(math, main, spacing, null, "\\allowbreak");
|
|
4765
|
+
defineSymbol(math, main, punct, ",", ",");
|
|
4766
|
+
defineSymbol(math, main, punct, ";", ";");
|
|
4767
|
+
defineSymbol(math, ams, bin, "\u22bc", "\\barwedge", true);
|
|
4768
|
+
defineSymbol(math, ams, bin, "\u22bb", "\\veebar", true);
|
|
4769
|
+
defineSymbol(math, main, bin, "\u2299", "\\odot", true);
|
|
4770
|
+
defineSymbol(math, main, bin, "\u2295", "\\oplus", true);
|
|
4771
|
+
defineSymbol(math, main, bin, "\u2297", "\\otimes", true);
|
|
4772
|
+
defineSymbol(math, main, textord, "\u2202", "\\partial", true);
|
|
4773
|
+
defineSymbol(math, main, bin, "\u2298", "\\oslash", true);
|
|
4774
|
+
defineSymbol(math, ams, bin, "\u229a", "\\circledcirc", true);
|
|
4775
|
+
defineSymbol(math, ams, bin, "\u22a1", "\\boxdot", true);
|
|
4776
|
+
defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup");
|
|
4777
|
+
defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown");
|
|
4778
|
+
defineSymbol(math, main, bin, "\u2020", "\\dagger");
|
|
4779
|
+
defineSymbol(math, main, bin, "\u22c4", "\\diamond");
|
|
4780
|
+
defineSymbol(math, main, bin, "\u22c6", "\\star");
|
|
4781
|
+
defineSymbol(math, main, bin, "\u25c3", "\\triangleleft");
|
|
4782
|
+
defineSymbol(math, main, bin, "\u25b9", "\\triangleright");
|
|
4783
|
+
defineSymbol(math, main, open, "{", "\\{");
|
|
4784
|
+
defineSymbol(text, main, textord, "{", "\\{");
|
|
4785
|
+
defineSymbol(text, main, textord, "{", "\\textbraceleft");
|
|
4786
|
+
defineSymbol(math, main, close, "}", "\\}");
|
|
4787
|
+
defineSymbol(text, main, textord, "}", "\\}");
|
|
4788
|
+
defineSymbol(text, main, textord, "}", "\\textbraceright");
|
|
4789
|
+
defineSymbol(math, main, open, "{", "\\lbrace");
|
|
4790
|
+
defineSymbol(math, main, close, "}", "\\rbrace");
|
|
4791
|
+
defineSymbol(math, main, open, "[", "\\lbrack", true);
|
|
4792
|
+
defineSymbol(text, main, textord, "[", "\\lbrack", true);
|
|
4793
|
+
defineSymbol(math, main, close, "]", "\\rbrack", true);
|
|
4794
|
+
defineSymbol(text, main, textord, "]", "\\rbrack", true);
|
|
4795
|
+
defineSymbol(math, main, open, "(", "\\lparen", true);
|
|
4796
|
+
defineSymbol(math, main, close, ")", "\\rparen", true);
|
|
4797
|
+
defineSymbol(text, main, textord, "<", "\\textless", true); // in T1 fontenc
|
|
4720
4798
|
|
|
4721
|
-
|
|
4722
|
-
} else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {
|
|
4723
|
-
// dotless i or j
|
|
4724
|
-
return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
|
|
4725
|
-
} else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {
|
|
4726
|
-
// Greek letters. Not supported, yet.
|
|
4727
|
-
return ["", ""];
|
|
4728
|
-
} else {
|
|
4729
|
-
// We don't support any wide characters outside 1D400–1D7FF.
|
|
4730
|
-
throw new ParseError("Unsupported character: " + wideChar);
|
|
4731
|
-
}
|
|
4732
|
-
};
|
|
4799
|
+
defineSymbol(text, main, textord, ">", "\\textgreater", true); // in T1 fontenc
|
|
4733
4800
|
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
[1, 1, 1], // size1: [5, 5, 5] \tiny
|
|
4743
|
-
[2, 1, 1], // size2: [6, 5, 5]
|
|
4744
|
-
[3, 1, 1], // size3: [7, 5, 5] \scriptsize
|
|
4745
|
-
[4, 2, 1], // size4: [8, 6, 5] \footnotesize
|
|
4746
|
-
[5, 2, 1], // size5: [9, 6, 5] \small
|
|
4747
|
-
[6, 3, 1], // size6: [10, 7, 5] \normalsize
|
|
4748
|
-
[7, 4, 2], // size7: [12, 8, 6] \large
|
|
4749
|
-
[8, 6, 3], // size8: [14.4, 10, 7] \Large
|
|
4750
|
-
[9, 7, 6], // size9: [17.28, 12, 10] \LARGE
|
|
4751
|
-
[10, 8, 7], // size10: [20.74, 14.4, 12] \huge
|
|
4752
|
-
[11, 10, 9] // size11: [24.88, 20.74, 17.28] \HUGE
|
|
4753
|
-
];
|
|
4754
|
-
var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if
|
|
4755
|
-
// you change size indexes, change that function.
|
|
4756
|
-
0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];
|
|
4801
|
+
defineSymbol(math, main, open, "\u230a", "\\lfloor", true);
|
|
4802
|
+
defineSymbol(math, main, close, "\u230b", "\\rfloor", true);
|
|
4803
|
+
defineSymbol(math, main, open, "\u2308", "\\lceil", true);
|
|
4804
|
+
defineSymbol(math, main, close, "\u2309", "\\rceil", true);
|
|
4805
|
+
defineSymbol(math, main, textord, "\\", "\\backslash");
|
|
4806
|
+
defineSymbol(math, main, textord, "\u2223", "|");
|
|
4807
|
+
defineSymbol(math, main, textord, "\u2223", "\\vert");
|
|
4808
|
+
defineSymbol(text, main, textord, "|", "\\textbar", true); // in T1 fontenc
|
|
4757
4809
|
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4810
|
+
defineSymbol(math, main, textord, "\u2225", "\\|");
|
|
4811
|
+
defineSymbol(math, main, textord, "\u2225", "\\Vert");
|
|
4812
|
+
defineSymbol(text, main, textord, "\u2225", "\\textbardbl");
|
|
4813
|
+
defineSymbol(text, main, textord, "~", "\\textasciitilde");
|
|
4814
|
+
defineSymbol(text, main, textord, "\\", "\\textbackslash");
|
|
4815
|
+
defineSymbol(text, main, textord, "^", "\\textasciicircum");
|
|
4816
|
+
defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
|
|
4817
|
+
defineSymbol(math, main, rel, "\u21d1", "\\Uparrow", true);
|
|
4818
|
+
defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
|
|
4819
|
+
defineSymbol(math, main, rel, "\u21d3", "\\Downarrow", true);
|
|
4820
|
+
defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true);
|
|
4821
|
+
defineSymbol(math, main, rel, "\u21d5", "\\Updownarrow", true);
|
|
4822
|
+
defineSymbol(math, main, op, "\u2210", "\\coprod");
|
|
4823
|
+
defineSymbol(math, main, op, "\u22c1", "\\bigvee");
|
|
4824
|
+
defineSymbol(math, main, op, "\u22c0", "\\bigwedge");
|
|
4825
|
+
defineSymbol(math, main, op, "\u2a04", "\\biguplus");
|
|
4826
|
+
defineSymbol(math, main, op, "\u22c2", "\\bigcap");
|
|
4827
|
+
defineSymbol(math, main, op, "\u22c3", "\\bigcup");
|
|
4828
|
+
defineSymbol(math, main, op, "\u222b", "\\int");
|
|
4829
|
+
defineSymbol(math, main, op, "\u222b", "\\intop");
|
|
4830
|
+
defineSymbol(math, main, op, "\u222c", "\\iint");
|
|
4831
|
+
defineSymbol(math, main, op, "\u222d", "\\iiint");
|
|
4832
|
+
defineSymbol(math, main, op, "\u220f", "\\prod");
|
|
4833
|
+
defineSymbol(math, main, op, "\u2211", "\\sum");
|
|
4834
|
+
defineSymbol(math, main, op, "\u2a02", "\\bigotimes");
|
|
4835
|
+
defineSymbol(math, main, op, "\u2a01", "\\bigoplus");
|
|
4836
|
+
defineSymbol(math, main, op, "\u2a00", "\\bigodot");
|
|
4837
|
+
defineSymbol(math, main, op, "\u222e", "\\oint");
|
|
4838
|
+
defineSymbol(math, main, op, "\u222f", "\\oiint");
|
|
4839
|
+
defineSymbol(math, main, op, "\u2230", "\\oiiint");
|
|
4840
|
+
defineSymbol(math, main, op, "\u2a06", "\\bigsqcup");
|
|
4841
|
+
defineSymbol(math, main, op, "\u222b", "\\smallint");
|
|
4842
|
+
defineSymbol(text, main, inner, "\u2026", "\\textellipsis");
|
|
4843
|
+
defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
|
|
4844
|
+
defineSymbol(text, main, inner, "\u2026", "\\ldots", true);
|
|
4845
|
+
defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
|
|
4846
|
+
defineSymbol(math, main, inner, "\u22ef", "\\@cdots", true);
|
|
4847
|
+
defineSymbol(math, main, inner, "\u22f1", "\\ddots", true);
|
|
4848
|
+
defineSymbol(math, main, textord, "\u22ee", "\\varvdots"); // \vdots is a macro
|
|
4761
4849
|
|
|
4850
|
+
defineSymbol(math, main, accent, "\u02ca", "\\acute");
|
|
4851
|
+
defineSymbol(math, main, accent, "\u02cb", "\\grave");
|
|
4852
|
+
defineSymbol(math, main, accent, "\u00a8", "\\ddot");
|
|
4853
|
+
defineSymbol(math, main, accent, "\u007e", "\\tilde");
|
|
4854
|
+
defineSymbol(math, main, accent, "\u02c9", "\\bar");
|
|
4855
|
+
defineSymbol(math, main, accent, "\u02d8", "\\breve");
|
|
4856
|
+
defineSymbol(math, main, accent, "\u02c7", "\\check");
|
|
4857
|
+
defineSymbol(math, main, accent, "\u005e", "\\hat");
|
|
4858
|
+
defineSymbol(math, main, accent, "\u20d7", "\\vec");
|
|
4859
|
+
defineSymbol(math, main, accent, "\u02d9", "\\dot");
|
|
4860
|
+
defineSymbol(math, main, accent, "\u02da", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA
|
|
4762
4861
|
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4862
|
+
defineSymbol(math, main, mathord, "\ue131", "\\@imath");
|
|
4863
|
+
defineSymbol(math, main, mathord, "\ue237", "\\@jmath");
|
|
4864
|
+
defineSymbol(math, main, textord, "\u0131", "\u0131");
|
|
4865
|
+
defineSymbol(math, main, textord, "\u0237", "\u0237");
|
|
4866
|
+
defineSymbol(text, main, textord, "\u0131", "\\i", true);
|
|
4867
|
+
defineSymbol(text, main, textord, "\u0237", "\\j", true);
|
|
4868
|
+
defineSymbol(text, main, textord, "\u00df", "\\ss", true);
|
|
4869
|
+
defineSymbol(text, main, textord, "\u00e6", "\\ae", true);
|
|
4870
|
+
defineSymbol(text, main, textord, "\u0153", "\\oe", true);
|
|
4871
|
+
defineSymbol(text, main, textord, "\u00f8", "\\o", true);
|
|
4872
|
+
defineSymbol(text, main, textord, "\u00c6", "\\AE", true);
|
|
4873
|
+
defineSymbol(text, main, textord, "\u0152", "\\OE", true);
|
|
4874
|
+
defineSymbol(text, main, textord, "\u00d8", "\\O", true);
|
|
4875
|
+
defineSymbol(text, main, accent, "\u02ca", "\\'"); // acute
|
|
4774
4876
|
|
|
4775
|
-
|
|
4776
|
-
* The base size index.
|
|
4777
|
-
*/
|
|
4778
|
-
constructor(data) {
|
|
4779
|
-
this.style = void 0;
|
|
4780
|
-
this.color = void 0;
|
|
4781
|
-
this.size = void 0;
|
|
4782
|
-
this.textSize = void 0;
|
|
4783
|
-
this.phantom = void 0;
|
|
4784
|
-
this.font = void 0;
|
|
4785
|
-
this.fontFamily = void 0;
|
|
4786
|
-
this.fontWeight = void 0;
|
|
4787
|
-
this.fontShape = void 0;
|
|
4788
|
-
this.sizeMultiplier = void 0;
|
|
4789
|
-
this.maxSize = void 0;
|
|
4790
|
-
this.minRuleThickness = void 0;
|
|
4791
|
-
this._fontMetrics = void 0;
|
|
4792
|
-
this.style = data.style;
|
|
4793
|
-
this.color = data.color;
|
|
4794
|
-
this.size = data.size || Options.BASESIZE;
|
|
4795
|
-
this.textSize = data.textSize || this.size;
|
|
4796
|
-
this.phantom = !!data.phantom;
|
|
4797
|
-
this.font = data.font || "";
|
|
4798
|
-
this.fontFamily = data.fontFamily || "";
|
|
4799
|
-
this.fontWeight = data.fontWeight || '';
|
|
4800
|
-
this.fontShape = data.fontShape || '';
|
|
4801
|
-
this.sizeMultiplier = sizeMultipliers[this.size - 1];
|
|
4802
|
-
this.maxSize = data.maxSize;
|
|
4803
|
-
this.minRuleThickness = data.minRuleThickness;
|
|
4804
|
-
this._fontMetrics = undefined;
|
|
4805
|
-
}
|
|
4806
|
-
/**
|
|
4807
|
-
* Returns a new options object with the same properties as "this". Properties
|
|
4808
|
-
* from "extension" will be copied to the new options object.
|
|
4809
|
-
*/
|
|
4877
|
+
defineSymbol(text, main, accent, "\u02cb", "\\`"); // grave
|
|
4810
4878
|
|
|
4879
|
+
defineSymbol(text, main, accent, "\u02c6", "\\^"); // circumflex
|
|
4811
4880
|
|
|
4812
|
-
|
|
4813
|
-
var data = {
|
|
4814
|
-
style: this.style,
|
|
4815
|
-
size: this.size,
|
|
4816
|
-
textSize: this.textSize,
|
|
4817
|
-
color: this.color,
|
|
4818
|
-
phantom: this.phantom,
|
|
4819
|
-
font: this.font,
|
|
4820
|
-
fontFamily: this.fontFamily,
|
|
4821
|
-
fontWeight: this.fontWeight,
|
|
4822
|
-
fontShape: this.fontShape,
|
|
4823
|
-
maxSize: this.maxSize,
|
|
4824
|
-
minRuleThickness: this.minRuleThickness
|
|
4825
|
-
};
|
|
4881
|
+
defineSymbol(text, main, accent, "\u02dc", "\\~"); // tilde
|
|
4826
4882
|
|
|
4827
|
-
|
|
4828
|
-
if (extension.hasOwnProperty(key)) {
|
|
4829
|
-
data[key] = extension[key];
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4883
|
+
defineSymbol(text, main, accent, "\u02c9", "\\="); // macron
|
|
4832
4884
|
|
|
4833
|
-
|
|
4834
|
-
}
|
|
4835
|
-
/**
|
|
4836
|
-
* Return an options object with the given style. If `this.style === style`,
|
|
4837
|
-
* returns `this`.
|
|
4838
|
-
*/
|
|
4885
|
+
defineSymbol(text, main, accent, "\u02d8", "\\u"); // breve
|
|
4839
4886
|
|
|
4887
|
+
defineSymbol(text, main, accent, "\u02d9", "\\."); // dot above
|
|
4840
4888
|
|
|
4841
|
-
|
|
4842
|
-
if (this.style === style) {
|
|
4843
|
-
return this;
|
|
4844
|
-
} else {
|
|
4845
|
-
return this.extend({
|
|
4846
|
-
style: style,
|
|
4847
|
-
size: sizeAtStyle(this.textSize, style)
|
|
4848
|
-
});
|
|
4849
|
-
}
|
|
4850
|
-
}
|
|
4851
|
-
/**
|
|
4852
|
-
* Return an options object with a cramped version of the current style. If
|
|
4853
|
-
* the current style is cramped, returns `this`.
|
|
4854
|
-
*/
|
|
4889
|
+
defineSymbol(text, main, accent, "\u00b8", "\\c"); // cedilla
|
|
4855
4890
|
|
|
4891
|
+
defineSymbol(text, main, accent, "\u02da", "\\r"); // ring above
|
|
4856
4892
|
|
|
4857
|
-
|
|
4858
|
-
return this.havingStyle(this.style.cramp());
|
|
4859
|
-
}
|
|
4860
|
-
/**
|
|
4861
|
-
* Return an options object with the given size and in at least `\textstyle`.
|
|
4862
|
-
* Returns `this` if appropriate.
|
|
4863
|
-
*/
|
|
4893
|
+
defineSymbol(text, main, accent, "\u02c7", "\\v"); // caron
|
|
4864
4894
|
|
|
4895
|
+
defineSymbol(text, main, accent, "\u00a8", '\\"'); // diaresis
|
|
4865
4896
|
|
|
4866
|
-
|
|
4867
|
-
if (this.size === size && this.textSize === size) {
|
|
4868
|
-
return this;
|
|
4869
|
-
} else {
|
|
4870
|
-
return this.extend({
|
|
4871
|
-
style: this.style.text(),
|
|
4872
|
-
size: size,
|
|
4873
|
-
textSize: size,
|
|
4874
|
-
sizeMultiplier: sizeMultipliers[size - 1]
|
|
4875
|
-
});
|
|
4876
|
-
}
|
|
4877
|
-
}
|
|
4878
|
-
/**
|
|
4879
|
-
* Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
|
|
4880
|
-
* changes to at least `\textstyle`.
|
|
4881
|
-
*/
|
|
4897
|
+
defineSymbol(text, main, accent, "\u02dd", "\\H"); // double acute
|
|
4882
4898
|
|
|
4899
|
+
defineSymbol(text, main, accent, "\u25ef", "\\textcircled"); // \bigcirc glyph
|
|
4900
|
+
// These ligatures are detected and created in Parser.js's `formLigatures`.
|
|
4883
4901
|
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4902
|
+
var ligatures = {
|
|
4903
|
+
"--": true,
|
|
4904
|
+
"---": true,
|
|
4905
|
+
"``": true,
|
|
4906
|
+
"''": true
|
|
4907
|
+
};
|
|
4908
|
+
defineSymbol(text, main, textord, "\u2013", "--", true);
|
|
4909
|
+
defineSymbol(text, main, textord, "\u2013", "\\textendash");
|
|
4910
|
+
defineSymbol(text, main, textord, "\u2014", "---", true);
|
|
4911
|
+
defineSymbol(text, main, textord, "\u2014", "\\textemdash");
|
|
4912
|
+
defineSymbol(text, main, textord, "\u2018", "`", true);
|
|
4913
|
+
defineSymbol(text, main, textord, "\u2018", "\\textquoteleft");
|
|
4914
|
+
defineSymbol(text, main, textord, "\u2019", "'", true);
|
|
4915
|
+
defineSymbol(text, main, textord, "\u2019", "\\textquoteright");
|
|
4916
|
+
defineSymbol(text, main, textord, "\u201c", "``", true);
|
|
4917
|
+
defineSymbol(text, main, textord, "\u201c", "\\textquotedblleft");
|
|
4918
|
+
defineSymbol(text, main, textord, "\u201d", "''", true);
|
|
4919
|
+
defineSymbol(text, main, textord, "\u201d", "\\textquotedblright"); // \degree from gensymb package
|
|
4887
4920
|
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
} else {
|
|
4891
|
-
return this.extend({
|
|
4892
|
-
style: style,
|
|
4893
|
-
size: wantSize
|
|
4894
|
-
});
|
|
4895
|
-
}
|
|
4896
|
-
}
|
|
4897
|
-
/**
|
|
4898
|
-
* Remove the effect of sizing changes such as \Huge.
|
|
4899
|
-
* Keep the effect of the current style, such as \scriptstyle.
|
|
4900
|
-
*/
|
|
4921
|
+
defineSymbol(math, main, textord, "\u00b0", "\\degree", true);
|
|
4922
|
+
defineSymbol(text, main, textord, "\u00b0", "\\degree"); // \textdegree from inputenc package
|
|
4901
4923
|
|
|
4924
|
+
defineSymbol(text, main, textord, "\u00b0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math
|
|
4925
|
+
// mode, but among our fonts, only Main-Regular defines this character "163".
|
|
4902
4926
|
|
|
4903
|
-
|
|
4904
|
-
|
|
4927
|
+
defineSymbol(math, main, textord, "\u00a3", "\\pounds");
|
|
4928
|
+
defineSymbol(math, main, textord, "\u00a3", "\\mathsterling", true);
|
|
4929
|
+
defineSymbol(text, main, textord, "\u00a3", "\\pounds");
|
|
4930
|
+
defineSymbol(text, main, textord, "\u00a3", "\\textsterling", true);
|
|
4931
|
+
defineSymbol(math, ams, textord, "\u2720", "\\maltese");
|
|
4932
|
+
defineSymbol(text, ams, textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards.
|
|
4933
|
+
// All of these are textords in math mode
|
|
4905
4934
|
|
|
4906
|
-
|
|
4907
|
-
case 4:
|
|
4908
|
-
case 5:
|
|
4909
|
-
size = 3; // normalsize in scriptstyle
|
|
4935
|
+
var mathTextSymbols = "0123456789/@.\"";
|
|
4910
4936
|
|
|
4911
|
-
|
|
4937
|
+
for (var i = 0; i < mathTextSymbols.length; i++) {
|
|
4938
|
+
var ch = mathTextSymbols.charAt(i);
|
|
4939
|
+
defineSymbol(math, main, textord, ch, ch);
|
|
4940
|
+
} // All of these are textords in text mode
|
|
4912
4941
|
|
|
4913
|
-
case 6:
|
|
4914
|
-
case 7:
|
|
4915
|
-
size = 1; // normalsize in scriptscriptstyle
|
|
4916
4942
|
|
|
4917
|
-
|
|
4943
|
+
var textSymbols = "0123456789!@*()-=+\";:?/.,";
|
|
4918
4944
|
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
// normalsize in textstyle or displaystyle
|
|
4922
|
-
}
|
|
4945
|
+
for (var _i = 0; _i < textSymbols.length; _i++) {
|
|
4946
|
+
var _ch = textSymbols.charAt(_i);
|
|
4923
4947
|
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
size: size
|
|
4927
|
-
});
|
|
4928
|
-
}
|
|
4929
|
-
/**
|
|
4930
|
-
* Create a new options object with the given color.
|
|
4931
|
-
*/
|
|
4948
|
+
defineSymbol(text, main, textord, _ch, _ch);
|
|
4949
|
+
} // All of these are textords in text mode, and mathords in math mode
|
|
4932
4950
|
|
|
4933
4951
|
|
|
4934
|
-
|
|
4935
|
-
return this.extend({
|
|
4936
|
-
color: color
|
|
4937
|
-
});
|
|
4938
|
-
}
|
|
4939
|
-
/**
|
|
4940
|
-
* Create a new options object with "phantom" set to true.
|
|
4941
|
-
*/
|
|
4952
|
+
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
4942
4953
|
|
|
4954
|
+
for (var _i2 = 0; _i2 < letters.length; _i2++) {
|
|
4955
|
+
var _ch2 = letters.charAt(_i2);
|
|
4943
4956
|
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
});
|
|
4948
|
-
}
|
|
4949
|
-
/**
|
|
4950
|
-
* Creates a new options object with the given math font or old text font.
|
|
4951
|
-
* @type {[type]}
|
|
4952
|
-
*/
|
|
4957
|
+
defineSymbol(math, main, mathord, _ch2, _ch2);
|
|
4958
|
+
defineSymbol(text, main, textord, _ch2, _ch2);
|
|
4959
|
+
} // Blackboard bold and script letters in Unicode range
|
|
4953
4960
|
|
|
4954
4961
|
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4962
|
+
defineSymbol(math, ams, textord, "C", "\u2102"); // blackboard bold
|
|
4963
|
+
|
|
4964
|
+
defineSymbol(text, ams, textord, "C", "\u2102");
|
|
4965
|
+
defineSymbol(math, ams, textord, "H", "\u210D");
|
|
4966
|
+
defineSymbol(text, ams, textord, "H", "\u210D");
|
|
4967
|
+
defineSymbol(math, ams, textord, "N", "\u2115");
|
|
4968
|
+
defineSymbol(text, ams, textord, "N", "\u2115");
|
|
4969
|
+
defineSymbol(math, ams, textord, "P", "\u2119");
|
|
4970
|
+
defineSymbol(text, ams, textord, "P", "\u2119");
|
|
4971
|
+
defineSymbol(math, ams, textord, "Q", "\u211A");
|
|
4972
|
+
defineSymbol(text, ams, textord, "Q", "\u211A");
|
|
4973
|
+
defineSymbol(math, ams, textord, "R", "\u211D");
|
|
4974
|
+
defineSymbol(text, ams, textord, "R", "\u211D");
|
|
4975
|
+
defineSymbol(math, ams, textord, "Z", "\u2124");
|
|
4976
|
+
defineSymbol(text, ams, textord, "Z", "\u2124");
|
|
4977
|
+
defineSymbol(math, main, mathord, "h", "\u210E"); // italic h, Planck constant
|
|
4963
4978
|
|
|
4979
|
+
defineSymbol(text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters.
|
|
4980
|
+
// We support some letters in the Unicode range U+1D400 to U+1D7FF,
|
|
4981
|
+
// Mathematical Alphanumeric Symbols.
|
|
4982
|
+
// Some editors do not deal well with wide characters. So don't write the
|
|
4983
|
+
// string into this file. Instead, create the string from the surrogate pair.
|
|
4964
4984
|
|
|
4965
|
-
|
|
4966
|
-
return this.extend({
|
|
4967
|
-
fontFamily,
|
|
4968
|
-
font: ""
|
|
4969
|
-
});
|
|
4970
|
-
}
|
|
4971
|
-
/**
|
|
4972
|
-
* Creates a new options object with the given font weight
|
|
4973
|
-
*/
|
|
4985
|
+
var wideChar = "";
|
|
4974
4986
|
|
|
4987
|
+
for (var _i3 = 0; _i3 < letters.length; _i3++) {
|
|
4988
|
+
var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair.
|
|
4989
|
+
// 0xD835 is the high surrogate for all letters in the range we support.
|
|
4990
|
+
// 0xDC00 is the low surrogate for bold A.
|
|
4975
4991
|
|
|
4976
|
-
withTextFontWeight(fontWeight) {
|
|
4977
|
-
return this.extend({
|
|
4978
|
-
fontWeight,
|
|
4979
|
-
font: ""
|
|
4980
|
-
});
|
|
4981
|
-
}
|
|
4982
|
-
/**
|
|
4983
|
-
* Creates a new options object with the given font weight
|
|
4984
|
-
*/
|
|
4985
4992
|
|
|
4993
|
+
wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold
|
|
4994
|
+
|
|
4995
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
4996
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
4997
|
+
wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic
|
|
4998
|
+
|
|
4999
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5000
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5001
|
+
wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic
|
|
5002
|
+
|
|
5003
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5004
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5005
|
+
wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur
|
|
5006
|
+
|
|
5007
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5008
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5009
|
+
wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif
|
|
5010
|
+
|
|
5011
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5012
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5013
|
+
wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold
|
|
5014
|
+
|
|
5015
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5016
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5017
|
+
wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic
|
|
5018
|
+
|
|
5019
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5020
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5021
|
+
wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace
|
|
5022
|
+
|
|
5023
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5024
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
4986
5025
|
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
});
|
|
4992
|
-
}
|
|
4993
|
-
/**
|
|
4994
|
-
* Return the CSS sizing classes required to switch from enclosing options
|
|
4995
|
-
* `oldOptions` to `this`. Returns an array of classes.
|
|
4996
|
-
*/
|
|
5026
|
+
if (_i3 < 26) {
|
|
5027
|
+
// KaTeX fonts have only capital letters for blackboard bold and script.
|
|
5028
|
+
// See exception for k below.
|
|
5029
|
+
wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck
|
|
4997
5030
|
|
|
5031
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5032
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5033
|
+
wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script
|
|
4998
5034
|
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
} else {
|
|
5003
|
-
return [];
|
|
5004
|
-
}
|
|
5005
|
-
}
|
|
5006
|
-
/**
|
|
5007
|
-
* Return the CSS sizing classes required to switch to the base size. Like
|
|
5008
|
-
* `this.havingSize(BASESIZE).sizingClasses(this)`.
|
|
5009
|
-
*/
|
|
5035
|
+
defineSymbol(math, main, mathord, _ch3, wideChar);
|
|
5036
|
+
defineSymbol(text, main, textord, _ch3, wideChar);
|
|
5037
|
+
} // TODO: Add bold script when it is supported by a KaTeX font.
|
|
5010
5038
|
|
|
5039
|
+
} // "k" is the only double struck lower case letter in the KaTeX fonts.
|
|
5011
5040
|
|
|
5012
|
-
baseSizingClasses() {
|
|
5013
|
-
if (this.size !== Options.BASESIZE) {
|
|
5014
|
-
return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
|
|
5015
|
-
} else {
|
|
5016
|
-
return [];
|
|
5017
|
-
}
|
|
5018
|
-
}
|
|
5019
|
-
/**
|
|
5020
|
-
* Return the font metrics for this size.
|
|
5021
|
-
*/
|
|
5022
5041
|
|
|
5042
|
+
wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck
|
|
5023
5043
|
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
this._fontMetrics = getGlobalMetrics(this.size);
|
|
5027
|
-
}
|
|
5044
|
+
defineSymbol(math, main, mathord, "k", wideChar);
|
|
5045
|
+
defineSymbol(text, main, textord, "k", wideChar); // Next, some wide character numerals
|
|
5028
5046
|
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
/**
|
|
5032
|
-
* Gets the CSS color of the current options object
|
|
5033
|
-
*/
|
|
5047
|
+
for (var _i4 = 0; _i4 < 10; _i4++) {
|
|
5048
|
+
var _ch4 = _i4.toString();
|
|
5034
5049
|
|
|
5050
|
+
wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold
|
|
5035
5051
|
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
} else {
|
|
5040
|
-
return this.color;
|
|
5041
|
-
}
|
|
5042
|
-
}
|
|
5052
|
+
defineSymbol(math, main, mathord, _ch4, wideChar);
|
|
5053
|
+
defineSymbol(text, main, textord, _ch4, wideChar);
|
|
5054
|
+
wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif
|
|
5043
5055
|
|
|
5044
|
-
|
|
5056
|
+
defineSymbol(math, main, mathord, _ch4, wideChar);
|
|
5057
|
+
defineSymbol(text, main, textord, _ch4, wideChar);
|
|
5058
|
+
wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans
|
|
5045
5059
|
|
|
5046
|
-
|
|
5060
|
+
defineSymbol(math, main, mathord, _ch4, wideChar);
|
|
5061
|
+
defineSymbol(text, main, textord, _ch4, wideChar);
|
|
5062
|
+
wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace
|
|
5047
5063
|
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
//
|
|
5053
|
-
//
|
|
5054
|
-
// *assuming* a font size of ptPerEm (normal size, normal style).
|
|
5064
|
+
defineSymbol(math, main, mathord, _ch4, wideChar);
|
|
5065
|
+
defineSymbol(text, main, textord, _ch4, wideChar);
|
|
5066
|
+
} // We add these Latin-1 letters as symbols for backwards-compatibility,
|
|
5067
|
+
// but they are not actually in the font, nor are they supported by the
|
|
5068
|
+
// Unicode accent mechanism, so they fall back to Times font and look ugly.
|
|
5069
|
+
// TODO(edemaine): Fix this.
|
|
5055
5070
|
|
|
5056
|
-
var ptPerUnit = {
|
|
5057
|
-
// https://en.wikibooks.org/wiki/LaTeX/Lengths and
|
|
5058
|
-
// https://tex.stackexchange.com/a/8263
|
|
5059
|
-
"pt": 1,
|
|
5060
|
-
// TeX point
|
|
5061
|
-
"mm": 7227 / 2540,
|
|
5062
|
-
// millimeter
|
|
5063
|
-
"cm": 7227 / 254,
|
|
5064
|
-
// centimeter
|
|
5065
|
-
"in": 72.27,
|
|
5066
|
-
// inch
|
|
5067
|
-
"bp": 803 / 800,
|
|
5068
|
-
// big (PostScript) points
|
|
5069
|
-
"pc": 12,
|
|
5070
|
-
// pica
|
|
5071
|
-
"dd": 1238 / 1157,
|
|
5072
|
-
// didot
|
|
5073
|
-
"cc": 14856 / 1157,
|
|
5074
|
-
// cicero (12 didot)
|
|
5075
|
-
"nd": 685 / 642,
|
|
5076
|
-
// new didot
|
|
5077
|
-
"nc": 1370 / 107,
|
|
5078
|
-
// new cicero (12 new didot)
|
|
5079
|
-
"sp": 1 / 65536,
|
|
5080
|
-
// scaled point (TeX's internal smallest unit)
|
|
5081
|
-
// https://tex.stackexchange.com/a/41371
|
|
5082
|
-
"px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
|
|
5083
5071
|
|
|
5084
|
-
|
|
5072
|
+
var extraLatin = "\u00d0\u00de\u00fe";
|
|
5085
5073
|
|
|
5086
|
-
var
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5074
|
+
for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
|
|
5075
|
+
var _ch5 = extraLatin.charAt(_i5);
|
|
5076
|
+
|
|
5077
|
+
defineSymbol(math, main, mathord, _ch5, _ch5);
|
|
5078
|
+
defineSymbol(text, main, textord, _ch5, _ch5);
|
|
5079
|
+
}
|
|
5091
5080
|
|
|
5092
5081
|
/**
|
|
5093
|
-
*
|
|
5094
|
-
*
|
|
5082
|
+
* This file provides support for Unicode range U+1D400 to U+1D7FF,
|
|
5083
|
+
* Mathematical Alphanumeric Symbols.
|
|
5084
|
+
*
|
|
5085
|
+
* Function wideCharacterFont takes a wide character as input and returns
|
|
5086
|
+
* the font information necessary to render it properly.
|
|
5095
5087
|
*/
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
* Convert a "size" parse node (with numeric "number" and string "unit" fields,
|
|
5105
|
-
* as parsed by functions.js argType "size") into a CSS em value for the
|
|
5106
|
-
* current style/scale. `options` gives the current options.
|
|
5088
|
+
/**
|
|
5089
|
+
* Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf
|
|
5090
|
+
* That document sorts characters into groups by font type, say bold or italic.
|
|
5091
|
+
*
|
|
5092
|
+
* In the arrays below, each subarray consists three elements:
|
|
5093
|
+
* * The CSS class of that group when in math mode.
|
|
5094
|
+
* * The CSS class of that group when in text mode.
|
|
5095
|
+
* * The font name, so that KaTeX can get font metrics.
|
|
5107
5096
|
*/
|
|
5108
5097
|
|
|
5109
|
-
var
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5098
|
+
var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright
|
|
5099
|
+
["mathbf", "textbf", "Main-Bold"], // a-z bold upright
|
|
5100
|
+
["mathnormal", "textit", "Math-Italic"], // A-Z italic
|
|
5101
|
+
["mathnormal", "textit", "Math-Italic"], // a-z italic
|
|
5102
|
+
["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic
|
|
5103
|
+
["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic
|
|
5104
|
+
// Map fancy A-Z letters to script, not calligraphic.
|
|
5105
|
+
// This aligns with unicode-math and math fonts (except Cambria Math).
|
|
5106
|
+
["mathscr", "textscr", "Script-Regular"], // A-Z script
|
|
5107
|
+
["", "", ""], // a-z script. No font
|
|
5108
|
+
["", "", ""], // A-Z bold script. No font
|
|
5109
|
+
["", "", ""], // a-z bold script. No font
|
|
5110
|
+
["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur
|
|
5111
|
+
["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur
|
|
5112
|
+
["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck
|
|
5113
|
+
["mathbb", "textbb", "AMS-Regular"], // k double-struck
|
|
5114
|
+
["", "", ""], // A-Z bold Fraktur No font metrics
|
|
5115
|
+
["", "", ""], // a-z bold Fraktur. No font.
|
|
5116
|
+
["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif
|
|
5117
|
+
["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif
|
|
5118
|
+
["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif
|
|
5119
|
+
["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif
|
|
5120
|
+
["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif
|
|
5121
|
+
["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif
|
|
5122
|
+
["", "", ""], // A-Z bold italic sans. No font
|
|
5123
|
+
["", "", ""], // a-z bold italic sans. No font
|
|
5124
|
+
["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace
|
|
5125
|
+
["mathtt", "texttt", "Typewriter-Regular"] // a-z monospace
|
|
5126
|
+
];
|
|
5127
|
+
var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold
|
|
5128
|
+
["", "", ""], // 0-9 double-struck. No KaTeX font.
|
|
5129
|
+
["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif
|
|
5130
|
+
["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif
|
|
5131
|
+
["mathtt", "texttt", "Typewriter-Regular"] // 0-9 monospace
|
|
5132
|
+
];
|
|
5133
|
+
var wideCharacterFont = function wideCharacterFont(wideChar, mode) {
|
|
5134
|
+
// IE doesn't support codePointAt(). So work with the surrogate pair.
|
|
5135
|
+
var H = wideChar.charCodeAt(0); // high surrogate
|
|
5124
5136
|
|
|
5125
|
-
|
|
5126
|
-
// isTight() means current style is script/scriptscript.
|
|
5127
|
-
unitOptions = options.havingStyle(options.style.text());
|
|
5128
|
-
} else {
|
|
5129
|
-
unitOptions = options;
|
|
5130
|
-
} // TODO: In TeX these units are relative to the quad of the current
|
|
5131
|
-
// *text* font, e.g. cmr10. KaTeX instead uses values from the
|
|
5132
|
-
// comparably-sized *Computer Modern symbol* font. At 10pt, these
|
|
5133
|
-
// match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
|
|
5134
|
-
// cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
|
|
5135
|
-
// TeX \showlists shows a kern of 1.13889 * fontsize;
|
|
5136
|
-
// KaTeX shows a kern of 1.171 * fontsize.
|
|
5137
|
+
var L = wideChar.charCodeAt(1); // low surrogate
|
|
5137
5138
|
|
|
5139
|
+
var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;
|
|
5140
|
+
var j = mode === "math" ? 0 : 1; // column index for CSS class.
|
|
5138
5141
|
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5142
|
+
if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {
|
|
5143
|
+
// wideLatinLetterData contains exactly 26 chars on each row.
|
|
5144
|
+
// So we can calculate the relevant row. No traverse necessary.
|
|
5145
|
+
var i = Math.floor((codePoint - 0x1D400) / 26);
|
|
5146
|
+
return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
|
|
5147
|
+
} else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {
|
|
5148
|
+
// Numerals, ten per row.
|
|
5149
|
+
var _i = Math.floor((codePoint - 0x1D7CE) / 10);
|
|
5146
5150
|
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5151
|
+
return [wideNumeralData[_i][2], wideNumeralData[_i][j]];
|
|
5152
|
+
} else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {
|
|
5153
|
+
// dotless i or j
|
|
5154
|
+
return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
|
|
5155
|
+
} else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {
|
|
5156
|
+
// Greek letters. Not supported, yet.
|
|
5157
|
+
return ["", ""];
|
|
5158
|
+
} else {
|
|
5159
|
+
// We don't support any wide characters outside 1D400–1D7FF.
|
|
5160
|
+
throw new ParseError("Unsupported character: " + wideChar);
|
|
5150
5161
|
}
|
|
5151
|
-
|
|
5152
|
-
return Math.min(sizeValue.number * scale, options.maxSize);
|
|
5153
5162
|
};
|
|
5154
5163
|
|
|
5155
5164
|
/* eslint no-console:0 */
|
|
@@ -5454,7 +5463,7 @@ var makeSvgSpan = (classes, children, options, style) => new Span(classes, child
|
|
|
5454
5463
|
var makeLineSpan = function makeLineSpan(className, options, thickness) {
|
|
5455
5464
|
var line = makeSpan$2([className], [], options);
|
|
5456
5465
|
line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
|
|
5457
|
-
line.style.borderBottomWidth = line.height
|
|
5466
|
+
line.style.borderBottomWidth = makeEm(line.height);
|
|
5458
5467
|
line.maxFontSize = 1.0;
|
|
5459
5468
|
return line;
|
|
5460
5469
|
};
|
|
@@ -5594,7 +5603,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5594
5603
|
|
|
5595
5604
|
pstrutSize += 2;
|
|
5596
5605
|
var pstrut = makeSpan$2(["pstrut"], []);
|
|
5597
|
-
pstrut.style.height = pstrutSize
|
|
5606
|
+
pstrut.style.height = makeEm(pstrutSize); // Create a new list of actual children at the correct offsets
|
|
5598
5607
|
|
|
5599
5608
|
var realChildren = [];
|
|
5600
5609
|
var minPos = depth;
|
|
@@ -5611,7 +5620,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5611
5620
|
var classes = _child.wrapperClasses || [];
|
|
5612
5621
|
var style = _child.wrapperStyle || {};
|
|
5613
5622
|
var childWrap = makeSpan$2(classes, [pstrut, _elem], undefined, style);
|
|
5614
|
-
childWrap.style.top = -pstrutSize - currPos - _elem.depth
|
|
5623
|
+
childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);
|
|
5615
5624
|
|
|
5616
5625
|
if (_child.marginLeft) {
|
|
5617
5626
|
childWrap.style.marginLeft = _child.marginLeft;
|
|
@@ -5633,7 +5642,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5633
5642
|
|
|
5634
5643
|
|
|
5635
5644
|
var vlist = makeSpan$2(["vlist"], realChildren);
|
|
5636
|
-
vlist.style.height = maxPos
|
|
5645
|
+
vlist.style.height = makeEm(maxPos); // A second row is used if necessary to represent the vlist's depth.
|
|
5637
5646
|
|
|
5638
5647
|
var rows;
|
|
5639
5648
|
|
|
@@ -5645,7 +5654,7 @@ var makeVList = function makeVList(params, options) {
|
|
|
5645
5654
|
// So we put another empty span inside the depth strut span.
|
|
5646
5655
|
var emptySpan = makeSpan$2([], []);
|
|
5647
5656
|
var depthStrut = makeSpan$2(["vlist"], [emptySpan]);
|
|
5648
|
-
depthStrut.style.height = -minPos
|
|
5657
|
+
depthStrut.style.height = makeEm(-minPos); // Safari wants the first row to have inline content; otherwise it
|
|
5649
5658
|
// puts the bottom of the *second* row on the baseline.
|
|
5650
5659
|
|
|
5651
5660
|
var topStrut = makeSpan$2(["vlist-s"], [new SymbolNode("\u200b")]);
|
|
@@ -5672,7 +5681,7 @@ var makeGlue = (measurement, options) => {
|
|
|
5672
5681
|
// Make an empty span for the space
|
|
5673
5682
|
var rule = makeSpan$2(["mspace"], [], options);
|
|
5674
5683
|
var size = calculateSize(measurement, options);
|
|
5675
|
-
rule.style.marginRight = size
|
|
5684
|
+
rule.style.marginRight = makeEm(size);
|
|
5676
5685
|
return rule;
|
|
5677
5686
|
}; // Takes font options, and returns the appropriate fontLookup name
|
|
5678
5687
|
|
|
@@ -5791,17 +5800,17 @@ var staticSvg = function staticSvg(value, options) {
|
|
|
5791
5800
|
var [pathName, width, height] = svgData[value];
|
|
5792
5801
|
var path = new PathNode(pathName);
|
|
5793
5802
|
var svgNode = new SvgNode([path], {
|
|
5794
|
-
"width": width
|
|
5795
|
-
"height": height
|
|
5803
|
+
"width": makeEm(width),
|
|
5804
|
+
"height": makeEm(height),
|
|
5796
5805
|
// Override CSS rule `.katex svg { width: 100% }`
|
|
5797
|
-
"style": "width:" + width
|
|
5806
|
+
"style": "width:" + makeEm(width),
|
|
5798
5807
|
"viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
|
|
5799
5808
|
"preserveAspectRatio": "xMinYMin"
|
|
5800
5809
|
});
|
|
5801
5810
|
var span = makeSvgSpan(["overlay"], [svgNode], options);
|
|
5802
5811
|
span.height = height;
|
|
5803
|
-
span.style.height = height
|
|
5804
|
-
span.style.width = width
|
|
5812
|
+
span.style.height = makeEm(height);
|
|
5813
|
+
span.style.width = makeEm(width);
|
|
5805
5814
|
return span;
|
|
5806
5815
|
};
|
|
5807
5816
|
|
|
@@ -6285,10 +6294,10 @@ function buildHTMLUnbreakable(children, options) {
|
|
|
6285
6294
|
// falls at the depth of the expression.
|
|
6286
6295
|
|
|
6287
6296
|
var strut = makeSpan$1(["strut"]);
|
|
6288
|
-
strut.style.height = body.height + body.depth
|
|
6297
|
+
strut.style.height = makeEm(body.height + body.depth);
|
|
6289
6298
|
|
|
6290
6299
|
if (body.depth) {
|
|
6291
|
-
strut.style.verticalAlign = -body.depth
|
|
6300
|
+
strut.style.verticalAlign = makeEm(-body.depth);
|
|
6292
6301
|
}
|
|
6293
6302
|
|
|
6294
6303
|
body.children.unshift(strut);
|
|
@@ -6384,10 +6393,10 @@ function buildHTML(tree, options) {
|
|
|
6384
6393
|
|
|
6385
6394
|
if (tagChild) {
|
|
6386
6395
|
var strut = tagChild.children[0];
|
|
6387
|
-
strut.style.height = htmlNode.height + htmlNode.depth
|
|
6396
|
+
strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
|
|
6388
6397
|
|
|
6389
6398
|
if (htmlNode.depth) {
|
|
6390
|
-
strut.style.verticalAlign = -htmlNode.depth
|
|
6399
|
+
strut.style.verticalAlign = makeEm(-htmlNode.depth);
|
|
6391
6400
|
}
|
|
6392
6401
|
}
|
|
6393
6402
|
|
|
@@ -6587,7 +6596,7 @@ class SpaceNode {
|
|
|
6587
6596
|
return document.createTextNode(this.character);
|
|
6588
6597
|
} else {
|
|
6589
6598
|
var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
|
|
6590
|
-
node.setAttribute("width", this.width
|
|
6599
|
+
node.setAttribute("width", makeEm(this.width));
|
|
6591
6600
|
return node;
|
|
6592
6601
|
}
|
|
6593
6602
|
}
|
|
@@ -6600,7 +6609,7 @@ class SpaceNode {
|
|
|
6600
6609
|
if (this.character) {
|
|
6601
6610
|
return "<mtext>" + this.character + "</mtext>";
|
|
6602
6611
|
} else {
|
|
6603
|
-
return "<mspace width=\"" + this.width + "
|
|
6612
|
+
return "<mspace width=\"" + makeEm(this.width) + "\"/>";
|
|
6604
6613
|
}
|
|
6605
6614
|
}
|
|
6606
6615
|
/**
|
|
@@ -7116,7 +7125,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7116
7125
|
var path = new PathNode(pathName);
|
|
7117
7126
|
var svgNode = new SvgNode([path], {
|
|
7118
7127
|
"width": "100%",
|
|
7119
|
-
"height": _height
|
|
7128
|
+
"height": makeEm(_height),
|
|
7120
7129
|
"viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
|
|
7121
7130
|
"preserveAspectRatio": "none"
|
|
7122
7131
|
});
|
|
@@ -7156,7 +7165,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7156
7165
|
|
|
7157
7166
|
var _svgNode = new SvgNode([_path], {
|
|
7158
7167
|
"width": "400em",
|
|
7159
|
-
"height": _height2
|
|
7168
|
+
"height": makeEm(_height2),
|
|
7160
7169
|
"viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
|
|
7161
7170
|
"preserveAspectRatio": aligns[i] + " slice"
|
|
7162
7171
|
});
|
|
@@ -7170,7 +7179,7 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7170
7179
|
height: _height2
|
|
7171
7180
|
};
|
|
7172
7181
|
} else {
|
|
7173
|
-
_span.style.height = _height2
|
|
7182
|
+
_span.style.height = makeEm(_height2);
|
|
7174
7183
|
spans.push(_span);
|
|
7175
7184
|
}
|
|
7176
7185
|
}
|
|
@@ -7192,10 +7201,10 @@ var svgSpan = function svgSpan(group, options) {
|
|
|
7192
7201
|
// Any adjustments relative to the baseline must be done in buildHTML.
|
|
7193
7202
|
|
|
7194
7203
|
span.height = height;
|
|
7195
|
-
span.style.height = height
|
|
7204
|
+
span.style.height = makeEm(height);
|
|
7196
7205
|
|
|
7197
7206
|
if (minWidth > 0) {
|
|
7198
|
-
span.style.minWidth = minWidth
|
|
7207
|
+
span.style.minWidth = makeEm(minWidth);
|
|
7199
7208
|
}
|
|
7200
7209
|
|
|
7201
7210
|
return span;
|
|
@@ -7244,13 +7253,13 @@ var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options)
|
|
|
7244
7253
|
|
|
7245
7254
|
var svgNode = new SvgNode(lines, {
|
|
7246
7255
|
"width": "100%",
|
|
7247
|
-
"height": totalHeight
|
|
7256
|
+
"height": makeEm(totalHeight)
|
|
7248
7257
|
});
|
|
7249
7258
|
img = buildCommon.makeSvgSpan([], [svgNode], options);
|
|
7250
7259
|
}
|
|
7251
7260
|
|
|
7252
7261
|
img.height = totalHeight;
|
|
7253
|
-
img.style.height = totalHeight
|
|
7262
|
+
img.style.height = makeEm(totalHeight);
|
|
7254
7263
|
return img;
|
|
7255
7264
|
};
|
|
7256
7265
|
|
|
@@ -7411,7 +7420,7 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7411
7420
|
left -= width / 2;
|
|
7412
7421
|
}
|
|
7413
7422
|
|
|
7414
|
-
accentBody.style.left = left
|
|
7423
|
+
accentBody.style.left = makeEm(left); // \textcircled uses the \bigcirc glyph, so it needs some
|
|
7415
7424
|
// vertical adjustment to match LaTeX.
|
|
7416
7425
|
|
|
7417
7426
|
if (group.label === "\\textcircled") {
|
|
@@ -7443,8 +7452,8 @@ var htmlBuilder$a = (grp, options) => {
|
|
|
7443
7452
|
elem: accentBody,
|
|
7444
7453
|
wrapperClasses: ["svg-align"],
|
|
7445
7454
|
wrapperStyle: skew > 0 ? {
|
|
7446
|
-
width: "calc(100% - " + 2 * skew + "
|
|
7447
|
-
marginLeft: 2 * skew
|
|
7455
|
+
width: "calc(100% - " + makeEm(2 * skew) + ")",
|
|
7456
|
+
marginLeft: makeEm(2 * skew)
|
|
7448
7457
|
} : undefined
|
|
7449
7458
|
}]
|
|
7450
7459
|
}, options);
|
|
@@ -7983,7 +7992,7 @@ defineFunction({
|
|
|
7983
7992
|
var newOptions = options.havingStyle(options.style.sup());
|
|
7984
7993
|
var label = buildCommon.wrapFragment(buildGroup$1(group.label, newOptions, options), options);
|
|
7985
7994
|
label.classes.push("cd-label-" + group.side);
|
|
7986
|
-
label.style.bottom = 0.8 - label.depth
|
|
7995
|
+
label.style.bottom = makeEm(0.8 - label.depth); // Zero out label height & depth, so vertical align of arrow is set
|
|
7987
7996
|
// by the arrow height, not by the label.
|
|
7988
7997
|
|
|
7989
7998
|
label.height = 0;
|
|
@@ -8203,7 +8212,7 @@ defineFunction({
|
|
|
8203
8212
|
span.classes.push("newline");
|
|
8204
8213
|
|
|
8205
8214
|
if (group.size) {
|
|
8206
|
-
span.style.marginTop = calculateSize(group.size, options)
|
|
8215
|
+
span.style.marginTop = makeEm(calculateSize(group.size, options));
|
|
8207
8216
|
}
|
|
8208
8217
|
}
|
|
8209
8218
|
|
|
@@ -8217,7 +8226,7 @@ defineFunction({
|
|
|
8217
8226
|
node.setAttribute("linebreak", "newline");
|
|
8218
8227
|
|
|
8219
8228
|
if (group.size) {
|
|
8220
|
-
node.setAttribute("height", calculateSize(group.size, options)
|
|
8229
|
+
node.setAttribute("height", makeEm(calculateSize(group.size, options)));
|
|
8221
8230
|
}
|
|
8222
8231
|
}
|
|
8223
8232
|
|
|
@@ -8523,7 +8532,7 @@ var centerSpan = function centerSpan(span, options, style) {
|
|
|
8523
8532
|
var newOptions = options.havingBaseStyle(style);
|
|
8524
8533
|
var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
|
|
8525
8534
|
span.classes.push("delimcenter");
|
|
8526
|
-
span.style.top = shift
|
|
8535
|
+
span.style.top = makeEm(shift);
|
|
8527
8536
|
span.height -= shift;
|
|
8528
8537
|
span.depth += shift;
|
|
8529
8538
|
};
|
|
@@ -8596,20 +8605,20 @@ var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) {
|
|
|
8596
8605
|
|
|
8597
8606
|
var makeInner = function makeInner(ch, height, options) {
|
|
8598
8607
|
// Create a span with inline SVG for the inner part of a tall stacked delimiter.
|
|
8599
|
-
var width = fontMetricsData['Size4-Regular'][ch.charCodeAt(0)] ? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4]
|
|
8608
|
+
var width = fontMetricsData['Size4-Regular'][ch.charCodeAt(0)] ? fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4] : fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4];
|
|
8600
8609
|
var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height)));
|
|
8601
8610
|
var svgNode = new SvgNode([path], {
|
|
8602
|
-
"width": width
|
|
8603
|
-
"height": height
|
|
8611
|
+
"width": makeEm(width),
|
|
8612
|
+
"height": makeEm(height),
|
|
8604
8613
|
// Override CSS rule `.katex svg { width: 100% }`
|
|
8605
|
-
"style": "width:" + width
|
|
8614
|
+
"style": "width:" + makeEm(width),
|
|
8606
8615
|
"viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),
|
|
8607
8616
|
"preserveAspectRatio": "xMinYMin"
|
|
8608
8617
|
});
|
|
8609
8618
|
var span = buildCommon.makeSvgSpan([], [svgNode], options);
|
|
8610
8619
|
span.height = height;
|
|
8611
|
-
span.style.height = height
|
|
8612
|
-
span.style.width = width
|
|
8620
|
+
span.style.height = makeEm(height);
|
|
8621
|
+
span.style.width = makeEm(width);
|
|
8613
8622
|
return {
|
|
8614
8623
|
type: "elem",
|
|
8615
8624
|
elem: span
|
|
@@ -8818,7 +8827,7 @@ var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum,
|
|
|
8818
8827
|
var svg = new SvgNode([pathNode], {
|
|
8819
8828
|
// Note: 1000:1 ratio of viewBox to document em width.
|
|
8820
8829
|
"width": "400em",
|
|
8821
|
-
"height": height
|
|
8830
|
+
"height": makeEm(height),
|
|
8822
8831
|
"viewBox": "0 0 400000 " + viewBoxHeight,
|
|
8823
8832
|
"preserveAspectRatio": "xMinYMin slice"
|
|
8824
8833
|
});
|
|
@@ -8887,7 +8896,7 @@ var makeSqrtImage = function makeSqrtImage(height, options) {
|
|
|
8887
8896
|
}
|
|
8888
8897
|
|
|
8889
8898
|
span.height = texHeight;
|
|
8890
|
-
span.style.height = spanHeight
|
|
8899
|
+
span.style.height = makeEm(spanHeight);
|
|
8891
8900
|
return {
|
|
8892
8901
|
span,
|
|
8893
8902
|
advanceWidth,
|
|
@@ -9263,8 +9272,9 @@ defineFunction({
|
|
|
9263
9272
|
}
|
|
9264
9273
|
|
|
9265
9274
|
node.setAttribute("stretchy", "true");
|
|
9266
|
-
|
|
9267
|
-
node.setAttribute("
|
|
9275
|
+
var size = makeEm(delimiter.sizeToMaxHeight[group.size]);
|
|
9276
|
+
node.setAttribute("minsize", size);
|
|
9277
|
+
node.setAttribute("maxsize", size);
|
|
9268
9278
|
return node;
|
|
9269
9279
|
}
|
|
9270
9280
|
});
|
|
@@ -9511,19 +9521,19 @@ var htmlBuilder$8 = (group, options) => {
|
|
|
9511
9521
|
scale = scale / newOptions.sizeMultiplier;
|
|
9512
9522
|
var angleHeight = inner.height + inner.depth + lineWeight + clearance; // Reserve a left pad for the angle.
|
|
9513
9523
|
|
|
9514
|
-
inner.style.paddingLeft = angleHeight / 2 + lineWeight
|
|
9524
|
+
inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight); // Create an SVG
|
|
9515
9525
|
|
|
9516
9526
|
var viewBoxHeight = Math.floor(1000 * angleHeight * scale);
|
|
9517
9527
|
var path = phasePath(viewBoxHeight);
|
|
9518
9528
|
var svgNode = new SvgNode([new PathNode("phase", path)], {
|
|
9519
9529
|
"width": "400em",
|
|
9520
|
-
"height": viewBoxHeight / 1000
|
|
9530
|
+
"height": makeEm(viewBoxHeight / 1000),
|
|
9521
9531
|
"viewBox": "0 0 400000 " + viewBoxHeight,
|
|
9522
9532
|
"preserveAspectRatio": "xMinYMin slice"
|
|
9523
9533
|
}); // Wrap it in a span with overflow: hidden.
|
|
9524
9534
|
|
|
9525
9535
|
img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options);
|
|
9526
|
-
img.style.height = angleHeight
|
|
9536
|
+
img.style.height = makeEm(angleHeight);
|
|
9527
9537
|
imgShift = inner.depth + lineWeight + clearance;
|
|
9528
9538
|
} else {
|
|
9529
9539
|
// Add horizontal padding
|
|
@@ -9562,10 +9572,10 @@ var htmlBuilder$8 = (group, options) => {
|
|
|
9562
9572
|
|
|
9563
9573
|
if (/fbox|boxed|fcolorbox/.test(label)) {
|
|
9564
9574
|
img.style.borderStyle = "solid";
|
|
9565
|
-
img.style.borderWidth = ruleThickness
|
|
9575
|
+
img.style.borderWidth = makeEm(ruleThickness);
|
|
9566
9576
|
} else if (label === "angl" && ruleThickness !== 0.049) {
|
|
9567
|
-
img.style.borderTopWidth = ruleThickness
|
|
9568
|
-
img.style.borderRightWidth = ruleThickness
|
|
9577
|
+
img.style.borderTopWidth = makeEm(ruleThickness);
|
|
9578
|
+
img.style.borderRightWidth = makeEm(ruleThickness);
|
|
9569
9579
|
}
|
|
9570
9580
|
|
|
9571
9581
|
imgShift = inner.depth + bottomPad;
|
|
@@ -10190,22 +10200,22 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
|
|
|
10190
10200
|
// between them.
|
|
10191
10201
|
if (!firstSeparator) {
|
|
10192
10202
|
colSep = buildCommon.makeSpan(["arraycolsep"], []);
|
|
10193
|
-
colSep.style.width = options.fontMetrics().doubleRuleSep
|
|
10203
|
+
colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);
|
|
10194
10204
|
cols.push(colSep);
|
|
10195
10205
|
}
|
|
10196
10206
|
|
|
10197
10207
|
if (colDescr.separator === "|" || colDescr.separator === ":") {
|
|
10198
10208
|
var lineType = colDescr.separator === "|" ? "solid" : "dashed";
|
|
10199
10209
|
var separator = buildCommon.makeSpan(["vertical-separator"], [], options);
|
|
10200
|
-
separator.style.height = totalHeight
|
|
10201
|
-
separator.style.borderRightWidth = ruleThickness
|
|
10210
|
+
separator.style.height = makeEm(totalHeight);
|
|
10211
|
+
separator.style.borderRightWidth = makeEm(ruleThickness);
|
|
10202
10212
|
separator.style.borderRightStyle = lineType;
|
|
10203
|
-
separator.style.margin = "0
|
|
10213
|
+
separator.style.margin = "0 " + makeEm(-ruleThickness / 2);
|
|
10204
10214
|
|
|
10205
10215
|
var _shift = totalHeight - offset;
|
|
10206
10216
|
|
|
10207
10217
|
if (_shift) {
|
|
10208
|
-
separator.style.verticalAlign = -_shift
|
|
10218
|
+
separator.style.verticalAlign = makeEm(-_shift);
|
|
10209
10219
|
}
|
|
10210
10220
|
|
|
10211
10221
|
cols.push(separator);
|
|
@@ -10229,7 +10239,7 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
|
|
|
10229
10239
|
|
|
10230
10240
|
if (sepwidth !== 0) {
|
|
10231
10241
|
colSep = buildCommon.makeSpan(["arraycolsep"], []);
|
|
10232
|
-
colSep.style.width = sepwidth
|
|
10242
|
+
colSep.style.width = makeEm(sepwidth);
|
|
10233
10243
|
cols.push(colSep);
|
|
10234
10244
|
}
|
|
10235
10245
|
}
|
|
@@ -10267,7 +10277,7 @@ var htmlBuilder$7 = function htmlBuilder(group, options) {
|
|
|
10267
10277
|
|
|
10268
10278
|
if (sepwidth !== 0) {
|
|
10269
10279
|
colSep = buildCommon.makeSpan(["arraycolsep"], []);
|
|
10270
|
-
colSep.style.width = sepwidth
|
|
10280
|
+
colSep.style.width = makeEm(sepwidth);
|
|
10271
10281
|
cols.push(colSep);
|
|
10272
10282
|
}
|
|
10273
10283
|
}
|
|
@@ -10367,7 +10377,7 @@ var mathmlBuilder$6 = function mathmlBuilder(group, options) {
|
|
|
10367
10377
|
|
|
10368
10378
|
var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}
|
|
10369
10379
|
: 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
|
|
10370
|
-
table.setAttribute("rowspacing", gap
|
|
10380
|
+
table.setAttribute("rowspacing", makeEm(gap)); // MathML table lines go only between cells.
|
|
10371
10381
|
// To place a line on an edge we'll use <menclose>, if necessary.
|
|
10372
10382
|
|
|
10373
10383
|
var menclose = "";
|
|
@@ -11453,7 +11463,7 @@ var mathmlBuilder$3 = (group, options) => {
|
|
|
11453
11463
|
node.setAttribute("linethickness", "0px");
|
|
11454
11464
|
} else if (group.barSize) {
|
|
11455
11465
|
var ruleWidth = calculateSize(group.barSize, options);
|
|
11456
|
-
node.setAttribute("linethickness", ruleWidth
|
|
11466
|
+
node.setAttribute("linethickness", makeEm(ruleWidth));
|
|
11457
11467
|
}
|
|
11458
11468
|
|
|
11459
11469
|
var style = adjustStyle(group.size, options.style);
|
|
@@ -12316,7 +12326,6 @@ defineFunction({
|
|
|
12316
12326
|
|
|
12317
12327
|
if (group.totalheight.number > 0) {
|
|
12318
12328
|
depth = calculateSize(group.totalheight, options) - height;
|
|
12319
|
-
depth = Number(depth.toFixed(2));
|
|
12320
12329
|
}
|
|
12321
12330
|
|
|
12322
12331
|
var width = 0;
|
|
@@ -12326,15 +12335,15 @@ defineFunction({
|
|
|
12326
12335
|
}
|
|
12327
12336
|
|
|
12328
12337
|
var style = {
|
|
12329
|
-
height: height + depth
|
|
12338
|
+
height: makeEm(height + depth)
|
|
12330
12339
|
};
|
|
12331
12340
|
|
|
12332
12341
|
if (width > 0) {
|
|
12333
|
-
style.width = width
|
|
12342
|
+
style.width = makeEm(width);
|
|
12334
12343
|
}
|
|
12335
12344
|
|
|
12336
12345
|
if (depth > 0) {
|
|
12337
|
-
style.verticalAlign = -depth
|
|
12346
|
+
style.verticalAlign = makeEm(-depth);
|
|
12338
12347
|
}
|
|
12339
12348
|
|
|
12340
12349
|
var node = new Img(group.src, group.alt, style);
|
|
@@ -12350,15 +12359,14 @@ defineFunction({
|
|
|
12350
12359
|
|
|
12351
12360
|
if (group.totalheight.number > 0) {
|
|
12352
12361
|
depth = calculateSize(group.totalheight, options) - height;
|
|
12353
|
-
|
|
12354
|
-
node.setAttribute("valign", "-" + depth + "em");
|
|
12362
|
+
node.setAttribute("valign", makeEm(-depth));
|
|
12355
12363
|
}
|
|
12356
12364
|
|
|
12357
|
-
node.setAttribute("height", height + depth
|
|
12365
|
+
node.setAttribute("height", makeEm(height + depth));
|
|
12358
12366
|
|
|
12359
12367
|
if (group.width.number > 0) {
|
|
12360
12368
|
var width = calculateSize(group.width, options);
|
|
12361
|
-
node.setAttribute("width", width
|
|
12369
|
+
node.setAttribute("width", makeEm(width));
|
|
12362
12370
|
}
|
|
12363
12371
|
|
|
12364
12372
|
node.setAttribute("src", group.src);
|
|
@@ -12466,10 +12474,10 @@ defineFunction({
|
|
|
12466
12474
|
// This code resolved issue #1153
|
|
12467
12475
|
|
|
12468
12476
|
var strut = buildCommon.makeSpan(["strut"]);
|
|
12469
|
-
strut.style.height = node.height + node.depth
|
|
12477
|
+
strut.style.height = makeEm(node.height + node.depth);
|
|
12470
12478
|
|
|
12471
12479
|
if (node.depth) {
|
|
12472
|
-
strut.style.verticalAlign = -node.depth
|
|
12480
|
+
strut.style.verticalAlign = makeEm(-node.depth);
|
|
12473
12481
|
}
|
|
12474
12482
|
|
|
12475
12483
|
node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
|
|
@@ -12588,7 +12596,6 @@ defineFunction({
|
|
|
12588
12596
|
}
|
|
12589
12597
|
});
|
|
12590
12598
|
|
|
12591
|
-
// For an operator with limits, assemble the base, sup, and sub into a span.
|
|
12592
12599
|
var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift) => {
|
|
12593
12600
|
base = buildCommon.makeSpan([], [base]);
|
|
12594
12601
|
var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup);
|
|
@@ -12628,7 +12635,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
12628
12635
|
}, {
|
|
12629
12636
|
type: "elem",
|
|
12630
12637
|
elem: sub.elem,
|
|
12631
|
-
marginLeft: -slant
|
|
12638
|
+
marginLeft: makeEm(-slant)
|
|
12632
12639
|
}, {
|
|
12633
12640
|
type: "kern",
|
|
12634
12641
|
size: sub.kern
|
|
@@ -12641,7 +12648,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
12641
12648
|
}, {
|
|
12642
12649
|
type: "elem",
|
|
12643
12650
|
elem: sup.elem,
|
|
12644
|
-
marginLeft: slant
|
|
12651
|
+
marginLeft: makeEm(slant)
|
|
12645
12652
|
}, {
|
|
12646
12653
|
type: "kern",
|
|
12647
12654
|
size: options.fontMetrics().bigOpSpacing5
|
|
@@ -12662,7 +12669,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
12662
12669
|
}, {
|
|
12663
12670
|
type: "elem",
|
|
12664
12671
|
elem: sub.elem,
|
|
12665
|
-
marginLeft: -slant
|
|
12672
|
+
marginLeft: makeEm(-slant)
|
|
12666
12673
|
}, {
|
|
12667
12674
|
type: "kern",
|
|
12668
12675
|
size: sub.kern
|
|
@@ -12686,7 +12693,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
12686
12693
|
}, {
|
|
12687
12694
|
type: "elem",
|
|
12688
12695
|
elem: sup.elem,
|
|
12689
|
-
marginLeft: slant
|
|
12696
|
+
marginLeft: makeEm(slant)
|
|
12690
12697
|
}, {
|
|
12691
12698
|
type: "kern",
|
|
12692
12699
|
size: options.fontMetrics().bigOpSpacing5
|
|
@@ -12705,7 +12712,7 @@ var assembleSupSub = (base, supGroup, subGroup, options, style, slant, baseShift
|
|
|
12705
12712
|
// A negative margin-left was applied to the lower limit.
|
|
12706
12713
|
// Avoid an overlap by placing a spacer on the left on the group.
|
|
12707
12714
|
var spacer = buildCommon.makeSpan(["mspace"], [], options);
|
|
12708
|
-
spacer.style.marginRight = slant
|
|
12715
|
+
spacer.style.marginRight = makeEm(slant);
|
|
12709
12716
|
parts.unshift(spacer);
|
|
12710
12717
|
}
|
|
12711
12718
|
|
|
@@ -12826,7 +12833,7 @@ var htmlBuilder$2 = (grp, options) => {
|
|
|
12826
12833
|
} else {
|
|
12827
12834
|
if (baseShift) {
|
|
12828
12835
|
base.style.position = "relative";
|
|
12829
|
-
base.style.top = baseShift
|
|
12836
|
+
base.style.top = makeEm(baseShift);
|
|
12830
12837
|
}
|
|
12831
12838
|
|
|
12832
12839
|
return base;
|
|
@@ -13453,9 +13460,9 @@ defineFunction({
|
|
|
13453
13460
|
var height = calculateSize(group.height, options);
|
|
13454
13461
|
var shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size
|
|
13455
13462
|
|
|
13456
|
-
rule.style.borderRightWidth = width
|
|
13457
|
-
rule.style.borderTopWidth = height
|
|
13458
|
-
rule.style.bottom = shift
|
|
13463
|
+
rule.style.borderRightWidth = makeEm(width);
|
|
13464
|
+
rule.style.borderTopWidth = makeEm(height);
|
|
13465
|
+
rule.style.bottom = makeEm(shift); // Record the height and width
|
|
13459
13466
|
|
|
13460
13467
|
rule.width = width;
|
|
13461
13468
|
rule.height = height + shift;
|
|
@@ -13474,18 +13481,18 @@ defineFunction({
|
|
|
13474
13481
|
var color = options.color && options.getColor() || "black";
|
|
13475
13482
|
var rule = new mathMLTree.MathNode("mspace");
|
|
13476
13483
|
rule.setAttribute("mathbackground", color);
|
|
13477
|
-
rule.setAttribute("width", width
|
|
13478
|
-
rule.setAttribute("height", height
|
|
13484
|
+
rule.setAttribute("width", makeEm(width));
|
|
13485
|
+
rule.setAttribute("height", makeEm(height));
|
|
13479
13486
|
var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
|
|
13480
13487
|
|
|
13481
13488
|
if (shift >= 0) {
|
|
13482
|
-
wrapper.setAttribute("height",
|
|
13489
|
+
wrapper.setAttribute("height", makeEm(shift));
|
|
13483
13490
|
} else {
|
|
13484
|
-
wrapper.setAttribute("height", shift
|
|
13485
|
-
wrapper.setAttribute("depth",
|
|
13491
|
+
wrapper.setAttribute("height", makeEm(shift));
|
|
13492
|
+
wrapper.setAttribute("depth", makeEm(-shift));
|
|
13486
13493
|
}
|
|
13487
13494
|
|
|
13488
|
-
wrapper.setAttribute("voffset", shift
|
|
13495
|
+
wrapper.setAttribute("voffset", makeEm(shift));
|
|
13489
13496
|
return wrapper;
|
|
13490
13497
|
}
|
|
13491
13498
|
|
|
@@ -13554,7 +13561,7 @@ defineFunction({
|
|
|
13554
13561
|
// that we're passing an options parameter we should be able to fix
|
|
13555
13562
|
// this.
|
|
13556
13563
|
|
|
13557
|
-
node.setAttribute("mathsize", newOptions.sizeMultiplier
|
|
13564
|
+
node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier));
|
|
13558
13565
|
return node;
|
|
13559
13566
|
}
|
|
13560
13567
|
});
|
|
@@ -13729,7 +13736,7 @@ defineFunction({
|
|
|
13729
13736
|
|
|
13730
13737
|
|
|
13731
13738
|
var imgShift = img.height - inner.height - lineClearance - ruleWidth;
|
|
13732
|
-
inner.style.paddingLeft = advanceWidth
|
|
13739
|
+
inner.style.paddingLeft = makeEm(advanceWidth); // Overlay the image and the argument.
|
|
13733
13740
|
|
|
13734
13741
|
var body = buildCommon.makeVList({
|
|
13735
13742
|
positionType: "firstBaseline",
|
|
@@ -13943,7 +13950,7 @@ defineFunctionBuilders({
|
|
|
13943
13950
|
|
|
13944
13951
|
|
|
13945
13952
|
var multiplier = options.sizeMultiplier;
|
|
13946
|
-
var marginRight = 0.5 / metrics.ptPerEm / multiplier
|
|
13953
|
+
var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier);
|
|
13947
13954
|
var marginLeft = null;
|
|
13948
13955
|
|
|
13949
13956
|
if (subm) {
|
|
@@ -13954,7 +13961,7 @@ defineFunctionBuilders({
|
|
|
13954
13961
|
|
|
13955
13962
|
if (base instanceof SymbolNode || isOiint) {
|
|
13956
13963
|
// $FlowFixMe
|
|
13957
|
-
marginLeft = -base.italic
|
|
13964
|
+
marginLeft = makeEm(-base.italic);
|
|
13958
13965
|
}
|
|
13959
13966
|
}
|
|
13960
13967
|
|
|
@@ -15369,7 +15376,7 @@ defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5e
|
|
|
15369
15376
|
// We compute the corresponding \raisebox when A is rendered in \normalsize
|
|
15370
15377
|
// \scriptstyle, which has a scale factor of 0.7 (see Options.js).
|
|
15371
15378
|
|
|
15372
|
-
var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1]
|
|
15379
|
+
var latexRaiseA = makeEm(fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1]);
|
|
15373
15380
|
defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo
|
|
15374
15381
|
|
|
15375
15382
|
defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
|
|
@@ -17739,7 +17746,7 @@ var katex = {
|
|
|
17739
17746
|
/**
|
|
17740
17747
|
* Current KaTeX version
|
|
17741
17748
|
*/
|
|
17742
|
-
version: "0.13.
|
|
17749
|
+
version: "0.13.24",
|
|
17743
17750
|
|
|
17744
17751
|
/**
|
|
17745
17752
|
* Renders the given LaTeX into an HTML+MathML combination, and adds
|