Skip to content

Commit e238e7c

Browse files
committed
Merge branch 'v2.0-candidate' of https://github.com/dpvc/MathJax into doc-update
2 parents da3a15a + 52ed4f8 commit e238e7c

File tree

8 files changed

+160
-31
lines changed

8 files changed

+160
-31
lines changed

MathJax.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/default.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ MathJax.Hub.Config({
689689
// EqChunkDelay is the time (in milliseconds) to delay between chunks
690690
// (to allow the browser to respond to other user interaction).
691691
//
692-
// Set EqnChunk to 1, EqnChunkFactor to 1, and EwnChunkDelay to 10 to get
692+
// Set EqnChunk to 1, EqnChunkFactor to 1, and EqnChunkDelay to 10 to get
693693
// the behavior from MathJax v1.1 and below.
694694
//
695695
EqnChunk: 50,
@@ -838,7 +838,7 @@ MathJax.Hub.Config({
838838

839839
//
840840
// This controls whether the MathML structure is retained and CSS
841-
// classes are used to mark the original MathML elements (as in the
841+
// classes are added to mark the original MathML elements (as in the
842842
// HTML-CSS output). By default, the SVG output jax removes unneeded
843843
// nesting in order to produce a more efficient markup, but if you
844844
// want to use CSS to style the elements as if they were MathML, you
@@ -941,7 +941,7 @@ MathJax.Hub.Config({
941941
// this long, the menu will appear. (The menu also will appear if you
942942
// click on the label.) It is in milliseconds.
943943
//
944-
delay: 400,
944+
delay: 150,
945945

946946
//
947947
// This is the URL for the MathJax Help menu item.
@@ -978,6 +978,20 @@ MathJax.Hub.Config({
978978
styles: {}
979979

980980
},
981+
982+
//============================================================================
983+
//
984+
// These parameters control the contextual menus that are available on the
985+
// mathematics within the page (provided the showMathMenu value is true above).
986+
//
987+
MathEvents: {
988+
//
989+
// This is the time required for the mouse to be held still over a
990+
// typeset equation in order for it to count as a hover (used when the
991+
// zoom trigger is "Hover"). It is in milliseconds.
992+
//
993+
hover: 500
994+
},
981995

982996
//============================================================================
983997
//

extensions/TeX/autoload-all.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* /MathJax/extensions/TeX/autoload-all.js
3+
*
4+
* Copyright (c) 2010 Design Science, Inc.
5+
*
6+
* Part of the MathJax library.
7+
* See http://www.mathjax.org for details.
8+
*
9+
* Licensed under the Apache License, Version 2.0;
10+
* you may not use this file except in compliance with the License.
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*/
14+
15+
MathJax.Extension["TeX/autoload-all"]={version:"2.0"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var h=MathJax.InputJax.TeX,c=h.Definitions.macros,g=h.Definitions.environment;var f={action:["mathtip","texttip","toggle"],AMSmath:["mathring","nobreakspace","negmedspace","negthickspace","intI","iiiint","idotsint","dddot","ddddot","sideset","boxed","substack","injlim","projlim","varliminf","varlimsup","varinjlim","varprojlim","DeclareMathOperator","operatorname","genfrac","tfrac","dfrac","binom","tbinom","dbinom","cfrac","shoveleft","shoveright","xrightarrow","xleftarrow"],begingroup:["begingroup","endgroup","gdef","global"],cancel:["cancel","bcancel","xcancel","cancelto"],color:["color","colorbox","fcolorbox"],enclose:["enclose"],extpfeil:["Newextarrow","xlongequal","xmapsto","xtofrom","xtwoheadleftarrow","xtwoheadrightarrow"],mhchem:["ce","cee","cf"]};for(var b in f){if(f.hasOwnProperty(b)){var e=f[b];for(var d=0,a=e.length;d<a;d++){c[e[d]]=["Extension",b]}}}g.subarray=["ExtensionEnv",null,"AMSmath"];g.smallmatrix=["ExtensionEnv",null,"AMSmath"];g.equation=["ExtensionEnv",null,"AMSmath"];g["equation*"]=["ExtensionEnv",null,"AMSmath"];MathJax.Hub.Startup.signal.Post("TeX autoload-all Ready")});MathJax.Callback.Queue(["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/AMSsymbols.js"],["loadComplete",MathJax.Ajax,"[MathJax]/extensions/TeX/autoload-all.js"]);
16+

extensions/TeX/color.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unpacked/MathJax.js

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ MathJax.fileversion = "2.0";
366366
};
367367

368368
//
369-
// An array of priorities hooks that are executed sequentially
369+
// An array of prioritized hooks that are executed sequentially
370370
// with a given set of data.
371371
//
372372
var HOOKS = MathJax.Object.Subclass({
@@ -590,6 +590,7 @@ MathJax.fileversion = "2.0";
590590
BASE.Callback.ExecuteHooks = EXECUTEHOOKS;
591591
})("MathJax");
592592

593+
593594
/**********************************************************/
594595

595596
(function (BASENAME) {
@@ -2033,17 +2034,8 @@ MathJax.Hub.Startup = {
20332034
cObject.Augment(null,cdef);
20342035
return this;
20352036
},
2036-
preProcess: function (element) {
2037-
var load, file = this.directory+"/"+this.JAXFILE;
2038-
this.constructor.prototype.preProcess = function (element) {
2039-
if (!load.called) {return load}
2040-
throw Error(file+" failed to load properly");
2041-
}
2042-
load = AJAX.Require(file);
2043-
return load;
2044-
},
2045-
Translate: function (element) {
2046-
throw Error(this.directory+"/"+this.JAXFILE+" failed to redefine the Translate() method");
2037+
Translate: function (script,state) {
2038+
throw Error(this.directory+"/"+this.JAXFILE+" failed to define the Translate() method");
20472039
},
20482040
Register: function (mimetype) {},
20492041
Config: function () {
@@ -2067,13 +2059,17 @@ MathJax.Hub.Startup = {
20672059
[function (config,id) {return MathJax.Hub.Startup.loadArray(config.extensions,"extensions/"+id)},this.config||{},this.id],
20682060
["Post",HUB.Startup.signal,this.id+" Jax Startup"],
20692061
["Startup",this],
2070-
["Post",HUB.Startup.signal,this.id+" Jax Ready"],
2071-
[function (THIS) {
2072-
THIS.preProcess = THIS.preTranslate;
2073-
THIS.Process = THIS.Translate;
2074-
THIS.postProcess = THIS.postTranslate;
2075-
},this.constructor.prototype]
2062+
["Post",HUB.Startup.signal,this.id+" Jax Ready"]
20762063
);
2064+
if (this.copyTranslate) {
2065+
queue.Push(
2066+
[function (THIS) {
2067+
THIS.preProcess = THIS.preTranslate;
2068+
THIS.Process = THIS.Translate;
2069+
THIS.postProcess = THIS.postTranslate;
2070+
},this.constructor.prototype]
2071+
);
2072+
}
20772073
return queue.Push(["loadComplete",AJAX,this.directory+"/"+file]);
20782074
}
20792075
}
@@ -2088,20 +2084,27 @@ MathJax.Hub.Startup = {
20882084

20892085
BASE.InputJax = JAX.Subclass({
20902086
elementJax: "mml", // the element jax to load for this input jax
2091-
Process: function (element) {
2092-
var queue = CALLBACK.Queue();
2087+
copyTranslate: true,
2088+
Process: function (script,state) {
2089+
var queue = CALLBACK.Queue(), file;
20932090
// Load any needed element jax
20942091
var jax = this.elementJax; if (!(jax instanceof Array)) {jax = [jax]}
20952092
for (var i = 0, m = jax.length; i < m; i++) {
2096-
var file = BASE.ElementJax.directory+"/"+jax[i]+"/"+this.JAXFILE;
2093+
file = BASE.ElementJax.directory+"/"+jax[i]+"/"+this.JAXFILE;
20972094
if (!this.require) {this.require = []}
20982095
else if (!(this.require instanceof Array)) {this.require = [this.require]};
20992096
this.require.push(file); // so Startup will wait for it to be loaded
21002097
queue.Push(AJAX.Require(file));
21012098
}
21022099
// Load the input jax
2103-
var load = queue.Push(AJAX.Require(this.directory+"/"+this.JAXFILE));
2104-
if (!load.called) {this.constructor.prototype.Process = function () {return load}}
2100+
file = this.directory+"/"+this.JAXFILE;
2101+
var load = queue.Push(AJAX.Require(file));
2102+
if (!load.called) {
2103+
this.constructor.prototype.Process = function () {
2104+
if (!load.called) {return load}
2105+
throw Error(file+" failed to load properly");
2106+
}
2107+
}
21052108
// Load the associated output jax
21062109
jax = HUB.outputJax["jax/"+jax[0]];
21072110
if (jax) {queue.Push(AJAX.Require(jax[0].directory+"/"+this.JAXFILE))}
@@ -2125,6 +2128,16 @@ MathJax.Hub.Startup = {
21252128
/***********************************/
21262129

21272130
BASE.OutputJax = JAX.Subclass({
2131+
copyTranslate: true,
2132+
preProcess: function (state) {
2133+
var load, file = this.directory+"/"+this.JAXFILE;
2134+
this.constructor.prototype.preProcess = function (state) {
2135+
if (!load.called) {return load}
2136+
throw Error(file+" failed to load properly");
2137+
}
2138+
load = AJAX.Require(file);
2139+
return load;
2140+
},
21282141
Register: function (mimetype) {
21292142
var jax = HUB.outputJax;
21302143
if (!jax[mimetype]) {jax[mimetype] = []}

unpacked/config/default.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ MathJax.Hub.Config({
689689
// EqChunkDelay is the time (in milliseconds) to delay between chunks
690690
// (to allow the browser to respond to other user interaction).
691691
//
692-
// Set EqnChunk to 1, EqnChunkFactor to 1, and EwnChunkDelay to 10 to get
692+
// Set EqnChunk to 1, EqnChunkFactor to 1, and EqnChunkDelay to 10 to get
693693
// the behavior from MathJax v1.1 and below.
694694
//
695695
EqnChunk: 50,
@@ -838,7 +838,7 @@ MathJax.Hub.Config({
838838

839839
//
840840
// This controls whether the MathML structure is retained and CSS
841-
// classes are used to mark the original MathML elements (as in the
841+
// classes are added to mark the original MathML elements (as in the
842842
// HTML-CSS output). By default, the SVG output jax removes unneeded
843843
// nesting in order to produce a more efficient markup, but if you
844844
// want to use CSS to style the elements as if they were MathML, you
@@ -941,7 +941,7 @@ MathJax.Hub.Config({
941941
// this long, the menu will appear. (The menu also will appear if you
942942
// click on the label.) It is in milliseconds.
943943
//
944-
delay: 400,
944+
delay: 150,
945945

946946
//
947947
// This is the URL for the MathJax Help menu item.
@@ -978,6 +978,20 @@ MathJax.Hub.Config({
978978
styles: {}
979979

980980
},
981+
982+
//============================================================================
983+
//
984+
// These parameters control the contextual menus that are available on the
985+
// mathematics within the page (provided the showMathMenu value is true above).
986+
//
987+
MathEvents: {
988+
//
989+
// This is the time required for the mouse to be held still over a
990+
// typeset equation in order for it to count as a hover (used when the
991+
// zoom trigger is "Hover"). It is in milliseconds.
992+
//
993+
hover: 500
994+
},
981995

982996
//============================================================================
983997
//
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*************************************************************
2+
*
3+
* MathJax/extensions/TeX/autoload-all.js
4+
*
5+
* Provides pre-defined macros to autoload all the extensions
6+
* so that all macros that MathJax knows about are available.
7+
*
8+
* ---------------------------------------------------------------------
9+
*
10+
* Copyright (c) 2012 Design Science, Inc.
11+
*
12+
* Licensed under the Apache License, Version 2.0 (the "License");
13+
* you may not use this file except in compliance with the License.
14+
* You may obtain a copy of the License at
15+
*
16+
* http://www.apache.org/licenses/LICENSE-2.0
17+
*
18+
* Unless required by applicable law or agreed to in writing, software
19+
* distributed under the License is distributed on an "AS IS" BASIS,
20+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
* See the License for the specific language governing permissions and
22+
* limitations under the License.
23+
*/
24+
25+
MathJax.Extension["TeX/autoload-all"] = {
26+
version: "2.0"
27+
};
28+
29+
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
30+
var TEX = MathJax.InputJax.TeX,
31+
MACROS = TEX.Definitions.macros,
32+
ENVS = TEX.Definitions.environment;
33+
34+
35+
var EXTENSIONS = {
36+
action: ["mathtip","texttip","toggle"],
37+
AMSmath: ["mathring","nobreakspace","negmedspace","negthickspace","intI",
38+
"iiiint","idotsint","dddot","ddddot","sideset","boxed",
39+
"substack","injlim","projlim","varliminf","varlimsup",
40+
"varinjlim","varprojlim","DeclareMathOperator","operatorname",
41+
"genfrac","tfrac","dfrac","binom","tbinom","dbinom","cfrac",
42+
"shoveleft","shoveright","xrightarrow","xleftarrow"],
43+
begingroup: ["begingroup","endgroup","gdef","global"],
44+
cancel: ["cancel","bcancel","xcancel","cancelto"],
45+
color: ["color","colorbox","fcolorbox"],
46+
enclose: ["enclose"],
47+
extpfeil: ["Newextarrow","xlongequal","xmapsto","xtofrom",
48+
"xtwoheadleftarrow","xtwoheadrightarrow"],
49+
mhchem: ["ce","cee","cf"]
50+
};
51+
52+
for (var name in EXTENSIONS) {if (EXTENSIONS.hasOwnProperty(name)) {
53+
var macros = EXTENSIONS[name];
54+
for (var i = 0, m = macros.length; i < m; i++) {
55+
MACROS[macros[i]] = ["Extension",name];
56+
}
57+
}}
58+
59+
ENVS["subarray"] = ['ExtensionEnv',null,'AMSmath'];
60+
ENVS["smallmatrix"] = ['ExtensionEnv',null,'AMSmath'];
61+
ENVS["equation"] = ['ExtensionEnv',null,'AMSmath'];
62+
ENVS["equation*"] = ['ExtensionEnv',null,'AMSmath'];
63+
64+
MathJax.Hub.Startup.signal.Post("TeX autoload-all Ready");
65+
66+
});
67+
68+
MathJax.Callback.Queue(
69+
["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/AMSsymbols.js"],
70+
["loadComplete",MathJax.Ajax,"[MathJax]/extensions/TeX/autoload-all.js"]
71+
);

0 commit comments

Comments
 (0)