123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
- var VERSION = "2.5.2";
- var MML = MathJax.ElementJax.mml;
- var TEX = MathJax.InputJax.TeX;
- var TEXDEF = TEX.Definitions;
-
- TEXDEF.Add({macros: {mathchoice: 'MathChoice'}},null,true);
- TEX.Parse.Augment({
- MathChoice: function (name) {
- var D = this.ParseArg(name),
- T = this.ParseArg(name),
- S = this.ParseArg(name),
- SS = this.ParseArg(name);
- this.Push(MML.TeXmathchoice(D,T,S,SS));
- }
- });
-
- MML.TeXmathchoice = MML.mbase.Subclass({
- type: "TeXmathchoice", notParent: true,
- choice: function () {
- if (this.selection != null) return this.selection;
- if (this.choosing) return 2;
- this.choosing = true;
- var selection = 0, values = this.getValues("displaystyle","scriptlevel");
- if (values.scriptlevel > 0) {selection = Math.min(3,values.scriptlevel+1)}
- else {selection = (values.displaystyle ? 0 : 1)}
-
- var node = this.inherit; while (node && node.type !== "math") node = node.inherit;
- if (node) this.selection = selection;
- this.choosing = false;
- return selection;
- },
- selected: function () {return this.data[this.choice()]},
- setTeXclass: function (prev) {return this.selected().setTeXclass(prev)},
- isSpacelike: function () {return this.selected().isSpacelike()},
- isEmbellished: function () {return this.selected().isEmbellished()},
- Core: function () {return this.selected()},
- CoreMO: function () {return this.selected().CoreMO()},
- toHTML: function (span) {
- span = this.HTMLcreateSpan(span);
- span.bbox = this.Core().toHTML(span).bbox;
-
-
-
-
-
-
- if (span.firstChild && span.firstChild.style.marginLeft) {
- span.style.marginLeft = span.firstChild.style.marginLeft;
- span.firstChild.style.marginLeft = "";
- }
- return span;
- },
- toSVG: function () {
- var svg = this.Core().toSVG();
- this.SVGsaveData(svg);
- return svg;
- },
- toCommonHTML: function (span) {
- span = this.CHTMLcreateSpan(span);
- this.CHTMLhandleStyle(span);
- this.CHTMLhandleColor(span);
- this.CHTMLaddChild(span,this.choice(),{});
- return span;
- }
- });
-
- MathJax.Hub.Startup.signal.Post("TeX mathchoice Ready");
-
- });
- MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mathchoice.js");
|