Merge branch 'develop' into issue703

This commit is contained in:
Davide P. Cervone 2014-02-21 11:06:47 -05:00
commit 3614cd1671
43 changed files with 542 additions and 287 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 552 B

View File

@ -107,7 +107,7 @@ Type text in the box below:<br/>
Preview is shown here:
<div id="MathPreview" style="border:1px solid; padding: 3px; width:50%; margin-top:5px"></div>
<div id="MathBuffer" style="border:1px solid; padding: 3px; width:50%; margin-top:5px;
visibility:hidden; position:absolute; top:0; left: 0"><div>
visibility:hidden; position:absolute; top:0; left: 0"></div>
<script>
Preview.Init();

View File

@ -46,7 +46,7 @@ if (window.MathJax) {window.MathJax = {AuthorConfig: window.MathJax}}
// MathJax.isPacked = true; // This line is uncommented by the packer.
MathJax.version = "2.3";
MathJax.fileversion = "2.3.1";
MathJax.fileversion = "2.3.2";
/**********************************************************/
@ -543,7 +543,7 @@ MathJax.fileversion = "2.3.1";
call: function () {this.callback(this); this.Process()},
//
// A listener calls this to register intrest in the signal (so it will be called
// A listener calls this to register interest in the signal (so it will be called
// when posts occur). If ignorePast is true, it will not be sent the post history.
//
Interest: function (callback,ignorePast,priority) {
@ -580,7 +580,7 @@ MathJax.fileversion = "2.3.1";
//
// Execute the message hooks for the given message
//
ExecuteHooks: function (msg,more) {
ExecuteHooks: function (msg) {
var type = ((msg instanceof Array) ? msg[0] : msg);
if (!this.hooks[type]) {return null}
return this.hooks[type].Execute(msg);
@ -1135,7 +1135,7 @@ MathJax.Localization = {
var result = [], match, last = 0;
regex.lastIndex = 0;
while (match = regex.exec(string)) {
result.push(string.substr(last,match.index));
result.push(string.substr(last,match.index-last));
result.push.apply(result,match.slice(1));
last = match.index + match[0].length;
}
@ -1557,7 +1557,9 @@ MathJax.Message = {
browsers: {
MSIE: function (browser) {
MathJax.Hub.config.styles["#MathJax_Message"].position = "absolute";
MathJax.Message.msieFixedPositionBug = ((document.documentMode||0) < 7);
if (MathJax.Message.msieFixedPositionBug)
{MathJax.Hub.config.styles["#MathJax_Message"].position = "absolute"}
MathJax.Message.quirks = (document.compatMode === "BackCompat");
},
Chrome: function (browser) {
@ -1580,7 +1582,7 @@ MathJax.Message = {
}
if (!this.div) {
var frame = document.body;
if (MathJax.Hub.Browser.isMSIE) {
if (this.msieFixedPositionBug && window.attachEvent) {
frame = this.frame = this.addDiv(document.body); frame.removeAttribute("id");
frame.style.position = "absolute";
frame.style.border = frame.style.margin = frame.style.padding = "0px";
@ -2359,21 +2361,6 @@ MathJax.Hub.Startup = {
MathJax.Hub.config.menuSettings.locale = this.params.locale;
}
//
// Check for user cookie configuration
//
var user = MathJax.HTML.Cookie.Get("user");
if (user.URL || user.Config) {
if (confirm(
MathJax.Localization._("CookieConfig",
"MathJax has found a user-configuration cookie that includes code to "+
"be run. Do you want to run it?\n\n"+
"(You should press Cancel unless you set up the cookie yourself.)")
)) {
if (user.URL) {this.queue.Push(["Require",MathJax.Ajax,user.URL])}
if (user.Config) {this.queue.Push(new Function(user.Config))}
} else {MathJax.HTML.Cookie.Set("user",{})}
}
//
// Run the config files, if any are given in the parameter list
//
if (this.params.config) {
@ -2554,26 +2541,28 @@ MathJax.Hub.Startup = {
// if needed later on.
//
MenuZoom: function () {
if (!MathJax.Extension.MathMenu) {
setTimeout(
function () {
MathJax.Callback.Queue(
["Require",MathJax.Ajax,"[MathJax]/extensions/MathMenu.js",{}],
["loadDomain",MathJax.Localization,"MathMenu"]
)
},1000
);
} else {
setTimeout(
MathJax.Callback(["loadDomain",MathJax.Localization,"MathMenu"]),
1000
);
}
if (!MathJax.Extension.MathZoom) {
setTimeout(
MathJax.Callback(["Require",MathJax.Ajax,"[MathJax]/extensions/MathZoom.js",{}]),
2000
);
if (MathJax.Hub.config.showMathMenu) {
if (!MathJax.Extension.MathMenu) {
setTimeout(
function () {
MathJax.Callback.Queue(
["Require",MathJax.Ajax,"[MathJax]/extensions/MathMenu.js",{}],
["loadDomain",MathJax.Localization,"MathMenu"]
)
},1000
);
} else {
setTimeout(
MathJax.Callback(["loadDomain",MathJax.Localization,"MathMenu"]),
1000
);
}
if (!MathJax.Extension.MathZoom) {
setTimeout(
MathJax.Callback(["Require",MathJax.Ajax,"[MathJax]/extensions/MathZoom.js",{}]),
2000
);
}
}
},
@ -2954,24 +2943,24 @@ MathJax.Hub.Startup = {
}
}
CONFIG.root = scripts[i].src.replace(/(^|\/)[^\/]*(\?.*)?$/,'')
.replace(/^(https?:\/\/(cdn.mathjax.org|c328740.ssl.cf1.rackcdn.com)\/mathjax\/)(latest)/,
"$1"+BASE.version+"-$3");
.replace(/^(https?:\/\/(cdn.mathjax.org|[0-9a-f]+(-[0-9a-f]+)?.ssl.cf1.rackcdn.com)\/mathjax\/)(latest)/,
"$1"+BASE.version+"-$4");
break;
}
}
BASE.Ajax.config = CONFIG;
var AGENT = navigator.userAgent;
var BROWSERS = {
isMac: (navigator.platform.substr(0,3) === "Mac"),
isPC: (navigator.platform.substr(0,3) === "Win"),
isMSIE: (window.ActiveXObject != null && window.clipboardData != null),
isFirefox: (navigator.userAgent.match(/Gecko/) != null &&
navigator.userAgent.match(/KHTML/) == null),
isSafari: (navigator.userAgent.match(/ (Apple)?WebKit\//) != null &&
isMSIE: ("ActiveXObject" in window && "clipboardData" in window),
isFirefox: (AGENT.match(/Gecko\//) && !AGENT.match(/like Gecko/)),
isSafari: (AGENT.match(/ (Apple)?WebKit\//) != null &&
(!window.chrome || window.chrome.loadTimes == null)),
isChrome: (window.chrome != null && window.chrome.loadTimes != null),
isOpera: (window.opera != null && window.opera.version != null),
isKonqueror: (window.hasOwnProperty && window.hasOwnProperty("konqueror") && navigator.vendor == "KDE"),
isKonqueror: ("konqueror" in window && navigator.vendor == "KDE"),
versionAtLeast: function (v) {
var bv = (this.version).split('.'); v = (new String(v)).split('.');
for (var i = 0, m = v.length; i < m; i++)
@ -2985,7 +2974,7 @@ MathJax.Hub.Startup = {
}
};
var AGENT = navigator.userAgent
var xAGENT = AGENT
.replace(/^Mozilla\/(\d+\.)+\d+ /,"") // remove initial Mozilla, which is never right
.replace(/[a-z][-a-z0-9._: ]+\/\d+[^ ]*-[^ ]*\.([a-z][a-z])?\d+ /i,"") // remove linux version
.replace(/Gentoo |Ubuntu\/(\d+\.)*\d+ (\([^)]*\) )?/,""); // special case for these
@ -2997,11 +2986,11 @@ MathJax.Hub.Startup = {
if (browser === "Mac" || browser === "PC") continue;
HUB.Browser = HUB.Insert(new String(browser),BROWSERS);
var VERSION = new RegExp(
".*(Version)/((?:\\d+\\.)+\\d+)|" + // for Safari and Opera10
".*(Version/| Trident/.*; rv:)((?:\\d+\\.)+\\d+)|" + // for Safari, Opera10, and IE11+
".*("+browser+")"+(browser == "MSIE" ? " " : "/")+"((?:\\d+\\.)*\\d+)|"+ // for one of the main browser
"(?:^|\\(| )([a-z][-a-z0-9._: ]+|(?:Apple)?WebKit)/((?:\\d+\\.)+\\d+)"); // for unrecognized browser
var MATCH = VERSION.exec(AGENT) || ["","","","unknown","0.0"];
HUB.Browser.name = (MATCH[1] == "Version" ? browser : (MATCH[3] || MATCH[5]));
var MATCH = VERSION.exec(xAGENT) || ["","","","unknown","0.0"];
HUB.Browser.name = (MATCH[1] != "" ? browser : (MATCH[3] || MATCH[5]));
HUB.Browser.version = MATCH[2] || MATCH[4] || MATCH[6];
break;
}
@ -3025,9 +3014,9 @@ MathJax.Hub.Startup = {
browser.noContextMenu = browser.isMobile;
},
Firefox: function (browser) {
if ((browser.version === "0.0" || navigator.userAgent.match(/Firefox/) == null) &&
if ((browser.version === "0.0" || AGENT.match(/Firefox/) == null) &&
navigator.product === "Gecko") {
var rv = navigator.userAgent.match(/[\/ ]rv:(\d+\.\d.*?)[\) ]/);
var rv = AGENT.match(/[\/ ]rv:(\d+\.\d.*?)[\) ]/);
if (rv) {browser.version = rv[1]}
else {
var date = (navigator.buildID||navigator.productSub||"0").substr(0,8);
@ -3044,8 +3033,8 @@ MathJax.Hub.Startup = {
}
}
browser.isMobile = (navigator.appVersion.match(/Android/i) != null ||
navigator.userAgent.match(/ Fennec\//) != null ||
navigator.userAgent.match(/Mobile/) != null);
AGENT.match(/ Fennec\//) != null ||
AGENT.match(/Mobile/) != null);
},
Opera: function (browser) {browser.version = opera.version()},
MSIE: function (browser) {

View File

@ -76,15 +76,30 @@ MathJax.Hub.Config({
// A comma-separated list of input and output jax to initialize at startup.
// Their main code is loaded only when they are actually used, so it is not
// inefficient to include jax that may not actually be used on the page. These
// are found in the MathJax/jax directory.
// are found in the MathJax/jax directory. The choices include
//
jax: ["input/TeX","output/HTML-CSS"],
// input/TeX
// input/MathML
// input/AsciiMath
//
// output/HTML-CSS
// output/NativeMML
// output/SVG
//
// If you change the input jax, you may need to include the appropriate
// preprocessor in the extensions array below.
//
jax: ["input/TeX", "output/HTML-CSS"],
//
// A comma-separated list of extensions to load at startup. The default
// directory is MathJax/extensions.
//
// Example: extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
//
// You may wish to include "mml2jax.js" if you are using "input/MathML" in the
// jax array above, and "asciimath2jax.js" if you using "input/AsciiMath".
// Include "jsmath2jax.js" if you are converting from using jsMath to MathJax.
//
extensions: ["tex2jax.js"],
@ -195,7 +210,7 @@ MathJax.Hub.Config({
// reposition the browser to the #hash location from the page URL after
// typesetting for the page.
//
positionToHash: false,
positionToHash: true,
//
// These control whether to attach the MathJax contextual menu to the
@ -569,6 +584,22 @@ MathJax.Hub.Config({
// These parameters control the AsciiMath input jax.
//
AsciiMath: {
//
// Determines whether the unicode positions for phi and varphi are
// to be swapped or not. (Unicode originally had these reversed, and
// many fonts have them reversed as well.) When set to true, phi
// and varphi will correspond to the LaTeX macros of the same name.
//
fixphi: true,
//
// Determines whether the MathML should be marked so that the HTML-CSS
// and SVG output jax will use MathML spacing rules rather than TeX
// spacing rules. Since AsciiMath was designed for MathML output, the
// MathML rules are used by default.
//
useMathMLspacing: true,
//
// Determines whether limits are placed above and below operators,
// or next to them. (AsciiMath doesn't have separate in-line and

View File

@ -241,8 +241,8 @@
if (HUB.Browser.isMSIE) {
if (CONFIG.messageStyle.position === "fixed") {
MathJax.Message.Init(); // make sure MathJax_MSIE_frame exists
frame = document.getElementById("MathJax_MSIE_Frame");
CONFIG.messageStyle.position = "absolute";
frame = document.getElementById("MathJax_MSIE_Frame") || frame;
if (frame !== document.body) {CONFIG.messageStyle.position = "absolute"}
}
} else {delete CONFIG.messageStyle.filter}
CONFIG.messageStyle.maxWidth = (document.body.clientWidth-75) + "px";

View File

@ -440,8 +440,10 @@
// Preload images so they show up with the menu
//
getImages: function () {
var menu = new Image();
menu.src = CONFIG.button.src;
if (SETTINGS.discoverable) {
var menu = new Image();
menu.src = CONFIG.button.src;
}
}
};

View File

@ -761,8 +761,10 @@
var H = (w.outerHeight-w.innerHeight)||30, W = (w.outerWidth-w.innerWidth)||30, x, y;
W = Math.max(100,Math.min(Math.floor(.5*screen.width),table.offsetWidth+W+25));
H = Math.max(40,Math.min(Math.floor(.5*screen.height),table.offsetHeight+H+25));
if (MENU.prototype.msieHeightBug) {H += 35}; // for title bar in XP
w.resizeTo(W,H);
if (event && event.screenX != null) {
var X; try {X = event.screenX} catch (e) {}; // IE8 throws an error accessing screenX
if (event && X != null) {
x = Math.max(0,Math.min(event.screenX-Math.floor(W/2), screen.width-W-20));
y = Math.max(0,Math.min(event.screenY-Math.floor(H/2), screen.height-H-20));
w.moveTo(x,y);
@ -955,9 +957,11 @@
var isIE8 = browser.versionAtLeast("8.0") && document.documentMode > 7;
MENU.Augment({
margin: 20,
msieBackgroundBug: (document.documentMode < 9),
msieBackgroundBug: ((document.documentMode||0) < 9),
msieFixedPositionBug: (quirks || !isIE8),
msieAboutBug: quirks
msieAboutBug: quirks,
msieHeightBug: ((document.documentMode||0) < 9)
// height of window doesn't include title bar in XP
});
if (isIE9) {
delete CONFIG.styles["#MathJax_About"].filter;

View File

@ -29,7 +29,7 @@ MathJax.Extension["TeX/AMScd"] = {
config: MathJax.Hub.CombineConfig("TeX.CD",{
colspace: "5pt",
rowspace: "5pt",
harrowsize: "2.25em",
harrowsize: "2.75em",
varrowsize: "1.75em",
hideHorizontalLabels: false
})
@ -66,7 +66,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
},
CD_arrow: function (name) {
var c = this.string[this.i];
var c = this.string.charAt(this.i);
if (!c.match(/[><VA.|=]/)) {return this.Other(name)} else {this.i++}
var top = this.stack.Top();
@ -80,7 +80,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var mml;
var hdef = {minsize: top.minw, stretchy:true},
vdef = {minsize: top.minh, stretchy:true, symmetric:true};
vdef = {minsize: top.minh, stretchy:true, symmetric:true, lspace:0, rspace:0};
if (c === ".") {}
else if (c === "|") {mml = this.mmlToken(MML.mo("\u2225").With(vdef))}
@ -130,6 +130,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
this.CD_cell(name);
},
CD_cell: function (name) {
var top = this.stack.Top();
if ((top.table||[]).length % 2 === 0 && (top.row||[]).length === 0) {
//
// Add a strut to the first cell in even rows to get
// better spacing of arrow rows.
//
this.Push(MML.mpadded().With({height:"8.5pt",depth:"2pt"}));
}
this.Push(STACKITEM.cell().With({isEntry:true, name:name}));
},

View File

@ -29,6 +29,8 @@ MathJax.Extension["TeX/AMSmath"] = {
number: 0, // current equation number
startNumber: 0, // current starting equation number (for when equation is restarted)
IDs: {}, // IDs used in previous equations
eqIDs: {}, // IDs used in this equation
labels: {}, // the set of labels
eqlabels: {}, // labels in the current equation
refs: [] // array of jax with unresolved references
@ -187,7 +189,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
global.label = label;
if (AMS.labels[label] || AMS.eqlabels[label])
{TEX.Error(["MultipleLabel","Label '%1' multiply defined",label])}
AMS.eqlabels[label] = "???"; // will be replaced by tag value later
AMS.eqlabels[label] = {tag:"???", id:""}; // will be replaced by tag value later
}
},
@ -197,11 +199,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
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)}
if (CONFIG.useLabelIds) {ref = label}
if (!ref) {ref = {tag:"???",id:""}; AMS.badref = !AMS.refUpdate}
var tag = ref.tag; if (eqref) {tag = CONFIG.formatTag(tag)}
this.Push(MML.mrow.apply(MML,this.InternalMath(tag)).With({
href:CONFIG.formatURL(CONFIG.formatID(ref)), "class":"MathJax_ref"
href:CONFIG.formatURL(ref.id), "class":"MathJax_ref"
}));
},
@ -209,7 +210,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
* Handle \DeclareMathOperator
*/
HandleDeclareOp: function (name) {
var limits = (this.GetStar() ? "\\limits" : "");
var limits = (this.GetStar() ? "" : "\\nolimits");
var cs = this.trimSpaces(this.GetArgument(name));
if (cs.charAt(0) == "\\") {cs = cs.substr(1)}
var op = this.GetArgument(name);
@ -218,7 +219,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
},
HandleOperatorName: function (name) {
var limits = (this.GetStar() ? "\\limits" : "\\nolimits");
var limits = (this.GetStar() ? "" : "\\nolimits");
var op = this.trimSpaces(this.GetArgument(name));
op = op.replace(/\*/g,'\\text{*}').replace(/-/g,'\\text{-}');
this.string = '\\mathop{\\rm '+op+'}'+limits+" "+this.string.slice(this.i);
@ -423,7 +424,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
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)}));
global.tag = MML.mtd(mml).With({id:CONFIG.formatID(global.tagID)});
}
},
@ -433,11 +434,40 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
getTag: function () {
var global = this.global, tag = global.tag; global.tagged = true;
if (global.label) {
AMS.eqlabels[global.label] = global.tagID;
if (CONFIG.useLabelIds) {tag.id = CONFIG.formatID(global.label)}
AMS.eqlabels[global.label] = {tag:global.tagID, id:tag.id};
}
//
// Check for repeated ID's (either in the document or as
// a previous tag) and find a unique related one. (#240)
//
if (document.getElementById(tag.id) || AMS.IDs[tag.id] || AMS.eqIDs[tag.id]) {
var i = 0, ID;
do {i++; ID = tag.id+"_"+i}
while (document.getElementById(ID) || AMS.IDs[ID] || AMS.eqIDs[ID]);
tag.id = ID; if (global.label) {AMS.eqlabels[global.label].id = ID}
}
AMS.eqIDs[tag.id] = 1;
delete global.tag; delete global.tagID; delete global.label;
return tag;
},
/*
* Set the initial <mo> to have form="infix" and lspace="0",
* skipping any initial space or empty braces (TeXAtom with child
* being an empty inferred row).
*/
fixInitialMO: function (data) {
for (var i = 0, m = data.length; i < m; i++) {
if (data[i] && (data[i].type !== "mspace" &&
(data[i].type !== "texatom" || (data[i].data[0] && data[i].data[0].data.length)))) {
if (data[i].isEmbellished()) {
var core = data[i].CoreMO();
core.form = MML.FORM.INFIX; core.lspace = 0;
}
break;
}
}
}
});
@ -453,6 +483,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments
},
EndEntry: function () {
if (this.table.length) {this.fixInitialMO(this.data)}
var mtd = MML.mtd.apply(MML,this.data);
if (this.data.shove) {mtd.columnalign = this.data.shove}
this.row.push(mtd);
@ -499,6 +530,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
stack.global.notags = (taggable ? null : name);
stack.global.tagged = !numbered && !stack.global.forcetag; // prevent automatic tagging in starred environments
},
EndEntry: function () {
if (this.row.length) {this.fixInitialMO(this.data)}
this.row.push(MML.mtd.apply(MML,this.data));
this.data = [];
},
EndRow: function () {
var mtr = MML.mtr;
if (!this.global.tag && this.numbered) {this.autoTag()}
@ -562,12 +598,13 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
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;
AMS.eqlabels = AMS.eqIDs = {}; 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.IDs,AMS.eqIDs); // save IDs from this 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
});
@ -595,7 +632,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
//
TEX.resetEquationNumbers = function (n,keepLabels) {
AMS.startNumber = (n || 0);
if (!keepLabels) {AMS.labels = {}}
if (!keepLabels) {AMS.labels = AMS.IDs = {}}
}
/******************************************************************************/

View File

@ -46,7 +46,7 @@
*/
MathJax.Extension["TeX/bbox"] = {
version: "2.3"
version: "2.3.1"
};
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -61,7 +61,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var bbox = this.GetBrackets(name,""),
math = this.ParseArg(name);
var parts = bbox.split(/,/), def, background, style;
for (var i in parts) {
for (var i = 0, m = parts.length; i < m; i++) {
var part = parts[i].replace(/^\s+/,'').replace(/\s+$/,'');
var match = part.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/);
if (match) {

View File

@ -167,7 +167,7 @@ MathJax.Extension.mml2jax = {
html = "<"+node.nodeName.toLowerCase();
for (i = 0, m = node.attributes.length; i < m; i++) {
var attribute = node.attributes[i];
if (attribute.specified) {
if (attribute.specified && attribute.nodeName.substr(0,10) !== "_moz-math-") {
// Opera 11.5 beta turns xmlns into xmlns:xmlns, so put it back (*** check after 11.5 is out ***)
html += " "+attribute.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"=";
var value = attribute.nodeValue; // IE < 8 doesn't properly set style by setAttributes
@ -250,10 +250,12 @@ MathJax.Extension.mml2jax = {
};
//
// We register the preprocessors with the following priorities:
// - mml2jax.js: 5
// - jsMath2jax.js: 8
// - asciimath2jax.js, tex2jax.js: 10 (default)
// See issues 18 and 484 and the other *2jax.js files.
//
MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax],5);
MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");

View File

@ -38,10 +38,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
if (space == null) {space = ""}
var tag = this.type, attr = this.toMathMLattributes();
if (tag === "mspace") {return space + "<"+tag+attr+" />"}
var data = []; var SPACE = (this.isToken ? "" : space+(inferred ? "" : " "));
var data = [], SPACE = (this.isToken ? "" : space+(inferred ? "" : " "));
for (var i = 0, m = this.data.length; i < m; i++) {
if (this.data[i]) {data.push(this.data[i].toMathML(SPACE))}
else if (!this.isToken) {data.push(SPACE+"<mrow />")}
else if (!this.isToken && !this.isChars) {data.push(SPACE+"<mrow />")}
}
if (this.isToken) {return space + "<"+tag+attr+">"+data.join("")+"</"+tag+">"}
if (inferred) {return data.join("\n")}
@ -59,7 +59,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
if (!this.attrNames) {
if (this.type === "mstyle") {defaults = MML.math.prototype.defaults}
for (var id in defaults) {if (!skip[id] && defaults.hasOwnProperty(id)) {
var force = (id === "open" || id === "close");
var force = (id === "open" || id === "close" || id === "form");
if (this[id] != null && (force || this[id] !== defaults[id])) {
var value = this[id]; delete this[id];
if (force || this.Get(id) !== value)

View File

@ -135,6 +135,7 @@ MathJax.ElementJax.mml.Augment({
UPDIAGONALARROW: "updiagonalarrow",
VERTICALSTRIKE: "verticalstrike",
HORIZONTALSTRIKE: "horizontalstrike",
PHASORANGLE: "phasorangle",
MADRUWB: "madruwb"
},
ALIGN: {
@ -274,7 +275,7 @@ MathJax.ElementJax.mml.Augment({
SetData: function (i,item) {
if (item != null) {
if (!(item instanceof MML.mbase))
{item = (this.isToken ? MML.chars(item) : MML.mtext(item))}
{item = (this.isToken || this.isChars ? MML.chars(item) : MML.mtext(item))}
item.parent = this;
item.setInherit(this.inheritFromMe ? this : this.inherit);
}
@ -517,7 +518,7 @@ MathJax.ElementJax.mml.Augment({
lspace: MML.LENGTH.THICKMATHSPACE,
rspace: MML.LENGTH.THICKMATHSPACE,
stretchy: false,
symmetric: true,
symmetric: false,
maxsize: MML.SIZE.INFINITY,
minsize: '0em', //'1em',
largeop: false,
@ -600,8 +601,12 @@ MathJax.ElementJax.mml.Augment({
isEmbellished: function () {return true},
hasNewline: function () {return (this.Get("linebreak") === MML.LINEBREAK.NEWLINE)},
setTeXclass: function (prev) {
this.getValues("lspace","rspace"); // sets useMMLspacing
var values = this.getValues("form","lspace","rspace","fence"); // sets useMMLspacing
if (this.useMMLspacing) {this.texClass = MML.TEXCLASS.NONE; return this}
if (values.fence && !this.texClass) {
if (values.form === MML.FORM.PREFIX) {this.texClass = MML.TEXCLASS.OPEN}
if (values.form === MML.FORM.POSTFIX) {this.texClass = MML.TEXCLASS.CLOSE}
}
this.texClass = this.Get("texClass");
if (this.data.join("") === "\u2061") {
// force previous node to be texClass OP, and skip this node
@ -746,10 +751,27 @@ MathJax.ElementJax.mml.Augment({
return this.SUPER(arguments).toString.call(this);
},
setTeXclass: function (prev) {
for (var i = 0, m = this.data.length; i < m; i++)
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}}
if (this.data[0]) {this.updateTeXclass(this.data[0])}
return prev;
var i, m = this.data.length;
if (this.open || this.close) {
//
// <mrow> came from \left...\right
// so treat as subexpression (tex class INNER)
//
this.getPrevClass(prev);
for (i = 0; i < m; i++)
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}}
this.texClass = MML.TEXCLASS.INNER;
return this;
} else {
//
// Normal <mrow>, so treat as
// thorugh mrow is not there
//
for (i = 0; i < m; i++)
{if (this.data[i]) {prev = this.data[i].setTeXclass(prev)}}
if (this.data[0]) {this.updateTeXclass(this.data[0])}
return prev;
}
},
getAnnotation: function (name) {
if (this.data.length != 1) return null;
@ -907,7 +929,11 @@ MathJax.ElementJax.mml.Augment({
values.separators = values.separators.replace(/[ \t\n\r]/g,"");
// create a fake node for the open item
if (values.open !== "") {
this.SetData("open",MML.mo(values.open).With({stretchy:true, texClass:MML.TEXCLASS.OPEN}));
this.SetData("open",MML.mo(values.open).With({
fence:true, form:MML.FORM.PREFIX, texClass:MML.TEXCLASS.OPEN
}));
// Clear flag for using MML spacing even though form is specified
this.data.open.useMMLspacing &= ~this.data.open.SPACE_ATTR.form;
prev = this.data.open.setTeXclass(prev);
}
// get the separators
@ -921,7 +947,7 @@ MathJax.ElementJax.mml.Augment({
for (var i = 1, m = this.data.length; i < m; i++) {
if (this.data[i]) {
if (values.separators !== "") {
this.SetData("sep"+i,MML.mo(values.separators.charAt(i-1)));
this.SetData("sep"+i,MML.mo(values.separators.charAt(i-1)).With({separator:true}));
prev = this.data["sep"+i].setTeXclass(prev);
}
prev = this.data[i].setTeXclass(prev);
@ -929,11 +955,16 @@ MathJax.ElementJax.mml.Augment({
}
// create fake node for the close item
if (values.close !== "") {
this.SetData("close",MML.mo(values.close).With({stretchy:true, texClass:MML.TEXCLASS.CLOSE}));
this.SetData("close",MML.mo(values.close).With({
fence:true, form:MML.FORM.POSTFIX, texClass:MML.TEXCLASS.CLOSE
}));
// Clear flag for using MML spacing even though form is specified
this.data.close.useMMLspacing &= ~this.data.close.SPACE_ATTR.form;
prev = this.data.close.setTeXclass(prev);
}
// get the data from the open item
this.updateTeXclass(this.data.open);
this.texClass = MML.TEXCLASS.INNER;
return prev;
}
});
@ -1216,7 +1247,7 @@ MathJax.ElementJax.mml.Augment({
}
});
MML.annotation = MML.mbase.Subclass({
type: "annotation", isToken: true,
type: "annotation", isChars: true,
linebreakContainer: true,
defaults: {
definitionURL: null,
@ -1692,8 +1723,13 @@ MathJax.ElementJax.mml.Augment({
// These are not in the W3C table, but FF works this way,
// and it makes sense, so add it here
//
MML.mo.prototype.OPTABLE.infix["^"] = MO.WIDEREL;
MML.mo.prototype.OPTABLE.infix["_"] = MO.WIDEREL;
var OPTABLE = MML.mo.prototype.OPTABLE;
OPTABLE.infix["^"] = MO.WIDEREL;
OPTABLE.infix["_"] = MO.WIDEREL;
OPTABLE.prefix["\u2223"] = MO.OPEN;
OPTABLE.prefix["\u2225"] = MO.OPEN;
OPTABLE.postfix["\u2223"] = MO.CLOSE;
OPTABLE.postfix["\u2225"] = MO.CLOSE;
})(MathJax.ElementJax.mml);

View File

@ -35,6 +35,8 @@ MathJax.InputJax.AsciiMath = MathJax.InputJax({
extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath",
config: {
fixphi: true, // switch phi and varphi unicode values
useMathMLspacing: true, // use MathML spacing rather than TeX spacing?
displaystyle: true, // put limits above and below operators
decimalsign: "." // can change to "," but watch out for "(1,2)"
}

View File

@ -95,7 +95,7 @@
MML.mbase.Augment({
firstChild: null,
lastChild: null,
nodeValue: "",
nodeValue: null,
nextSibling: null,
Init: function () {
var obj = MBASEINIT.apply(this,arguments) || this;
@ -117,7 +117,6 @@
if (!this.firstChild) {this.firstChild = node}
this.Append(node);
this.lastChild = node;
this.nodeValue += node.nodeValue;
}
return node;
},
@ -132,9 +131,6 @@
else {this.lastChild = this.childNodes[this.childNodes.length-1]}
}
if (i) {this.childNodes[i-1].nextSibling = node.nextSibling}
this.nodeValue = "";
for (i = 0, m = this.childNodes.length; i < m; i++)
{this.nodeValue += this.childNodes[i].nodeValue}
node.nextSibling = node.parent = null;
return node;
},
@ -145,9 +141,6 @@
if (i) {this.childNodes[i-1].nextSibling = node} else {this.firstChild = node}
if (i >= m-1) {this.lastChild = node}
this.SetData(i,node); node.nextSibling = old.nextSibling;
this.nodeValue = "";
for (i = 0, m = this.childNodes.length; i < m; i++)
{this.nodeValue += this.childNodes[i].nodeValue}
old.nextSibling = old.parent = null;
return old;
},
@ -167,7 +160,11 @@
//
var document = {
getElementById: true,
createElementNS: function (ns,type) {return MML[type]()},
createElementNS: function (ns,type) {
var node = MML[type]();
if (type === "mo" && ASCIIMATH.config.useMathMLspacing) {node.useMMLspacing = 0x80}
return node;
},
createTextNode: function (text) {return MML.chars(text).With({nodeValue:text})},
createDocumentFragment: function () {return DOCFRAG()}
};
@ -1199,6 +1196,11 @@ ASCIIMATH.Augment({
// Old versions use the "decimal" option, so take it into account if it
// is defined by the user. See issue 384.
decimalsign = (ASCIIMATH.config.decimal || ASCIIMATH.config.decimalsign);
// fix pi and var phi, if requested
for (var i = 0, m = AMsymbols.length; i < m; i++) {
if (AMsymbols[i].input === "phi") {AMsymbols[i].output = "\u03D5"}
if (AMsymbols[i].input === "varphi") {AMsymbols[i].output = "\u03C6"; i = m}
}
INITASCIIMATH();
AMinitSymbols();
},

View File

@ -157,7 +157,7 @@
var child = node.childNodes[i];
if (child.nodeName === "#comment") continue;
if (child.nodeName === "#text") {
if (mml.isToken && !mml.mmlSelfClosing) {
if ((mml.isToken || mml.isChars) && !mml.mmlSelfClosing) {
var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);
mml.Append(MML.chars(this.trimSpace(text)));
} else if (child.nodeValue.match(/\S/)) {

View File

@ -424,6 +424,7 @@
'%': 'Comment',
'&': 'Entry',
'#': 'Hash',
'\u00A0': 'Space',
'\u2019': 'Prime'
},
@ -935,6 +936,8 @@
textrm: ['Macro','\\mathord{\\rm\\text{#1}}',1],
textit: ['Macro','\\mathord{\\it{\\text{#1}}}',1],
textbf: ['Macro','\\mathord{\\bf{\\text{#1}}}',1],
textsf: ['Macro','\\mathord{\\sf{\\text{#1}}}',1],
texttt: ['Macro','\\mathord{\\tt{\\text{#1}}}',1],
pmb: ['Macro','\\rlap{#1}\\kern1px{#1}',1],
TeX: ['Macro','T\\kern-.14em\\lower.5ex{E}\\kern-.115em X'],
LaTeX: ['Macro','L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX'],
@ -944,6 +947,7 @@
not: 'Not',
dots: 'Dots',
space: 'Tilde',
'\u00A0': 'Tilde',
// LaTeX
@ -1531,7 +1535,7 @@
MakeBig: function (name,mclass,size) {
size *= TEXDEF.p_height;
size = String(size).replace(/(\.\d\d\d).+/,'$1')+"em";
var delim = this.GetDelimiter(name);
var delim = this.GetDelimiter(name,true);
this.Push(MML.TeXAtom(MML.mo(delim).With({
minsize: size, maxsize: size,
fence: true, stretchy: true, symmetric: true
@ -1667,7 +1671,7 @@
}
} else {
if (n) {this.Push(MML.mspace().With({depth:n}))}
this.Push(MML.mo().With({linebreak:MML.LINEBREAK.NEWLINE}));
this.Push(MML.mspace().With({linebreak:MML.LINEBREAK.NEWLINE}));
}
},
emPerInch: 7.2,
@ -1805,7 +1809,7 @@
* Check if the next character is a space
*/
nextIsSpace: function () {
return this.string.charAt(this.i).match(/[ \n\r\t]/);
return this.string.charAt(this.i).match(/\s/);
},
/*
@ -1886,11 +1890,12 @@
/*
* Get the name of a delimiter (check it in the delimiter list).
*/
GetDelimiter: function (name) {
GetDelimiter: function (name,braceOK) {
while (this.nextIsSpace()) {this.i++}
var c = this.string.charAt(this.i);
if (this.i < this.string.length) {
this.i++; if (c == "\\") {c += this.GetCS(name)}
var c = this.string.charAt(this.i); this.i++;
if (this.i <= this.string.length) {
if (c == "\\") {c += this.GetCS(name)}
else if (c === "{" && braceOK) {this.i--; c = this.GetArgument(name)}
if (TEXDEF.delimiter[c] != null) {return this.convertDelimiter(c)}
}
TEX.Error(["MissingOrUnrecognizedDelim",
@ -2125,8 +2130,7 @@
* Create an mrow that has stretchy delimiters at either end, as needed
*/
fenced: function (open,mml,close) {
var mrow = MML.mrow();
mrow.open = open; mrow.close = close;
var mrow = MML.mrow().With({open:open, close:close, texClass:MML.TEXCLASS.INNER});
if (open) {mrow.Append(MML.mo(open).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.OPEN}))}
if (mml.type === "mrow") {mrow.Append.apply(mrow,mml.data)} else {mrow.Append(mml)}
if (close) {mrow.Append(MML.mo(close).With({fence:true, stretchy:true, texClass:MML.TEXCLASS.CLOSE}))}

View File

@ -182,6 +182,27 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
});
}
break;
case MML.NOTATION.PHASORANGLE:
W -= 2*p; p = (H+D)/2; W += p;
if (HTMLCSS.useVML) {
if (!vml) {vml = this.HTMLvml(stack,H,D,W,t,values.mathcolor)}
this.HTMLvmlElement(vml,"shape",{
style: {width:this.HTMLpx(W), height:this.HTMLpx(H+D)},
path: "m "+this.HTMLpt(p+t/2,t/2)+
" l "+this.HTMLpt(t/2,H+D-t)+" "+this.HTMLpt(W-t/2,H+D-t)+" e",
coordsize: this.HTMLpt(W,H+D)
});
} else {
if (!svg) {svg = this.HTMLsvg(stack,H,D,W,t,values.mathcolor)}
this.HTMLsvgElement(svg.firstChild,"path",{
d: "M "+this.HTMLpx(p)+",1" +
"L 1,"+this.HTMLpx(H+D-t)+" L "+this.HTMLpx(W)+","+this.HTMLpx(H+D-t)
});
HTMLCSS.placeBox(svg.parentNode,0,-D,true);
}
break;
case MML.NOTATION.MADRUWB:
frame.style.borderBottom = SOLID;

View File

@ -25,7 +25,7 @@
*/
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var VERSION = "2.3";
var VERSION = "2.3.1";
var MML = MathJax.ElementJax.mml,
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
@ -34,18 +34,11 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
span = this.HTMLhandleSize(this.HTMLcreateSpan(span));
var values = this.getValues("lquote","rquote");
var text = this.data.join(""); // FIXME: handle mglyph?
var pattern = [];
if (values.lquote.length === 1) {pattern.push(this.HTMLquoteRegExp(values.lquote))}
if (values.rquote.length === 1) {pattern.push(this.HTMLquoteRegExp(values.rquote))}
if (pattern.length) {text = text.replace(RegExp("("+pattern.join("|")+")","g"),"\\$1")}
this.HTMLhandleVariant(span,this.HTMLgetVariant(),values.lquote+text+values.rquote);
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
this.HTMLhandleDir(span);
return span;
},
HTMLquoteRegExp: function (string) {
return string.replace(/([.*+?|{}()\[\]\\])/g,"\\$1");
}
});
MML.ms.prototype.defaults.mathvariant = 'monospace';

View File

@ -41,16 +41,17 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var stack = HTMLCSS.createStack(span);
var scale = this.HTMLgetScale(), mu = this.HTMLgetMu(span), LABEL = -1;
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row, cell, mo, entries = [];
var LHD = HTMLCSS.FONTDATA.baselineskip * scale * values.useHeight, HD,
LH = HTMLCSS.FONTDATA.lineH * scale, LD = HTMLCSS.FONTDATA.lineD * scale;
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1,
m, M, s, row, cell, mo, entries = [], HD;
var LH = HTMLCSS.FONTDATA.lineH * scale * values.useHeight,
LD = HTMLCSS.FONTDATA.lineD * scale * values.useHeight;
//
// Create cells and measure columns and rows
//
for (i = 0, m = this.data.length; i < m; i++) {
row = this.data[i]; s = (row.type === "mlabeledtr" ? LABEL : 0);
A[i] = []; H[i] = D[i] = 0;
A[i] = []; H[i] = LH; D[i] = LD;
for (j = s, M = row.data.length + s; j < M; j++) {
if (W[j] == null) {
if (j > J) {J = j}
@ -90,8 +91,6 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (A[i][j].bbox.w > W[j]) {W[j] = A[i][j].bbox.w}
}
}
if (H[0]+D[0]) {H[0] = Math.max(H[0],LH)}
if (H[A.length-1]+D[A.length-1]) {D[A.length-1] = Math.max(D[A.length-1],LD)}
//
// Determine spacing and alignment
@ -146,7 +145,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
// Determine array total height
//
HD = H[0] + D[A.length-1];
for (i = 0, m = A.length-1; i < m; i++) {HD += Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}
for (i = 0, m = A.length-1; i < m; i++) {HD += Math.max(0,D[i]+H[i+1]+RSPACE[i])}
//
// Determine frame and line sizes
//
@ -179,7 +178,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
Y = 0; fY = -(HD + fy) + H[0];
for (i = 0, m = n-1; i < m; i++) {
// FIXME: Should handle values.align for final row
var dY = Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i]);
var dY = Math.max(0,D[i]+H[i+1]+RSPACE[i]);
Y += dY; fY += dY;
}
} else {
@ -280,6 +279,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
mo = cell.CoreMO();
var symmetric = mo.symmetric; mo.symmetric = false;
A[i][j].bbox = cell.HTMLstretchV(C[j],H[i],D[i]).bbox; A[i][j].HH = null;
if (A[i][j].bbox.h > H[i]) {A[i][j].bbox.H = A[i][j].bbox.h; A[i][j].bbox.h = H[i]}
if (A[i][j].bbox.d > D[i]) {A[i][j].bbox.D = A[i][j].bbox.d; A[i][j].bbox.d = D[i]}
mo.symmetric = symmetric;
}
align = cell.rowalign||this.data[i].rowalign||RALIGN[i];
@ -290,7 +291,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
align = (cell.columnalign||RCALIGN[i][j]||CALIGN[j]);
HTMLCSS.alignBox(A[i][j],align,y+dy);
}
if (i < A.length-1) {y -= Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}
if (i < A.length-1) {y -= Math.max(0,D[i]+H[i+1]+RSPACE[i])}
}
y = Y;
}
@ -399,7 +400,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
//
y = Y;
for (i = 0, m = A.length-1; i < m; i++) {
dy = Math.max(LHD,D[i]+H[i+1]+RSPACE[i]);
dy = Math.max(0,D[i]+H[i+1]+RSPACE[i]);
if (RLINES[i] !== "none") {
line = HTMLCSS.createRule(stack,1.25/HTMLCSS.em,0,fW); HTMLCSS.addBox(stack,line);
line.bbox = {h:1.25/HTMLCSS.em, d:0, w:fW, rw:fW, lw:0};

View File

@ -75,6 +75,20 @@ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({
"font-size": "90%"
},
//
// For mtextFontInherit version of \texttt{}
//
".MathJax .MJX-monospace": {
"font-family": "monospace"
},
//
// For mtextFontInherit version of \textsf{}
//
".MathJax .MJX-sans-serif": {
"font-family": "sans-serif"
},
"#MathJax_Tooltip": {
"background-color": "InfoBackground", color: "InfoText",
border: "1px solid black",

View File

@ -91,7 +91,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -91,7 +91,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -91,7 +91,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -93,7 +93,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -82,7 +82,7 @@
"bold": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], italic:true},
"bolditalic": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true},
"bold-italic": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -21,7 +21,7 @@
(function (HTMLCSS,MML,AJAX) {
var VERSION = "2.3";
var VERSION = "2.3";
var ALPHABETSBOLDITALIC = "STIXMathJax_Alphabets-bold-italic",
ALPHABETSBOLD = "STIXMathJax_Alphabets-bold",
@ -155,7 +155,7 @@
"bold": {fonts: [MAINBOLD,NORMALBOLD,FRAKTURBOLD,DOUBLESTRUCKBOLD,SANSSERIFBOLD,LATINBOLD,ALPHABETSBOLD,MARKSBOLD,ARROWSBOLD,OPERATORSBOLD,SYMBOLSBOLD,SHAPESBOLD,MISCBOLD,VARIANTSBOLD,SIZE1], bold:true
},
"italic": {fonts: [MAINITALIC,NORMALITALIC,SCRIPTITALIC,DOUBLESTRUCKITALIC,SANSSERIFITALIC,LATINITALIC,ALPHABETSITALIC,MARKSITALIC,MISCITALIC,VARIANTSITALIC,SIZE1], italic:true},
"bolditalic": {fonts: [MAINBOLDITALIC,NORMALBOLDITALIC,SCRIPTBOLDITALIC,DOUBLESTRUCKBOLDITALIC,SANSSERIFBOLDITALIC,LATINBOLDITALIC,ALPHABETSBOLDITALIC,MARKSBOLDITALIC,SHAPESBOLDITALIC,MISCBOLDITALIC,VARIANTSBOLDITALIC,SIZE1], bold: true, italic:true},
"bold-italic": {fonts: [MAINBOLDITALIC,NORMALBOLDITALIC,SCRIPTBOLDITALIC,DOUBLESTRUCKBOLDITALIC,SANSSERIFBOLDITALIC,LATINBOLDITALIC,ALPHABETSBOLDITALIC,MARKSBOLDITALIC,SHAPESBOLDITALIC,MISCBOLDITALIC,VARIANTSBOLDITALIC,SIZE1], bold: true, italic:true},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,
@ -184,7 +184,8 @@
fonts: [SANSSERIF],
offsetA: 0x1D5A0,
offsetN: 0x1D7E2,
offsetG: 0xE17D
offsetG: 0xE17D,
offsetE: 0xE17D
},
"bold-sans-serif": {
fonts: [SANSSERIFBOLD], bold:true,
@ -196,7 +197,8 @@
fonts: [SANSSERIFITALIC], italic: true,
offsetA: 0x1D608,
offsetN: 0xE1B4,
offsetG: 0xE1BF
offsetG: 0xE1BF,
offsetE: 0xE1BF
},
"sans-serif-bold-italic": {
fonts: [SANSSERIFBOLDITALIC], bold:true, italic: true,
@ -223,6 +225,7 @@
{name: "alpha", low: 0x61, high: 0x7A, offset: "A", add: 26},
{name: "Alpha", low: 0x41, high: 0x5A, offset: "A"},
{name: "number", low: 0x30, high: 0x39, offset: "N"},
{name: "greek-non-unicode", low: 0x03B1, high: 0x03C9, offset: "E", add: 25},
{name: "greek", low: 0x03B1, high: 0x03C9, offset: "G", add: 26},
{name: "Greek", low: 0x0391, high: 0x03F6, offset: "G",
remap: {0x03F5: 52, 0x03D1: 53, 0x03F0: 54, 0x03D5: 55, 0x03F1: 56, 0x03D6: 57, 0x03F4: 17}}
@ -241,7 +244,13 @@
},
REMAPACCENT: {
"\u2192": "\u20D7"
"\u007E": "\u0303",
"\u2192": "\u20D7",
"\u0060": "\u0300",
"\u005E": "\u0302",
"\u00B4": "\u0301",
"\u2032": "\u0301",
"\u2035": "\u0300"
},
REMAPACCENTUNDER: {

View File

@ -87,9 +87,9 @@
0x1D4A4: 0x2110, 0x1D4A7: 0x2112, 0x1D4A8: 0x2133, 0x1D4AD: 0x211B,
0x1D4BA: 0x212F, 0x1D4BC: 0x210A, 0x1D4C4: 0x2134}},
"bold-script": {fonts: [BITALIC], offsetA: 0x1D4D0, bold:true, italic:true},
"sans-serif": {offsetA: 0x1D5A0, offsetN: 0x1D7E2, offsetG: 0xE17D},
"sans-serif": {offsetA: 0x1D5A0, offsetN: 0x1D7E2, offsetG: 0xE17D, offsetE: 0xE17D},
"bold-sans-serif": {offsetA: 0x1D5D4, offsetG: 0x1D756, offsetN: 0x1D7EC, bold:true},
"sans-serif-italic": {fonts: [ITALIC,NONUNII], offsetA: 0x1D608, offsetN: 0xE1B4, offsetG: 0xE1BF, italic:true},
"sans-serif-italic": {fonts: [ITALIC,NONUNII], offsetA: 0x1D608, offsetN: 0xE1B4, offsetG: 0xE1BF, offsetE: 0xE1BF, italic:true},
"sans-serif-bold-italic": {fonts: [BITALIC,"STIXNonUnicode-bold-italic"], offsetA: 0x1D63C, offsetN: 0xE1F6, offsetG: 0x1D790, bold:true, italic:true},
"monospace": {offsetA: 0x1D670, offsetN: 0x1D7F6,
remap: {0x20: [0x20,"-STIX-variant"]}}, // use a special space for monospace (see below)
@ -122,6 +122,7 @@
{name: "alpha", low: 0x61, high: 0x7A, offset: "A", add: 26},
{name: "Alpha", low: 0x41, high: 0x5A, offset: "A"},
{name: "number", low: 0x30, high: 0x39, offset: "N"},
{name: "greek-non-unicode", low: 0x03B1, high: 0x03C9, offset: "E", add: 25},
{name: "greek", low: 0x03B1, high: 0x03C9, offset: "G", add: 26},
{name: "Greek", low: 0x0391, high: 0x03F6, offset: "G",
remap: {0x03F5: 53, 0x03D1: 54, 0x03F0: 55, 0x03D5: 56, 0x03F1: 57, 0x03D6: 58, 0x03F4: 17}}
@ -137,7 +138,13 @@
},
REMAPACCENT: {
"\u2192": "\u20D7"
"\u007E": "\u0303",
"\u2192": "\u20D7",
"\u0060": "\u0300",
"\u005E": "\u0302",
"\u00B4": "\u0301",
"\u2032": "\u0301",
"\u2035": "\u0300"
},
REMAPACCENTUNDER: {
},
@ -245,7 +252,7 @@
},
0x21D1: // \Uparrow
{
dir: V, HW: [[.818,GENERAL]], stretch: {top:[0x21D1,GENERAL], ext:[0x2225,GENERAL,.1]}
dir: V, HW: [[.818,GENERAL]], stretch: {top:[0x21D1,GENERAL], ext:[0x2225,GENERAL,.082]}
},
0x21D2: // right double arrow
{
@ -253,7 +260,7 @@
},
0x21D3: // \Downarrow
{
dir: V, HW: [[.818,GENERAL]], stretch: {ext:[0x2225,GENERAL,.1], bot:[0x21D3,GENERAL]}
dir: V, HW: [[.818,GENERAL]], stretch: {ext:[0x2225,GENERAL,.082], bot:[0x21D3,GENERAL]}
},
0x21D4: // left-right double arrow
{
@ -263,7 +270,7 @@
0x21D5: // \Updownarrow
{
dir: V, HW: [[.818,GENERAL]],
stretch: {top:[0x21D1,GENERAL], ext:[0x2225,GENERAL,.1], bot:[0x21D3,GENERAL]}
stretch: {top:[0x21D1,GENERAL], ext:[0x2225,GENERAL,.082], bot:[0x21D3,GENERAL]}
},
0x221A: // \surd
{

View File

@ -42,12 +42,19 @@
FontInfo: {
STIX: {family: "STIXSizeOneSym", testString: "() {} []"},
TeX: {family: "MathJax_Size1", testString: "() {} []"},
"STIX-Web": {family: "STIXWeb_Size1", testString: "() {} []"},
"Asana-Math": {family: "AsanaMath_Size1", testString: "() {} []"},
"Gyre-Pagella": {family: "GyrePagella_Size1", testString: "() {} []"},
"Gyre-Termes": {family: "GyreTermes_Size1", testString: "() {} []"},
"Latin-Modern": {family: "LatinModern_Size1", testString: "() {} []"},
"Neo-Euler": {family: "NeoEuler_Size1", testString: "() {} []"}
//
// These are the new web fonts. The strange use of single quotes is because the
// testing routine adds quotes at the beginning and ending, so for this list of
// names, we need to take those into account. We need a list because the names are
// not handled consistently between Mac and Windows in the font data, as they are
// in the TeX and original STIX fonts (sigh).
//
"STIX-Web": {family: "STIX MathJax Size1','STIXMathJax_Size1-Regular", testString: "() {} []"},
"Asana-Math": {family: "Asana MathJax Size1','AsanaMathJax_Size1-Regular'", testString: "() {} []"},
"Gyre-Pagella": {family: "Gyre Pagella MathJax Size1','GyrePagellaMathJax_Size1-Regular", testString: "() {} []"},
"Gyre-Termes": {family: "Gyre Termes MathJax Size1','GyreTermesMathJax_Size1-Regular", testString: "() {} []"},
"Latin-Modern": {family: "Latin Modern MathJax Size1','LatinModernMathJax_Size1-Regular", testString: "() {} []"},
"Neo-Euler": {family: "Neo Euler MathJax Size1','NeoEulerMathJax_Size1-Regular", testString: "() {} []"}
},
comparisonFont: ["sans-serif","monospace","script","Times","Courier","Arial","Helvetica"],
testSize: ["40px","50px","60px","30px","20px"],
@ -84,19 +91,22 @@
this.div.style.fontStyle = (font.style||"normal");
}
var W = this.getComparisonWidths(font.testString,font.noStyleChar);
var found = null;
if (W) {
this.div.style.fontFamily = "'"+font.family+"',"+this.comparisonFont[0];
if (this.div.offsetWidth == W[0]) {
this.div.style.fontFamily = "'"+font.family+"',"+this.comparisonFont[W[2]];
if (this.div.offsetWidth == W[1]) {return false}
if (this.div.offsetWidth == W[1]) {found = false}
}
if (this.div.offsetWidth != W[3] || this.div.offsetHeight != W[4]) {
if (font.noStyleChar || !HTMLCSS.FONTDATA || !HTMLCSS.FONTDATA.hasStyleChar) {return true}
for (var i = 0, m = this.testSize.length; i < m; i++)
{if (this.testStyleChar(font,this.testSize[i])) {return true}}
if (found === null && (this.div.offsetWidth != W[3] || this.div.offsetHeight != W[4])) {
if (!font.noStyleChar && HTMLCSS.FONTDATA && HTMLCSS.FONTDATA.hasStyleChar) {
for (var i = 0, m = this.testSize.length; i < m; i++)
{if (this.testStyleChar(font,this.testSize[i])) {found = true; m = 0}}
} else {found = true}
}
}
return false;
if (HTMLCSS.safariTextNodeBug) {this.div.innerHTML = ""} else {this.text.nodeValue = ""}
return found;
},
styleChar: "\uEFFD", // width encodes style
@ -224,23 +234,30 @@
"white-space": "nowrap",
"float": "none",
"direction": "ltr",
"max-width": "none", "max-height": "none",
"min-width": 0, "min-height": 0,
border: 0, padding: 0, margin: 0
},
".MathJax_Display": {
position: "relative",
display: "block",
display: "block!important",
"text-indent": 0,
"max-width": "none", "max-height": "none",
"min-width": 0, "min-height": 0,
width: "100%"
},
".MathJax img, .MathJax nobr, .MathJax a": {
border: 0, padding: 0, margin: 0, "max-width": "none", "max-height": "none",
border: 0, padding: 0, margin: 0,
"max-width": "none", "max-height": "none",
"min-width": 0, "min-height": 0,
"vertical-align": 0, "line-height": "normal",
"text-decoration": "none"
},
"img.MathJax_strut": {
border:"0 !important", padding:"0 !important", margin: "0 !important",
"vertical-align": "0 !important"
border:"0!important", padding:"0!important", margin:"0!important",
"vertical-align": "0!important"
},
".MathJax span": {
@ -251,12 +268,12 @@
},
".MathJax nobr": {
"white-space": "nowrap ! important"
"white-space": "nowrap!important"
},
".MathJax img": {
display: "inline ! important",
"float": "none ! important"
display: "inline!important",
"float": "none!important"
},
".MathJax *": {
@ -274,12 +291,14 @@
".MathJax_Processed": {display:"none!important"},
".MathJax_ExBox": {
display:"block", overflow:"hidden",
width:"1px", height:"60ex"
display:"block!important", overflow:"hidden",
width:"1px", height:"60ex",
"min-height": 0, "max-height":"none"
},
".MathJax .MathJax_EmBox": {
display:"block", overflow:"hidden",
width:"1px", height:"60em"
display:"block!important", overflow:"hidden",
width:"1px", height:"60em",
"min-height": 0, "max-height":"none"
},
".MathJax .MathJax_HitBox": {
@ -579,7 +598,8 @@
//
var jax = script.MathJax.elementJax, math = jax.root,
span = document.getElementById(jax.inputID+"-Frame"),
div = (jax.HTMLCSS.display ? span.parentNode : span);
div = (jax.HTMLCSS.display ? (span||{}).parentNode : span);
if (!div) return;
//
// Set the font metrics
//
@ -1337,24 +1357,16 @@
}
}
if (variant.remap && variant.remap[n]) {
if (variant.remap[n] instanceof Array) {
var remap = variant.remap[n];
n = remap[0]; variant = this.FONTDATA.VARIANT[remap[1]];
} else if (typeof(variant.remap[n]) === "string") {
text = variant.remap[n]+text.substr(i+1);
i = 0; m = text.length; n = text.charCodeAt(0);
} else {
n = variant.remap[n];
if (variant.remap.variant) {variant = this.FONTDATA.VARIANT[variant.remap.variant]}
}
}
if (this.FONTDATA.REMAP[n] && !variant.noRemap) {
n = variant.remap[n];
if (variant.remap.variant) {variant = this.FONTDATA.VARIANT[variant.remap.variant]}
} else if (this.FONTDATA.REMAP[n] && !variant.noRemap) {
n = this.FONTDATA.REMAP[n];
if (n instanceof Array) {variant = this.FONTDATA.VARIANT[n[1]]; n = n[0]}
if (typeof(n) === "string") {
text = n+text.substr(i+1);
i = 0; m = text.length; n = n.charCodeAt(0);
}
}
if (n instanceof Array) {variant = this.FONTDATA.VARIANT[n[1]]; n = n[0]}
if (typeof(n) === "string") {
text = n+text.substr(i+1);
m = text.length; i = -1;
continue;
}
font = this.lookupChar(variant,n); c = font[n];
if (force || (!this.checkFont(font,SPAN.style) && !c[5].img)) {
@ -1602,9 +1614,13 @@
for (var i = 0, m = this.data.length; i < m; i++)
{if (this.data[i]) {this.data[i].toHTML(span)}}
var stretchy = this.HTMLcomputeBBox(span);
var h = span.bbox.h, d = span.bbox.d;
for (i = 0, m = stretchy.length; i < m; i++) {stretchy[i].HTMLstretchV(span,h,d)}
if (stretchy.length) {this.HTMLcomputeBBox(span,true)}
var h = span.bbox.h, d = span.bbox.d, stretched = false;
for (i = 0, m = stretchy.length; i < m; i++) {
var bbox = stretchy[i].HTMLspanElement().bbox;
if (bbox.h !== h || bbox.d !== d)
{stretchy[i].HTMLstretchV(span,h,d); stretched = true}
}
if (stretched) {this.HTMLcomputeBBox(span,true)}
if (this.HTMLlineBreaks(span)) {span = this.HTMLmultiline(span)}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
@ -2158,8 +2174,12 @@
span = this.HTMLhandleSize(this.HTMLcreateSpan(span));
var variant = this.HTMLgetVariant();
// Avoid setting the font style for error text or if mtextFontInherit is set
if (HTMLCSS.config.mtextFontInherit || this.Parent().type === "merror")
{variant = {bold:variant.bold, italic:variant.italic, fontInherit: true}}
if (HTMLCSS.config.mtextFontInherit || this.Parent().type === "merror") {
var vname = this.Get("mathvariant");
if (vname === "monospace") {span.className += " MJX-monospace"}
else if (vname.match(/sans-serif/)) {span.className += " MJX-sans-serif"}
variant = {bold:variant.bold, italic:variant.italic, fontInherit: true};
}
for (var i = 0, m = this.data.length; i < m; i++)
{if (this.data[i]) {this.data[i].toHTML(span,variant)}}
if (!span.bbox) {span.bbox = this.HTMLzeroBBox()}
@ -2357,10 +2377,15 @@
},
HTMLcanStretch: function (direction) {return false},
HTMLhandleSpace: function (span) {
if (!this.texWithDelims) {
var space = (this.useMMLspacing ? 0 : HTMLCSS.length2em(this.texSpacing()||0)) + .12;
span.style.paddingLeft = HTMLCSS.Em(space);
span.style.paddingRight = HTMLCSS.Em(.12);
if (!this.texWithDelims && !this.useMMLspacing) {
//
// Add nulldelimiterspace around the fraction
// (TeXBook pg 150 and Appendix G rule 15e)
//
var space = HTMLCSS.TeX.nulldelimiterspace;
var style = span.firstChild.style;
style.marginLeft = style.marginRight = HTMLCSS.Em(space);
span.bbox.w += 2*space; span.bbox.r += 2*space;
}
}
});
@ -2724,23 +2749,31 @@
});
MML.TeXAtom.Augment({
toHTML: function (span) {
toHTML: function (span,HW,D) {
span = this.HTMLcreateSpan(span);
if (this.data[0] != null) {
if (this.texClass === MML.TEXCLASS.VCENTER) {
var stack = HTMLCSS.createStack(span);
var box = HTMLCSS.createBox(stack);
HTMLCSS.Measured(this.data[0].toHTML(box),box);
var child = this.data[0].toHTML(box);
if (D != null) {HTMLCSS.Remeasured(this.data[0].HTMLstretchV(box,HW,D),box)}
else if (HW != null) {HTMLCSS.Remeasured(this.data[0].HTMLstretchH(box,HW),box)}
else {HTMLCSS.Measured(child,box)}
// FIXME: should the axis height be scaled?
HTMLCSS.placeBox(box,0,HTMLCSS.TeX.axis_height-(box.bbox.h+box.bbox.d)/2+box.bbox.d);
} else {
span.bbox = this.data[0].toHTML(span).bbox;
var html = this.data[0].toHTML(span,HW,D);
if (D != null) {html = this.data[0].HTMLstretchV(box,HW,D)}
else if (HW != null) {html = this.data[0].HTMLstretchH(box,HW)}
span.bbox = html.bbox;
}
}
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
return span;
}
},
HTMLstretchH: MML.mbase.HTMLstretchH,
HTMLstretchV: MML.mbase.HTMLstretchV
});
//
@ -2869,9 +2902,10 @@
HTMLCSS.Augment({
Em: HTMLCSS.EmRounded, // vertical alignment needs help (since around v20)
cloneNodeBug: true, // Chrome gets heights wrong with the cloned ones
rfuzz: .011,
rfuzz: -.02,
AccentBug: true,
AdjustSurd: true,
FontFaceBug: (browser.version.substr(0,3) === "32."), // Chrome 32 fails on bold-italic (#735)
negativeBBoxes: true,
safariNegativeSpaceBug: true,
safariWebFontSerif: [""],

View File

@ -101,20 +101,23 @@
"white-space": "nowrap",
"float": "none",
"direction": "ltr",
"max-width": "none", "max-height": "none",
"min-width": 0, "min-height": 0,
border: 0, padding: 0, margin: 0
},
"span.MathJax_MathML": {
display: "inline"
display: "inline!important"
},
"div.MathJax_MathML": {
display: "block"
display: "block!important"
},
".MathJax_mmlExBox": {
display:"block", overflow:"hidden",
display:"block!important", overflow:"hidden",
height:"1px", width:"60ex",
"min-height": 0, "max-height":"none",
padding:0, border: 0, margin: 0
}
}
@ -286,8 +289,8 @@
// Get the jax and the container and set the size
//
var jax = script.MathJax.elementJax, math = jax.root;
var span = document.getElementById(jax.inputID+"-Frame"),
container = span.firstChild, mspan = container.firstChild;
var span = document.getElementById(jax.inputID+"-Frame"); if (!span) return;
var container = span.firstChild, mspan = container.firstChild;
this.ex = jax.NativeMML.ex || this.defaultEx;
this.scale = jax.NativeMML.scale || 1;
if (this.scale !== 1) {span.style.fontSize = jax.NativeMML.fontSize}
@ -974,8 +977,9 @@
tag = nMML.adjustWidths[i];
var style = tag.getAttribute("style") || "";
if (!style.match(/(^|;)\s*min-width:/)) {
mtd.push(tag.scrollWidth);
var width = (tag.scrollWidth/nMML.ex).toFixed(3)+"ex";
var width = tag.firstChild.scrollWidth;
mtd.push(width);
width = (width/nMML.ex).toFixed(3)+"ex";
style = style.replace(/;?\s*$/,"; ");
tag.setAttribute("style",style+"min-width:"+width);
}

View File

@ -177,6 +177,11 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
case MML.NOTATION.DOWNDIAGONALSTRIKE:
svg.Add(BBOX.DLINE(H,D,W,t,values.mathcolor,"down"));
break;
case MML.NOTATION.PHASORANGLE:
borders[2] = true; W -= 2*p; p = (H+D)/2; W += p;
svg.Add(BBOX.DLINE(H,D,p,t,values.mathcolor,"up"));
break;
case MML.NOTATION.MADRUWB:
borders[1] = borders[2] = true;

View File

@ -25,7 +25,7 @@
*/
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var VERSION = "2.3";
var VERSION = "2.3.1";
var MML = MathJax.ElementJax.mml,
SVG = MathJax.OutputJax.SVG;
@ -36,18 +36,11 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var values = this.getValues("lquote","rquote");
var variant = this.SVGgetVariant(), scale = this.SVGgetScale();
var text = this.data.join(""); // FIXME: handle mglyph?
var pattern = [];
if (values.lquote.length === 1) {pattern.push(this.SVGquoteRegExp(values.lquote))}
if (values.rquote.length === 1) {pattern.push(this.SVGquoteRegExp(values.rquote))}
if (pattern.length) {text = text.replace(RegExp("("+pattern.join("|")+")","g"),"\\$1")}
svg.Add(this.SVGhandleVariant(variant,scale,values.lquote+text+values.rquote));
svg.Clean();
this.SVGhandleColor(svg);
this.SVGsaveData(svg);
return svg;
},
SVGquoteRegExp: function (string) {
return string.replace(/([.*+?|{}()\[\]\\])/g,"\\$1");
}
});
MML.ms.prototype.defaults.mathvariant = 'monospace';

View File

@ -45,16 +45,17 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var scale = this.SVGgetScale(), mu = this.SVGgetMu(svg);
var LABEL = -1;
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row, cell, mo;
var LHD = SVG.FONTDATA.baselineskip * scale * values.useHeight, HD,
LH = SVG.FONTDATA.lineH * scale, LD = SVG.FONTDATA.lineD * scale;
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1,
m, M, s, row, cell, mo, HD;
var LH = SVG.FONTDATA.lineH * scale * values.useHeight,
LD = SVG.FONTDATA.lineD * scale * values.useHeight;
//
// Create cells and measure columns and rows
//
for (i = 0, m = this.data.length; i < m; i++) {
row = this.data[i]; s = (row.type === "mlabeledtr" ? LABEL : 0);
A[i] = []; H[i] = D[i] = 0;
A[i] = []; H[i] = LH; D[i] = LD;
for (j = s, M = row.data.length + s; j < M; j++) {
if (W[j] == null) {
if (j > J) {J = j}
@ -72,8 +73,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
HD = mo.SVGdata.h + mo.SVGdata.d;
if (HD) {
min = SVG.length2em(min,mu,HD);
if (min*mo.SVGdata.h/HD > H[j]) {H[j] = min*mo.SVGdata.h/HD}
if (min*mo.SVGdata.d/HD > D[j]) {D[j] = min*mo.SVGdata.d/HD}
if (min*mo.SVGdata.h/HD > H[i]) {H[i] = min*mo.SVGdata.h/HD}
if (min*mo.SVGdata.d/HD > D[i]) {D[i] = min*mo.SVGdata.d/HD}
}
} else if (mo.SVGcanStretch("Horizontal")) {
min = SVG.length2em(min,mu,mo.SVGdata.w);
@ -86,8 +87,6 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
if (A[i][j].w > W[j]) {W[j] = A[i][j].w}
}
}
if (H[0]+D[0]) {H[0] = Math.max(H[0],LH)}
if (H[A.length-1]+D[A.length-1]) {D[A.length-1] = Math.max(D[A.length-1],LD)}
//
// Determine spacing and alignment
@ -143,7 +142,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
//
HD = H[0] + D[A.length-1];
for (i = 0, m = A.length-1; i < m; i++)
{HD += Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}
{HD += Math.max(0,D[i]+H[i+1]+RSPACE[i])}
//
// Determine frame and line sizes
//
@ -176,7 +175,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
Y = 0; fY = -(HD + fy) + H[0];
for (i = 0, m = n-1; i < m; i++) {
// FIXME: Should handle values.align for final row
var dY = Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i]);
var dY = Math.max(0,D[i]+H[i+1]+RSPACE[i]);
Y += dY; fY += dY;
}
} else {
@ -274,7 +273,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
align = (cell.columnalign||RCALIGN[i][j]||CALIGN[j])
C[j].Align(A[i][j],align,0,y+dy);
}
if (i < A.length-1) {y -= Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}
if (i < A.length-1) {y -= Math.max(0,D[i]+H[i+1]+RSPACE[i])}
}
y = Y;
}
@ -307,7 +306,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
//
y = Y - lw/2;
for (i = 0, m = A.length-1; i < m; i++) {
dy = Math.max(LHD,D[i]+H[i+1]+RSPACE[i]);
dy = Math.max(0,D[i]+H[i+1]+RSPACE[i]);
if (RLINES[i] !== "none")
{svg.Add(BBOX.HLINE(fW,lw,RLINES[i]),0,y-D[i]-(dy-D[i]-H[i+1])/2)}
y -= dy;

View File

@ -86,10 +86,13 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
//
// Start with a fresh SVG element
// and make it full width if we are breaking to a specific width
// in the top-level math element
//
svg = this.SVG();
if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth}
else {svg.w = SVG.cwidth/SVG.em * 1000}
if (isTop && parent.type !== "mtd") {
if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth}
else {svg.w = SVG.cwidth/SVG.em * 1000}
}
var state = {
n: 0, Y: 0,
@ -504,7 +507,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
//
// Get the default penalty for this location
//
var W = info.scanW, mo = (info.embellished||this); delete info.embellished;
var W = info.scanW, mo = info.embellished; delete info.embellished;
if (!mo || !mo.SVGdata) {mo = this}
var svg = mo.SVGdata, w = svg.w + svg.x;
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)

View File

@ -64,6 +64,19 @@ MathJax.OutputJax.SVG = MathJax.OutputJax({
margin: "1em 0em"
},
//
// For mtextFontInherit version of \texttt{}
//
".MathJax_SVG .MJX-monospace": {
"font-family": "monospace"
},
//
// For mtextFontInherit version of \textsf{}
//
".MathJax_SVG .MJX-sans-serif": {
"font-family": "sans-serif"
},
"#MathJax_SVG_Tooltip": {
"background-color": "InfoBackground", color: "InfoText",
border: "1px solid black",

View File

@ -88,7 +88,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -88,7 +88,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -88,7 +88,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -90,7 +90,7 @@
"bold": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], italic:true, offsetA: 0x1D434, offsetG: 0x1D6E2, remap: {0x1D455: 0x210E}},
"bolditalic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"bold-italic": {fonts: [MAIN,NORMAL,MONOSPACE,LATIN,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,MISC,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true, offsetA: 0x1D468, offsetG: 0x1D71C},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -79,7 +79,7 @@
"bold": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], bold:true
, offsetA: 0x1D400, offsetG: 0x1D6A8, offsetN: 0x1D7CE},
"italic": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], italic:true},
"bolditalic": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true},
"bold-italic": {fonts: [MAIN,NORMAL,ALPHABETS,MARKS,ARROWS,OPERATORS,SYMBOLS,SHAPES,VARIANTS,NONUNICODE,SIZE1], bold: true, italic:true},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,

View File

@ -152,7 +152,7 @@
"bold": {fonts: [MAINBOLD,NORMALBOLD,FRAKTURBOLD,DOUBLESTRUCKBOLD,SANSSERIFBOLD,LATINBOLD,ALPHABETSBOLD,MARKSBOLD,ARROWSBOLD,OPERATORSBOLD,SYMBOLSBOLD,SHAPESBOLD,MISCBOLD,VARIANTSBOLD,SIZE1], bold:true
},
"italic": {fonts: [MAINITALIC,NORMALITALIC,SCRIPTITALIC,DOUBLESTRUCKITALIC,SANSSERIFITALIC,LATINITALIC,ALPHABETSITALIC,MARKSITALIC,MISCITALIC,VARIANTSITALIC,SIZE1], italic:true},
"bolditalic": {fonts: [MAINBOLDITALIC,NORMALBOLDITALIC,SCRIPTBOLDITALIC,DOUBLESTRUCKBOLDITALIC,SANSSERIFBOLDITALIC,LATINBOLDITALIC,ALPHABETSBOLDITALIC,MARKSBOLDITALIC,SHAPESBOLDITALIC,MISCBOLDITALIC,VARIANTSBOLDITALIC,SIZE1], bold: true, italic:true},
"bold-italic": {fonts: [MAINBOLDITALIC,NORMALBOLDITALIC,SCRIPTBOLDITALIC,DOUBLESTRUCKBOLDITALIC,SANSSERIFBOLDITALIC,LATINBOLDITALIC,ALPHABETSBOLDITALIC,MARKSBOLDITALIC,SHAPESBOLDITALIC,MISCBOLDITALIC,VARIANTSBOLDITALIC,SIZE1], bold: true, italic:true},
"double-struck": {
fonts: [DOUBLESTRUCK],
offsetA: 0x1D538,
@ -181,7 +181,8 @@
fonts: [SANSSERIF],
offsetA: 0x1D5A0,
offsetN: 0x1D7E2,
offsetG: 0xE17D
offsetG: 0xE17D,
offsetE: 0xE17D
},
"bold-sans-serif": {
fonts: [SANSSERIFBOLD], bold:true,
@ -193,7 +194,8 @@
fonts: [SANSSERIFITALIC], italic: true,
offsetA: 0x1D608,
offsetN: 0xE1B4,
offsetG: 0xE1BF
offsetG: 0xE1BF,
offsetE: 0xE1BF
},
"sans-serif-bold-italic": {
fonts: [SANSSERIFBOLDITALIC], bold:true, italic: true,
@ -220,6 +222,7 @@
{name: "alpha", low: 0x61, high: 0x7A, offset: "A", add: 26},
{name: "Alpha", low: 0x41, high: 0x5A, offset: "A"},
{name: "number", low: 0x30, high: 0x39, offset: "N"},
{name: "greek-non-unicode", low: 0x03B1, high: 0x03C9, offset: "E", add: 25},
{name: "greek", low: 0x03B1, high: 0x03C9, offset: "G", add: 26},
{name: "Greek", low: 0x0391, high: 0x03F6, offset: "G",
remap: {0x03F5: 52, 0x03D1: 53, 0x03F0: 54, 0x03D5: 55, 0x03F1: 56, 0x03D6: 57, 0x03F4: 17}}
@ -238,7 +241,13 @@
},
REMAPACCENT: {
"\u2192": "\u20D7"
"\u007E": "\u0303",
"\u2192": "\u20D7",
"\u0060": "\u0300",
"\u005E": "\u0302",
"\u00B4": "\u0301",
"\u2032": "\u0301",
"\u2035": "\u0300"
},
REMAPACCENTUNDER: {

View File

@ -52,12 +52,17 @@
"white-space": "nowrap",
"float": "none",
"direction": "ltr",
"max-width": "none", "max-height": "none",
"min-width": 0, "min-height": 0,
border: 0, padding: 0, margin: 0
},
".MathJax_SVG_Display": {
position: "relative",
display: "block",
display: "block!important",
"text-indent": 0,
"max-width": "none", "max-height": "none",
"min-width": 0, "min-height": 0,
width: "100%"
},
@ -75,13 +80,15 @@
".MathJax_SVG_Processing": {
visibility: "hidden", position:"absolute", top:0, left:0,
width:0, height: 0, overflow:"hidden", display:"block"
width:0, height: 0, overflow:"hidden", display:"block!important"
},
".MathJax_SVG_Processed": {display:"none!important"},
".MathJax_SVG_ExBox": {
display:"block", overflow:"hidden",
width:"1px", height:"60ex"
display:"block!important", overflow:"hidden",
width:"1px", height:"60ex",
"min-height": 0, "max-height":"none",
padding:0, border: 0, margin: 0
},
"#MathJax_SVG_Tooltip": {
@ -289,7 +296,8 @@
//
var jax = script.MathJax.elementJax, math = jax.root,
span = document.getElementById(jax.inputID+"-Frame"),
div = (jax.SVG.display ? span.parentNode : span);
div = (jax.SVG.display ? (span||{}).parentNode : span);
if (!div) return;
//
// Set the font metrics
//
@ -551,25 +559,16 @@
}
}
if (variant.remap && variant.remap[n]) {
if (variant.remap[n] instanceof Array) {
var remap = variant.remap[n];
n = remap[0]; variant = this.FONTDATA.VARIANT[remap[1]];
} else if (typeof(variant.remap[n]) === "string") {
text = variant.remap[n]+text.substr(i+1);
i = 0; m = text.length; n = text.charCodeAt(0);
} else {
n = variant.remap[n];
if (variant.remap.variant) {variant = this.FONTDATA.VARIANT[variant.remap.variant]}
}
}
if (this.FONTDATA.REMAP[n] && !variant.noRemap) {
n = variant.remap[n];
if (variant.remap.variant) {variant = this.FONTDATA.VARIANT[variant.remap.variant]}
} else if (this.FONTDATA.REMAP[n] && !variant.noRemap) {
n = this.FONTDATA.REMAP[n];
if (n instanceof Array) {variant = this.FONTDATA.VARIANT[n[1]]; n = n[0]}
if (typeof(n) === "string") {
text = n+text.substr(i+1);
i = 0; m = text.length;
n = n.charCodeAt(0);
}
}
if (n instanceof Array) {variant = this.FONTDATA.VARIANT[n[1]]; n = n[0]}
if (typeof(n) === "string") {
text = n+text.substr(i+1);
m = text.length; i = -1;
continue;
}
font = this.lookupChar(variant,n); c = font[n];
if (c) {
@ -859,6 +858,17 @@
},
Align: function (svg,align,dx,dy) {
dx = ({left: dx, center: (this.w - svg.w)/2, right: this.w - svg.w - dx})[align] || 0;
//
// If we extend to the left of the current contents,
// move the contents to the right and adjust the bounding box
//
if (dx < 0) {
if (this.element.childNodes.length) {
this.element.setAttribute("transform","translate("+Math.floor(-dx)+",0)");
var g = SVG.Element("g"); g.appendChild(this.element); this.element = g;
}
this.l -= dx; this.w -= dx; this.r -= dx; dx = 0;
}
this.Add(svg,dx,dy);
},
Clean: function () {
@ -883,7 +893,9 @@
{
var svg = this.svg[i], mml = svg.mml;
if (mml) {
svg = mml.SVGstretchV(this.sh,this.sd);
if (mml.SVGdata.h !== this.sh || mml.SVGdata.d !== this.sd) {
svg = mml.SVGstretchV(this.sh,this.sd);
}
mml.SVGdata.HW = this.sh; mml.SVGdata.D = this.sd;
}
if (svg.ic) {this.ic = svg.ic} else {delete this.ic}
@ -1040,6 +1052,7 @@
if (!this.SVGdata) {this.SVGdata = {}}
this.SVGdata.w = svg.w, this.SVGdata.x = svg.x;
this.SVGdata.h = svg.h, this.SVGdata.d = svg.d;
if (svg.y) {this.SVGdata.h += svg.y; this.SVGdata.d -= svg.y}
if (svg.X != null) {this.SVGdata.X = svg.X}
if (this["class"]) {svg.removeable = false; SVG.Element(svg.element,{"class":this["class"]})}
// FIXME: if an element is split by linebreaking, the ID will be the same on both parts
@ -1476,6 +1489,9 @@
var variant = this.SVGgetVariant(), def = {direction:this.Get("dir")};
if (variant.bold) {def["font-weight"] = "bold"}
if (variant.italic) {def["font-style"] = "italic"}
variant = this.Get("mathvariant");
if (variant === "monospace") {def["class"] = "MJX-monospace"}
else if (variant.match(/sans-serif/)) {def["class"] = "MJX-sans-serif"}
svg.Add(BBOX.TEXT(scale,this.data.join(""),def)); svg.Clean();
this.SVGhandleColor(svg);
this.SVGsaveData(svg);
@ -1614,18 +1630,20 @@
MML.mfrac.Augment({
toSVG: function () {
this.SVGgetStyles();
var svg = this.SVG(); this.SVGhandleSpace(svg);
var svg = this.SVG();
var frac = BBOX(); this.SVGhandleSpace(frac);
var num = this.SVGchildSVG(0), den = this.SVGchildSVG(1);
var values = this.getValues("displaystyle","linethickness","numalign","denomalign","bevelled");
var scale = svg.scale = this.SVGgetScale(), isDisplay = values.displaystyle;
var scale = svg.scale = frac.scale = this.SVGgetScale(),
isDisplay = values.displaystyle;
var a = SVG.TeX.axis_height * scale;
if (values.bevelled) {
var delta = (isDisplay ? 400 : 150);
var H = Math.max(num.h+num.d,den.h+den.d)+2*delta;
var bevel = SVG.createDelimiter(0x2F,H);
svg.Add(num,0,(num.d-num.h)/2+a+delta);
svg.Add(bevel,num.w-delta/2,(bevel.d-bevel.h)/2+a);
svg.Add(den,num.w+bevel.w-delta,(den.d-den.h)/2+a-delta);
frac.Add(num,0,(num.d-num.h)/2+a+delta);
frac.Add(bevel,num.w-delta/2,(bevel.d-bevel.h)/2+a);
frac.Add(den,num.w+bevel.w-delta,(den.d-den.h)/2+a-delta);
} else {
var W = Math.max(num.w,den.w);
var t = SVG.thickness2em(values.linethickness,scale), p,q, u,v;
@ -1637,27 +1655,30 @@
p = Math.max((isDisplay ? 7 : 3) * SVG.TeX.rule_thickness, 2*mt); // force to at least 2 px
q = (u - num.d) - (den.h - v);
if (q < p) {u += (p - q)/2; v += (p - q)/2}
svg.w = W; t = 0;
frac.w = W; t = 0;
} else {// \over
p = Math.max((isDisplay ? 2 : 0) * mt + t, t/2 + 1.5*mt); // force to be at least 1.5px
q = (u - num.d) - (a + t/2); if (q < p) {u += p - q}
q = (a - t/2) - (den.h - v); if (q < p) {v += p - q}
svg.Add(BBOX.RECT(t/2,t/2,W+2*t),0,a);
frac.Add(BBOX.RECT(t/2,t/2,W+2*t),0,a);
}
svg.Align(num,values.numalign,t,u);
svg.Align(den,values.denomalign,t,-v);
frac.Align(num,values.numalign,t,u);
frac.Align(den,values.denomalign,t,-v);
}
svg.Clean();
frac.Clean(); svg.Add(frac,0,0); svg.Clean();
this.SVGhandleColor(svg);
this.SVGsaveData(svg);
return svg;
},
SVGcanStretch: function (direction) {return false},
SVGhandleSpace: function (svg) {
if (!this.texWithDelims) {
svg.x = (this.useMMLspacing ? 0 : SVG.length2em(this.texSpacing()||0)) + 120;
svg.X = 120;
}
if (!this.texWithDelims && !this.useMMLspacing) {
//
// Add nulldelimiterspace around the fraction
// (TeXBook pg 150 and Appendix G rule 15e)
//
svg.x = svg.X = SVG.TeX.nulldelimiterspace;
}
}
});
@ -1922,6 +1943,17 @@
svg.Add(box); svg.Clean();
this.SVGsaveData(svg);
//
// If this element is not the top-level math element
// remove the transform and return the svg object
// (issue #614).
//
if (!span) {
svg.element = svg.element.firstChild; // remove <svg> element
svg.element.removeAttribute("transform");
svg.removable = true;
return svg;
}
//
// Style the <svg> to get the right size and placement
//
var l = Math.max(-svg.l,0), r = Math.max(svg.r-svg.w,0);
@ -1970,12 +2002,12 @@
});
MML.TeXAtom.Augment({
toSVG: function () {
toSVG: function (HW,D) {
this.SVGgetStyles();
var svg = this.SVG();
this.SVGhandleSpace(svg);
if (this.data[0] != null) {
var box = this.data[0].toSVG(), y = 0;
var box = this.data[0].SVGdataStretched(0,HW,D), y = 0;
if (this.texClass === MML.TEXCLASS.VCENTER) {
// FIXME: should the axis height be scaled?
y = SVG.TeX.axis_height - (box.h+box.d)/2 + box.d;