Add a flag to user-defined macros so they are not overwritten when an extension is loaded (resolves issue #128).
This commit is contained in:
parent
6a265df244
commit
b9016bdf83
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
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1";var c=MathJax.InputJax.TeX;var a=c.Definitions;a.macros.href="HREF_attribute";a.macros["class"]="CLASS_attribute";a.macros.style="STYLE_attribute";a.macros.cssId="ID_attribute";c.Parse.Augment({HREF_attribute:function(f){var e=this.GetArgument(f),d=this.GetArgumentMML(f);this.Push(d.With({href:e}))},CLASS_attribute:function(e){var f=this.GetArgument(e),d=this.GetArgumentMML(e);if(d["class"]!=null){f=d["class"]+" "+f}this.Push(d.With({"class":f}))},STYLE_attribute:function(e){var f=this.GetArgument(e),d=this.GetArgumentMML(e);if(d.style!=null){if(f.charAt(f.length-1)!==";"){f+=";"}f=d.style+" "+f}this.Push(d.With({style:f}))},ID_attribute:function(f){var e=this.GetArgument(f),d=this.GetArgumentMML(f);this.Push(d.With({id:e}))},GetArgumentMML:function(e){var d=this.ParseArg(e);if(d.inferred&&d.data.length==1){d=d.data[0]}else{delete d.inferred}return d}});MathJax.Hub.Startup.signal.Post("TeX HTML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js");
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1.1";var c=MathJax.InputJax.TeX;var a=c.Definitions;a.Add({macros:{href:"HREF_attribute","class":"CLASS_attribute",style:"STYLE_attribute",cssId:"ID_attribute"}});c.Parse.Augment({HREF_attribute:function(f){var e=this.GetArgument(f),d=this.GetArgumentMML(f);this.Push(d.With({href:e}))},CLASS_attribute:function(e){var f=this.GetArgument(e),d=this.GetArgumentMML(e);if(d["class"]!=null){f=d["class"]+" "+f}this.Push(d.With({"class":f}))},STYLE_attribute:function(e){var f=this.GetArgument(e),d=this.GetArgumentMML(e);if(d.style!=null){if(f.charAt(f.length-1)!==";"){f+=";"}f=d.style+" "+f}this.Push(d.With({style:f}))},ID_attribute:function(f){var e=this.GetArgument(f),d=this.GetArgumentMML(f);this.Push(d.With({id:e}))},GetArgumentMML:function(e){var d=this.ParseArg(e);if(d.inferred&&d.data.length==1){d=d.data[0]}else{delete d.inferred}return d}});MathJax.Hub.Startup.signal.Post("TeX HTML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js");
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX;var b=d.Definitions;var a=MathJax.Object.Subclass({macros:null,environments:null,Init:function(e,f){this.macros=(e||{});this.environments=(f||{})},Find:function(e,f){if(this[f][e]){return this[f][e]}},Def:function(e,g,f){this[f][e]=g},Undef:function(e,f){delete this[f][e]},Merge:function(e){MathJax.Hub.Insert(this.macros,e.macros);MathJax.Hub.Insert(this.environments,e.environments)},MergeGlobals:function(e){var f=this.macros;for(var g in f){if(f.hasOwnProperty(g)&&f[g].global){e.Def(g,f[g],"macros",true);delete f[g].global;delete f[g]}}},Clear:function(g){this.environments={};if(g){this.macros={}}else{var e=this.macros;for(var f in e){if(e.hasOwnProperty(f)&&!e[f].global){delete e[f]}}}return this}});var c=d.nsStack=MathJax.Object.Subclass({stack:null,top:0,isEqn:false,Init:function(e){this.isEqn=e;this.stack=[];if(!e){this.Push(a(b.macros,b.environments))}else{this.Push(a())}},Def:function(e,h,f,g){var i=this.top-1;if(g){while(i>0){this.stack[i].Undef(e,f);i--}if(!(h instanceof Array)){h=[h]}if(this.isEqn){h.global=true}}this.stack[i].Def(e,h,f)},Push:function(e){this.stack.push(e);this.top=this.stack.length},Pop:function(){var e;if(this.top>1){e=this.stack[--this.top];if(this.isEqn){this.stack.pop()}}else{if(this.isEqn){this.Clear()}}return e},Find:function(e,g){for(var f=this.top-1;f>=0;f--){var h=this.stack[f].Find(e,g);if(h){return h}}return null},Merge:function(e){e.stack[0].MergeGlobals(this);this.stack[this.top-1].Merge(e.stack[0]);var f=[this.top,this.stack.length-this.top].concat(e.stack.slice(1));this.stack.splice.apply(this.stack,f);this.top=this.stack.length},Reset:function(){this.top=this.stack.length},Clear:function(e){this.stack=[this.stack[0].Clear()];this.top=this.stack.length}},{nsFrame:a});b.macros.begingroup="BeginGroup";b.macros.endgroup="EndGroup";b.macros.global=["Extension","newcommand"];b.macros.gdef=["Extension","newcommand"];d.Parse.Augment({BeginGroup:function(e){d.eqnStack.Push(a())},EndGroup:function(e){if(d.eqnStack.top>1){d.eqnStack.Pop()}else{if(d.rootStack.top===1){d.Error("Extra "+e+" or missing \\begingroup")}else{d.eqnStack.Clear();d.rootStack.Pop()}}},csFindMacro:function(e){return(d.eqnStack.Find(e,"macros")||d.rootStack.Find(e,"macros"))},envFindName:function(e){return(d.eqnStack.Find(e,"environments")||d.rootStack.Find(e,"environments"))}});d.rootStack=c();d.eqnStack=c(true);d.prefilterHooks.Add(function(){d.rootStack.Reset();d.eqnStack.Clear(true)});d.postfilterHooks.Add(function(){d.rootStack.Merge(d.eqnStack)});MathJax.Hub.Register.StartupHook("TeX newcommand Ready",function(){b.macros.global="Global";b.macros.gdef=["Macro","\\global\\def"];d.Parse.Augment({setDef:function(e,f){d.eqnStack.Def(e,f,"macros",this.stack.isGlobal);delete this.stack.env.isGlobal},setEnv:function(e,f){d.eqnStack.Def(e,f,"environments")},Global:function(e){var f=this.i;var g=this.GetCSname(e);this.i=f;if(g!=="let"&&g!=="def"&&g!=="newcommand"){d.Error(e+" not followed by \\let, \\def, or \\newcommand")}this.stack.env.isGlobal=true}})});MathJax.Hub.Startup.signal.Post("TeX begingroup Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/begingroup.js");
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d="1.1.1";var e=MathJax.InputJax.TeX,b=e.Definitions;var a=MathJax.Object.Subclass({macros:null,environments:null,Init:function(f,g){this.macros=(f||{});this.environments=(g||{})},Find:function(f,g){if(this[g][f]){return this[g][f]}},Def:function(f,h,g){this[g][f]=h},Undef:function(f,g){delete this[g][f]},Merge:function(f){MathJax.Hub.Insert(this.macros,f.macros);MathJax.Hub.Insert(this.environments,f.environments)},MergeGlobals:function(f){var g=this.macros;for(var h in g){if(g.hasOwnProperty(h)&&g[h].global){f.Def(h,g[h],"macros",true);delete g[h].global;delete g[h]}}},Clear:function(h){this.environments={};if(h){this.macros={}}else{var f=this.macros;for(var g in f){if(f.hasOwnProperty(g)&&!f[g].global){delete f[g]}}}return this}});var c=e.nsStack=MathJax.Object.Subclass({stack:null,top:0,isEqn:false,Init:function(f){this.isEqn=f;this.stack=[];if(!f){this.Push(a(b.macros,b.environments))}else{this.Push(a())}},Def:function(f,i,g,h){var j=this.top-1;if(h){while(j>0){this.stack[j].Undef(f,g);j--}if(!(i instanceof Array)){i=[i]}if(this.isEqn){i.global=true}}this.stack[j].Def(f,i,g)},Push:function(f){this.stack.push(f);this.top=this.stack.length},Pop:function(){var f;if(this.top>1){f=this.stack[--this.top];if(this.isEqn){this.stack.pop()}}else{if(this.isEqn){this.Clear()}}return f},Find:function(f,h){for(var g=this.top-1;g>=0;g--){var j=this.stack[g].Find(f,h);if(j){return j}}return null},Merge:function(f){f.stack[0].MergeGlobals(this);this.stack[this.top-1].Merge(f.stack[0]);var g=[this.top,this.stack.length-this.top].concat(f.stack.slice(1));this.stack.splice.apply(this.stack,g);this.top=this.stack.length},Reset:function(){this.top=this.stack.length},Clear:function(f){this.stack=[this.stack[0].Clear()];this.top=this.stack.length}},{nsFrame:a});b.macros.begingroup="BeginGroup";b.macros.endgroup="EndGroup";b.macros.global=["Extension","newcommand"];b.macros.gdef=["Extension","newcommand"];e.Parse.Augment({BeginGroup:function(f){e.eqnStack.Push(a())},EndGroup:function(f){if(e.eqnStack.top>1){e.eqnStack.Pop()}else{if(e.rootStack.top===1){e.Error("Extra "+f+" or missing \\begingroup")}else{e.eqnStack.Clear();e.rootStack.Pop()}}},csFindMacro:function(f){return(e.eqnStack.Find(f,"macros")||e.rootStack.Find(f,"macros"))},envFindName:function(f){return(e.eqnStack.Find(f,"environments")||e.rootStack.Find(f,"environments"))}});e.rootStack=c();e.eqnStack=c(true);e.prefilterHooks.Add(function(){e.rootStack.Reset();e.eqnStack.Clear(true)});e.postfilterHooks.Add(function(){e.rootStack.Merge(e.eqnStack)});MathJax.Hub.Register.StartupHook("TeX newcommand Ready",function(){b.macros.global="Global";b.macros.gdef=["Macro","\\global\\def"];e.Parse.Augment({setDef:function(f,g){g.isUser=true;e.eqnStack.Def(f,g,"macros",this.stack.env.isGlobal);delete this.stack.env.isGlobal},setEnv:function(f,g){g.isUser=true;e.eqnStack.Def(f,g,"environments")},Global:function(f){var g=this.i;var h=this.GetCSname(f);this.i=g;if(h!=="let"&&h!=="def"&&h!=="newcommand"){e.Error(f+" not followed by \\let, \\def, or \\newcommand")}this.stack.env.isGlobal=true}})});MathJax.Hub.Startup.signal.Post("TeX begingroup Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/begingroup.js");
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1.1";var c=MathJax.InputJax.TeX;var a=c.Definitions;MathJax.Hub.Insert(a,{macros:{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"}});c.Parse.Augment({NewCommand:function(d){var e=this.trimSpaces(this.GetArgument(d)),g=this.trimSpaces(this.GetBrackets(d)),f=this.GetArgument(d);if(g===""){g=null}if(e.charAt(0)==="\\"){e=e.substr(1)}if(!e.match(/^(.|[a-z]+)$/i)){c.Error("Illegal control sequence name for "+d)}if(g!=null&&!g.match(/^[0-9]+$/)){c.Error("Illegal number of parameters specified in "+d)}this.setDef(e,["Macro",f,g])},NewEnvironment:function(e){var f=this.trimSpaces(this.GetArgument(e)),h=this.trimSpaces(this.GetBrackets(e)),g=this.GetArgument(e),d=this.GetArgument(e);if(h===""){h=null}if(h!=null&&!h.match(/^[0-9]+$/)){c.Error("Illegal number of parameters specified in "+e)}this.setEnv(f,["BeginEnv","EndEnv",g,d,h])},MacroDef:function(d){var e=this.GetCSname(d),g=this.GetTemplate(d,"\\"+e),f=this.GetArgument(d);if(!(g instanceof Array)){this.setDef(e,["Macro",f,g])}else{this.setDef(e,["MacroWithTemplate",f].concat(g))}},Let:function(d){var e=this.GetCSname(d),f;var g=this.GetNext();if(g==="="){this.i++;g=this.GetNext()}if(g==="\\"){d=this.GetCSname(d);f=this.csFindMacro(d);if(!f){if(a.mathchar0mi[d]){f=["csMathchar0mi",a.mathchar0mi[d]]}else{if(a.mathchar0mo[d]){f=["csMathchar0mo",a.mathchar0mo[d]]}else{if(a.mathchar7[d]){f=["csMathchar7",a.mathchar7[d]]}else{if(a.delimiter["\\"+d]!=null){f=["csDelimiter",a.delimiter["\\"+d]]}}}}}}else{f=["Macro",g];this.i++}this.setDef(e,f)},setDef:function(d,e){a.macros[d]=e},setEnv:function(d,e){a.environment[d]=e},GetCSname:function(e){var f=this.GetNext();if(f!=="\\"){c.Error("\\ must be followed by a control sequence")}var d=this.trimSpaces(this.GetArgument(e));return d.substr(1)},GetTemplate:function(f,e){var j,g=[],h=0;j=this.GetNext();var d=this.i;while(this.i<this.string.length){j=this.GetNext();if(j==="#"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}j=this.string.charAt(++this.i);if(!j.match(/^[1-9]$/)){c.Error("Illegal use of # in template for "+e)}if(parseInt(j)!=++h){c.Error("Parameters for "+e+" must be numbered sequentially")}d=this.i+1}else{if(j==="{"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}if(g.length>0){return[h,g]}else{return h}}}this.i++}c.Error("Missing replacement string for definition of "+f)},MacroWithTemplate:function(e,h,j,g){if(j){var d=[];this.GetNext();if(g[0]&&!this.MatchParam(g[0])){c.Error("Use of "+e+" doesn't match its definition")}for(var f=0;f<j;f++){d.push(this.GetParameter(e,g[f+1]))}h=this.SubstituteArgs(d,h)}this.string=this.AddArgs(h,this.string.slice(this.i));this.i=0;if(++this.macroCount>c.config.MAXMACROS){c.Error("MathJax maximum macro substitution count exceeded; is there a recursive macro call?")}},BeginEnv:function(g,j,d,h){if(h){var e=[];for(var f=0;f<h;f++){e.push(this.GetArgument("\\begin{"+name+"}"))}j=this.SubstituteArgs(e,j);d=this.SubstituteArgs(e,d)}g.edef=d;this.string=this.AddArgs(j,this.string.slice(this.i));this.i=0;return g},EndEnv:function(d,e){this.string=this.AddArgs(d.edef,this.string.slice(this.i));this.i=0;return e},GetParameter:function(e,h){if(h==null){return this.GetArgument(e)}var g=this.i,d=0,f=0;while(this.i<this.string.length){if(this.string.charAt(this.i)==="{"){if(this.i===g){f=1}this.GetArgument(e);d=this.i-g}else{if(this.MatchParam(h)){if(f){g++;d-=2}return this.string.substr(g,d)}else{this.i++;d++;f=0}}}c.Error("Runaway argument for "+e+"?")},MatchParam:function(d){if(this.string.substr(this.i,d.length)!==d){return 0}this.i+=d.length;return 1}});c.Environment=function(d){a.environment[d]=["BeginEnv","EndEnv"].concat([].slice.call(arguments,1))};MathJax.Hub.Startup.signal.Post("TeX newcommand Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/newcommand.js");
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b="1.1.2";var c=MathJax.InputJax.TeX;var a=c.Definitions;a.Add({macros:{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"}},null,true);c.Parse.Augment({NewCommand:function(d){var e=this.trimSpaces(this.GetArgument(d)),g=this.trimSpaces(this.GetBrackets(d)),f=this.GetArgument(d);if(g===""){g=null}if(e.charAt(0)==="\\"){e=e.substr(1)}if(!e.match(/^(.|[a-z]+)$/i)){c.Error("Illegal control sequence name for "+d)}if(g!=null&&!g.match(/^[0-9]+$/)){c.Error("Illegal number of parameters specified in "+d)}this.setDef(e,["Macro",f,g])},NewEnvironment:function(e){var f=this.trimSpaces(this.GetArgument(e)),h=this.trimSpaces(this.GetBrackets(e)),g=this.GetArgument(e),d=this.GetArgument(e);if(h===""){h=null}if(h!=null&&!h.match(/^[0-9]+$/)){c.Error("Illegal number of parameters specified in "+e)}this.setEnv(f,["BeginEnv","EndEnv",g,d,h])},MacroDef:function(d){var e=this.GetCSname(d),g=this.GetTemplate(d,"\\"+e),f=this.GetArgument(d);if(!(g instanceof Array)){this.setDef(e,["Macro",f,g])}else{this.setDef(e,["MacroWithTemplate",f].concat(g))}},Let:function(d){var e=this.GetCSname(d),f;var g=this.GetNext();if(g==="="){this.i++;g=this.GetNext()}if(g==="\\"){d=this.GetCSname(d);f=this.csFindMacro(d);if(!f){if(a.mathchar0mi[d]){f=["csMathchar0mi",a.mathchar0mi[d]]}else{if(a.mathchar0mo[d]){f=["csMathchar0mo",a.mathchar0mo[d]]}else{if(a.mathchar7[d]){f=["csMathchar7",a.mathchar7[d]]}else{if(a.delimiter["\\"+d]!=null){f=["csDelimiter",a.delimiter["\\"+d]]}}}}}}else{f=["Macro",g];this.i++}this.setDef(e,f)},setDef:function(d,e){e.isUser=true;a.macros[d]=e},setEnv:function(d,e){e.isUser=true;a.environment[d]=e},GetCSname:function(e){var f=this.GetNext();if(f!=="\\"){c.Error("\\ must be followed by a control sequence")}var d=this.trimSpaces(this.GetArgument(e));return d.substr(1)},GetTemplate:function(f,e){var j,g=[],h=0;j=this.GetNext();var d=this.i;while(this.i<this.string.length){j=this.GetNext();if(j==="#"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}j=this.string.charAt(++this.i);if(!j.match(/^[1-9]$/)){c.Error("Illegal use of # in template for "+e)}if(parseInt(j)!=++h){c.Error("Parameters for "+e+" must be numbered sequentially")}d=this.i+1}else{if(j==="{"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}if(g.length>0){return[h,g]}else{return h}}}this.i++}c.Error("Missing replacement string for definition of "+f)},MacroWithTemplate:function(e,h,j,g){if(j){var d=[];this.GetNext();if(g[0]&&!this.MatchParam(g[0])){c.Error("Use of "+e+" doesn't match its definition")}for(var f=0;f<j;f++){d.push(this.GetParameter(e,g[f+1]))}h=this.SubstituteArgs(d,h)}this.string=this.AddArgs(h,this.string.slice(this.i));this.i=0;if(++this.macroCount>c.config.MAXMACROS){c.Error("MathJax maximum macro substitution count exceeded; is there a recursive macro call?")}},BeginEnv:function(g,j,d,h){if(h){var e=[];for(var f=0;f<h;f++){e.push(this.GetArgument("\\begin{"+name+"}"))}j=this.SubstituteArgs(e,j);d=this.SubstituteArgs(e,d)}g.edef=d;this.string=this.AddArgs(j,this.string.slice(this.i));this.i=0;return g},EndEnv:function(d,e){this.string=this.AddArgs(d.edef,this.string.slice(this.i));this.i=0;return e},GetParameter:function(e,h){if(h==null){return this.GetArgument(e)}var g=this.i,d=0,f=0;while(this.i<this.string.length){if(this.string.charAt(this.i)==="{"){if(this.i===g){f=1}this.GetArgument(e);d=this.i-g}else{if(this.MatchParam(h)){if(f){g++;d-=2}return this.string.substr(g,d)}else{this.i++;d++;f=0}}}c.Error("Runaway argument for "+e+"?")},MatchParam:function(d){if(this.string.substr(this.i,d.length)!==d){return 0}this.i+=d.length;return 1}});c.Environment=function(d){a.environment[d]=["BeginEnv","EndEnv"].concat([].slice.call(arguments,1));a.environment[d].isUser=true};MathJax.Hub.Startup.signal.Post("TeX newcommand Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/newcommand.js");
|
||||
|
||||
|
|
|
@ -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%"}});MathJax.InputJax.TeX.Register("math/tex");MathJax.InputJax.TeX.loadComplete("config.js");
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
var MML = MathJax.ElementJax.mml;
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
|
@ -30,8 +30,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
var STACKITEM = TEX.Stack.Item;
|
||||
|
||||
var COLS = function (W) {return W.join("em ") + "em"};
|
||||
|
||||
MathJax.Hub.Insert(TEXDEF,{
|
||||
|
||||
TEXDEF.Add({
|
||||
macros: {
|
||||
mathring: ['Accent','2DA'], // or 0x30A
|
||||
|
||||
|
@ -110,7 +110,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
'\\lVert': ['2225',{texClass:MML.TEXCLASS.OPEN}],
|
||||
'\\rVert': ['2225',{texClass:MML.TEXCLASS.CLOSE}]
|
||||
}
|
||||
});
|
||||
},null,true);
|
||||
|
||||
|
||||
TEX.Parse.Augment({
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var VERSION = "1.1.2";
|
||||
var VERSION = "1.1.3";
|
||||
|
||||
var MML = MathJax.ElementJax.mml;
|
||||
var MML = MathJax.ElementJax.mml,
|
||||
TEXDEF = MathJax.InputJax.TeX.Definitions;
|
||||
|
||||
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions,{
|
||||
TEXDEF.Add({
|
||||
|
||||
mathchar0mi: {
|
||||
// Lowercase Greek letters
|
||||
|
@ -306,7 +307,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
impliedby: ['Macro','\\;\\Longleftarrow\\;']
|
||||
}
|
||||
|
||||
});
|
||||
},null,true);
|
||||
|
||||
var REL = MML.mo.OPTYPES.REL;
|
||||
|
||||
|
|
|
@ -22,15 +22,19 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var VERSION = "1.1";
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
var TEXDEF = TEX.Definitions;
|
||||
|
||||
TEXDEF.macros.href = 'HREF_attribute';
|
||||
TEXDEF.macros["class"] = 'CLASS_attribute';
|
||||
TEXDEF.macros.style = 'STYLE_attribute';
|
||||
TEXDEF.macros.cssId = 'ID_attribute';
|
||||
TEXDEF.Add({
|
||||
macros: {
|
||||
href: 'HREF_attribute',
|
||||
"class": 'CLASS_attribute',
|
||||
style: 'STYLE_attribute',
|
||||
cssId: 'ID_attribute'
|
||||
}
|
||||
});
|
||||
|
||||
TEX.Parse.Augment({
|
||||
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var TEX = MathJax.InputJax.TeX; var TEXDEF = TEX.Definitions;
|
||||
var VERSION = "1.1.1";
|
||||
|
||||
var TEX = MathJax.InputJax.TeX,
|
||||
TEXDEF = TEX.Definitions;
|
||||
|
||||
/****************************************************/
|
||||
|
||||
|
@ -260,10 +263,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
// to make them go into the equation namespace stack
|
||||
//
|
||||
setDef: function (name,value) {
|
||||
TEX.eqnStack.Def(name,value,"macros",this.stack.isGlobal);
|
||||
value.isUser = true;
|
||||
TEX.eqnStack.Def(name,value,"macros",this.stack.env.isGlobal);
|
||||
delete this.stack.env.isGlobal;
|
||||
},
|
||||
setEnv: function (name,value) {TEX.eqnStack.Def(name,value,"environments")},
|
||||
setEnv: function (name,value) {
|
||||
value.isUser = true;
|
||||
TEX.eqnStack.Def(name,value,"environments")
|
||||
},
|
||||
|
||||
//
|
||||
// Implement \global (for \global\let, \global\def and \global\newcommand)
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
*/
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var VERSION = "1.1.1";
|
||||
var VERSION = "1.1.2";
|
||||
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
var TEXDEF = TEX.Definitions;
|
||||
|
||||
MathJax.Hub.Insert(TEXDEF,{
|
||||
TEXDEF.Add({
|
||||
macros: {
|
||||
newcommand: 'NewCommand',
|
||||
renewcommand: 'NewCommand',
|
||||
|
@ -37,7 +37,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
def: 'MacroDef',
|
||||
let: 'Let'
|
||||
}
|
||||
})
|
||||
},null,true);
|
||||
|
||||
TEX.Parse.Augment({
|
||||
|
||||
|
@ -112,8 +112,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
* Routines to set the macro and environment definitions
|
||||
* (overridden by begingroup to make localized versions)
|
||||
*/
|
||||
setDef: function (name,value) {TEXDEF.macros[name] = value},
|
||||
setEnv: function (name,value) {TEXDEF.environment[name] = value},
|
||||
setDef: function (name,value) {value.isUser = true; TEXDEF.macros[name] = value},
|
||||
setEnv: function (name,value) {value.isUser = true; TEXDEF.environment[name] = value},
|
||||
|
||||
/*
|
||||
* Get a CS name or give an error
|
||||
|
@ -219,6 +219,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
|||
|
||||
TEX.Environment = function (name) {
|
||||
TEXDEF.environment[name] = ['BeginEnv','EndEnv'].concat([].slice.call(arguments,1));
|
||||
TEXDEF.environment[name].isUser = true;
|
||||
}
|
||||
|
||||
MathJax.Hub.Startup.signal.Post("TeX newcommand Ready");
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
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",
|
||||
|
||||
|
|
|
@ -292,7 +292,21 @@
|
|||
});
|
||||
|
||||
|
||||
var TEXDEF = {};
|
||||
var TEXDEF = {
|
||||
//
|
||||
// Add new definitions without overriding user-defined ones
|
||||
//
|
||||
Add: function (src,dst,nouser) {
|
||||
if (!dst) {dst = this}
|
||||
for (var id in src) {if (src.hasOwnProperty(id)) {
|
||||
if (typeof src[id] === 'object' && !(src[id] instanceof Array) &&
|
||||
(typeof dst[id] === 'object' || typeof dst[id] === 'function'))
|
||||
{this.Add(src[id],dst[id],src[id],nouser)}
|
||||
else if (!dst[id] || !dst[id].isUser || !nouser) {dst[id] = src[id]}
|
||||
}}
|
||||
return dst;
|
||||
}
|
||||
};
|
||||
var STARTUP = function () {
|
||||
MML = MathJax.ElementJax.mml;
|
||||
MathJax.Hub.Insert(TEXDEF,{
|
||||
|
@ -910,6 +924,7 @@
|
|||
for (var id in MACROS) {if (MACROS.hasOwnProperty(id)) {
|
||||
if (typeof(MACROS[id]) === "string") {TEXDEF.macros[id] = ['Macro',MACROS[id]]}
|
||||
else {TEXDEF.macros[id] = ["Macro"].concat(MACROS[id])}
|
||||
TEXDEF.macros[id].isUser = true;
|
||||
}}
|
||||
}
|
||||
};
|
||||
|
@ -1772,6 +1787,7 @@
|
|||
},
|
||||
Macro: function (name,def,argn) {
|
||||
TEXDEF.macros[name] = ['Macro'].concat([].slice.call(arguments,1));
|
||||
TEXDEF.macros[name].isUser = true;
|
||||
},
|
||||
|
||||
combineRelations: function (mml) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user