Merge branch 'issue71' into new-features (adds line numbering, \label and \ref)
This commit is contained in:
commit
fcefc54b20
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -262,6 +262,13 @@ MathJax.Hub.Config({
|
|||
//
|
||||
processEnvironments: true,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax processes \ref{...} commands outside
|
||||
// of math mode. Set to "false" to prevent processing of \ref
|
||||
// except within math mode.
|
||||
//
|
||||
processRefs: true,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, when it locates in-line
|
||||
|
@ -368,7 +375,20 @@ MathJax.Hub.Config({
|
|||
// bold: ['{\\bf #1}', 1]
|
||||
// }
|
||||
//
|
||||
Macros: {}
|
||||
Macros: {},
|
||||
|
||||
//
|
||||
// Equation numbering parameters.
|
||||
//
|
||||
equationNumbers: {
|
||||
// formatNumber: function (n) {return n}, // format for equation number n
|
||||
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
|
||||
// formatID: function (n) {return 'mjx-eqn-'+n}, // element ID to use for reference
|
||||
// formatURL: function (n) {return '#mjx-eqn-'+escape(n)}, // URL to use for references
|
||||
|
||||
autoNumber: "none" // "AMS" for standard AMS environment numbering,
|
||||
// or "all" to number all displayed equations
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.2",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%"}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
MathJax.InputJax.TeX=MathJax.InputJax({id:"TeX",version:"1.1.3",directory:MathJax.InputJax.directory+"/TeX",extensionDir:MathJax.InputJax.extensionDir+"/TeX",config:{TagSide:"right",TagIndent:"0.8em",MultLineWidth:"85%",equationNumbers:{autoNumber:"none",formatNumber:function(a){return a},formatTag:function(a){return"("+a+")"},formatID:function(a){return"mjx-eqn-"+a},formatURL:function(a){return"#mjx-eqn-"+escape(a)}}}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.OutputJax["HTML-CSS"]=MathJax.OutputJax({id:"HTML-CSS",version:"1.1.8",directory:MathJax.OutputJax.directory+"/HTML-CSS",extensionDir:MathJax.OutputJax.extensionDir+"/HTML-CSS",autoloadDir:MathJax.OutputJax.directory+"/HTML-CSS/autoload",fontDir:MathJax.OutputJax.directory+"/HTML-CSS/fonts",webfontDir:MathJax.OutputJax.fontDir+"/HTML-CSS",config:{scale:100,minScaleAdjust:50,availableFonts:["STIX","TeX"],preferredFont:"TeX",webFont:"TeX",imageFont:"TeX",undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",showMathMenu:true,styles:{".MathJax_Display":{"text-align":"center",margin:"1em 0em"},".MathJax .merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-family":"serif","font-style":"normal","font-size":"90%"},".MathJax_Preview":{color:"#888888"},"#MathJax_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')",padding:"3px 4px"}}}});if(MathJax.Hub.Browser.isMSIE&&document.documentMode>=9){delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter}if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}MathJax.Hub.Register.StartupHook("End Config",[function(b,c){var a=b.Insert({minBrowserVersion:{Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4},inlineMathDelimiters:["$","$"],displayMathDelimiters:["$$","$$"],multilineDisplay:true,minBrowserTranslate:function(f){var e=b.getJaxFor(f),k=["[Math]"],j;var h=document.createElement("span",{className:"MathJax_Preview"});if(e.inputJax.id==="TeX"){if(e.root.Get("displaystyle")){j=a.displayMathDelimiters;k=[j[0]+e.originalText+j[1]];if(a.multilineDisplay){k=k[0].split(/\n/)}}else{j=a.inlineMathDelimiters;k=[j[0]+e.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+j[1]]}}for(var g=0,d=k.length;g<d;g++){h.appendChild(document.createTextNode(k[g]));if(g<d-1){h.appendChild(document.createElement("br"))}}f.parentNode.insertBefore(h,f)}},(b.config["HTML-CSS"]||{}));if(b.Browser.version!=="0.0"&&!b.Browser.versionAtLeast(a.minBrowserVersion[b.Browser]||0)){c.Translate=a.minBrowserTranslate;b.Config({showProcessingMessages:false});MathJax.Message.Set("Your browser does not support MathJax",null,4000);b.Startup.signal.Post("MathJax not supported")}},MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]);MathJax.OutputJax["HTML-CSS"].loadComplete("config.js");
|
||||
MathJax.OutputJax["HTML-CSS"]=MathJax.OutputJax({id:"HTML-CSS",version:"1.1.9",directory:MathJax.OutputJax.directory+"/HTML-CSS",extensionDir:MathJax.OutputJax.extensionDir+"/HTML-CSS",autoloadDir:MathJax.OutputJax.directory+"/HTML-CSS/autoload",fontDir:MathJax.OutputJax.directory+"/HTML-CSS/fonts",webfontDir:MathJax.OutputJax.fontDir+"/HTML-CSS",config:{scale:100,minScaleAdjust:50,availableFonts:["STIX","TeX"],preferredFont:"TeX",webFont:"TeX",imageFont:"TeX",undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",showMathMenu:true,styles:{".MathJax_Display":{"text-align":"center",margin:"1em 0em"},".MathJax .merror":{"background-color":"#FFFF88",color:"#CC0000",border:"1px solid #CC0000",padding:"1px 3px","font-family":"serif","font-style":"normal","font-size":"90%"},".MathJax_Preview":{color:"#888888"},"#MathJax_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')",padding:"3px 4px"}}}});if(MathJax.Hub.Browser.isMSIE&&document.documentMode>=9){delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter}if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}MathJax.Hub.Register.StartupHook("End Config",[function(b,c){var a=b.Insert({minBrowserVersion:{Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4},inlineMathDelimiters:["$","$"],displayMathDelimiters:["$$","$$"],multilineDisplay:true,minBrowserTranslate:function(f){var e=b.getJaxFor(f),k=["[Math]"],j;var h=document.createElement("span",{className:"MathJax_Preview"});if(e.inputJax==="TeX"){if(e.root.Get("displaystyle")){j=a.displayMathDelimiters;k=[j[0]+e.originalText+j[1]];if(a.multilineDisplay){k=k[0].split(/\n/)}}else{j=a.inlineMathDelimiters;k=[j[0]+e.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+j[1]]}}for(var g=0,d=k.length;g<d;g++){h.appendChild(document.createTextNode(k[g]));if(g<d-1){h.appendChild(document.createElement("br"))}}f.parentNode.insertBefore(h,f)}},(b.config["HTML-CSS"]||{}));if(b.Browser.version!=="0.0"&&!b.Browser.versionAtLeast(a.minBrowserVersion[b.Browser]||0)){c.Translate=a.minBrowserTranslate;b.Config({showProcessingMessages:false});MathJax.Message.Set("Your browser does not support MathJax",null,4000);b.Startup.signal.Post("MathJax not supported")}},MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]);MathJax.OutputJax["HTML-CSS"].loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.OutputJax.NativeMML=MathJax.OutputJax({id:"NativeMML",version:"1.1.4",directory:MathJax.OutputJax.directory+"/NativeMML",extensionDir:MathJax.OutputJax.extensionDir+"/NativeMML",config:{scale:100,showMathMenu:true,showMathMenuMSIE:true,styles:{"DIV.MathJax_MathML":{"text-align":"center",margin:".75em 0px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.NativeMML.Register("jax/mml")}MathJax.OutputJax.NativeMML.loadComplete("config.js");
|
||||
MathJax.OutputJax.NativeMML=MathJax.OutputJax({id:"NativeMML",version:"1.1.5",directory:MathJax.OutputJax.directory+"/NativeMML",extensionDir:MathJax.OutputJax.extensionDir+"/NativeMML",config:{scale:100,showMathMenu:true,showMathMenuMSIE:true,styles:{"DIV.MathJax_MathML":{"text-align":"center",margin:".75em 0px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.NativeMML.Register("jax/mml")}MathJax.OutputJax.NativeMML.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@ if (!window.MathJax) {window.MathJax= {}}
|
|||
if (!MathJax.Hub) { // skip if already loaded
|
||||
|
||||
MathJax.version = "1.1a";
|
||||
MathJax.fileversion = "1.1.7";
|
||||
MathJax.fileversion = "1.1.8";
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
|
@ -366,25 +366,52 @@ MathJax.fileversion = "1.1.7";
|
|||
};
|
||||
|
||||
//
|
||||
// Run an array of callbacks passing them the given data.
|
||||
// If any return callbacks, return a callback that will be
|
||||
// executed when they all have completed.
|
||||
// An array or priorities hooks that are executed sequentially
|
||||
// with a given set of data.
|
||||
//
|
||||
var HOOKS = function (hooks,data,reset) {
|
||||
if (!hooks) {return null}
|
||||
if (!(hooks instanceof Array)) {hooks = [hooks]}
|
||||
if (!(data instanceof Array)) {data = (data == null ? [] : [data])}
|
||||
var callbacks = [{}];
|
||||
for (var i = 0, m = hooks.length; i < m; i++) {
|
||||
if (reset) {hooks[i].reset()}
|
||||
var result = hooks[i].apply(window,data);
|
||||
if (ISCALLBACK(result) && !result.called) {callbacks.push(result)}
|
||||
var HOOKS = MathJax.Object.Subclass({
|
||||
//
|
||||
// Initialize the array and the auto-reset status
|
||||
//
|
||||
Init: function (reset) {
|
||||
this.hooks = [];
|
||||
this.reset = reset;
|
||||
},
|
||||
//
|
||||
// Add a callback to the list, in priority order (default priority is 10)
|
||||
//
|
||||
Add: function (hook,priority) {
|
||||
if (priority == null) {priority = 10}
|
||||
if (!ISCALLBACK(hook)) {hook = USING(hook)}
|
||||
hook.priority = priority;
|
||||
var i = this.hooks.length;
|
||||
while (i > 0 && priority < this.hooks[i-1].priority) {i--}
|
||||
this.hooks.splice(i,0,hook);
|
||||
return hook;
|
||||
},
|
||||
Remove: function (hook) {
|
||||
for (var i = 0, m = this.hooks.length; i < m; i++) {
|
||||
if (this.hooks[i] === hook) {this.hooks.splice(i,1); return}
|
||||
}
|
||||
},
|
||||
//
|
||||
// Execute the list of callbacks, resetting them if requested.
|
||||
// If any return callbacks, return a callback that will be
|
||||
// executed when they all have completed.
|
||||
//
|
||||
Execute: function () {
|
||||
var callbacks = [{}];
|
||||
for (var i = 0, m = this.hooks.length; i < m; i++) {
|
||||
if (this.reset) {this.hooks[i].reset()}
|
||||
var result = this.hooks[i].apply(window,arguments);
|
||||
if (ISCALLBACK(result) && !result.called) {callbacks.push(result)}
|
||||
}
|
||||
if (callbacks.length === 1) {return null}
|
||||
if (callbacks.length === 2) {return callbacks[1]}
|
||||
return AFTER.apply({},callbacks);
|
||||
}
|
||||
if (callbacks.length === 1) {return null}
|
||||
if (callbacks.length === 2) {return callbacks[1]}
|
||||
return AFTER.apply({},callbacks);
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
//
|
||||
// Command queue that performs commands in order, waiting when
|
||||
// necessary for commands to complete asynchronousely
|
||||
|
@ -447,8 +474,8 @@ MathJax.fileversion = "1.1.7";
|
|||
Init: function (name) {
|
||||
QUEUE.prototype.Init.call(this);
|
||||
this.name = name;
|
||||
this.posted = []; // the messages posted so far
|
||||
this.listeners = []; // those with interest in this signal
|
||||
this.posted = []; // the messages posted so far
|
||||
this.listeners = HOOKS(true); // those with interest in this signal
|
||||
},
|
||||
//
|
||||
// Post a message to the signal listeners, with callback for when complete
|
||||
|
@ -460,12 +487,9 @@ MathJax.fileversion = "1.1.7";
|
|||
} else {
|
||||
this.callback = callback; callback.reset();
|
||||
if (!forget) {this.posted.push(message)}
|
||||
this.Suspend(); this.posting = 1;
|
||||
for (var i = 0, m = this.listeners.length; i < m; i++) {
|
||||
this.listeners[i].reset();
|
||||
var result = (this.listeners[i])(message);
|
||||
if (ISCALLBACK(result) && !result.called) {WAITFOR(result,this)}
|
||||
}
|
||||
this.Suspend(); this.posting = true;
|
||||
var result = this.listeners.Execute(message);
|
||||
if (ISCALLBACK(result) && !result.called) {WAITFOR(result,this)}
|
||||
this.Resume(); delete this.posting;
|
||||
if (!this.pending) {this.call()}
|
||||
}
|
||||
|
@ -491,11 +515,11 @@ MathJax.fileversion = "1.1.7";
|
|||
|
||||
//
|
||||
// A listener calls this to register intrest in the signal (so it will be called
|
||||
// when posts occur). If ignorePast is 1, it will not be sent the post history.
|
||||
// when posts occur). If ignorePast is true, it will not be sent the post history.
|
||||
//
|
||||
Interest: function (callback,ignorePast) {
|
||||
Interest: function (callback,ignorePast,priority) {
|
||||
callback = USING(callback);
|
||||
this.listeners[this.listeners.length] = callback;
|
||||
this.listeners.Add(callback,priority);
|
||||
if (!ignorePast) {
|
||||
for (var i = 0, m = this.posted.length; i < m; i++) {
|
||||
callback.reset();
|
||||
|
@ -509,19 +533,17 @@ MathJax.fileversion = "1.1.7";
|
|||
// A listener calls this to remove itself from a signal
|
||||
//
|
||||
NoInterest: function (callback) {
|
||||
for (var i = 0, m = this.listeners.length; i < m; i++) {
|
||||
if (this.listeners[i] === callback) {this.listeners.splice(i,1); return}
|
||||
}
|
||||
this.listeners.Remove(callback);
|
||||
},
|
||||
|
||||
//
|
||||
// Hook a callback to a particular message on this signal
|
||||
//
|
||||
MessageHook: function (msg,callback) {
|
||||
MessageHook: function (msg,callback,priority) {
|
||||
callback = USING(callback);
|
||||
if (!this.hooks) {this.hooks = {}; this.Interest(["ExecuteHooks",this])}
|
||||
if (!this.hooks[msg]) {this.hooks[msg] = []}
|
||||
this.hooks[msg].push(callback);
|
||||
if (!this.hooks[msg]) {this.hooks[msg] = HOOKS(true)}
|
||||
this.hooks[msg].Add(callback,priority);
|
||||
for (var i = 0, m = this.posted.length; i < m; i++)
|
||||
{if (this.posted[i] == msg) {callback.reset(); callback(this.posted[i])}}
|
||||
return callback;
|
||||
|
@ -531,7 +553,8 @@ MathJax.fileversion = "1.1.7";
|
|||
//
|
||||
ExecuteHooks: function (msg,more) {
|
||||
var type = ((msg instanceof Array) ? msg[0] : msg);
|
||||
return HOOKS(this.hooks[type],[msg],true);
|
||||
if (!this.hooks[type]) {return null}
|
||||
return this.hooks[type].Execute(msg);
|
||||
}
|
||||
|
||||
},{
|
||||
|
@ -550,7 +573,7 @@ MathJax.fileversion = "1.1.7";
|
|||
BASE.Callback.After = AFTER;
|
||||
BASE.Callback.Queue = QUEUE;
|
||||
BASE.Callback.Signal = SIGNAL.find;
|
||||
BASE.Callback.ExecuteHooks = HOOKS;
|
||||
BASE.Callback.Hooks = HOOKS;
|
||||
})("MathJax");
|
||||
|
||||
/**********************************************************/
|
||||
|
@ -635,8 +658,7 @@ MathJax.fileversion = "1.1.7";
|
|||
else {type = file.split(/\./).pop().toUpperCase()}
|
||||
file = this.fileURL(file);
|
||||
if (this.loading[file]) {
|
||||
if (!this.loadHooks[file]) {this.loadHooks[file] = []}
|
||||
this.loadHooks[file].push(callback);
|
||||
this.addHook(file,callback);
|
||||
} else {
|
||||
this.head = HEAD(this.head);
|
||||
if (this.loader[type]) {this.loader[type].call(this,file,callback)}
|
||||
|
@ -649,18 +671,18 @@ MathJax.fileversion = "1.1.7";
|
|||
// Register a load hook for a particular file (it will be called when
|
||||
// loadComplete() is called for that file)
|
||||
//
|
||||
LoadHook: function (file,callback) {
|
||||
LoadHook: function (file,callback,priority) {
|
||||
callback = BASE.Callback(callback);
|
||||
if (file instanceof Object) {for (var i in file) {file = file[i]}}
|
||||
file = this.fileURL(file);
|
||||
if (this.loaded[file]) {
|
||||
callback(this.loaded[file]);
|
||||
} else {
|
||||
if (!this.loadHooks[file]) {this.loadHooks[file] = []}
|
||||
this.loadHooks[file].push(callback);
|
||||
}
|
||||
if (this.loaded[file]) {callback(this.loaded[file])}
|
||||
else {this.addHook(file,callback,priority)}
|
||||
return callback;
|
||||
},
|
||||
addHook: function (file,callback,priority) {
|
||||
if (!this.loadHooks[file]) {this.loadHooks[file] = MathJax.Callback.Hooks()}
|
||||
this.loadHooks[file].Add(callback,priority);
|
||||
},
|
||||
|
||||
//
|
||||
// Used when files are combined in a preloading configuration file
|
||||
|
@ -818,13 +840,13 @@ MathJax.fileversion = "1.1.7";
|
|||
SCRIPTS.push(loading.script);
|
||||
}
|
||||
this.loaded[file] = loading.status; delete this.loading[file];
|
||||
if (!this.loadHooks[file]) {this.loadHooks[file] = []}
|
||||
this.loadHooks[file].push(loading.callback);
|
||||
this.addHook(file,loading.callback);
|
||||
} else {
|
||||
this.loaded[file] = this.STATUS.OK;
|
||||
loading = {status: this.STATUS.OK}
|
||||
}
|
||||
BASE.Callback.ExecuteHooks(this.loadHooks[file],loading.status);
|
||||
if (!this.loadHooks[file]) {return null}
|
||||
return this.loadHooks[file].Execute(loading.status);
|
||||
},
|
||||
|
||||
//
|
||||
|
@ -1091,6 +1113,9 @@ MathJax.Message = {
|
|||
} else if (text.match(/^Processing /)) {
|
||||
if (!this.processing) {this.processing = "Processing "}
|
||||
text = this.processing; this.processing += ".";
|
||||
} else if (text.match(/^Typesetting /)) {
|
||||
if (!this.typesetting) {this.typesetting = "Typesetting "}
|
||||
text = this.typesetting; this.typesetting += ".";
|
||||
}
|
||||
}
|
||||
return text;
|
||||
|
@ -1186,10 +1211,6 @@ MathJax.Hub = {
|
|||
"v1.0-compatible": true, // set to false to prevent loading of default configuration file
|
||||
elements: [], // array of elements to process when none is given explicitly
|
||||
|
||||
preProcessors: [], // list of callbacks for preprocessing (initialized by extensions)
|
||||
inputJax: {}, // mime-type mapped to input jax (by registration)
|
||||
outputJax: {order:{}}, // mime-type mapped to output jax list (by registration)
|
||||
|
||||
menuSettings: {
|
||||
//format: "MathML", // the Show Source format (set in MathMenu.js)
|
||||
zoom: "None", // when to do MathZoom
|
||||
|
@ -1209,6 +1230,10 @@ MathJax.Hub = {
|
|||
}
|
||||
},
|
||||
|
||||
preProcessors: MathJax.Callback.Hooks(true), // list of callbacks for preprocessing (initialized by extensions)
|
||||
inputJax: {}, // mime-type mapped to input jax (by registration)
|
||||
outputJax: {order:{}}, // mime-type mapped to output jax list (by registration)
|
||||
|
||||
processUpdateTime: 250, // time between screen updates when processing math (milliseconds)
|
||||
|
||||
signal: MathJax.Callback.Signal("Hub"), // Signal used for Hub events
|
||||
|
@ -1228,7 +1253,7 @@ MathJax.Hub = {
|
|||
},
|
||||
|
||||
Register: {
|
||||
PreProcessor: function (callback) {MathJax.Hub.config.preProcessors.push(MathJax.Callback(callback))},
|
||||
PreProcessor: function () {MathJax.Hub.preProcessors.Add.apply(MathJax.Hub.preProcessors,arguments)},
|
||||
MessageHook: function () {return MathJax.Hub.signal.MessageHook.apply(MathJax.Hub.signal,arguments)},
|
||||
StartupHook: function () {return MathJax.Hub.Startup.signal.MessageHook.apply(MathJax.Hub.Startup.signal,arguments)},
|
||||
LoadHook: function () {return MathJax.Ajax.LoadHook.apply(MathJax.Ajax,arguments)}
|
||||
|
@ -1275,7 +1300,7 @@ MathJax.Hub = {
|
|||
if (element && element.tagName != null && element.tagName.toLowerCase() === 'script') {
|
||||
if (element.MathJax)
|
||||
{return (element.MathJax.state === MathJax.ElementJax.STATE.PROCESSED ? 1 : -1)}
|
||||
if (element.type && this.config.inputJax[element.type.replace(/ *;(.|\s)*/,"")]) {return -1}
|
||||
if (element.type && this.inputJax[element.type.replace(/ *;(.|\s)*/,"")]) {return -1}
|
||||
}
|
||||
// FIXME: check for results of outputJax
|
||||
return 0;
|
||||
|
@ -1307,8 +1332,7 @@ MathJax.Hub = {
|
|||
if (ec.elements[i]) {
|
||||
queue.Push(
|
||||
["Post",this.signal,["Begin PreProcess",ec.elements[i]]],
|
||||
["ExecuteHooks",MathJax.Callback,
|
||||
(arguments.callee.disabled ? [] : this.config.preProcessors), ec.elements[i], true],
|
||||
(arguments.callee.disabled? {} : ["Execute",this.preProcessors,ec.elements[i]]),
|
||||
["Post",this.signal,["End PreProcess",ec.elements[i]]]
|
||||
);
|
||||
}
|
||||
|
@ -1330,7 +1354,12 @@ MathJax.Hub = {
|
|||
["Post",this.signal,["Begin "+action,ec.elements[i]]],
|
||||
["Post",this.signal,["Begin Math",ec.elements[i]]],
|
||||
["prepareScripts",this,action,ec.elements[i],scripts],
|
||||
["processScripts",this,scripts],
|
||||
["Post",this.signal,["Begin Math Input",ec.elements[i]]],
|
||||
["processInput",this,scripts],
|
||||
["Post",this.signal,["End Math Input",ec.elements[i]]],
|
||||
["Post",this.signal,["Begin Math Output",ec.elements[i]]],
|
||||
["processOutput",this,scripts],
|
||||
["Post",this.signal,["End Math Output",ec.elements[i]]],
|
||||
["Post",this.signal,["End Math",ec.elements[i]]],
|
||||
["Post",this.signal,["End "+action,ec.elements[i]]]
|
||||
);
|
||||
|
@ -1343,14 +1372,12 @@ MathJax.Hub = {
|
|||
Process: function (script) {},
|
||||
Update: function (script) {
|
||||
var jax = script.MathJax.elementJax;
|
||||
// FIXME: Have intputJax determine if things have changed?
|
||||
if (jax && jax.originalText === (script.text == "" ? script.innerHTML : script.text))
|
||||
{script.MathJax.state = jax.STATE.PROCESSED} else
|
||||
{jax.outputJax.Remove(jax); script.MathJax.state = jax.STATE.UPDATE}
|
||||
if (jax && jax.needsUpdate()) {jax.Remove(true); script.MathJax.state = jax.STATE.UPDATE}
|
||||
else {script.MathJax.state = jax.STATE.PROCESSED}
|
||||
},
|
||||
Reprocess: function (script) {
|
||||
var jax = script.MathJax.elementJax;
|
||||
if (jax) {jax.outputJax.Remove(jax); script.MathJax.state = jax.STATE.UPDATE}
|
||||
if (jax) {jax.Remove(true); script.MathJax.state = jax.STATE.UPDATE}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1360,7 +1387,7 @@ MathJax.Hub = {
|
|||
var STATE = MathJax.ElementJax.STATE;
|
||||
for (var i = 0, m = scripts.length; i < m; i++) {
|
||||
var script = scripts[i];
|
||||
if (script.type && this.config.inputJax[script.type.replace(/ *;(.|\n)*/,"")]) {
|
||||
if (script.type && this.inputJax[script.type.replace(/ *;(.|\n)*/,"")]) {
|
||||
if (script.MathJax && script.MathJax.state !== STATE.PENDING)
|
||||
{this.scriptAction[action](script)}
|
||||
if (!script.MathJax) {script.MathJax = {state: STATE.PENDING}}
|
||||
|
@ -1403,13 +1430,12 @@ MathJax.Hub = {
|
|||
if (script.MathJax) {script.MathJax.checked = 1}
|
||||
},
|
||||
|
||||
processScripts: function (scripts,start,n) {
|
||||
processInput: function (scripts,start,n) {
|
||||
if (arguments.callee.disabled) {return null}
|
||||
if (!start) {start = new Date().getTime()}
|
||||
var result, STATE = MathJax.ElementJax.STATE;
|
||||
var inputJax = this.config.inputJax, outputJax = this.config.outputJax;
|
||||
var i = 0, script, prev;
|
||||
try {
|
||||
if (!start) {start = new Date().getTime()}
|
||||
var i = 0, script, prev;
|
||||
while (i < scripts.length) {
|
||||
script = scripts[i]; if (!script) {i++; continue}
|
||||
prev = script.previousSibling;
|
||||
|
@ -1418,46 +1444,68 @@ MathJax.Hub = {
|
|||
if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) {i++; continue};
|
||||
if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) {
|
||||
this.checkScriptSiblings(script);
|
||||
result = inputJax[type].Process(script);
|
||||
result = this.inputJax[type].Process(script);
|
||||
if (typeof result === 'function') {
|
||||
if (result.called) continue; // go back and call Process() again
|
||||
this.RestartAfter(result);
|
||||
}
|
||||
result.Attach(script,inputJax[type]);
|
||||
result.Attach(script,this.inputJax[type].id);
|
||||
script.MathJax.state = STATE.OUTPUT;
|
||||
}
|
||||
var jax = script.MathJax.elementJax;
|
||||
if (!outputJax[jax.mimeType]) {
|
||||
script.MathJax.state = STATE.UPDATE;
|
||||
throw Error("No output jax registered for "+jax.mimeType);
|
||||
}
|
||||
jax.outputJax = outputJax[jax.mimeType][0];
|
||||
result = jax.outputJax.Process(script);
|
||||
if (typeof result === 'function') {
|
||||
if (result.called) continue; // go back and call Process() again
|
||||
this.RestartAfter(result);
|
||||
}
|
||||
script.MathJax.state = STATE.PROCESSED;
|
||||
this.signal.Post(["New Math",jax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback)
|
||||
i++;
|
||||
if (new Date().getTime() - start > this.processUpdateTime && i < scripts.length)
|
||||
{start = 0; this.RestartAfter(MathJax.Callback.Delay(1))}
|
||||
}
|
||||
} catch (err) {
|
||||
if (!err.restart) {
|
||||
if (!this.config.errorSettings.message) {throw err}
|
||||
this.formatError(script,err); i++;
|
||||
} catch (err) {return this.processError(err,scripts,i,n,start,"Input")}
|
||||
if ((n || scripts.length) && this.config.showProcessingMessages)
|
||||
{MathJax.Message.Set("Processing math: 100%",0)}
|
||||
return null;
|
||||
},
|
||||
|
||||
processOutput: function (scripts,start,n) {
|
||||
if (arguments.callee.disabled) {return null}
|
||||
if (!start) {start = new Date().getTime()}
|
||||
var result, STATE = MathJax.ElementJax.STATE;
|
||||
var i = 0, script;
|
||||
try {
|
||||
while (i < scripts.length) {
|
||||
script = scripts[i]; if (!script || !script.MathJax) {i++; continue}
|
||||
var jax = script.MathJax.elementJax; if (!jax) {i++; continue}
|
||||
if (!this.outputJax[jax.mimeType]) {
|
||||
script.MathJax.state = STATE.UPDATE;
|
||||
throw Error("No output jax registered for "+jax.mimeType);
|
||||
}
|
||||
var outputJax = this.outputJax[jax.mimeType][0];
|
||||
jax.outputJax = outputJax.id;
|
||||
result = outputJax.Process(script);
|
||||
if (typeof result === 'function') {
|
||||
if (result.called) continue; // go back and call Process() again
|
||||
this.RestartAfter(result);
|
||||
}
|
||||
script.MathJax.state = STATE.PROCESSED; i++;
|
||||
this.signal.Post(["New Math",jax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback)
|
||||
if (new Date().getTime() - start > this.processUpdateTime && i < scripts.length)
|
||||
{start = 0; this.RestartAfter(MathJax.Callback.Delay(1))}
|
||||
}
|
||||
if (!n) {n = 0}; var m = Math.floor((n+i)/(n+scripts.length)*100); n += i;
|
||||
if (this.config.showProcessingMessages) {MathJax.Message.Set("Processing math: "+m+"%",0)}
|
||||
return MathJax.Callback.After(["processScripts",this,scripts.slice(i),start,n],err.restart);
|
||||
}
|
||||
} catch (err) {return this.processError(err,scripts,i,n,start,"Output")}
|
||||
if ((n || scripts.length) && this.config.showProcessingMessages) {
|
||||
MathJax.Message.Set("Processing Math: 100%",0);
|
||||
MathJax.Message.Set("Typesetting math: 100%",0);
|
||||
MathJax.Message.Clear(0);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
processError: function (err,scripts,i,n,start,type) {
|
||||
if (!err.restart) {
|
||||
if (!this.config.errorSettings.message) {throw err}
|
||||
this.formatError(scripts[i],err); i++;
|
||||
}
|
||||
if (!n) {n = 0}; var m = Math.floor((n+i)/(n+scripts.length)*100); n += i;
|
||||
var message = (type === "Output" ? "Typesetting" : "Processing");
|
||||
if (this.config.showProcessingMessages) {MathJax.Message.Set(message+" math: "+m+"%",0)}
|
||||
return MathJax.Callback.After(["process"+type,this,scripts.slice(i),start,n],err.restart);
|
||||
},
|
||||
|
||||
formatError: function (script,err) {
|
||||
var error = MathJax.HTML.Element("span",{className:"MathJax_Error"},this.config.errorSettings.message);
|
||||
script.parentNode.insertBefore(error,script);
|
||||
|
@ -1505,8 +1553,7 @@ MathJax.Hub.Insert(MathJax.Hub.config.styles,MathJax.Message.styles);
|
|||
MathJax.Hub.Insert(MathJax.Hub.config.styles,{".MathJax_Error":MathJax.Hub.config.errorSettings.style});
|
||||
|
||||
//
|
||||
// Storage area for preprocessors and extensions
|
||||
// (should these be classes?)
|
||||
// Storage area for extensions and preprocessors
|
||||
//
|
||||
MathJax.Extension = {};
|
||||
|
||||
|
@ -1637,11 +1684,11 @@ MathJax.Hub.Startup = {
|
|||
// Load the input and output jax
|
||||
//
|
||||
Jax: function () {
|
||||
var config = MathJax.Hub.config;
|
||||
var config = MathJax.Hub.config, jax = MathJax.Hub.outputJax;
|
||||
// Save the order of the output jax since they are loading asynchronously
|
||||
for (var i = 0, m = config.jax.length, k = 0; i < m; i++) {
|
||||
if (config.jax[i].substr(0,7) === "output/")
|
||||
{config.outputJax.order[config.jax[i].substr(7)] = k; k++}
|
||||
{jax.order[config.jax[i].substr(7)] = k; k++}
|
||||
}
|
||||
var queue = MathJax.Callback.Queue();
|
||||
return queue.Push(
|
||||
|
@ -1674,7 +1721,7 @@ MathJax.Hub.Startup = {
|
|||
// (this must come after the jax are loaded)
|
||||
//
|
||||
Menu: function () {
|
||||
var menu = MathJax.Hub.config.menuSettings, jax = MathJax.Hub.config.outputJax, registered;
|
||||
var menu = MathJax.Hub.config.menuSettings, jax = MathJax.Hub.outputJax, registered;
|
||||
for (var id in jax) {if (jax.hasOwnProperty(id)) {
|
||||
if (jax[id].length) {registered = jax[id]; break}
|
||||
}}
|
||||
|
@ -1840,13 +1887,17 @@ MathJax.Hub.Startup = {
|
|||
var load = queue.Push(AJAX.Require(this.directory+"/"+this.JAXFILE));
|
||||
if (!load.called) {this.constructor.prototype.Process = function () {return load}}
|
||||
// Load the associated output jax
|
||||
jax = HUB.config.outputJax["jax/"+jax[0]];
|
||||
jax = HUB.outputJax["jax/"+jax[0]];
|
||||
if (jax) {queue.Push(AJAX.Require(jax[0].directory+"/"+this.JAXFILE))}
|
||||
return queue.Push({});
|
||||
},
|
||||
needsUpdate: function (jax) {
|
||||
var script = jax.SourceElement();
|
||||
return (jax.originalText !== (script.text == "" ? script.innerHTML : script.text));
|
||||
},
|
||||
Register: function (mimetype) {
|
||||
if (!HUB.config.inputJax) {HUB.config.inputJax = {}}
|
||||
HUB.config.inputJax[mimetype] = this;
|
||||
if (!HUB.inputJax) {HUB.inputJax = {}}
|
||||
HUB.inputJax[mimetype] = this;
|
||||
}
|
||||
},{
|
||||
version: "1.1",
|
||||
|
@ -1858,7 +1909,7 @@ MathJax.Hub.Startup = {
|
|||
|
||||
BASE.OutputJax = JAX.Subclass({
|
||||
Register: function (mimetype) {
|
||||
var jax = HUB.config.outputJax;
|
||||
var jax = HUB.outputJax;
|
||||
if (!jax[mimetype]) {jax[mimetype] = []}
|
||||
// If the output jax is earlier in the original configuration list, put it first here
|
||||
if (jax[mimetype].length && (this.id === HUB.config.menuSettings.renderer ||
|
||||
|
@ -1905,10 +1956,15 @@ MathJax.Hub.Startup = {
|
|||
script.MathJax.state = this.STATE.OUTPUT;
|
||||
return HUB.Process(script,callback);
|
||||
},
|
||||
Remove: function () {
|
||||
this.outputJax.Remove(this);
|
||||
HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish?
|
||||
this.Detach();
|
||||
Remove: function (keep) {
|
||||
BASE.OutputJax[this.outputJax].Remove(this);
|
||||
if (!keep) {
|
||||
HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish?
|
||||
this.Detach();
|
||||
}
|
||||
},
|
||||
needsUpdate: function () {
|
||||
return BASE.InputJax[this.inputJax].needsUpdate(this);
|
||||
},
|
||||
|
||||
SourceElement: function () {return document.getElementById(this.inputID)},
|
||||
|
|
|
@ -262,6 +262,13 @@ MathJax.Hub.Config({
|
|||
//
|
||||
processEnvironments: true,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax processes \ref{...} commands outside
|
||||
// of math mode. Set to "false" to prevent processing of \ref
|
||||
// except within math mode.
|
||||
//
|
||||
processRefs: true,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, when it locates in-line
|
||||
|
@ -368,7 +375,20 @@ MathJax.Hub.Config({
|
|||
// bold: ['{\\bf #1}', 1]
|
||||
// }
|
||||
//
|
||||
Macros: {}
|
||||
Macros: {},
|
||||
|
||||
//
|
||||
// Equation numbering parameters.
|
||||
//
|
||||
equationNumbers: {
|
||||
// formatNumber: function (n) {return n}, // format for equation number n
|
||||
// formatTag: function (n) {return '('+n+')'}, // format for \tag and \eqref
|
||||
// formatID: function (n) {return 'mjx-eqn-'+n}, // element ID to use for reference
|
||||
// formatURL: function (n) {return '#mjx-eqn-'+escape(n)}, // URL to use for references
|
||||
|
||||
autoNumber: "none" // "AMS" for standard AMS environment numbering,
|
||||
// or "all" to number all displayed equations
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
(function (HUB,HTML,AJAX,HTMLCSS,nMML) {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
var CONFIG = HUB.CombineConfig("MathZoom",{
|
||||
delay: 400, // mouse must be still this long (milliseconds)
|
||||
|
@ -148,8 +148,8 @@
|
|||
if (parent.parentNode.className === "MathJax_MathContainer") {parent = parent.parentNode.parentNode}
|
||||
var script = (String(parent.className).match(/^MathJax_(MathML|Display)$/) ? parent : math).nextSibling;
|
||||
var jax = HUB.getJaxFor(script), root = jax.root;
|
||||
var JAX = (HTMLCSS && jax.outputJax.isa(HTMLCSS.constructor) ? "HTMLCSS" :
|
||||
(nMML && jax.outputJax.isa(nMML.constructor) ? "MathML" : null));
|
||||
var JAX = (HTMLCSS && jax.outputJax === "HTML-CSS" ? "HTMLCSS" :
|
||||
(nMML && jax.outputJax === "NativeMML" ? "MathML" : null));
|
||||
if (!JAX) return; // FIXME: report an error?
|
||||
|
||||
//
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2009 Design Science, Inc.
|
||||
* Copyright (c) 2009-2011 Design Science, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -21,16 +21,30 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
MathJax.Extension["TeX/AMSmath"] = {
|
||||
version: "1.1.1",
|
||||
|
||||
number: 0, // current equation number
|
||||
startNumber: 0, // current starting equation number (for when equation is restarted)
|
||||
labels: {}, // the set of labels
|
||||
eqlabels: {}, // labels in the current equation
|
||||
refs: [] // array of jax with unresolved references
|
||||
};
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var VERSION = "1.1";
|
||||
|
||||
var MML = MathJax.ElementJax.mml;
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
var TEXDEF = TEX.Definitions;
|
||||
var STACKITEM = TEX.Stack.Item;
|
||||
|
||||
var MML = MathJax.ElementJax.mml,
|
||||
TEX = MathJax.InputJax.TeX,
|
||||
AMS = MathJax.Extension["TeX/AMSmath"];
|
||||
|
||||
var TEXDEF = TEX.Definitions,
|
||||
STACKITEM = TEX.Stack.Item,
|
||||
CONFIG = TEX.config.equationNumbers;
|
||||
|
||||
var COLS = function (W) {return W.join("em ") + "em"};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
MathJax.Hub.Insert(TEXDEF,{
|
||||
macros: {
|
||||
mathring: ['Accent','2DA'], // or 0x30A
|
||||
|
@ -54,6 +68,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
|
||||
tag: 'HandleTag',
|
||||
notag: 'HandleNoTag',
|
||||
label: 'HandleLabel',
|
||||
ref: 'HandleRef',
|
||||
eqref: ['HandleRef',true],
|
||||
|
||||
substack: ['Macro','\\begin{subarray}{c}#1\\end{subarray}',1],
|
||||
|
||||
|
@ -101,7 +118,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
gathered: ['Array',null,null,null,'c',null,".5em",'D'],
|
||||
|
||||
subarray: ['Array',null,null,null,null,COLS([0,0,0,0]),"0.1em",'S',1],
|
||||
smallmatrix: ['Array',null,null,null,'c',COLS([1/3]),".2em",'S',1]
|
||||
smallmatrix: ['Array',null,null,null,'c',COLS([1/3]),".2em",'S',1],
|
||||
|
||||
'equation': ['EquationBegin','Equation',true],
|
||||
'equation*': ['EquationBegin','EquationStar',false]
|
||||
},
|
||||
|
||||
delimiter: {
|
||||
|
@ -113,21 +133,50 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
});
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
TEX.Parse.Augment({
|
||||
|
||||
/*
|
||||
* Add the tag to the environment to be added to the table row later
|
||||
* Add the tag to the environment (to be added to the table row later)
|
||||
*/
|
||||
HandleTag: function (name) {
|
||||
var arg = this.trimSpaces(this.GetArgument(name));
|
||||
if (arg === "*") {arg = this.GetArgument(name)} else {arg = "("+arg+")"}
|
||||
if (this.stack.global.notag)
|
||||
{TEX.Error(name+" not allowed in "+this.stack.global.notag+" environment")}
|
||||
if (this.stack.global.tag) {TEX.Error("Multiple "+name)}
|
||||
this.stack.global.tag = MML.mtd.apply(MML,this.InternalMath(arg));
|
||||
var arg = this.trimSpaces(this.GetArgument(name)), tag = arg;
|
||||
if (arg === "*") {tag = arg = this.GetArgument(name)} else {arg = CONFIG.formatTag(arg)}
|
||||
var global = this.stack.global; global.tagID = tag;
|
||||
if (global.notags) {TEX.Error(name+" not allowed in "+global.notags+" environment")}
|
||||
if (global.tag) {TEX.Error("Multiple "+name)}
|
||||
global.tag = MML.mtd.apply(MML,this.InternalMath(arg)).With({id:CONFIG.formatID(tag)});
|
||||
},
|
||||
HandleNoTag: function (name) {
|
||||
if (this.stack.global.tag) {delete this.stack.global.tag}
|
||||
this.stack.global.notag = true; // prevent auto-tagging
|
||||
},
|
||||
|
||||
/*
|
||||
* Record a label name for a tag
|
||||
*/
|
||||
HandleLabel: function (name) {
|
||||
var global = this.stack.global, label = this.GetArgument(name);
|
||||
if (!AMS.refUpdate) {
|
||||
if (global.label) {TEX.Error("Multiple "+name+"'s")}
|
||||
global.label = label;
|
||||
if (AMS.labels[label] || AMS.eqlabels[label]) {TEX.Error("Label '"+label+"' mutiply defined")}
|
||||
AMS.eqlabels[label] = "???"; // will be replaced by tag value later
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Handle a label reference
|
||||
*/
|
||||
HandleRef: function (name,eqref) {
|
||||
var label = this.GetArgument(name);
|
||||
var ref = AMS.labels[label] || AMS.eqlabels[label];
|
||||
if (!ref) {ref = "??"; AMS.badref = !AMS.refUpdate}
|
||||
var tag = ref; if (eqref) {tag = CONFIG.formatTag(tag)}
|
||||
this.Push(MML.mrow.apply(MML,this.InternalMath(tag)).With({
|
||||
href:CONFIG.formatURL(ref), "class":"MathJax_ref"
|
||||
}));
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -202,7 +251,6 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
if (STYLE === "D") {frac.displaystyle = true; frac.scriptlevel = 0}
|
||||
else {frac.displaystyle = false; frac.scriptlevel = style - 1}
|
||||
}
|
||||
|
||||
this.Push(frac);
|
||||
},
|
||||
|
||||
|
@ -210,8 +258,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
* Implements multline environment (mostly handled through STACKITEM below)
|
||||
*/
|
||||
Multline: function (begin,numbered) {
|
||||
this.Push(begin);
|
||||
return STACKITEM.multline().With({
|
||||
this.Push(begin); this.checkEqnEnv();
|
||||
return STACKITEM.multline(numbered,this.stack).With({
|
||||
arraydef: {
|
||||
displaystyle: true,
|
||||
rowspacing: ".5em",
|
||||
|
@ -226,7 +274,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
* Handle AMS aligned environments
|
||||
*/
|
||||
AMSarray: function (begin,numbered,taggable,align,spacing) {
|
||||
this.Push(begin);
|
||||
this.Push(begin); if (taggable) {this.checkEqnEnv()}
|
||||
align = align.replace(/[^clr]/g,'').split('').join(' ');
|
||||
align = align.replace(/l/g,'left').replace(/r/g,'right').replace(/c/g,'center');
|
||||
return STACKITEM.AMSarray(begin.name,numbered,taggable,this.stack).With({
|
||||
|
@ -242,6 +290,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
});
|
||||
},
|
||||
|
||||
/*
|
||||
* Handle alignat environments
|
||||
*/
|
||||
AlignAt: function (begin,numbered,taggable) {
|
||||
var n = this.GetArgument("\\begin{"+begin.name+"}");
|
||||
if (n.match(/[^0-9]/)) {TEX.Error("Argument to \\begin{"+begin.name+"} must me a positive integer")}
|
||||
|
@ -252,6 +303,27 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
return this.Array(begin,null,null,align,spacing,".5em",'D');
|
||||
},
|
||||
|
||||
/*
|
||||
* Handle equation environment
|
||||
*/
|
||||
EquationBegin: function (begin,force) {
|
||||
this.checkEqnEnv();
|
||||
this.stack.global.forcetag = (force && CONFIG.autoNumber !== "none");
|
||||
return begin;
|
||||
},
|
||||
EquationStar: function (begin,row) {
|
||||
this.stack.global.tagged = true; // prevent automatic tagging
|
||||
return row;
|
||||
},
|
||||
|
||||
/*
|
||||
* Check for bad nesting of equation environments
|
||||
*/
|
||||
checkEqnEnv: function () {
|
||||
if (this.stack.global.eqnenv) {TEX.Error("Erroneous nesting of equation structures")}
|
||||
this.stack.global.eqnenv = true;
|
||||
},
|
||||
|
||||
/*
|
||||
* Handle multiple integrals (make a mathop if followed by limits)
|
||||
*/
|
||||
|
@ -268,6 +340,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
this.i = 0;
|
||||
},
|
||||
|
||||
/*
|
||||
* Handle stretchable arrows
|
||||
*/
|
||||
xArrow: function (name,chr,l,r) {
|
||||
var def = {width: "+"+(l+r)+"mu", lspace: l+"mu"};
|
||||
var bot = this.GetBrackets(name),
|
||||
|
@ -295,11 +370,43 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
}
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
STACKITEM.Augment({
|
||||
/*
|
||||
* Increment equation number and form tag mtd element
|
||||
*/
|
||||
autoTag: function () {
|
||||
var global = this.global;
|
||||
if (!global.notag) {
|
||||
AMS.number++; global.tagID = CONFIG.formatNumber(AMS.number.toString());
|
||||
var mml = TEX.Parse("\\text{"+CONFIG.formatTag(global.tagID)+"}",{}).mml();
|
||||
global.tag = MML.mtd(mml.With({id:CONFIG.formatID(global.tagID)}));
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Get the tag and record the label, if any
|
||||
*/
|
||||
getTag: function () {
|
||||
var global = this.global, tag = global.tag; global.tagged = true;
|
||||
if (global.label) {AMS.eqlabels[global.label] = global.tagID}
|
||||
delete global.tag; delete global.tagID; delete global.label;
|
||||
return tag;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Implement multline environment via a STACKITEM
|
||||
*/
|
||||
STACKITEM.multline = STACKITEM.array.Subclass({
|
||||
type: "multline",
|
||||
Init: function (numbered,stack) {
|
||||
this.SUPER(arguments).Init.apply(this);
|
||||
this.numbered = (numbered && CONFIG.autoNumber !== "none");
|
||||
this.save = {notag: stack.global.notag};
|
||||
stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments
|
||||
},
|
||||
EndEntry: function () {
|
||||
var mtd = MML.mtd.apply(MML,this.data);
|
||||
if (this.data.shove) {mtd.columnalign = this.data.shove}
|
||||
|
@ -317,37 +424,46 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
if (!this.table[0][0].columnalign) {this.table[0][0].columnalign = MML.ALIGN.LEFT}
|
||||
if (!this.table[m][0].columnalign) {this.table[m][0].columnalign = MML.ALIGN.RIGHT}
|
||||
var mtr = MML.mtr;
|
||||
if (this.global.tag) {
|
||||
this.table[0] = [this.global.tag].concat(this.table[0]);
|
||||
delete this.global.tag; mtr = MML.mlabeledtr;
|
||||
if (!this.global.tag && this.numbered) {this.autoTag()}
|
||||
if (this.global.tag && !this.global.notags) {
|
||||
this.table[0] = [this.getTag()].concat(this.table[0]);
|
||||
mtr = MML.mlabeledtr;
|
||||
}
|
||||
this.table[0] = mtr.apply(MML,this.table[0]);
|
||||
for (i = 1, m = this.table.length; i < m; i++)
|
||||
{this.table[i] = MML.mtr.apply(MML,this.table[i])}
|
||||
}
|
||||
this.global.notag = this.save.notag;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Save data about numbering and taging equations, and add
|
||||
* tags at the ends of rows.
|
||||
*/
|
||||
STACKITEM.AMSarray = STACKITEM.array.Subclass({
|
||||
type: "AMSarray",
|
||||
Init: function (name,numbered,taggable,stack) {
|
||||
this.SUPER(arguments).Init.apply(this);
|
||||
this.numbered = numbered;
|
||||
this.save_notag = stack.global.notag;
|
||||
stack.global.notag = (taggable ? null : name);
|
||||
this.numbered = (numbered && CONFIG.autoNumber !== "none");
|
||||
this.save = {notags: stack.global.notags, notag: stack.global.notag};
|
||||
stack.global.notags = (taggable ? null : name);
|
||||
stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments
|
||||
},
|
||||
EndRow: function () {
|
||||
var mtr = MML.mtr;
|
||||
if (this.global.tag) {
|
||||
this.row = [this.global.tag].concat(this.row);
|
||||
if (!this.global.tag && this.numbered) {this.autoTag()}
|
||||
if (this.global.tag &&! this.global.notags) {
|
||||
this.row = [this.getTag()].concat(this.row);
|
||||
mtr = MML.mlabeledtr;
|
||||
delete this.global.tag;
|
||||
}
|
||||
if (this.numbered) {delete this.global.notag}
|
||||
this.table.push(mtr.apply(MML,this.row)); this.row = [];
|
||||
},
|
||||
EndTable: function () {
|
||||
this.SUPER(arguments).EndTable.call(this);
|
||||
this.global.notag = this.save_notag;
|
||||
this.global.notags = this.save.notags;
|
||||
this.global.notag = this.save.notag;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -358,9 +474,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
oldCheckItem: STACKITEM.start.prototype.checkItem,
|
||||
checkItem: function (item) {
|
||||
if (item.type === "stop") {
|
||||
var mml = this.mmlData();
|
||||
if (this.global.tag) {
|
||||
var row = [this.global.tag,MML.mtd(mml)]; delete this.global.tag;
|
||||
var mml = this.mmlData(), global = this.global;
|
||||
if (AMS.display && !global.tag && !global.tagged && !global.isInner &&
|
||||
(CONFIG.autoNumber === "all" || global.forcetag)) {this.autoTag()}
|
||||
if (global.tag) {
|
||||
var row = [this.getTag(),MML.mtd(mml)];
|
||||
var def = {
|
||||
side: TEX.config.TagSide,
|
||||
minlabelspacing: TEX.config.TagIndent,
|
||||
|
@ -383,10 +501,44 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
}
|
||||
return STACKITEM.mml(mml);
|
||||
}
|
||||
return this.SUPER(arguments).checkItem.call(this,item);
|
||||
return this.oldCheckItem.call(this,item);
|
||||
}
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/*
|
||||
* Add pre- and post-filters to handle the equation number maintainance.
|
||||
*/
|
||||
TEX.prefilterHooks.Add(function (data) {
|
||||
AMS.display = data.display;
|
||||
AMS.number = AMS.startNumber; // reset equation numbers (in case the equation restarted)
|
||||
AMS.eqlabels = {}; AMS.badref = false;
|
||||
if (AMS.refUpdate) {AMS.number = data.script.MathJax.startNumber}
|
||||
});
|
||||
TEX.postfilterHooks.Add(function (data) {
|
||||
data.script.MathJax.startNumber = AMS.startNumber;
|
||||
AMS.startNumber = AMS.number; // equation numbers for next equation
|
||||
MathJax.Hub.Insert(AMS.labels,AMS.eqlabels); // save labels from this equation
|
||||
if (AMS.badref && !data.math.texError) {AMS.refs.push(data.script)} // reprocess later
|
||||
});
|
||||
|
||||
MathJax.Hub.Register.MessageHook("Begin Math Input",function () {
|
||||
AMS.refs = []; // array of jax with bad references
|
||||
AMS.refUpdate = false;
|
||||
});
|
||||
MathJax.Hub.Register.MessageHook("End Math Input",function (message) {
|
||||
if (AMS.refs.length) {
|
||||
AMS.refUpdate = true;
|
||||
for (var i = 0, m = AMS.refs.length; i < m; i++)
|
||||
{AMS.refs[i].MathJax.state = MathJax.ElementJax.STATE.UPDATE}
|
||||
return MathJax.Hub.processInput(AMS.refs);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
MathJax.Hub.Startup.signal.Post("TeX AMSmath Ready");
|
||||
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Extension.tex2jax = {
|
||||
version: "1.1.3",
|
||||
version: "1.1.4",
|
||||
config: {
|
||||
inlineMath: [ // The start/stop pairs for in-line math
|
||||
// ['$','$'], // (comment out any you don't want, or add your own, but
|
||||
|
@ -56,6 +56,8 @@ MathJax.Extension.tex2jax = {
|
|||
processEnvironments: true, // set to true to process \begin{xxx}...\end{xxx} outside
|
||||
// of math mode, false to prevent that
|
||||
|
||||
processRefs: true, // set to true to process \ref{...} outside of math mode
|
||||
|
||||
preview: "TeX" // set to "none" to not insert MathJax_Preview spans
|
||||
// or set to an array specifying an HTML snippet
|
||||
// to use the same preview for every equation.
|
||||
|
@ -96,9 +98,10 @@ MathJax.Extension.tex2jax = {
|
|||
};
|
||||
}
|
||||
this.start = new RegExp(
|
||||
starts.sort(this.sortLength).join("|") +
|
||||
(config.processEnvironments ? "|\\\\begin\\{([^}]*)\\}" : "") +
|
||||
(config.processEscapes ? "|\\\\*\\\\\\\$" : ""), "g"
|
||||
starts.sort(this.sortLength).join("|") +
|
||||
(config.processEnvironments ? "|\\\\begin\\{([^}]*)\\}" : "") +
|
||||
(config.processEscapes ? "|\\\\*\\\\\\\$" : "") +
|
||||
(config.processRefs ? "|\\\\(eq)?ref\\{[^}]*\\}" : ""), "g"
|
||||
);
|
||||
this.skipTags = new RegExp("^("+config.skipTags.join("|")+")$","i");
|
||||
this.ignoreClass = new RegExp("(^| )("+config.ignoreClass+")( |$)");
|
||||
|
@ -172,6 +175,12 @@ MathJax.Extension.tex2jax = {
|
|||
isBeginEnd: true
|
||||
};
|
||||
this.switchPattern(this.endPattern(this.search.end));
|
||||
} else if (match[0].substr(0,4) === "\\ref" || match[0].substr(0,6) === "\\eqref") {
|
||||
this.search = {
|
||||
mode: "", end: "", open: element,
|
||||
olen: 0, opos: this.pattern.lastIndex - match[0].length,
|
||||
}
|
||||
return this.endMatch([""],element);
|
||||
} else { // escaped dollar signs
|
||||
// put $ in a span so it doesn't get processed again
|
||||
// split off backslashes so they don't get removed later
|
||||
|
|
|
@ -24,14 +24,23 @@
|
|||
|
||||
MathJax.InputJax.TeX = MathJax.InputJax({
|
||||
id: "TeX",
|
||||
version: "1.1.2",
|
||||
version: "1.1.3",
|
||||
directory: MathJax.InputJax.directory + "/TeX",
|
||||
extensionDir: MathJax.InputJax.extensionDir + "/TeX",
|
||||
|
||||
config: {
|
||||
TagSide: "right",
|
||||
TagIndent: "0.8em",
|
||||
MultLineWidth: "85%"
|
||||
MultLineWidth: "85%",
|
||||
|
||||
equationNumbers: {
|
||||
autoNumber: "none", // "AMS" for standard AMS numbering,
|
||||
// or "all" for all displayed equations
|
||||
formatNumber: function (n) {return n},
|
||||
formatTag: function (n) {return '('+n+')'},
|
||||
formatID: function (n) {return 'mjx-eqn-'+n},
|
||||
formatURL: function (n) {return '#mjx-eqn-'+escape(n)}
|
||||
}
|
||||
}
|
||||
});
|
||||
MathJax.InputJax.TeX.Register("math/tex");
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function (TEX) {
|
||||
(function (TEX,HUB,AJAX) {
|
||||
var TRUE = true, FALSE = false, MML, NBSP = String.fromCharCode(0xA0);
|
||||
|
||||
var STACK = MathJax.Object.Subclass({
|
||||
Init: function (env) {
|
||||
this.global = {};
|
||||
this.data = [STACKITEM.start().With({global: this.global})];
|
||||
Init: function (env,inner) {
|
||||
this.global = {isInner: inner};
|
||||
this.data = [STACKITEM.start(this.global)];
|
||||
if (env) {this.data[0].env = env}
|
||||
this.env = this.data[0].env;
|
||||
},
|
||||
|
@ -102,6 +102,10 @@
|
|||
|
||||
STACKITEM.start = STACKITEM.Subclass({
|
||||
type: "start", isOpen: TRUE,
|
||||
Init: function (global) {
|
||||
this.SUPER(arguments).Init.call(this);
|
||||
this.global = global;
|
||||
},
|
||||
checkItem: function (item) {
|
||||
if (item.type === "stop") {return STACKITEM.mml(this.mmlData())}
|
||||
return this.SUPER(arguments).checkItem.call(this,item);
|
||||
|
@ -291,7 +295,7 @@
|
|||
var TEXDEF = {};
|
||||
var STARTUP = function () {
|
||||
MML = MathJax.ElementJax.mml;
|
||||
MathJax.Hub.Insert(TEXDEF,{
|
||||
HUB.Insert(TEXDEF,{
|
||||
|
||||
// patterns for letters and numbers
|
||||
letter: /[a-z]/i,
|
||||
|
@ -846,8 +850,10 @@
|
|||
|
||||
tag: ['Extension','AMSmath'],
|
||||
notag: ['Extension','AMSmath'],
|
||||
label: ['Macro','',1], // not implemented yet
|
||||
nonumber: ['Macro',''], // not implemented yet
|
||||
label: ['Extension','AMSmath'],
|
||||
ref: ['Extension','AMSmath'],
|
||||
eqref: ['Extension','AMSmath'],
|
||||
nonumber: ['Macro','\\notag'],
|
||||
|
||||
// Extensions to TeX
|
||||
unicode: ['Extension','unicode'],
|
||||
|
@ -917,9 +923,8 @@
|
|||
Init: function (string,env) {
|
||||
this.string = string; this.i = 0; this.macroCount = 0;
|
||||
var ENV; if (env) {ENV = {}; for (var id in env) {if (env.hasOwnProperty(id)) {ENV[id] = env[id]}}}
|
||||
this.stack = TEX.Stack(ENV);
|
||||
this.Parse();
|
||||
this.Push(STACKITEM.stop());
|
||||
this.stack = TEX.Stack(ENV,!!env);
|
||||
this.Parse(); this.Push(STACKITEM.stop());
|
||||
},
|
||||
Parse: function () {
|
||||
var c;
|
||||
|
@ -1344,9 +1349,9 @@
|
|||
if (name && !typeof(name) === "string") {name = name.name}
|
||||
file = TEX.extensionDir+"/"+file;
|
||||
if (!file.match(/\.js$/)) {file += ".js"}
|
||||
if (!MathJax.Ajax.loaded[MathJax.Ajax.fileURL(file)]) {
|
||||
if (!AJAX.loaded[AJAX.fileURL(file)]) {
|
||||
if (name != null) {delete TEXDEF[array || 'macros'][name.replace(/^\\/,"")]}
|
||||
MathJax.Hub.RestartAfter(MathJax.Ajax.Require(file));
|
||||
HUB.RestartAfter(AJAX.Require(file));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1643,27 +1648,35 @@
|
|||
InternalMath: function (text,level) {
|
||||
var def = {displaystyle: FALSE}; if (level != null) {def.scriptlevel = level}
|
||||
if (this.stack.env.font) {def.mathvariant = this.stack.env.font}
|
||||
if (!text.match(/\$|\\\(/)) {return [this.InternalText(text,def)]}
|
||||
if (!text.match(/\$|\\\(|\\(eq)?ref\s*\{/)) {return [this.InternalText(text,def)]}
|
||||
var i = 0, k = 0, c, match = '';
|
||||
var mml = [];
|
||||
while (i < text.length) {
|
||||
c = text.charAt(i++);
|
||||
if (c === '$') {
|
||||
if (match === '$') {
|
||||
mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-1)).mml().With(def)));
|
||||
mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-1),{}).mml().With(def)));
|
||||
match = ''; k = i;
|
||||
} else if (match === '') {
|
||||
if (k < i-1) {mml.push(this.InternalText(text.slice(k,i-1),def))}
|
||||
match = '$'; k = i;
|
||||
}
|
||||
} else if (c === '}' && match === '}') {
|
||||
mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i),{}).mml().With(def)));
|
||||
match = ''; k = i;
|
||||
} else if (c === '\\') {
|
||||
c = text.charAt(i++);
|
||||
if (c === '(' && match === '') {
|
||||
if (k < i-2) {mml.push(this.InternalText(text.slice(k,i-2),def))}
|
||||
match = ')'; k = i;
|
||||
} else if (c === ')' && match === ')') {
|
||||
mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-2)).mml().With(def)));
|
||||
match = ''; k = i;
|
||||
if (match === '' && text.substr(i).match(/^(eq)?ref\s*\{/)) {
|
||||
if (k < i-1) {mml.push(this.InternalText(text.slice(k,i-1),def))}
|
||||
match = '}'; k = i-1;
|
||||
} else {
|
||||
c = text.charAt(i++);
|
||||
if (c === '(' && match === '') {
|
||||
if (k < i-2) {mml.push(this.InternalText(text.slice(k,i-2),def))}
|
||||
match = ')'; k = i;
|
||||
} else if (c === ')' && match === ')') {
|
||||
mml.push(MML.TeXAtom(TEX.Parse(text.slice(k,i-2),{}).mml().With(def)));
|
||||
match = ''; k = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1720,42 +1733,75 @@
|
|||
MAXBUFFER: 5*1024 // maximum size of TeX string to process
|
||||
},
|
||||
|
||||
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX
|
||||
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX
|
||||
|
||||
//
|
||||
// Check if AMSmath extension must be loaded and push
|
||||
// it on the extensions array, if needed
|
||||
//
|
||||
Config: function () {
|
||||
this.SUPER(arguments).Config.apply(this,arguments);
|
||||
if (this.config.equationNumbers.autoNumber !== "none") {
|
||||
if (!this.config.extensions) {this.config.extensions = []}
|
||||
this.config.extensions.push("AMSmath.js");
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// Convert TeX to ElementJax
|
||||
//
|
||||
Translate: function (script) {
|
||||
var mml, math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
|
||||
if (MathJax.Hub.Browser.isKonqueror)
|
||||
{math = math.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}
|
||||
var displaystyle =
|
||||
(script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null);
|
||||
math = TEX.prefilterMath(math,displaystyle,script);
|
||||
var mml, isError = false, math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
|
||||
var display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null);
|
||||
var data = {math:math, display:display, script:script};
|
||||
this.prefilterHooks.Execute(data); math = data.math;
|
||||
try {
|
||||
mml = TEX.Parse(math).mml();
|
||||
// mml = MML.semantics(mml,MML.annotation(math).With({encoding:"application:x-tex"}));
|
||||
} catch(err) {
|
||||
if (!err.texError) {throw err}
|
||||
mml = this.formatError(err,math,displaystyle,script);
|
||||
mml = this.formatError(err,math,display,script);
|
||||
isError = true;
|
||||
}
|
||||
if (mml.inferred) {mml = MML.apply(MathJax.ElementJax,mml.data)} else {mml = MML(mml)}
|
||||
if (displaystyle) {mml.root.display = "block"}
|
||||
return this.postfilterMath(mml,displaystyle,script);
|
||||
if (display) {mml.root.display = "block"}
|
||||
if (isError) {mml.texError = true}
|
||||
data.math = mml; this.postfilterHooks.Execute(data);
|
||||
return data.math;
|
||||
},
|
||||
prefilterMath: function (math,displaystyle,script) {
|
||||
prefilterMath: function (data) {
|
||||
// Konqueror incorrectly quotes these characters in script.innerHTML
|
||||
if (HUB.Browser.isKonqueror)
|
||||
{data.math = data.math.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}
|
||||
// avoid parsing super- and subscript numbers as a unit
|
||||
return math.replace(/([_^]\s*\d)([0-9.,])/g,"$1 $2");
|
||||
data.math = data.math.replace(/([_^]\s*\d)([0-9.,])/g,"$1 $2");
|
||||
},
|
||||
postfilterMath: function (math,displaystyle,script) {
|
||||
this.combineRelations(math.root);
|
||||
return math;
|
||||
postfilterMath: function (data) {
|
||||
this.combineRelations(data.math.root);
|
||||
},
|
||||
formatError: function (err,math,displaystyle,script) {
|
||||
formatError: function (err,math,display,script) {
|
||||
return MML.merror(err.message.replace(/\n.*/,""));
|
||||
},
|
||||
|
||||
//
|
||||
// Produce an error and stop processing this equation
|
||||
//
|
||||
Error: function (message) {
|
||||
throw MathJax.Hub.Insert(Error(message),{texError: TRUE});
|
||||
throw HUB.Insert(Error(message),{texError: TRUE});
|
||||
},
|
||||
|
||||
//
|
||||
// Add a user-defined macro to the macro list
|
||||
//
|
||||
Macro: function (name,def,argn) {
|
||||
TEXDEF.macros[name] = ['Macro'].concat([].slice.call(arguments,1));
|
||||
},
|
||||
|
||||
//
|
||||
// Combine adjacent <mo> elements that are relations
|
||||
// (since MathML treats the spacing very differently)
|
||||
//
|
||||
combineRelations: function (mml) {
|
||||
for (var i = 0, m = mml.data.length; i < m; i++) {
|
||||
if (mml.data[i]) {
|
||||
|
@ -1774,6 +1820,12 @@
|
|||
}
|
||||
});
|
||||
|
||||
//
|
||||
// Add the default filters
|
||||
//
|
||||
TEX.prefilterHooks.Add(["prefilterMath",TEX]);
|
||||
TEX.postfilterHooks.Add(["postfilterMath",TEX]);
|
||||
|
||||
TEX.loadComplete("jax.js");
|
||||
|
||||
})(MathJax.InputJax.TeX);
|
||||
})(MathJax.InputJax.TeX,MathJax.Hub,MathJax.Ajax);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({
|
||||
id: "HTML-CSS",
|
||||
version: "1.1.8",
|
||||
version: "1.1.9",
|
||||
directory: MathJax.OutputJax.directory + "/HTML-CSS",
|
||||
extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS",
|
||||
autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload",
|
||||
|
@ -110,7 +110,7 @@ MathJax.Hub.Register.StartupHook("End Config",[function (HUB,HTMLCSS) {
|
|||
minBrowserTranslate: function (script) {
|
||||
var MJ = HUB.getJaxFor(script), text = ["[Math]"], delim;
|
||||
var span = document.createElement("span",{className: "MathJax_Preview"});
|
||||
if (MJ.inputJax.id === "TeX") {
|
||||
if (MJ.inputJax === "TeX") {
|
||||
if (MJ.root.Get("displaystyle")) {
|
||||
delim = CONFIG.displayMathDelimiters;
|
||||
text = [delim[0]+MJ.originalText+delim[1]];
|
||||
|
|
|
@ -433,7 +433,7 @@
|
|||
var math = (this.parentNode.className === "MathJax_Display" ? this.parentNode : this)
|
||||
MENU.jax = HUB.getJaxFor(math.nextSibling);
|
||||
MENU.menu.items[1].menu.items[1].name =
|
||||
(MENU.jax.inputJax.id === "MathML" ? "Original" : MENU.jax.inputJax.id);
|
||||
(MENU.jax.inputJax === "MathML" ? "Original" : MENU.jax.inputJax);
|
||||
return MENU.menu.Post(event);
|
||||
} else {
|
||||
if (!AJAX.loadingMathMenu) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
MathJax.OutputJax.NativeMML = MathJax.OutputJax({
|
||||
id: "NativeMML",
|
||||
version: "1.1.4",
|
||||
version: "1.1.5",
|
||||
directory: MathJax.OutputJax.directory + "/NativeMML",
|
||||
extensionDir: MathJax.OutputJax.extensionDir + "/NativeMML",
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
var script = (isMSIE ? this.parentNode.parentNode.nextSibling : this.parentNode.nextSibling);
|
||||
MENU.jax = HUB.getJaxFor(script);
|
||||
MENU.menu.items[1].menu.items[1].name =
|
||||
(MENU.jax.inputJax.id === "MathML" ? "Original" : MENU.jax.inputJax.id);
|
||||
(MENU.jax.inputJax === "MathML" ? "Original" : MENU.jax.inputJax);
|
||||
delete nMML.trapClick; delete nMML.trapUp;
|
||||
return MENU.menu.Post(event);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user