| 1 |
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ |
| 2 |
/* vim: set ts=2 et sw=2 tw=80: */ |
| 3 |
|
| 4 |
/************************************************************* |
| 5 |
* |
| 6 |
* MathJax/jax/element/mml/jax.js |
| 7 |
* |
| 8 |
* Implements the MML ElementJax that holds the internal represetation |
| 9 |
* of the mathematics on the page. Various InputJax will produce this |
| 10 |
* format, and the OutputJax will display it in various formats. |
| 11 |
* |
| 12 |
* --------------------------------------------------------------------- |
| 13 |
* |
| 14 |
* Copyright (c) 2009-2020 The MathJax Consortium |
| 15 |
* |
| 16 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 17 |
* you may not use this file except in compliance with the License. |
| 18 |
* You may obtain a copy of the License at |
| 19 |
* |
| 20 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 21 |
* |
| 22 |
* Unless required by applicable law or agreed to in writing, software |
| 23 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 24 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 25 |
* See the License for the specific language governing permissions and |
| 26 |
* limitations under the License. |
| 27 |
*/ |
| 28 |
|
| 29 |
MathJax.ElementJax.mml = MathJax.ElementJax({ |
| 30 |
mimeType: "jax/mml" |
| 31 |
},{ |
| 32 |
id: "mml", |
| 33 |
version: "2.7.9", |
| 34 |
directory: MathJax.ElementJax.directory + "/mml", |
| 35 |
extensionDir: MathJax.ElementJax.extensionDir + "/mml", |
| 36 |
optableDir: MathJax.ElementJax.directory + "/mml/optable" |
| 37 |
}); |
| 38 |
|
| 39 |
MathJax.ElementJax.mml.Augment({ |
| 40 |
Init: function () { |
| 41 |
if (arguments.length === 1 && arguments[0].type === "math") {this.root = arguments[0]} |
| 42 |
else {this.root = MathJax.ElementJax.mml.math.apply(this,arguments)} |
| 43 |
if (this.root.attr && this.root.attr.mode) { |
| 44 |
if (!this.root.display && this.root.attr.mode === "display") { |
| 45 |
this.root.display = "block"; |
| 46 |
this.root.attrNames.push("display"); |
| 47 |
} |
| 48 |
delete this.root.attr.mode; |
| 49 |
for (var i = 0, m = this.root.attrNames.length; i < m; i++) { |
| 50 |
if (this.root.attrNames[i] === "mode") {this.root.attrNames.splice(i,1); break} |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
},{ |
| 55 |
INHERIT: "_inherit_", |
| 56 |
AUTO: "_auto_", |
| 57 |
SIZE: { |
| 58 |
INFINITY: "infinity", |
| 59 |
SMALL: "small", |
| 60 |
NORMAL: "normal", |
| 61 |
BIG: "big" |
| 62 |
}, |
| 63 |
COLOR: { |
| 64 |
TRANSPARENT: "transparent" |
| 65 |
}, |
| 66 |
VARIANT: { |
| 67 |
NORMAL: "normal", |
| 68 |
BOLD: "bold", |
| 69 |
ITALIC: "italic", |
| 70 |
BOLDITALIC: "bold-italic", |
| 71 |
DOUBLESTRUCK: "double-struck", |
| 72 |
FRAKTUR: "fraktur", |
| 73 |
BOLDFRAKTUR: "bold-fraktur", |
| 74 |
SCRIPT: "script", |
| 75 |
BOLDSCRIPT: "bold-script", |
| 76 |
SANSSERIF: "sans-serif", |
| 77 |
BOLDSANSSERIF: "bold-sans-serif", |
| 78 |
SANSSERIFITALIC: "sans-serif-italic", |
| 79 |
SANSSERIFBOLDITALIC: "sans-serif-bold-italic", |
| 80 |
MONOSPACE: "monospace", |
| 81 |
INITIAL: "initial", |
| 82 |
TAILED: "tailed", |
| 83 |
LOOPED: "looped", |
| 84 |
STRETCHED: "stretched", |
| 85 |
CALIGRAPHIC: "-tex-caligraphic", |
| 86 |
OLDSTYLE: "-tex-oldstyle" |
| 87 |
}, |
| 88 |
FORM: { |
| 89 |
PREFIX: "prefix", |
| 90 |
INFIX: "infix", |
| 91 |
POSTFIX: "postfix" |
| 92 |
}, |
| 93 |
LINEBREAK: { |
| 94 |
AUTO: "auto", |
| 95 |
NEWLINE: "newline", |
| 96 |
NOBREAK: "nobreak", |
| 97 |
GOODBREAK: "goodbreak", |
| 98 |
BADBREAK: "badbreak" |
| 99 |
}, |
| 100 |
LINEBREAKSTYLE: { |
| 101 |
BEFORE: "before", |
| 102 |
AFTER: "after", |
| 103 |
DUPLICATE: "duplicate", |
| 104 |
INFIXLINBREAKSTYLE: "infixlinebreakstyle" |
| 105 |
}, |
| 106 |
INDENTALIGN: { |
| 107 |
LEFT: "left", |
| 108 |
CENTER: "center", |
| 109 |
RIGHT: "right", |
| 110 |
AUTO: "auto", |
| 111 |
ID: "id", |
| 112 |
INDENTALIGN: "indentalign" |
| 113 |
}, |
| 114 |
INDENTSHIFT: { |
| 115 |
INDENTSHIFT: "indentshift" |
| 116 |
}, |
| 117 |
LINETHICKNESS: { |
| 118 |
THIN: "thin", |
| 119 |
MEDIUM: "medium", |
| 120 |
THICK: "thick" |
| 121 |
}, |
| 122 |
NOTATION: { |
| 123 |
LONGDIV: "longdiv", |
| 124 |
ACTUARIAL: "actuarial", |
| 125 |
RADICAL: "radical", |
| 126 |
BOX: "box", |
| 127 |
ROUNDEDBOX: "roundedbox", |
| 128 |
CIRCLE: "circle", |
| 129 |
LEFT: "left", |
| 130 |
RIGHT: "right", |
| 131 |
TOP: "top", |
| 132 |
BOTTOM: "bottom", |
| 133 |
UPDIAGONALSTRIKE: "updiagonalstrike", |
| 134 |
DOWNDIAGONALSTRIKE: "downdiagonalstrike", |
| 135 |
UPDIAGONALARROW: "updiagonalarrow", |
| 136 |
VERTICALSTRIKE: "verticalstrike", |
| 137 |
HORIZONTALSTRIKE: "horizontalstrike", |
| 138 |
PHASORANGLE: "phasorangle", |
| 139 |
MADRUWB: "madruwb" |
| 140 |
}, |
| 141 |
ALIGN: { |
| 142 |
TOP: "top", |
| 143 |
BOTTOM: "bottom", |
| 144 |
CENTER: "center", |
| 145 |
BASELINE: "baseline", |
| 146 |
AXIS: "axis", |
| 147 |
LEFT: "left", |
| 148 |
RIGHT: "right" |
| 149 |
}, |
| 150 |
LINES: { |
| 151 |
NONE: "none", |
| 152 |
SOLID: "solid", |
| 153 |
DASHED: "dashed" |
| 154 |
}, |
| 155 |
SIDE: { |
| 156 |
LEFT: "left", |
| 157 |
RIGHT: "right", |
| 158 |
LEFTOVERLAP: "leftoverlap", |
| 159 |
RIGHTOVERLAP: "rightoverlap" |
| 160 |
}, |
| 161 |
WIDTH: { |
| 162 |
AUTO: "auto", |
| 163 |
FIT: "fit" |
| 164 |
}, |
| 165 |
ACTIONTYPE: { |
| 166 |
TOGGLE: "toggle", |
| 167 |
STATUSLINE: "statusline", |
| 168 |
TOOLTIP: "tooltip", |
| 169 |
INPUT: "input" |
| 170 |
}, |
| 171 |
LENGTH: { |
| 172 |
VERYVERYTHINMATHSPACE: "veryverythinmathspace", |
| 173 |
VERYTHINMATHSPACE: "verythinmathspace", |
| 174 |
THINMATHSPACE: "thinmathspace", |
| 175 |
MEDIUMMATHSPACE: "mediummathspace", |
| 176 |
THICKMATHSPACE: "thickmathspace", |
| 177 |
VERYTHICKMATHSPACE: "verythickmathspace", |
| 178 |
VERYVERYTHICKMATHSPACE: "veryverythickmathspace", |
| 179 |
NEGATIVEVERYVERYTHINMATHSPACE: "negativeveryverythinmathspace", |
| 180 |
NEGATIVEVERYTHINMATHSPACE: "negativeverythinmathspace", |
| 181 |
NEGATIVETHINMATHSPACE: "negativethinmathspace", |
| 182 |
NEGATIVEMEDIUMMATHSPACE: "negativemediummathspace", |
| 183 |
NEGATIVETHICKMATHSPACE: "negativethickmathspace", |
| 184 |
NEGATIVEVERYTHICKMATHSPACE: "negativeverythickmathspace", |
| 185 |
NEGATIVEVERYVERYTHICKMATHSPACE: "negativeveryverythickmathspace" |
| 186 |
}, |
| 187 |
OVERFLOW: { |
| 188 |
LINBREAK: "linebreak", |
| 189 |
SCROLL: "scroll", |
| 190 |
ELIDE: "elide", |
| 191 |
TRUNCATE: "truncate", |
| 192 |
SCALE: "scale" |
| 193 |
}, |
| 194 |
UNIT: { |
| 195 |
EM: "em", |
| 196 |
EX: "ex", |
| 197 |
PX: "px", |
| 198 |
IN: "in", |
| 199 |
CM: "cm", |
| 200 |
MM: "mm", |
| 201 |
PT: "pt", |
| 202 |
PC: "pc" |
| 203 |
}, |
| 204 |
TEXCLASS: { |
| 205 |
ORD: 0, |
| 206 |
OP: 1, |
| 207 |
BIN: 2, |
| 208 |
REL: 3, |
| 209 |
OPEN: 4, |
| 210 |
CLOSE: 5, |
| 211 |
PUNCT: 6, |
| 212 |
INNER: 7, |
| 213 |
VCENTER: 8, |
| 214 |
NONE: -1 |
| 215 |
}, |
| 216 |
TEXCLASSNAMES: ["ORD", "OP", "BIN", "REL", "OPEN", "CLOSE", "PUNCT", "INNER", "VCENTER"], |
| 217 |
skipAttributes: { |
| 218 |
texClass:true, useHeight:true, texprimestyle:true |
| 219 |
}, |
| 220 |
copyAttributes: { |
| 221 |
displaystyle:1, scriptlevel:1, open:1, close:1, form:1, |
| 222 |
actiontype: 1, |
| 223 |
fontfamily:true, fontsize:true, fontweight:true, fontstyle:true, |
| 224 |
color:true, background:true, |
| 225 |
id:true, "class":1, href:true, style:true |
| 226 |
}, |
| 227 |
copyAttributeNames: [ |
| 228 |
"displaystyle", "scriptlevel", "open", "close", "form", // force these to be copied |
| 229 |
"actiontype", |
| 230 |
"fontfamily", "fontsize", "fontweight", "fontstyle", |
| 231 |
"color", "background", |
| 232 |
"id", "class", "href", "style" |
| 233 |
], |
| 234 |
nocopyAttributes: { |
| 235 |
fontfamily: true, fontsize: true, fontweight: true, fontstyle: true, |
| 236 |
color: true, background: true, |
| 237 |
id: true, 'class': true, href: true, style: true, |
| 238 |
xmlns: true |
| 239 |
}, |
| 240 |
Error: function (message,def) { |
| 241 |
var mml = this.merror(message), |
| 242 |
dir = MathJax.Localization.fontDirection(), |
| 243 |
font = MathJax.Localization.fontFamily(); |
| 244 |
if (def) {mml = mml.With(def)} |
| 245 |
if (dir || font) { |
| 246 |
mml = this.mstyle(mml); |
| 247 |
if (dir) {mml.dir = dir} |
| 248 |
if (font) {mml.style.fontFamily = "font-family: "+font} |
| 249 |
} |
| 250 |
return mml; |
| 251 |
} |
| 252 |
}); |
| 253 |
|
| 254 |
(function (MML) { |
| 255 |
|
| 256 |
MML.mbase = MathJax.Object.Subclass({ |
| 257 |
type: "base", isToken: false, |
| 258 |
defaults: { |
| 259 |
mathbackground: MML.INHERIT, |
| 260 |
mathcolor: MML.INHERIT, |
| 261 |
dir: MML.INHERIT |
| 262 |
}, |
| 263 |
noInherit: {}, |
| 264 |
noInheritAttribute: { |
| 265 |
texClass: true |
| 266 |
}, |
| 267 |
getRemoved: {}, |
| 268 |
linebreakContainer: false, |
| 269 |
|
| 270 |
Init: function () { |
| 271 |
this.data = []; |
| 272 |
if (this.inferRow && !(arguments.length === 1 && arguments[0].inferred)) |
| 273 |
{this.Append(MML.mrow().With({inferred: true, notParent: true}))} |
| 274 |
this.Append.apply(this,arguments); |
| 275 |
}, |
| 276 |
With: function (def) { |
| 277 |
for (var id in def) {if (def.hasOwnProperty(id)) {this[id] = def[id]}} |
| 278 |
return this; |
| 279 |
}, |
| 280 |
Append: function () { |
| 281 |
if (this.inferRow && this.data.length) { |
| 282 |
this.data[0].Append.apply(this.data[0],arguments); |
| 283 |
} else { |
| 284 |
for (var i = 0, m = arguments.length; i < m; i++) |
| 285 |
{this.SetData(this.data.length,arguments[i])} |
| 286 |
} |
| 287 |
}, |
| 288 |
SetData: function (i,item) { |
| 289 |
if (item != null) { |
| 290 |
if (!(item instanceof MML.mbase)) |
| 291 |
{item = (this.isToken || this.isChars ? MML.chars(item) : MML.mtext(item))} |
| 292 |
item.parent = this; |
| 293 |
item.setInherit(this.inheritFromMe ? this : this.inherit); |
| 294 |
} |
| 295 |
this.data[i] = item; |
| 296 |
}, |
| 297 |
Parent: function () { |
| 298 |
var parent = this.parent; |
| 299 |
while (parent && parent.notParent) {parent = parent.parent} |
| 300 |
return parent; |
| 301 |
}, |
| 302 |
Get: function (name,nodefault,noself) { |
| 303 |
if (!noself) { |
| 304 |
if (this[name] != null) {return this[name]} |
| 305 |
if (this.attr && this.attr[name] != null) {return this.attr[name]} |
| 306 |
} |
| 307 |
// FIXME: should cache these values and get from cache |
| 308 |
// (clear cache when appended to a new object?) |
| 309 |
var parent = this.Parent(); |
| 310 |
if (parent && parent["adjustChild_"+name] != null) { |
| 311 |
return (parent["adjustChild_"+name])(this.childPosition(),nodefault); |
| 312 |
} |
| 313 |
var obj = this.inherit; var root = obj; |
| 314 |
while (obj) { |
| 315 |
var value = obj[name]; if (value == null && obj.attr) {value = obj.attr[name]} |
| 316 |
if (obj.removedStyles && obj.getRemoved[name] && value == null) value = obj.removedStyles[obj.getRemoved[name]]; |
| 317 |
if (value != null && obj.noInheritAttribute && !obj.noInheritAttribute[name]) { |
| 318 |
var noInherit = obj.noInherit[this.type]; |
| 319 |
if (!(noInherit && noInherit[name])) {return value} |
| 320 |
} |
| 321 |
root = obj; obj = obj.inherit; |
| 322 |
} |
| 323 |
if (!nodefault) { |
| 324 |
if (this.defaults[name] === MML.AUTO) {return this.autoDefault(name)} |
| 325 |
if (this.defaults[name] !== MML.INHERIT && this.defaults[name] != null) |
| 326 |
{return this.defaults[name]} |
| 327 |
if (root) {return root.defaults[name]} |
| 328 |
} |
| 329 |
return null; |
| 330 |
}, |
| 331 |
hasValue: function (name) {return (this.Get(name,true) != null)}, |
| 332 |
getValues: function () { |
| 333 |
var values = {}; |
| 334 |
for (var i = 0, m = arguments.length; i < m; i++) |
| 335 |
{values[arguments[i]] = this.Get(arguments[i])} |
| 336 |
return values; |
| 337 |
}, |
| 338 |
adjustChild_scriptlevel: function (i,nodef) {return this.Get("scriptlevel",nodef)}, // always inherit from parent |
| 339 |
adjustChild_displaystyle: function (i,nodef) {return this.Get("displaystyle",nodef)}, // always inherit from parent |
| 340 |
adjustChild_texprimestyle: function (i,nodef) {return this.Get("texprimestyle",nodef)}, // always inherit from parent |
| 341 |
hasMMLspacing: function () {return false}, |
| 342 |
childPosition: function () { |
| 343 |
var child = this, parent = child.parent; |
| 344 |
while (parent.notParent) {child = parent; parent = child.parent} |
| 345 |
for (var i = 0, m = parent.data.length; i < m; i++) {if (parent.data[i] === child) {return i}} |
| 346 |
return null; |
| 347 |
}, |
| 348 |
setInherit: function (obj) { |
| 349 |
if (obj !== this.inherit && this.inherit == null) { |
| 350 |
this.inherit = obj; |
| 351 |
for (var i = 0, m = this.data.length; i < m; i++) { |
| 352 |
if (this.data[i] && this.data[i].setInherit) {this.data[i].setInherit(obj)} |
| 353 |
} |
| 354 |
} |
| 355 |
}, |
| 356 |
setTeXclass: function (prev) { |
| 357 |
this.getPrevClass(prev); |
| 358 |
return (typeof(this.texClass) !== "undefined" ? this : prev); |
| 359 |
}, |
| 360 |
getPrevClass: function (prev) { |
| 361 |
if (prev) { |
| 362 |
this.prevClass = prev.Get("texClass"); |
| 363 |
this.prevLevel = prev.Get("scriptlevel"); |
| 364 |
} |
| 365 |
}, |
| 366 |
updateTeXclass: function (core) { |
| 367 |
if (core) { |
| 368 |
this.prevClass = core.prevClass; delete core.prevClass; |
| 369 |
this.prevLevel = core.prevLevel; delete core.prevLevel; |
| 370 |
this.texClass = core.Get("texClass"); |
| 371 |
} |
| 372 |
}, |
| 373 |
texSpacing: function () { |
| 374 |
var prev = (this.prevClass != null ? this.prevClass : MML.TEXCLASS.NONE); |
| 375 |
var tex = (this.Get("texClass") || MML.TEXCLASS.ORD); |
| 376 |
if (prev === MML.TEXCLASS.NONE || tex === MML.TEXCLASS.NONE) {return ""} |
| 377 |
if (prev === MML.TEXCLASS.VCENTER) {prev = MML.TEXCLASS.ORD} |
| 378 |
if (tex === MML.TEXCLASS.VCENTER) {tex = MML.TEXCLASS.ORD} |
| 379 |
var space = this.TEXSPACE[prev][tex]; |
| 380 |
if ((this.prevLevel > 0 || this.Get("scriptlevel") > 0) && space >= 0) {return ""} |
| 381 |
return this.TEXSPACELENGTH[Math.abs(space)]; |
| 382 |
}, |
| 383 |
TEXSPACELENGTH:[ |
| 384 |
"", |
| 385 |
MML.LENGTH.THINMATHSPACE, |
| 386 |
MML.LENGTH.MEDIUMMATHSPACE, |
| 387 |
MML.LENGTH.THICKMATHSPACE |
| 388 |
], |
| 389 |
// See TeXBook Chapter 18 (p. 170) |
| 390 |
TEXSPACE: [ |
| 391 |
[ 0,-1, 2, 3, 0, 0, 0, 1], // ORD |
| 392 |
[-1,-1, 0, 3, 0, 0, 0, 1], // OP |
| 393 |
[ 2, 2, 0, 0, 2, 0, 0, 2], // BIN |
| 394 |
[ 3, 3, 0, 0, 3, 0, 0, 3], // REL |
| 395 |
[ 0, 0, 0, 0, 0, 0, 0, 0], // OPEN |
| 396 |
[ 0,-1, 2, 3, 0, 0, 0, 1], // CLOSE |
| 397 |
[ 1, 1, 0, 1, 1, 1, 1, 1], // PUNCT |
| 398 |
[ 1,-1, 2, 3, 1, 0, 1, 1] // INNER |
| 399 |
], |
| 400 |
autoDefault: function (name) {return ""}, |
| 401 |
isSpacelike: function () {return false}, |
| 402 |
isEmbellished: function () {return false}, |
| 403 |
Core: function () {return this}, |
| 404 |
CoreMO: function () {return this}, |
| 405 |
childIndex: function(child) { |
| 406 |
if (child == null) return; |
| 407 |
for (var i = 0, m = this.data.length; i < m; i++) if (child === this.data[i]) return i; |
| 408 |
}, |
| 409 |
CoreIndex: function () { |
| 410 |
return (this.inferRow ? this.data[0]||this : this).childIndex(this.Core()); |
| 411 |
}, |
| 412 |
hasNewline: function () { |
| 413 |
if (this.isEmbellished()) {return this.CoreMO().hasNewline()} |
| 414 |
if (this.isToken || this.linebreakContainer) {return false} |
| 415 |
for (var i = 0, m = this.data.length; i < m; i++) { |
| 416 |
if (this.data[i] && this.data[i].hasNewline()) {return true} |
| 417 |
} |
| 418 |
return false; |
| 419 |
}, |
| 420 |
array: function () {if (this.inferred) {return this.data} else {return [this]}}, |
| 421 |
toString: function () {return this.type+"("+this.data.join(",")+")"}, |
| 422 |
getAnnotation: function () {return null} |
| 423 |
},{ |
| 424 |
childrenSpacelike: function () { |
| 425 |
for (var i = 0, m = this.data.length; i < m; i++) |
| 426 |
{if (!this.data[i].isSpacelike()) {return false}} |
| 427 |
return true; |
| 428 |
}, |
| 429 |
childEmbellished: function () { |
| 430 |
return (this.data[0] && this.data[0].isEmbellished()); |
| 431 |
}, |
| 432 |
childCore: function () {return (this.inferRow && this.data[0] ? this.data[0].Core() : this.data[0])}, |
| 433 |
childCoreMO: function () {return (this.data[0] ? this.data[0].CoreMO() : null)}, |
| 434 |
setChildTeXclass: function (prev) { |
| 435 |
if (this.data[0]) { |
| 436 |
prev = this.data[0].setTeXclass(prev); |
| 437 |
this.updateTeXclass(this.data[0]); |
| 438 |
} |
| 439 |
return prev; |
| 440 |
}, |
| 441 |
setBaseTeXclasses: function (prev) { |
| 442 |
this.getPrevClass(prev); this.texClass = null; |
| 443 |
if (this.data[0]) { |
| 444 |
if (this.isEmbellished() || this.data[0].isa(MML.mi)) { |
| 445 |
prev = this.data[0].setTeXclass(prev); |
| 446 |
this.updateTeXclass(this.Core()); |
| 447 |
} else {this.data[0].setTeXclass(); prev = this} |
| 448 |
} else {prev = this} |
| 449 |
for (var i = 1, m = this.data.length; i < m; i++) |
| 450 |
{if (this.data[i]) {this.data[i].setTeXclass()}} |
| 451 |
return prev; |
| 452 |
}, |
| 453 |
setSeparateTeXclasses: function (prev) { |
| 454 |
this.getPrevClass(prev); |
| 455 |
for (var i = 0, m = this.data.length; i < m; i++) |
| 456 |
{if (this.data[i]) {this.data[i].setTeXclass()}} |
| 457 |
if (this.isEmbellished()) {this.updateTeXclass(this.Core())} |
| 458 |
return this; |
| 459 |
} |
| 460 |
}); |
| 461 |
|
| 462 |
MML.mi = MML.mbase.Subclass({ |
| 463 |
type: "mi", isToken: true, |
| 464 |
texClass: MML.TEXCLASS.ORD, |
| 465 |
defaults: { |
| 466 |
mathvariant: MML.AUTO, |
| 467 |
mathsize: MML.INHERIT, |
| 468 |
mathbackground: MML.INHERIT, |
| 469 |
mathcolor: MML.INHERIT, |
| 470 |
dir: MML.INHERIT |
| 471 |
}, |
| 472 |
autoDefault: function (name) { |
| 473 |
if (name === "mathvariant") { |
| 474 |
var mi = (this.data[0]||"").toString(); |
| 475 |
return (mi.length === 1 || |
| 476 |
(mi.length === 2 && mi.charCodeAt(0) >= 0xD800 && mi.charCodeAt(0) < 0xDC00) ? |
| 477 |
MML.VARIANT.ITALIC : MML.VARIANT.NORMAL); |
| 478 |
} |
| 479 |
return ""; |
| 480 |
}, |
| 481 |
setTeXclass: function (prev) { |
| 482 |
this.getPrevClass(prev); |
| 483 |
var name = this.data.join(""); |
| 484 |
if (name.length > 1 && name.match(/^[a-z][a-z0-9]*$/i) && |
| 485 |
this.texClass === MML.TEXCLASS.ORD) { |
| 486 |
this.texClass = MML.TEXCLASS.OP; |
| 487 |
this.autoOP = true; |
| 488 |
} |
| 489 |
return this; |
| 490 |
} |
| 491 |
}); |
| 492 |
|
| 493 |
MML.mn = MML.mbase.Subclass({ |
| 494 |
type: "mn", isToken: true, |
| 495 |
texClass: MML.TEXCLASS.ORD, |
| 496 |
defaults: { |
| 497 |
mathvariant: MML.INHERIT, |
| 498 |
mathsize: MML.INHERIT, |
| 499 |
mathbackground: MML.INHERIT, |
| 500 |
mathcolor: MML.INHERIT, |
| 501 |
dir: MML.INHERIT |
| 502 |
} |
| 503 |
}); |
| 504 |
|
| 505 |
MML.mo = MML.mbase.Subclass({ |
| 506 |
type: "mo", isToken: true, |
| 507 |
defaults: { |
| 508 |
mathvariant: MML.INHERIT, |
| 509 |
mathsize: MML.INHERIT, |
| 510 |
mathbackground: MML.INHERIT, |
| 511 |
mathcolor: MML.INHERIT, |
| 512 |
dir: MML.INHERIT, |
| 513 |
form: MML.AUTO, |
| 514 |
fence: MML.AUTO, |
| 515 |
separator: MML.AUTO, |
| 516 |
lspace: MML.AUTO, |
| 517 |
rspace: MML.AUTO, |
| 518 |
stretchy: MML.AUTO, |
| 519 |
symmetric: MML.AUTO, |
| 520 |
maxsize: MML.AUTO, |
| 521 |
minsize: MML.AUTO, |
| 522 |
largeop: MML.AUTO, |
| 523 |
movablelimits: MML.AUTO, |
| 524 |
accent: MML.AUTO, |
| 525 |
linebreak: MML.LINEBREAK.AUTO, |
| 526 |
lineleading: MML.INHERIT, |
| 527 |
linebreakstyle: MML.AUTO, |
| 528 |
linebreakmultchar: MML.INHERIT, |
| 529 |
indentalign: MML.INHERIT, |
| 530 |
indentshift: MML.INHERIT, |
| 531 |
indenttarget: MML.INHERIT, |
| 532 |
indentalignfirst: MML.INHERIT, |
| 533 |
indentshiftfirst: MML.INHERIT, |
| 534 |
indentalignlast: MML.INHERIT, |
| 535 |
indentshiftlast: MML.INHERIT, |
| 536 |
texClass: MML.AUTO |
| 537 |
}, |
| 538 |
defaultDef: { |
| 539 |
form: MML.FORM.INFIX, |
| 540 |
fence: false, |
| 541 |
separator: false, |
| 542 |
lspace: MML.LENGTH.THICKMATHSPACE, |
| 543 |
rspace: MML.LENGTH.THICKMATHSPACE, |
| 544 |
stretchy: false, |
| 545 |
symmetric: false, |
| 546 |
maxsize: MML.SIZE.INFINITY, |
| 547 |
minsize: '0em', //'1em', |
| 548 |
largeop: false, |
| 549 |
movablelimits: false, |
| 550 |
accent: false, |
| 551 |
linebreak: MML.LINEBREAK.AUTO, |
| 552 |
lineleading: "1ex", |
| 553 |
linebreakstyle: "before", |
| 554 |
indentalign: MML.INDENTALIGN.AUTO, |
| 555 |
indentshift: "0", |
| 556 |
indenttarget: "", |
| 557 |
indentalignfirst: MML.INDENTALIGN.INDENTALIGN, |
| 558 |
indentshiftfirst: MML.INDENTSHIFT.INDENTSHIFT, |
| 559 |
indentalignlast: MML.INDENTALIGN.INDENTALIGN, |
| 560 |
indentshiftlast: MML.INDENTSHIFT.INDENTSHIFT, |
| 561 |
texClass: MML.TEXCLASS.REL // for MML, but TeX sets ORD explicitly |
| 562 |
}, |
| 563 |
SPACE_ATTR: {lspace: 0x01, rspace: 0x02}, |
| 564 |
useMMLspacing: 0x03, |
| 565 |
hasMMLspacing: function () { |
| 566 |
if (this.useMMLspacing) return true; |
| 567 |
return this.form && (this.OPTABLE[this.form]||{})[this.data.join('')]; |
| 568 |
}, |
| 569 |
autoDefault: function (name,nodefault) { |
| 570 |
var def = this.def; |
| 571 |
if (!def) { |
| 572 |
if (name === "form") {return this.getForm()} |
| 573 |
var mo = this.data.join(""); |
| 574 |
var forms = [this.Get("form"),MML.FORM.INFIX,MML.FORM.POSTFIX,MML.FORM.PREFIX]; |
| 575 |
for (var i = 0, m = forms.length; i < m; i++) { |
| 576 |
var data = this.OPTABLE[forms[i]][mo]; |
| 577 |
if (data) {def = this.makeDef(data); break} |
| 578 |
} |
| 579 |
if (!def) {def = this.CheckRange(mo)} |
| 580 |
if (!def && nodefault) {def = {}} else { |
| 581 |
if (!def) {def = MathJax.Hub.Insert({},this.defaultDef)} |
| 582 |
if (this.parent) {this.def = def} else {def = MathJax.Hub.Insert({},def)} |
| 583 |
def.form = forms[0]; |
| 584 |
} |
| 585 |
} |
| 586 |
this.useMMLspacing &= ~(this.SPACE_ATTR[name] || 0); |
| 587 |
if (def[name] != null) {return def[name]} |
| 588 |
else if (!nodefault) {return this.defaultDef[name]} |
| 589 |
return ""; |
| 590 |
}, |
| 591 |
CheckRange: function (mo) { |
| 592 |
var n = mo.charCodeAt(0); |
| 593 |
if (n >= 0xD800 && n < 0xDC00) {n = (((n-0xD800)<<10)+(mo.charCodeAt(1)-0xDC00))+0x10000} |
| 594 |
for (var i = 0, m = this.RANGES.length; i < m && this.RANGES[i][0] <= n; i++) { |
| 595 |
if (n <= this.RANGES[i][1]) { |
| 596 |
if (this.RANGES[i][3]) { |
| 597 |
var file = MML.optableDir+"/"+this.RANGES[i][3]+".js"; |
| 598 |
this.RANGES[i][3] = null; |
| 599 |
MathJax.Hub.RestartAfter(MathJax.Ajax.Require(file)); |
| 600 |
} |
| 601 |
var data = MML.TEXCLASSNAMES[this.RANGES[i][2]]; |
| 602 |
data = this.OPTABLE.infix[mo] = MML.mo.OPTYPES[data === "BIN" ? "BIN3" : data]; |
| 603 |
return this.makeDef(data); |
| 604 |
} |
| 605 |
} |
| 606 |
return null; |
| 607 |
}, |
| 608 |
makeDef: function (data) { |
| 609 |
if (data[2] == null) {data[2] = this.defaultDef.texClass} |
| 610 |
if (!data[3]) {data[3] = {}} |
| 611 |
var def = MathJax.Hub.Insert({},data[3]); |
| 612 |
def.lspace = this.SPACE[data[0]]; def.rspace = this.SPACE[data[1]]; |
| 613 |
def.texClass = data[2]; |
| 614 |
if (def.texClass === MML.TEXCLASS.REL && |
| 615 |
(this.movablelimits || this.data.join("").match(/^[a-z]+$/i))) |
| 616 |
{def.texClass = MML.TEXCLASS.OP} // mark named operators as OP |
| 617 |
return def; |
| 618 |
}, |
| 619 |
getForm: function () { |
| 620 |
var core = this, parent = this.parent, Parent = this.Parent(); |
| 621 |
while (Parent && Parent.isEmbellished()) |
| 622 |
{core = parent; parent = Parent.parent; Parent = Parent.Parent()} |
| 623 |
if (parent && parent.type === "mrow" && parent.NonSpaceLength() !== 1) { |
| 624 |
if (parent.FirstNonSpace() === core) {return MML.FORM.PREFIX} |
| 625 |
if (parent.LastNonSpace() === core) {return MML.FORM.POSTFIX} |
| 626 |
} |
| 627 |
return MML.FORM.INFIX; |
| 628 |
}, |
| 629 |
isEmbellished: function () {return true}, |
| 630 |
hasNewline: function () {return (this.Get("linebreak") === MML.LINEBREAK.NEWLINE)}, |
| 631 |
CoreParent: function () { |
| 632 |
var parent = this; |
| 633 |
while (parent && parent.isEmbellished() && |
| 634 |
parent.CoreMO() === this && !parent.isa(MML.math)) {parent = parent.Parent()} |
| 635 |
return parent; |
| 636 |
}, |
| 637 |
CoreText: function (parent) { |
| 638 |
if (!parent) {return ""} |
| 639 |
if (parent.isEmbellished()) {return parent.CoreMO().data.join("")} |
| 640 |
while ((((parent.isa(MML.mrow) || parent.isa(MML.TeXAtom) || |
| 641 |
parent.isa(MML.mstyle) || parent.isa(MML.mphantom)) && |
| 642 |
parent.data.length === 1) || parent.isa(MML.munderover)) && |
| 643 |
parent.data[0]) {parent = parent.data[0]} |
| 644 |
if (!parent.isToken) {return ""} else {return parent.data.join("")} |
| 645 |
}, |
| 646 |
remapChars: { |
| 647 |
'*':"\u2217", |
| 648 |
'"':"\u2033", |
| 649 |
"\u00B0":"\u2218", |
| 650 |
"\u00B2":"2", |
| 651 |
"\u00B3":"3", |
| 652 |
"\u00B4":"\u2032", |
| 653 |
"\u00B9":"1" |
| 654 |
}, |
| 655 |
remap: function (text,map) { |
| 656 |
text = text.replace(/-/g,"\u2212"); |
| 657 |
if (map) { |
| 658 |
text = text.replace(/'/g,"\u2032").replace(/`/g,"\u2035"); |
| 659 |
if (text.length === 1) {text = map[text]||text} |
| 660 |
} |
| 661 |
return text; |
| 662 |
}, |
| 663 |
setTeXclass: function (prev) { |
| 664 |
var values = this.getValues("form","lspace","rspace","fence"); // sets useMMLspacing |
| 665 |
if (this.hasMMLspacing()) {this.texClass = MML.TEXCLASS.NONE; return this} |
| 666 |
if (values.fence && !this.texClass) { |
| 667 |
if (values.form === MML.FORM.PREFIX) {this.texClass = MML.TEXCLASS.OPEN} |
| 668 |
if (values.form === MML.FORM.POSTFIX) {this.texClass = MML.TEXCLASS.CLOSE} |
| 669 |
} |
| 670 |
this.texClass = this.Get("texClass"); |
| 671 |
if (this.data.join("") === "\u2061") { |
| 672 |
// force previous node to be texClass OP, and skip this node |
| 673 |
if (prev) {prev.texClass = MML.TEXCLASS.OP; prev.fnOP = true} |
| 674 |
this.texClass = this.prevClass = MML.TEXCLASS.NONE; |
| 675 |
return prev; |
| 676 |
} |
| 677 |
return this.adjustTeXclass(prev); |
| 678 |
}, |
| 679 |
adjustTeXclass: function (prev) { |
| 680 |
if (this.texClass === MML.TEXCLASS.NONE) {return prev} |
| 681 |
if (prev) { |
| 682 |
if (prev.autoOP && (this.texClass === MML.TEXCLASS.BIN || |
| 683 |
this.texClass === MML.TEXCLASS.REL)) |
| 684 |
{prev.texClass = MML.TEXCLASS.ORD} |
| 685 |
this.prevClass = prev.texClass || MML.TEXCLASS.ORD; |
| 686 |
this.prevLevel = prev.Get("scriptlevel") |
| 687 |
} else {this.prevClass = MML.TEXCLASS.NONE} |
| 688 |
if (this.texClass === MML.TEXCLASS.BIN && |
| 689 |
(this.prevClass === MML.TEXCLASS.NONE || |
| 690 |
this.prevClass === MML.TEXCLASS.BIN || |
| 691 |
this.prevClass === MML.TEXCLASS.OP || |
| 692 |
this.prevClass === MML.TEXCLASS.REL || |
| 693 |
this.prevClass === MML.TEXCLASS.OPEN || |
| 694 |
this.prevClass === MML.TEXCLASS.PUNCT)) { |
| 695 |
this.texClass = MML.TEXCLASS.ORD; |
| 696 |
} else if (this.prevClass === MML.TEXCLASS.BIN && |
| 697 |
(this.texClass === MML.TEXCLASS.REL || |
| 698 |
this.texClass === MML.TEXCLASS.CLOSE || |
| 699 |
this.texClass === MML.TEXCLASS.PUNCT)) { |
| 700 |
prev.texClass = this.prevClass = MML.TEXCLASS.ORD; |
| 701 |
} else if (this.texClass === MML.TEXCLASS.BIN) { |
| 702 |
// |
| 703 |
// Check if node is the last one in its container since the rule |
| 704 |
// above only takes effect if there is a node that follows. |
| 705 |
// |
| 706 |
var child = this, parent = this.parent; |
| 707 |
while (parent && parent.parent && parent.isEmbellished() && |
| 708 |
(parent.data.length === 1 || |
| 709 |
(parent.type !== "mrow" && parent.Core() === child))) // handles msubsup and munderover |
| 710 |
{child = parent; parent = parent.parent} |
| 711 |
if (parent.data[parent.data.length-1] === child) this.texClass = MML.TEXCLASS.ORD; |
| 712 |
} |
| 713 |
return this; |
| 714 |
} |
| 715 |
}); |
| 716 |
|
| 717 |
MML.mtext = MML.mbase.Subclass({ |
| 718 |
type: "mtext", isToken: true, |
| 719 |
isSpacelike: function () {return true}, |
| 720 |
texClass: MML.TEXCLASS.ORD, |
| 721 |
defaults: { |
| 722 |
mathvariant: MML.INHERIT, |
| 723 |
mathsize: MML.INHERIT, |
| 724 |
mathbackground: MML.INHERIT, |
| 725 |
mathcolor: MML.INHERIT, |
| 726 |
dir: MML.INHERIT |
| 727 |
} |
| 728 |
}); |
| 729 |
|
| 730 |
MML.mspace = MML.mbase.Subclass({ |
| 731 |
type: "mspace", isToken: true, |
| 732 |
isSpacelike: function () {return true}, |
| 733 |
defaults: { |
| 734 |
mathbackground: MML.INHERIT, |
| 735 |
mathcolor: MML.INHERIT, |
| 736 |
width: "0em", |
| 737 |
height: "0ex", |
| 738 |
depth: "0ex", |
| 739 |
linebreak: MML.LINEBREAK.AUTO |
| 740 |
}, |
| 741 |
hasDimAttr: function () { |
| 742 |
return (this.hasValue("width") || this.hasValue("height") || |
| 743 |
this.hasValue("depth")); |
| 744 |
}, |
| 745 |
hasNewline: function () { |
| 746 |
// The MathML spec says that the linebreak attribute should be ignored |
| 747 |
// if any dimensional attribute is set. |
| 748 |
return (!this.hasDimAttr() && |
| 749 |
this.Get("linebreak") === MML.LINEBREAK.NEWLINE); |
| 750 |
} |
| 751 |
}); |
| 752 |
|
| 753 |
MML.ms = MML.mbase.Subclass({ |
| 754 |
type: "ms", isToken: true, |
| 755 |
texClass: MML.TEXCLASS.ORD, |
| 756 |
defaults: { |
| 757 |
mathvariant: MML.INHERIT, |
| 758 |
mathsize: MML.INHERIT, |
| 759 |
mathbackground: MML.INHERIT, |
| 760 |
mathcolor: MML.INHERIT, |
| 761 |
dir: MML.INHERIT, |
| 762 |
lquote: '"', |
| 763 |
rquote: '"' |
| 764 |
} |
| 765 |
}); |
| 766 |
|
| 767 |
MML.mglyph = MML.mbase.Subclass({ |
| 768 |
type: "mglyph", isToken: true, |
| 769 |
texClass: MML.TEXCLASS.ORD, |
| 770 |
defaults: { |
| 771 |
mathbackground: MML.INHERIT, |
| 772 |
mathcolor: MML.INHERIT, |
| 773 |
alt: "", |
| 774 |
src: "", |
| 775 |
width: MML.AUTO, |
| 776 |
height: MML.AUTO, |
| 777 |
valign: "0em" |
| 778 |
} |
| 779 |
}); |
| 780 |
|
| 781 |
MML.mrow = MML.mbase.Subclass({ |
| 782 |
type: "mrow", |
| 783 |
isSpacelike: MML.mbase.childrenSpacelike, |
| 784 |
inferred: false, notParent: false, |
| 785 |
isEmbellished: function () { |
| 786 |
var isEmbellished = false; |
| 787 |
for (var i = 0, m = this.data.length; i < m; i++) { |
| 788 |
if (this.data[i] == null) continue; |
| 789 |
if (this.data[i].isEmbellished()) { |
| 790 |
if (isEmbellished) {return false} |
| 791 |
isEmbellished = true; this.core = i; |
| 792 |
} else if (!this.data[i].isSpacelike()) {return false} |
| 793 |
} |
| 794 |
return isEmbellished; |
| 795 |
}, |
| 796 |
NonSpaceLength: function () { |
| 797 |
var n = 0; |
| 798 |
for (var i = 0, m = this.data.length; i < m; i++) |
| 799 |
{if (this.data[i] && !this.data[i].isSpacelike()) {n++}} |
| 800 |
return n; |
| 801 |
}, |
| 802 |
FirstNonSpace: function () { |
| 803 |
for (var i = 0, m = this.data.length; i < m; i++) |
| 804 |
{if (this.data[i] && !this.data[i].isSpacelike()) {return this.data[i]}} |
| 805 |
return null; |
| 806 |
}, |
| 807 |
LastNonSpace: function () { |
| 808 |
for (var i = this.data.length-1; i >= 0; i--) |
| 809 |
{if (this.data[0] && !this.data[i].isSpacelike()) {return this.data[i]}} |
| 810 |
return null; |
| 811 |
}, |
| 812 |
Core: function () { |
| 813 |
if (!(this.isEmbellished()) || typeof(this.core) === "undefined") {return this} |
| 814 |
return this.data[this.core]; |
| 815 |
}, |
| 816 |
CoreMO: function () { |
| 817 |
if (!(this.isEmbellished()) || typeof(this.core) === "undefined") {return this} |
| 818 |
return this.data[this.core].CoreMO(); |
| 819 |
}, |
| 820 |
toString: function () { |
| 821 |
if (this.inferred) {return '[' + this.data.join(',') + ']'} |
| 822 |
return this.SUPER(arguments).toString.call(this); |
| 823 |
}, |
| 824 |
setTeXclass: function (prev) { |
| 825 |
var i, m = this.data.length; |
| 826 |
if ((this.open || this.close) && (!prev || !prev.fnOP)) { |
| 827 |
// |
| 828 |
// <mrow> came from \left...\right |
| 829 |
// so treat as subexpression (tex class INNER) |
| 830 |
// |
| 831 |
this.getPrevClass(prev); prev = null; |
| 832 |
for (i = 0; i < m; i++) |
| 833 |
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}} |
| 834 |
if (!this.hasOwnProperty("texClass")) this.texClass = MML.TEXCLASS.INNER; |
| 835 |
return this; |
| 836 |
} else { |
| 837 |
// |
| 838 |
// Normal <mrow>, so treat as |
| 839 |
// thorugh mrow is not there |
| 840 |
// |
| 841 |
for (i = 0; i < m; i++) |
| 842 |
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}} |
| 843 |
if (this.data[0]) {this.updateTeXclass(this.data[0])} |
| 844 |
return prev; |
| 845 |
} |
| 846 |
}, |
| 847 |
getAnnotation: function (name) { |
| 848 |
if (this.data.length != 1) return null; |
| 849 |
return this.data[0].getAnnotation(name); |
| 850 |
} |
| 851 |
}); |
| 852 |
|
| 853 |
MML.mfrac = MML.mbase.Subclass({ |
| 854 |
type: "mfrac", num: 0, den: 1, |
| 855 |
linebreakContainer: true, |
| 856 |
isEmbellished: MML.mbase.childEmbellished, |
| 857 |
Core: MML.mbase.childCore, |
| 858 |
CoreMO: MML.mbase.childCoreMO, |
| 859 |
defaults: { |
| 860 |
mathbackground: MML.INHERIT, |
| 861 |
mathcolor: MML.INHERIT, |
| 862 |
linethickness: MML.LINETHICKNESS.MEDIUM, |
| 863 |
numalign: MML.ALIGN.CENTER, |
| 864 |
denomalign: MML.ALIGN.CENTER, |
| 865 |
bevelled: false |
| 866 |
}, |
| 867 |
adjustChild_displaystyle: function (n) {return false}, |
| 868 |
adjustChild_scriptlevel: function (n) { |
| 869 |
var level = this.Get("scriptlevel"); |
| 870 |
if (!this.Get("displaystyle") || level > 0) {level++} |
| 871 |
return level; |
| 872 |
}, |
| 873 |
adjustChild_texprimestyle: function (n) { |
| 874 |
if (n == this.den) {return true} |
| 875 |
return this.Get("texprimestyle"); |
| 876 |
}, |
| 877 |
setTeXclass: MML.mbase.setSeparateTeXclasses |
| 878 |
}); |
| 879 |
|
| 880 |
MML.msqrt = MML.mbase.Subclass({ |
| 881 |
type: "msqrt", |
| 882 |
inferRow: true, |
| 883 |
linebreakContainer: true, |
| 884 |
texClass: MML.TEXCLASS.ORD, |
| 885 |
setTeXclass: MML.mbase.setSeparateTeXclasses, |
| 886 |
adjustChild_texprimestyle: function (n) {return true} |
| 887 |
}); |
| 888 |
|
| 889 |
MML.mroot = MML.mbase.Subclass({ |
| 890 |
type: "mroot", |
| 891 |
linebreakContainer: true, |
| 892 |
texClass: MML.TEXCLASS.ORD, |
| 893 |
adjustChild_displaystyle: function (n) { |
| 894 |
if (n === 1) {return false} |
| 895 |
return this.Get("displaystyle"); |
| 896 |
}, |
| 897 |
adjustChild_scriptlevel: function (n) { |
| 898 |
var level = this.Get("scriptlevel"); |
| 899 |
if (n === 1) {level += 2} |
| 900 |
return level; |
| 901 |
}, |
| 902 |
adjustChild_texprimestyle: function (n) { |
| 903 |
if (n === 0) {return true}; |
| 904 |
return this.Get("texprimestyle"); |
| 905 |
}, |
| 906 |
setTeXclass: MML.mbase.setSeparateTeXclasses |
| 907 |
}); |
| 908 |
|
| 909 |
MML.mstyle = MML.mbase.Subclass({ |
| 910 |
type: "mstyle", |
| 911 |
isSpacelike: MML.mbase.childrenSpacelike, |
| 912 |
isEmbellished: MML.mbase.childEmbellished, |
| 913 |
Core: MML.mbase.childCore, |
| 914 |
CoreMO: MML.mbase.childCoreMO, |
| 915 |
inferRow: true, |
| 916 |
defaults: { |
| 917 |
scriptlevel: MML.INHERIT, |
| 918 |
displaystyle: MML.INHERIT, |
| 919 |
scriptsizemultiplier: Math.sqrt(1/2), |
| 920 |
scriptminsize: "8pt", |
| 921 |
mathbackground: MML.INHERIT, |
| 922 |
mathcolor: MML.INHERIT, |
| 923 |
dir: MML.INHERIT, |
| 924 |
infixlinebreakstyle: MML.LINEBREAKSTYLE.BEFORE, |
| 925 |
decimalseparator: "." |
| 926 |
}, |
| 927 |
adjustChild_scriptlevel: function (n) { |
| 928 |
var level = this.scriptlevel; |
| 929 |
if (level == null) { |
| 930 |
level = this.Get("scriptlevel"); |
| 931 |
} else if (String(level).match(/^ *[-+]/)) { |
| 932 |
var LEVEL = this.Get("scriptlevel",null,true); |
| 933 |
level = LEVEL + parseInt(level); |
| 934 |
} |
| 935 |
return level; |
| 936 |
}, |
| 937 |
inheritFromMe: true, |
| 938 |
noInherit: { |
| 939 |
mpadded: {width: true, height: true, depth: true, lspace: true, voffset: true}, |
| 940 |
mtable: {width: true, height: true, depth: true, align: true} |
| 941 |
}, |
| 942 |
getRemoved: {fontfamily:"fontFamily", fontweight:"fontWeight", fontstyle:"fontStyle", fontsize:"fontSize"}, |
| 943 |
setTeXclass: MML.mbase.setChildTeXclass |
| 944 |
}); |
| 945 |
|
| 946 |
MML.merror = MML.mbase.Subclass({ |
| 947 |
type: "merror", |
| 948 |
inferRow: true, |
| 949 |
linebreakContainer: true, |
| 950 |
texClass: MML.TEXCLASS.ORD |
| 951 |
}); |
| 952 |
|
| 953 |
MML.mpadded = MML.mbase.Subclass({ |
| 954 |
type: "mpadded", |
| 955 |
inferRow: true, |
| 956 |
isSpacelike: MML.mbase.childrenSpacelike, |
| 957 |
isEmbellished: MML.mbase.childEmbellished, |
| 958 |
Core: MML.mbase.childCore, |
| 959 |
CoreMO: MML.mbase.childCoreMO, |
| 960 |
defaults: { |
| 961 |
mathbackground: MML.INHERIT, |
| 962 |
mathcolor: MML.INHERIT, |
| 963 |
width: "", |
| 964 |
height: "", |
| 965 |
depth: "", |
| 966 |
lspace: 0, |
| 967 |
voffset: 0 |
| 968 |
}, |
| 969 |
setTeXclass: MML.mbase.setChildTeXclass |
| 970 |
}); |
| 971 |
|
| 972 |
MML.mphantom = MML.mbase.Subclass({ |
| 973 |
type: "mphantom", |
| 974 |
texClass: MML.TEXCLASS.ORD, |
| 975 |
inferRow: true, |
| 976 |
isSpacelike: MML.mbase.childrenSpacelike, |
| 977 |
isEmbellished: MML.mbase.childEmbellished, |
| 978 |
Core: MML.mbase.childCore, |
| 979 |
CoreMO: MML.mbase.childCoreMO, |
| 980 |
setTeXclass: MML.mbase.setChildTeXclass |
| 981 |
}); |
| 982 |
|
| 983 |
MML.mfenced = MML.mbase.Subclass({ |
| 984 |
type: "mfenced", |
| 985 |
defaults: { |
| 986 |
mathbackground: MML.INHERIT, |
| 987 |
mathcolor: MML.INHERIT, |
| 988 |
open: '(', |
| 989 |
close: ')', |
| 990 |
separators: ',' |
| 991 |
}, |
| 992 |
addFakeNodes: function () { |
| 993 |
var values = this.getValues("open","close","separators"); |
| 994 |
values.open = values.open.replace(/[ \t\n\r]/g,""); |
| 995 |
values.close = values.close.replace(/[ \t\n\r]/g,""); |
| 996 |
values.separators = values.separators.replace(/[ \t\n\r]/g,""); |
| 997 |
// |
| 998 |
// Create a fake node for the open item |
| 999 |
// |
| 1000 |
if (values.open !== "") { |
| 1001 |
this.SetData("open",MML.mo(values.open).With({ |
| 1002 |
fence:true, form:MML.FORM.PREFIX, texClass:MML.TEXCLASS.OPEN |
| 1003 |
})); |
| 1004 |
} |
| 1005 |
// |
| 1006 |
// Create fake nodes for the separators |
| 1007 |
// |
| 1008 |
if (values.separators !== "") { |
| 1009 |
while (values.separators.length < this.data.length) |
| 1010 |
{values.separators += values.separators.charAt(values.separators.length-1)} |
| 1011 |
for (var i = 1, m = this.data.length; i < m; i++) { |
| 1012 |
if (this.data[i]) |
| 1013 |
{this.SetData("sep"+i,MML.mo(values.separators.charAt(i-1)).With({separator:true}))} |
| 1014 |
} |
| 1015 |
} |
| 1016 |
// |
| 1017 |
// Create fake node for the close item |
| 1018 |
// |
| 1019 |
if (values.close !== "") { |
| 1020 |
this.SetData("close",MML.mo(values.close).With({ |
| 1021 |
fence:true, form:MML.FORM.POSTFIX, texClass:MML.TEXCLASS.CLOSE |
| 1022 |
})); |
| 1023 |
} |
| 1024 |
}, |
| 1025 |
texClass: MML.TEXCLASS.OPEN, |
| 1026 |
setTeXclass: function (prev) { |
| 1027 |
this.addFakeNodes(); |
| 1028 |
this.getPrevClass(prev); |
| 1029 |
if (this.data.open) {prev = this.data.open.setTeXclass(prev)} |
| 1030 |
if (this.data[0]) {prev = this.data[0].setTeXclass(prev)} |
| 1031 |
for (var i = 1, m = this.data.length; i < m; i++) { |
| 1032 |
if (this.data["sep"+i]) {prev = this.data["sep"+i].setTeXclass(prev)} |
| 1033 |
if (this.data[i]) {prev = this.data[i].setTeXclass(prev)} |
| 1034 |
} |
| 1035 |
if (this.data.close) {prev = this.data.close.setTeXclass(prev)} |
| 1036 |
this.updateTeXclass(this.data.open); |
| 1037 |
this.texClass = MML.TEXCLASS.INNER; |
| 1038 |
return prev; |
| 1039 |
} |
| 1040 |
}); |
| 1041 |
|
| 1042 |
MML.menclose = MML.mbase.Subclass({ |
| 1043 |
type: "menclose", |
| 1044 |
inferRow: true, |
| 1045 |
linebreakContainer: true, |
| 1046 |
defaults: { |
| 1047 |
mathbackground: MML.INHERIT, |
| 1048 |
mathcolor: MML.INHERIT, |
| 1049 |
notation: MML.NOTATION.LONGDIV, |
| 1050 |
texClass: MML.TEXCLASS.ORD |
| 1051 |
}, |
| 1052 |
setTeXclass: MML.mbase.setSeparateTeXclasses |
| 1053 |
}); |
| 1054 |
|
| 1055 |
MML.msubsup = MML.mbase.Subclass({ |
| 1056 |
type: "msubsup", base: 0, sub: 1, sup: 2, |
| 1057 |
isEmbellished: MML.mbase.childEmbellished, |
| 1058 |
Core: MML.mbase.childCore, |
| 1059 |
CoreMO: MML.mbase.childCoreMO, |
| 1060 |
defaults: { |
| 1061 |
mathbackground: MML.INHERIT, |
| 1062 |
mathcolor: MML.INHERIT, |
| 1063 |
subscriptshift: "", |
| 1064 |
superscriptshift: "", |
| 1065 |
texClass: MML.AUTO |
| 1066 |
}, |
| 1067 |
autoDefault: function (name) { |
| 1068 |
if (name === "texClass") |
| 1069 |
{return (this.isEmbellished() ? this.CoreMO().Get(name) : MML.TEXCLASS.ORD)} |
| 1070 |
return 0; |
| 1071 |
}, |
| 1072 |
adjustChild_displaystyle: function (n) { |
| 1073 |
if (n > 0) {return false} |
| 1074 |
return this.Get("displaystyle"); |
| 1075 |
}, |
| 1076 |
adjustChild_scriptlevel: function (n) { |
| 1077 |
var level = this.Get("scriptlevel"); |
| 1078 |
if (n > 0) {level++} |
| 1079 |
return level; |
| 1080 |
}, |
| 1081 |
adjustChild_texprimestyle: function (n) { |
| 1082 |
if (n === this.sub) {return true} |
| 1083 |
return this.Get("texprimestyle"); |
| 1084 |
}, |
| 1085 |
setTeXclass: MML.mbase.setBaseTeXclasses |
| 1086 |
}); |
| 1087 |
|
| 1088 |
MML.msub = MML.msubsup.Subclass({type: "msub"}); |
| 1089 |
MML.msup = MML.msubsup.Subclass({type: "msup", sub:2, sup:1}); |
| 1090 |
MML.mmultiscripts = MML.msubsup.Subclass({ |
| 1091 |
type: "mmultiscripts", |
| 1092 |
adjustChild_texprimestyle: function (n) { |
| 1093 |
if (n % 2 === 1) {return true} |
| 1094 |
return this.Get("texprimestyle"); |
| 1095 |
} |
| 1096 |
}); |
| 1097 |
MML.mprescripts = MML.mbase.Subclass({type: "mprescripts"}); |
| 1098 |
MML.none = MML.mbase.Subclass({type: "none"}); |
| 1099 |
|
| 1100 |
MML.munderover = MML.mbase.Subclass({ |
| 1101 |
type: "munderover", |
| 1102 |
base: 0, under: 1, over: 2, sub: 1, sup: 2, |
| 1103 |
ACCENTS: ["", "accentunder", "accent"], |
| 1104 |
linebreakContainer: true, |
| 1105 |
isEmbellished: MML.mbase.childEmbellished, |
| 1106 |
Core: MML.mbase.childCore, |
| 1107 |
CoreMO: MML.mbase.childCoreMO, |
| 1108 |
defaults: { |
| 1109 |
mathbackground: MML.INHERIT, |
| 1110 |
mathcolor: MML.INHERIT, |
| 1111 |
accent: MML.AUTO, |
| 1112 |
accentunder: MML.AUTO, |
| 1113 |
align: MML.ALIGN.CENTER, |
| 1114 |
texClass: MML.AUTO, |
| 1115 |
subscriptshift: "", // when converted to msubsup by moveablelimits |
| 1116 |
superscriptshift: "" // when converted to msubsup by moveablelimits |
| 1117 |
}, |
| 1118 |
autoDefault: function (name) { |
| 1119 |
if (name === "texClass") |
| 1120 |
{return (this.isEmbellished() ? this.CoreMO().Get(name) : MML.TEXCLASS.ORD)} |
| 1121 |
if (name === "accent" && this.data[this.over]) {return this.data[this.over].CoreMO().Get("accent")} |
| 1122 |
if (name === "accentunder" && this.data[this.under]) {return this.data[this.under].CoreMO().Get("accent")} |
| 1123 |
return false; |
| 1124 |
}, |
| 1125 |
adjustChild_displaystyle: function (n) { |
| 1126 |
if (n > 0) {return false} |
| 1127 |
return this.Get("displaystyle"); |
| 1128 |
}, |
| 1129 |
adjustChild_scriptlevel: function (n) { |
| 1130 |
var level = this.Get("scriptlevel"); |
| 1131 |
var force = (this.data[this.base] && !this.Get("displaystyle") && |
| 1132 |
this.data[this.base].CoreMO().Get("movablelimits")); |
| 1133 |
if (n == this.under && (force || !this.Get("accentunder"))) {level++} |
| 1134 |
if (n == this.over && (force || !this.Get("accent"))) {level++} |
| 1135 |
return level; |
| 1136 |
}, |
| 1137 |
adjustChild_texprimestyle: function (n) { |
| 1138 |
if (n === this.base && this.data[this.over]) {return true} |
| 1139 |
return this.Get("texprimestyle"); |
| 1140 |
}, |
| 1141 |
setTeXclass: MML.mbase.setBaseTeXclasses |
| 1142 |
}); |
| 1143 |
|
| 1144 |
MML.munder = MML.munderover.Subclass({type: "munder"}); |
| 1145 |
MML.mover = MML.munderover.Subclass({ |
| 1146 |
type: "mover", over: 1, under: 2, sup: 1, sub: 2, |
| 1147 |
ACCENTS: ["", "accent", "accentunder"] |
| 1148 |
}); |
| 1149 |
|
| 1150 |
MML.mtable = MML.mbase.Subclass({ |
| 1151 |
type: "mtable", |
| 1152 |
defaults: { |
| 1153 |
mathbackground: MML.INHERIT, |
| 1154 |
mathcolor: MML.INHERIT, |
| 1155 |
align: MML.ALIGN.AXIS, |
| 1156 |
rowalign: MML.ALIGN.BASELINE, |
| 1157 |
columnalign: MML.ALIGN.CENTER, |
| 1158 |
groupalign: "{left}", |
| 1159 |
alignmentscope: true, |
| 1160 |
columnwidth: MML.WIDTH.AUTO, |
| 1161 |
width: MML.WIDTH.AUTO, |
| 1162 |
rowspacing: "1ex", |
| 1163 |
columnspacing: ".8em", |
| 1164 |
rowlines: MML.LINES.NONE, |
| 1165 |
columnlines: MML.LINES.NONE, |
| 1166 |
frame: MML.LINES.NONE, |
| 1167 |
framespacing: "0.4em 0.5ex", |
| 1168 |
equalrows: false, |
| 1169 |
equalcolumns: false, |
| 1170 |
displaystyle: false, |
| 1171 |
side: MML.SIDE.RIGHT, |
| 1172 |
minlabelspacing: "0.8em", |
| 1173 |
texClass: MML.TEXCLASS.ORD, |
| 1174 |
useHeight: 1 |
| 1175 |
}, |
| 1176 |
adjustChild_displaystyle: function () { |
| 1177 |
return (this.displaystyle != null ? this.displaystyle : this.defaults.displaystyle); |
| 1178 |
}, |
| 1179 |
inheritFromMe: true, |
| 1180 |
noInherit: { |
| 1181 |
mover: {align: true}, |
| 1182 |
munder: {align: true}, |
| 1183 |
munderover: {align: true}, |
| 1184 |
mtable: { |
| 1185 |
align: true, rowalign: true, columnalign: true, groupalign: true, |
| 1186 |
alignmentscope: true, columnwidth: true, width: true, rowspacing: true, |
| 1187 |
columnspacing: true, rowlines: true, columnlines: true, frame: true, |
| 1188 |
framespacing: true, equalrows: true, equalcolumns: true, displaystyle: true, |
| 1189 |
side: true, minlabelspacing: true, texClass: true, useHeight: 1 |
| 1190 |
} |
| 1191 |
}, |
| 1192 |
linebreakContainer: true, |
| 1193 |
Append: function () { |
| 1194 |
for (var i = 0, m = arguments.length; i < m; i++) { |
| 1195 |
if (!((arguments[i] instanceof MML.mtr) || |
| 1196 |
(arguments[i] instanceof MML.mlabeledtr))) {arguments[i] = MML.mtr(arguments[i])} |
| 1197 |
} |
| 1198 |
this.SUPER(arguments).Append.apply(this,arguments); |
| 1199 |
}, |
| 1200 |
setTeXclass: MML.mbase.setSeparateTeXclasses |
| 1201 |
}); |
| 1202 |
|
| 1203 |
MML.mtr = MML.mbase.Subclass({ |
| 1204 |
type: "mtr", |
| 1205 |
defaults: { |
| 1206 |
mathbackground: MML.INHERIT, |
| 1207 |
mathcolor: MML.INHERIT, |
| 1208 |
rowalign: MML.INHERIT, |
| 1209 |
columnalign: MML.INHERIT, |
| 1210 |
groupalign: MML.INHERIT |
| 1211 |
}, |
| 1212 |
inheritFromMe: true, |
| 1213 |
noInherit: { |
| 1214 |
mrow: {rowalign: true, columnalign: true, groupalign: true}, |
| 1215 |
mtable: {rowalign: true, columnalign: true, groupalign: true} |
| 1216 |
}, |
| 1217 |
linebreakContainer: true, |
| 1218 |
Append: function () { |
| 1219 |
for (var i = 0, m = arguments.length; i < m; i++) { |
| 1220 |
if (!(arguments[i] instanceof MML.mtd)) {arguments[i] = MML.mtd(arguments[i])} |
| 1221 |
} |
| 1222 |
this.SUPER(arguments).Append.apply(this,arguments); |
| 1223 |
}, |
| 1224 |
setTeXclass: MML.mbase.setSeparateTeXclasses |
| 1225 |
}); |
| 1226 |
|
| 1227 |
MML.mtd = MML.mbase.Subclass({ |
| 1228 |
type: "mtd", |
| 1229 |
inferRow: true, |
| 1230 |
linebreakContainer: true, |
| 1231 |
isEmbellished: MML.mbase.childEmbellished, |
| 1232 |
Core: MML.mbase.childCore, |
| 1233 |
CoreMO: MML.mbase.childCoreMO, |
| 1234 |
defaults: { |
| 1235 |
mathbackground: MML.INHERIT, |
| 1236 |
mathcolor: MML.INHERIT, |
| 1237 |
rowspan: 1, |
| 1238 |
columnspan: 1, |
| 1239 |
rowalign: MML.INHERIT, |
| 1240 |
columnalign: MML.INHERIT, |
| 1241 |
groupalign: MML.INHERIT |
| 1242 |
}, |
| 1243 |
setTeXclass: MML.mbase.setSeparateTeXclasses |
| 1244 |
}); |
| 1245 |
|
| 1246 |
MML.maligngroup = MML.mbase.Subclass({ |
| 1247 |
type: "maligngroup", |
| 1248 |
isSpacelike: function () {return true}, |
| 1249 |
defaults: { |
| 1250 |
mathbackground: MML.INHERIT, |
| 1251 |
mathcolor: MML.INHERIT, |
| 1252 |
groupalign: MML.INHERIT |
| 1253 |
}, |
| 1254 |
inheritFromMe: true, |
| 1255 |
noInherit: { |
| 1256 |
mrow: {groupalign: true}, |
| 1257 |
mtable: {groupalign: true} |
| 1258 |
} |
| 1259 |
}); |
| 1260 |
|
| 1261 |
MML.malignmark = MML.mbase.Subclass({ |
| 1262 |
type: "malignmark", |
| 1263 |
defaults: { |
| 1264 |
mathbackground: MML.INHERIT, |
| 1265 |
mathcolor: MML.INHERIT, |
| 1266 |
edge: MML.SIDE.LEFT |
| 1267 |
}, |
| 1268 |
isSpacelike: function () {return true} |
| 1269 |
}); |
| 1270 |
|
| 1271 |
MML.mlabeledtr = MML.mtr.Subclass({ |
| 1272 |
type: "mlabeledtr" |
| 1273 |
}); |
| 1274 |
|
| 1275 |
MML.maction = MML.mbase.Subclass({ |
| 1276 |
type: "maction", |
| 1277 |
defaults: { |
| 1278 |
mathbackground: MML.INHERIT, |
| 1279 |
mathcolor: MML.INHERIT, |
| 1280 |
actiontype: MML.ACTIONTYPE.TOGGLE, |
| 1281 |
selection: 1 |
| 1282 |
}, |
| 1283 |
selected: function () {return this.data[this.Get("selection")-1] || MML.NULL}, |
| 1284 |
isEmbellished: function () {return this.selected().isEmbellished()}, |
| 1285 |
isSpacelike: function () {return this.selected().isSpacelike()}, |
| 1286 |
Core: function () {return this.selected().Core()}, |
| 1287 |
CoreMO: function () {return this.selected().CoreMO()}, |
| 1288 |
setTeXclass: function (prev) { |
| 1289 |
if (this.Get("actiontype") === MML.ACTIONTYPE.TOOLTIP && this.data[1]) { |
| 1290 |
// Make sure tooltip has proper spacing when typeset (see issue #412) |
| 1291 |
this.data[1].setTeXclass(); |
| 1292 |
} |
| 1293 |
var selected = this.selected(); |
| 1294 |
prev = selected.setTeXclass(prev); |
| 1295 |
this.updateTeXclass(selected); |
| 1296 |
return prev; |
| 1297 |
} |
| 1298 |
}); |
| 1299 |
|
| 1300 |
MML.semantics = MML.mbase.Subclass({ |
| 1301 |
type: "semantics", notParent: true, |
| 1302 |
isEmbellished: MML.mbase.childEmbellished, |
| 1303 |
Core: MML.mbase.childCore, |
| 1304 |
CoreMO: MML.mbase.childCoreMO, |
| 1305 |
defaults: { |
| 1306 |
definitionURL: null, |
| 1307 |
encoding: null |
| 1308 |
}, |
| 1309 |
setTeXclass: MML.mbase.setChildTeXclass, |
| 1310 |
getAnnotation: function (name) { |
| 1311 |
var encodingList = MathJax.Hub.config.MathMenu.semanticsAnnotations[name]; |
| 1312 |
if (encodingList) { |
| 1313 |
for (var i = 0, m = this.data.length; i < m; i++) { |
| 1314 |
var encoding = this.data[i].Get("encoding"); |
| 1315 |
if (encoding) { |
| 1316 |
for (var j = 0, n = encodingList.length; j < n; j++) { |
| 1317 |
if (encodingList[j] === encoding) return this.data[i]; |
| 1318 |
} |
| 1319 |
} |
| 1320 |
} |
| 1321 |
} |
| 1322 |
return null; |
| 1323 |
} |
| 1324 |
}); |
| 1325 |
MML.annotation = MML.mbase.Subclass({ |
| 1326 |
type: "annotation", isChars: true, |
| 1327 |
linebreakContainer: true, |
| 1328 |
defaults: { |
| 1329 |
definitionURL: null, |
| 1330 |
encoding: null, |
| 1331 |
cd: "mathmlkeys", |
| 1332 |
name: "", |
| 1333 |
src: null |
| 1334 |
} |
| 1335 |
}); |
| 1336 |
MML["annotation-xml"] = MML.mbase.Subclass({ |
| 1337 |
type: "annotation-xml", |
| 1338 |
linebreakContainer: true, |
| 1339 |
defaults: { |
| 1340 |
definitionURL: null, |
| 1341 |
encoding: null, |
| 1342 |
cd: "mathmlkeys", |
| 1343 |
name: "", |
| 1344 |
src: null |
| 1345 |
} |
| 1346 |
}); |
| 1347 |
|
| 1348 |
MML.math = MML.mstyle.Subclass({ |
| 1349 |
type: "math", |
| 1350 |
defaults: { |
| 1351 |
mathvariant: MML.VARIANT.NORMAL, |
| 1352 |
mathsize: MML.SIZE.NORMAL, |
| 1353 |
mathcolor: "", // should be "black", but allow it to inherit from surrounding text |
| 1354 |
mathbackground: MML.COLOR.TRANSPARENT, |
| 1355 |
dir: "ltr", |
| 1356 |
scriptlevel: 0, |
| 1357 |
displaystyle: MML.AUTO, |
| 1358 |
display: "inline", |
| 1359 |
maxwidth: "", |
| 1360 |
overflow: MML.OVERFLOW.LINEBREAK, |
| 1361 |
altimg: "", |
| 1362 |
'altimg-width': "", |
| 1363 |
'altimg-height': "", |
| 1364 |
'altimg-valign': "", |
| 1365 |
alttext: "", |
| 1366 |
cdgroup: "", |
| 1367 |
scriptsizemultiplier: Math.sqrt(1/2), |
| 1368 |
scriptminsize: "8px", // should be 8pt, but that's too big |
| 1369 |
infixlinebreakstyle: MML.LINEBREAKSTYLE.BEFORE, |
| 1370 |
lineleading: "1ex", |
| 1371 |
indentshift: "auto", // use user configuration |
| 1372 |
indentalign: MML.INDENTALIGN.AUTO, |
| 1373 |
indentalignfirst: MML.INDENTALIGN.INDENTALIGN, |
| 1374 |
indentshiftfirst: MML.INDENTSHIFT.INDENTSHIFT, |
| 1375 |
indentalignlast: MML.INDENTALIGN.INDENTALIGN, |
| 1376 |
indentshiftlast: MML.INDENTSHIFT.INDENTSHIFT, |
| 1377 |
decimalseparator: ".", |
| 1378 |
texprimestyle: false // is it in TeX's C' style? |
| 1379 |
}, |
| 1380 |
autoDefault: function (name) { |
| 1381 |
if (name === "displaystyle") {return this.Get("display") === "block"} |
| 1382 |
return ""; |
| 1383 |
}, |
| 1384 |
linebreakContainer: true, |
| 1385 |
setTeXclass: MML.mbase.setChildTeXclass, |
| 1386 |
getAnnotation: function (name) { |
| 1387 |
if (this.data.length != 1) return null; |
| 1388 |
return this.data[0].getAnnotation(name); |
| 1389 |
} |
| 1390 |
}); |
| 1391 |
|
| 1392 |
MML.chars = MML.mbase.Subclass({ |
| 1393 |
type: "chars", |
| 1394 |
Append: function () {this.data.push.apply(this.data,arguments)}, |
| 1395 |
value: function () {return this.data.join("")}, |
| 1396 |
toString: function () {return this.data.join("")} |
| 1397 |
}); |
| 1398 |
|
| 1399 |
MML.entity = MML.mbase.Subclass({ |
| 1400 |
type: "entity", |
| 1401 |
Append: function () {this.data.push.apply(this.data,arguments)}, |
| 1402 |
value: function () { |
| 1403 |
if (this.data[0].substr(0,2) === "#x") {return parseInt(this.data[0].substr(2),16)} |
| 1404 |
else if (this.data[0].substr(0,1) === "#") {return parseInt(this.data[0].substr(1))} |
| 1405 |
else {return 0} // FIXME: look up named entities from table |
| 1406 |
}, |
| 1407 |
toString: function () { |
| 1408 |
var n = this.value(); |
| 1409 |
if (n <= 0xFFFF) {return String.fromCharCode(n)} |
| 1410 |
n -= 0x10000; |
| 1411 |
return String.fromCharCode((n>>10)+0xD800) |
| 1412 |
+ String.fromCharCode((n&0x3FF)+0xDC00); |
| 1413 |
} |
| 1414 |
}); |
| 1415 |
|
| 1416 |
MML.xml = MML.mbase.Subclass({ |
| 1417 |
type: "xml", |
| 1418 |
Init: function () { |
| 1419 |
this.div = document.createElement("div"); |
| 1420 |
return this.SUPER(arguments).Init.apply(this,arguments); |
| 1421 |
}, |
| 1422 |
Append: function () { |
| 1423 |
for (var i = 0, m = arguments.length; i < m; i++) { |
| 1424 |
var node = this.Import(arguments[i]); |
| 1425 |
this.data.push(node); |
| 1426 |
this.div.appendChild(node); |
| 1427 |
} |
| 1428 |
}, |
| 1429 |
Import: function (node) { |
| 1430 |
if (document.importNode) {return document.importNode(node,true)} |
| 1431 |
// |
| 1432 |
// IE < 9 doesn't have importNode, so fake it. |
| 1433 |
// |
| 1434 |
var nNode, i, m; |
| 1435 |
if (node.nodeType === 1) { // ELEMENT_NODE |
| 1436 |
nNode = document.createElement(node.nodeName); |
| 1437 |
for (i = 0, m = node.attributes.length; i < m; i++) { |
| 1438 |
var attribute = node.attributes[i]; |
| 1439 |
if (attribute.specified && attribute.nodeValue != null && attribute.nodeValue != '') |
| 1440 |
{nNode.setAttribute(attribute.nodeName,attribute.nodeValue)} |
| 1441 |
if (attribute.nodeName === "style") {nNode.style.cssText = attribute.nodeValue} |
| 1442 |
} |
| 1443 |
if (node.className) {nNode.className = node.className} |
| 1444 |
} else if (node.nodeType === 3 || node.nodeType === 4) { // TEXT_NODE or CDATA_SECTION_NODE |
| 1445 |
nNode = document.createTextNode(node.nodeValue); |
| 1446 |
} else if (node.nodeType === 8) { // COMMENT_NODE |
| 1447 |
nNode = document.createComment(node.nodeValue); |
| 1448 |
} else { |
| 1449 |
return document.createTextNode(''); |
| 1450 |
} |
| 1451 |
for (i = 0, m = node.childNodes.length; i < m; i++) |
| 1452 |
{nNode.appendChild(this.Import(node.childNodes[i]))} |
| 1453 |
return nNode; |
| 1454 |
}, |
| 1455 |
value: function () {return this.div}, |
| 1456 |
toString: function () {return this.div.innerHTML} |
| 1457 |
}); |
| 1458 |
|
| 1459 |
MML.TeXAtom = MML.mbase.Subclass({ |
| 1460 |
type: "texatom", |
| 1461 |
linebreakContainer: true, |
| 1462 |
inferRow: true, notParent: true, |
| 1463 |
texClass: MML.TEXCLASS.ORD, |
| 1464 |
Core: MML.mbase.childCore, |
| 1465 |
CoreMO: MML.mbase.childCoreMO, |
| 1466 |
isEmbellished: MML.mbase.childEmbellished, |
| 1467 |
setTeXclass: function (prev) { |
| 1468 |
this.data[0].setTeXclass(); |
| 1469 |
return this.adjustTeXclass(prev); |
| 1470 |
}, |
| 1471 |
adjustTeXclass: MML.mo.prototype.adjustTeXclass |
| 1472 |
}); |
| 1473 |
|
| 1474 |
MML.NULL = MML.mbase().With({type:"null"}); |
| 1475 |
|
| 1476 |
var TEXCLASS = MML.TEXCLASS; |
| 1477 |
|
| 1478 |
var MO = { |
| 1479 |
ORD: [0,0,TEXCLASS.ORD], |
| 1480 |
ORD11: [1,1,TEXCLASS.ORD], |
| 1481 |
ORD21: [2,1,TEXCLASS.ORD], |
| 1482 |
ORD02: [0,2,TEXCLASS.ORD], |
| 1483 |
ORD55: [5,5,TEXCLASS.ORD], |
| 1484 |
OP: [1,2,TEXCLASS.OP,{largeop: true, movablelimits: true, symmetric: true}], |
| 1485 |
OPFIXED: [1,2,TEXCLASS.OP,{largeop: true, movablelimits: true}], |
| 1486 |
INTEGRAL: [0,1,TEXCLASS.OP,{largeop: true, symmetric: true}], |
| 1487 |
INTEGRAL2: [1,2,TEXCLASS.OP,{largeop: true, symmetric: true}], |
| 1488 |
BIN3: [3,3,TEXCLASS.BIN], |
| 1489 |
BIN4: [4,4,TEXCLASS.BIN], |
| 1490 |
BIN01: [0,1,TEXCLASS.BIN], |
| 1491 |
BIN5: [5,5,TEXCLASS.BIN], |
| 1492 |
TALLBIN: [4,4,TEXCLASS.BIN,{stretchy: true}], |
| 1493 |
BINOP: [4,4,TEXCLASS.BIN,{largeop: true, movablelimits: true}], |
| 1494 |
REL: [5,5,TEXCLASS.REL], |
| 1495 |
REL1: [1,1,TEXCLASS.REL,{stretchy: true}], |
| 1496 |
REL4: [4,4,TEXCLASS.REL], |
| 1497 |
RELSTRETCH: [5,5,TEXCLASS.REL,{stretchy: true}], |
| 1498 |
RELACCENT: [5,5,TEXCLASS.REL,{accent: true}], |
| 1499 |
WIDEREL: [5,5,TEXCLASS.REL,{accent: true, stretchy: true}], |
| 1500 |
OPEN: [0,0,TEXCLASS.OPEN,{fence: true, stretchy: true, symmetric: true}], |
| 1501 |
CLOSE: [0,0,TEXCLASS.CLOSE,{fence: true, stretchy: true, symmetric: true}], |
| 1502 |
INNER: [0,0,TEXCLASS.INNER], |
| 1503 |
PUNCT: [0,3,TEXCLASS.PUNCT], |
| 1504 |
ACCENT: [0,0,TEXCLASS.ORD,{accent: true}], |
| 1505 |
WIDEACCENT: [0,0,TEXCLASS.ORD,{accent: true, stretchy: true}] |
| 1506 |
}; |
| 1507 |
|
| 1508 |
MML.mo.Augment({ |
| 1509 |
SPACE: [ |
| 1510 |
'0em', |
| 1511 |
'0.1111em', |
| 1512 |
'0.1667em', |
| 1513 |
'0.2222em', |
| 1514 |
'0.2667em', |
| 1515 |
'0.3333em' |
| 1516 |
], |
| 1517 |
RANGES: [ |
| 1518 |
[0x20,0x7F,TEXCLASS.REL,"BasicLatin"], |
| 1519 |
[0xA0,0xFF,TEXCLASS.ORD,"Latin1Supplement"], |
| 1520 |
[0x100,0x17F,TEXCLASS.ORD], |
| 1521 |
[0x180,0x24F,TEXCLASS.ORD], |
| 1522 |
[0x2B0,0x2FF,TEXCLASS.ORD,"SpacingModLetters"], |
| 1523 |
[0x300,0x36F,TEXCLASS.ORD,"CombDiacritMarks"], |
| 1524 |
[0x370,0x3FF,TEXCLASS.ORD,"GreekAndCoptic"], |
| 1525 |
[0x1E00,0x1EFF,TEXCLASS.ORD], |
| 1526 |
[0x2000,0x206F,TEXCLASS.PUNCT,"GeneralPunctuation"], |
| 1527 |
[0x2070,0x209F,TEXCLASS.ORD], |
| 1528 |
[0x20A0,0x20CF,TEXCLASS.ORD], |
| 1529 |
[0x20D0,0x20FF,TEXCLASS.ORD,"CombDiactForSymbols"], |
| 1530 |
[0x2100,0x214F,TEXCLASS.ORD,"LetterlikeSymbols"], |
| 1531 |
[0x2150,0x218F,TEXCLASS.ORD], |
| 1532 |
[0x2190,0x21FF,TEXCLASS.REL,"Arrows"], |
| 1533 |
[0x2200,0x22FF,TEXCLASS.BIN,"MathOperators"], |
| 1534 |
[0x2300,0x23FF,TEXCLASS.ORD,"MiscTechnical"], |
| 1535 |
[0x2460,0x24FF,TEXCLASS.ORD], |
| 1536 |
[0x2500,0x259F,TEXCLASS.ORD], |
| 1537 |
[0x25A0,0x25FF,TEXCLASS.ORD,"GeometricShapes"], |
| 1538 |
[0x2700,0x27BF,TEXCLASS.ORD,"Dingbats"], |
| 1539 |
[0x27C0,0x27EF,TEXCLASS.ORD,"MiscMathSymbolsA"], |
| 1540 |
[0x27F0,0x27FF,TEXCLASS.REL,"SupplementalArrowsA"], |
| 1541 |
[0x2900,0x297F,TEXCLASS.REL,"SupplementalArrowsB"], |
| 1542 |
[0x2980,0x29FF,TEXCLASS.ORD,"MiscMathSymbolsB"], |
| 1543 |
[0x2A00,0x2AFF,TEXCLASS.BIN,"SuppMathOperators"], |
| 1544 |
[0x2B00,0x2BFF,TEXCLASS.ORD,"MiscSymbolsAndArrows"], |
| 1545 |
[0x1D400,0x1D7FF,TEXCLASS.ORD] |
| 1546 |
], |
| 1547 |
OPTABLE: { |
| 1548 |
prefix: { |
| 1549 |
'\u2200': MO.ORD21, // for all |
| 1550 |
'\u2202': MO.ORD21, // partial differential |
| 1551 |
'\u2203': MO.ORD21, // there exists |
| 1552 |
'\u2207': MO.ORD21, // nabla |
| 1553 |
'\u220F': MO.OP, // n-ary product |
| 1554 |
'\u2210': MO.OP, // n-ary coproduct |
| 1555 |
'\u2211': MO.OP, // n-ary summation |
| 1556 |
'\u2212': MO.BIN01, // minus sign |
| 1557 |
'\u2213': MO.BIN01, // minus-or-plus sign |
| 1558 |
'\u221A': [1,1,TEXCLASS.ORD,{stretchy: true}], // square root |
| 1559 |
'\u2220': MO.ORD, // angle |
| 1560 |
'\u222B': MO.INTEGRAL, // integral |
| 1561 |
'\u222E': MO.INTEGRAL, // contour integral |
| 1562 |
'\u22C0': MO.OP, // n-ary logical and |
| 1563 |
'\u22C1': MO.OP, // n-ary logical or |
| 1564 |
'\u22C2': MO.OP, // n-ary intersection |
| 1565 |
'\u22C3': MO.OP, // n-ary union |
| 1566 |
'\u2308': MO.OPEN, // left ceiling |
| 1567 |
'\u230A': MO.OPEN, // left floor |
| 1568 |
'\u27E8': MO.OPEN, // mathematical left angle bracket |
| 1569 |
'\u27EE': MO.OPEN, // mathematical left flattened parenthesis |
| 1570 |
'\u2A00': MO.OP, // n-ary circled dot operator |
| 1571 |
'\u2A01': MO.OP, // n-ary circled plus operator |
| 1572 |
'\u2A02': MO.OP, // n-ary circled times operator |
| 1573 |
'\u2A04': MO.OP, // n-ary union operator with plus |
| 1574 |
'\u2A06': MO.OP, // n-ary square union operator |
| 1575 |
'\u00AC': MO.ORD21, // not sign |
| 1576 |
'\u00B1': MO.BIN01, // plus-minus sign |
| 1577 |
'(': MO.OPEN, // left parenthesis |
| 1578 |
'+': MO.BIN01, // plus sign |
| 1579 |
'-': MO.BIN01, // hyphen-minus |
| 1580 |
'[': MO.OPEN, // left square bracket |
| 1581 |
'{': MO.OPEN, // left curly bracket |
| 1582 |
'|': MO.OPEN // vertical line |
| 1583 |
}, |
| 1584 |
postfix: { |
| 1585 |
'!': [1,0,TEXCLASS.CLOSE], // exclamation mark |
| 1586 |
'&': MO.ORD, // ampersand |
| 1587 |
'\u2032': MO.ORD02, // prime |
| 1588 |
'\u203E': MO.WIDEACCENT, // overline |
| 1589 |
'\u2309': MO.CLOSE, // right ceiling |
| 1590 |
'\u230B': MO.CLOSE, // right floor |
| 1591 |
'\u23DE': MO.WIDEACCENT, // top curly bracket |
| 1592 |
'\u23DF': MO.WIDEACCENT, // bottom curly bracket |
| 1593 |
'\u266D': MO.ORD02, // music flat sign |
| 1594 |
'\u266E': MO.ORD02, // music natural sign |
| 1595 |
'\u266F': MO.ORD02, // music sharp sign |
| 1596 |
'\u27E9': MO.CLOSE, // mathematical right angle bracket |
| 1597 |
'\u27EF': MO.CLOSE, // mathematical right flattened parenthesis |
| 1598 |
'\u02C6': MO.WIDEACCENT, // modifier letter circumflex accent |
| 1599 |
'\u02C7': MO.WIDEACCENT, // caron |
| 1600 |
'\u02C9': MO.WIDEACCENT, // modifier letter macron |
| 1601 |
'\u02CA': MO.ACCENT, // modifier letter acute accent |
| 1602 |
'\u02CB': MO.ACCENT, // modifier letter grave accent |
| 1603 |
'\u02D8': MO.ACCENT, // breve |
| 1604 |
'\u02D9': MO.ACCENT, // dot above |
| 1605 |
'\u02DC': MO.WIDEACCENT, // small tilde |
| 1606 |
'\u0302': MO.WIDEACCENT, // combining circumflex accent |
| 1607 |
'\u00A8': MO.ACCENT, // diaeresis |
| 1608 |
'\u00AF': MO.WIDEACCENT, // macron |
| 1609 |
')': MO.CLOSE, // right parenthesis |
| 1610 |
']': MO.CLOSE, // right square bracket |
| 1611 |
'^': MO.WIDEACCENT, // circumflex accent |
| 1612 |
'_': MO.WIDEACCENT, // low line |
| 1613 |
'`': MO.ACCENT, // grave accent |
| 1614 |
'|': MO.CLOSE, // vertical line |
| 1615 |
'}': MO.CLOSE, // right curly bracket |
| 1616 |
'~': MO.WIDEACCENT // tilde |
| 1617 |
}, |
| 1618 |
infix: { |
| 1619 |
'': MO.ORD, // empty <mo> |
| 1620 |
'%': [3,3,TEXCLASS.ORD], // percent sign |
| 1621 |
'\u2022': MO.BIN4, // bullet |
| 1622 |
'\u2026': MO.INNER, // horizontal ellipsis |
| 1623 |
'\u2044': MO.TALLBIN, // fraction slash |
| 1624 |
'\u2061': MO.ORD, // function application |
| 1625 |
'\u2062': MO.ORD, // invisible times |
| 1626 |
'\u2063': [0,0,TEXCLASS.ORD,{linebreakstyle:"after", separator: true}], // invisible separator |
| 1627 |
'\u2064': MO.ORD, // invisible plus |
| 1628 |
'\u2190': MO.WIDEREL, // leftwards arrow |
| 1629 |
'\u2191': MO.RELSTRETCH, // upwards arrow |
| 1630 |
'\u2192': MO.WIDEREL, // rightwards arrow |
| 1631 |
'\u2193': MO.RELSTRETCH, // downwards arrow |
| 1632 |
'\u2194': MO.WIDEREL, // left right arrow |
| 1633 |
'\u2195': MO.RELSTRETCH, // up down arrow |
| 1634 |
'\u2196': MO.RELSTRETCH, // north west arrow |
| 1635 |
'\u2197': MO.RELSTRETCH, // north east arrow |
| 1636 |
'\u2198': MO.RELSTRETCH, // south east arrow |
| 1637 |
'\u2199': MO.RELSTRETCH, // south west arrow |
| 1638 |
'\u21A6': MO.WIDEREL, // rightwards arrow from bar |
| 1639 |
'\u21A9': MO.WIDEREL, // leftwards arrow with hook |
| 1640 |
'\u21AA': MO.WIDEREL, // rightwards arrow with hook |
| 1641 |
'\u21BC': MO.WIDEREL, // leftwards harpoon with barb upwards |
| 1642 |
'\u21BD': MO.WIDEREL, // leftwards harpoon with barb downwards |
| 1643 |
'\u21C0': MO.WIDEREL, // rightwards harpoon with barb upwards |
| 1644 |
'\u21C1': MO.WIDEREL, // rightwards harpoon with barb downwards |
| 1645 |
'\u21CC': MO.WIDEREL, // rightwards harpoon over leftwards harpoon |
| 1646 |
'\u21D0': MO.WIDEREL, // leftwards double arrow |
| 1647 |
'\u21D1': MO.RELSTRETCH, // upwards double arrow |
| 1648 |
'\u21D2': MO.WIDEREL, // rightwards double arrow |
| 1649 |
'\u21D3': MO.RELSTRETCH, // downwards double arrow |
| 1650 |
'\u21D4': MO.WIDEREL, // left right double arrow |
| 1651 |
'\u21D5': MO.RELSTRETCH, // up down double arrow |
| 1652 |
'\u2208': MO.REL, // element of |
| 1653 |
'\u2209': MO.REL, // not an element of |
| 1654 |
'\u220B': MO.REL, // contains as member |
| 1655 |
'\u2212': MO.BIN4, // minus sign |
| 1656 |
'\u2213': MO.BIN4, // minus-or-plus sign |
| 1657 |
'\u2215': MO.TALLBIN, // division slash |
| 1658 |
'\u2216': MO.BIN4, // set minus |
| 1659 |
'\u2217': MO.BIN4, // asterisk operator |
| 1660 |
'\u2218': MO.BIN4, // ring operator |
| 1661 |
'\u2219': MO.BIN4, // bullet operator |
| 1662 |
'\u221D': MO.REL, // proportional to |
| 1663 |
'\u2223': MO.REL, // divides |
| 1664 |
'\u2225': MO.REL, // parallel to |
| 1665 |
'\u2227': MO.BIN4, // logical and |
| 1666 |
'\u2228': MO.BIN4, // logical or |
| 1667 |
'\u2229': MO.BIN4, // intersection |
| 1668 |
'\u222A': MO.BIN4, // union |
| 1669 |
'\u223C': MO.REL, // tilde operator |
| 1670 |
'\u2240': MO.BIN4, // wreath product |
| 1671 |
'\u2243': MO.REL, // asymptotically equal to |
| 1672 |
'\u2245': MO.REL, // approximately equal to |
| 1673 |
'\u2248': MO.REL, // almost equal to |
| 1674 |
'\u224D': MO.REL, // equivalent to |
| 1675 |
'\u2250': MO.REL, // approaches the limit |
| 1676 |
'\u2260': MO.REL, // not equal to |
| 1677 |
'\u2261': MO.REL, // identical to |
| 1678 |
'\u2264': MO.REL, // less-than or equal to |
| 1679 |
'\u2265': MO.REL, // greater-than or equal to |
| 1680 |
'\u226A': MO.REL, // much less-than |
| 1681 |
'\u226B': MO.REL, // much greater-than |
| 1682 |
'\u227A': MO.REL, // precedes |
| 1683 |
'\u227B': MO.REL, // succeeds |
| 1684 |
'\u2282': MO.REL, // subset of |
| 1685 |
'\u2283': MO.REL, // superset of |
| 1686 |
'\u2286': MO.REL, // subset of or equal to |
| 1687 |
'\u2287': MO.REL, // superset of or equal to |
| 1688 |
'\u228E': MO.BIN4, // multiset union |
| 1689 |
'\u2291': MO.REL, // square image of or equal to |
| 1690 |
'\u2292': MO.REL, // square original of or equal to |
| 1691 |
'\u2293': MO.BIN4, // square cap |
| 1692 |
'\u2294': MO.BIN4, // square cup |
| 1693 |
'\u2295': MO.BIN4, // circled plus |
| 1694 |
'\u2296': MO.BIN4, // circled minus |
| 1695 |
'\u2297': MO.BIN4, // circled times |
| 1696 |
'\u2298': MO.BIN4, // circled division slash |
| 1697 |
'\u2299': MO.BIN4, // circled dot operator |
| 1698 |
'\u22A2': MO.REL, // right tack |
| 1699 |
'\u22A3': MO.REL, // left tack |
| 1700 |
'\u22A4': MO.ORD55, // down tack |
| 1701 |
'\u22A5': MO.REL, // up tack |
| 1702 |
'\u22A8': MO.REL, // true |
| 1703 |
'\u22C4': MO.BIN4, // diamond operator |
| 1704 |
'\u22C5': MO.BIN4, // dot operator |
| 1705 |
'\u22C6': MO.BIN4, // star operator |
| 1706 |
'\u22C8': MO.REL, // bowtie |
| 1707 |
'\u22EE': MO.ORD55, // vertical ellipsis |
| 1708 |
'\u22EF': MO.INNER, // midline horizontal ellipsis |
| 1709 |
'\u22F1': [5,5,TEXCLASS.INNER], // down right diagonal ellipsis |
| 1710 |
'\u25B3': MO.BIN4, // white up-pointing triangle |
| 1711 |
'\u25B5': MO.BIN4, // white up-pointing small triangle |
| 1712 |
'\u25B9': MO.BIN4, // white right-pointing small triangle |
| 1713 |
'\u25BD': MO.BIN4, // white down-pointing triangle |
| 1714 |
'\u25BF': MO.BIN4, // white down-pointing small triangle |
| 1715 |
'\u25C3': MO.BIN4, // white left-pointing small triangle |
| 1716 |
'\u2758': MO.REL, // light vertical bar |
| 1717 |
'\u27F5': MO.WIDEREL, // long leftwards arrow |
| 1718 |
'\u27F6': MO.WIDEREL, // long rightwards arrow |
| 1719 |
'\u27F7': MO.WIDEREL, // long left right arrow |
| 1720 |
'\u27F8': MO.WIDEREL, // long leftwards double arrow |
| 1721 |
'\u27F9': MO.WIDEREL, // long rightwards double arrow |
| 1722 |
'\u27FA': MO.WIDEREL, // long left right double arrow |
| 1723 |
'\u27FC': MO.WIDEREL, // long rightwards arrow from bar |
| 1724 |
'\u2A2F': MO.BIN4, // vector or cross product |
| 1725 |
'\u2A3F': MO.BIN4, // amalgamation or coproduct |
| 1726 |
'\u2AAF': MO.REL, // precedes above single-line equals sign |
| 1727 |
'\u2AB0': MO.REL, // succeeds above single-line equals sign |
| 1728 |
'\u00B1': MO.BIN4, // plus-minus sign |
| 1729 |
'\u00B7': MO.BIN4, // middle dot |
| 1730 |
'\u00D7': MO.BIN4, // multiplication sign |
| 1731 |
'\u00F7': MO.BIN4, // division sign |
| 1732 |
'*': MO.BIN3, // asterisk |
| 1733 |
'+': MO.BIN4, // plus sign |
| 1734 |
',': [0,3,TEXCLASS.PUNCT,{linebreakstyle:"after", separator: true}], // comma |
| 1735 |
'-': MO.BIN4, // hyphen-minus |
| 1736 |
'.': [3,3,TEXCLASS.ORD], // full stop |
| 1737 |
'/': MO.ORD11, // solidus |
| 1738 |
':': [1,2,TEXCLASS.REL], // colon |
| 1739 |
';': [0,3,TEXCLASS.PUNCT,{linebreakstyle:"after", separator: true}], // semicolon |
| 1740 |
'<': MO.REL, // less-than sign |
| 1741 |
'=': MO.REL, // equals sign |
| 1742 |
'>': MO.REL, // greater-than sign |
| 1743 |
'?': [1,1,TEXCLASS.CLOSE], // question mark |
| 1744 |
'\\': MO.ORD, // reverse solidus |
| 1745 |
'^': MO.ORD11, // circumflex accent |
| 1746 |
'_': MO.ORD11, // low line |
| 1747 |
'|': [2,2,TEXCLASS.ORD,{fence: true, stretchy: true, symmetric: true}], // vertical line |
| 1748 |
'#': MO.ORD, // # |
| 1749 |
'$': MO.ORD, // $ |
| 1750 |
'\u002E': [0,3,TEXCLASS.PUNCT,{separator: true}], // \ldotp |
| 1751 |
'\u02B9': MO.ORD, // prime |
| 1752 |
'\u0300': MO.ACCENT, // \grave |
| 1753 |
'\u0301': MO.ACCENT, // \acute |
| 1754 |
'\u0303': MO.WIDEACCENT, // \tilde |
| 1755 |
'\u0304': MO.ACCENT, // \bar |
| 1756 |
'\u0306': MO.ACCENT, // \breve |
| 1757 |
'\u0307': MO.ACCENT, // \dot |
| 1758 |
'\u0308': MO.ACCENT, // \ddot |
| 1759 |
'\u030C': MO.ACCENT, // \check |
| 1760 |
'\u0332': MO.WIDEACCENT, // horizontal line |
| 1761 |
'\u0338': MO.REL4, // \not |
| 1762 |
'\u2015': [0,0,TEXCLASS.ORD,{stretchy: true}], // horizontal line |
| 1763 |
'\u2017': [0,0,TEXCLASS.ORD,{stretchy: true}], // horizontal line |
| 1764 |
'\u2020': MO.BIN3, // \dagger |
| 1765 |
'\u2021': MO.BIN3, // \ddagger |
| 1766 |
'\u20D7': MO.ACCENT, // \vec |
| 1767 |
'\u2111': MO.ORD, // \Im |
| 1768 |
'\u2113': MO.ORD, // \ell |
| 1769 |
'\u2118': MO.ORD, // \wp |
| 1770 |
'\u211C': MO.ORD, // \Re |
| 1771 |
'\u2205': MO.ORD, // \emptyset |
| 1772 |
'\u221E': MO.ORD, // \infty |
| 1773 |
'\u2305': MO.BIN3, // barwedge |
| 1774 |
'\u2306': MO.BIN3, // doublebarwedge |
| 1775 |
'\u2322': MO.REL4, // \frown |
| 1776 |
'\u2323': MO.REL4, // \smile |
| 1777 |
'\u2329': MO.OPEN, // langle |
| 1778 |
'\u232A': MO.CLOSE, // rangle |
| 1779 |
'\u23AA': MO.ORD, // \bracevert |
| 1780 |
'\u23AF': [0,0,TEXCLASS.ORD,{stretchy: true}], // \underline |
| 1781 |
'\u23B0': MO.OPEN, // \lmoustache |
| 1782 |
'\u23B1': MO.CLOSE, // \rmoustache |
| 1783 |
'\u2500': MO.ORD, // horizontal line |
| 1784 |
'\u25EF': MO.BIN3, // \bigcirc |
| 1785 |
'\u2660': MO.ORD, // \spadesuit |
| 1786 |
'\u2661': MO.ORD, // \heartsuit |
| 1787 |
'\u2662': MO.ORD, // \diamondsuit |
| 1788 |
'\u2663': MO.ORD, // \clubsuit |
| 1789 |
'\u3008': MO.OPEN, // langle |
| 1790 |
'\u3009': MO.CLOSE, // rangle |
| 1791 |
'\uFE37': MO.WIDEACCENT, // horizontal brace down |
| 1792 |
'\uFE38': MO.WIDEACCENT // horizontal brace up |
| 1793 |
} |
| 1794 |
} |
| 1795 |
},{ |
| 1796 |
OPTYPES: MO |
| 1797 |
}); |
| 1798 |
|
| 1799 |
// |
| 1800 |
// These are not in the W3C table, but FF works this way, |
| 1801 |
// and it makes sense, so add it here |
| 1802 |
// |
| 1803 |
var OPTABLE = MML.mo.prototype.OPTABLE; |
| 1804 |
OPTABLE.infix["^"] = MO.WIDEREL; |
| 1805 |
OPTABLE.infix["_"] = MO.WIDEREL; |
| 1806 |
OPTABLE.prefix["\u2223"] = MO.OPEN; |
| 1807 |
OPTABLE.prefix["\u2225"] = MO.OPEN; |
| 1808 |
OPTABLE.postfix["\u2223"] = MO.CLOSE; |
| 1809 |
OPTABLE.postfix["\u2225"] = MO.CLOSE; |
| 1810 |
|
| 1811 |
})(MathJax.ElementJax.mml); |
| 1812 |
|
| 1813 |
MathJax.ElementJax.mml.loadComplete("jax.js"); |