123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- MathJax.Extension["TeX/unicode"] = {
- version: "2.7.2",
- unicode: {},
- config: MathJax.Hub.CombineConfig("TeX.unicode",{
- fonts: "STIXGeneral,'Arial Unicode MS'"
- })
- };
-
- MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
- var TEX = MathJax.InputJax.TeX;
- var MML = MathJax.ElementJax.mml;
- var UNICODE = MathJax.Extension["TeX/unicode"].unicode;
-
-
-
-
- TEX.Definitions.Add({macros: {unicode: 'Unicode'}},null,true);
-
-
-
- TEX.Parse.Augment({
- Unicode: function(name) {
- var HD = this.GetBrackets(name), font;
- if (HD) {
- if (HD.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/))
- {HD = HD.replace(/ /g,"").split(/,/); font = this.GetBrackets(name)}
- else {font = HD; HD = null}
- }
- var n = this.trimSpaces(this.GetArgument(name)),
- N = parseInt(n.match(/^x/) ? "0"+n : n);
- if (!UNICODE[N]) {UNICODE[N] = [800,200,font,N]}
- else if (!font) {font = UNICODE[N][2]}
- if (HD) {
- UNICODE[N][0] = Math.floor(HD[0]*1000);
- UNICODE[N][1] = Math.floor(HD[1]*1000);
- }
- var variant = this.stack.env.font, def = {};
- if (font) {
- UNICODE[N][2] = def.fontfamily = font.replace(/"/g,"'");
- if (variant) {
- if (variant.match(/bold/)) {def.fontweight = "bold"}
- if (variant.match(/italic|-mathit/)) {def.fontstyle = "italic"}
- }
- } else if (variant) {def.mathvariant = variant}
- def.unicode = [].concat(UNICODE[N]);
- this.Push(MML.mtext(MML.entity("#"+n)).With(def));
- }
- });
- MathJax.Hub.Startup.signal.Post("TeX unicode Ready");
-
- });
-
- MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
- var MML = MathJax.ElementJax.mml;
- var FONTS = MathJax.Extension["TeX/unicode"].config.fonts;
-
-
-
- var GETVARIANT = MML.mbase.prototype.HTMLgetVariant;
- MML.mbase.Augment({
- HTMLgetVariant: function () {
- var variant = GETVARIANT.apply(this,arguments);
- if (variant.unicode) {delete variant.unicode; delete variant.FONTS}
- if (!this.unicode) {return variant}
- variant.unicode = true;
- if (!variant.defaultFont) {
- variant = MathJax.Hub.Insert({},variant);
- variant.defaultFont = {family:FONTS};
- }
- var family = this.unicode[2]; if (family) {family += ","+FONTS} else {family = FONTS}
- variant.defaultFont[this.unicode[3]] = [
- this.unicode[0],this.unicode[1],500,0,500,
- {isUnknown:true, isUnicode:true, font:family}
- ];
- return variant;
- }
- });
- });
- MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
- var MML = MathJax.ElementJax.mml;
- var FONTS = MathJax.Extension["TeX/unicode"].config.fonts;
-
-
-
- var GETVARIANT = MML.mbase.prototype.SVGgetVariant;
- MML.mbase.Augment({
- SVGgetVariant: function () {
- var variant = GETVARIANT.call(this);
- if (variant.unicode) {delete variant.unicode; delete variant.FONTS}
- if (!this.unicode) {return variant}
- variant.unicode = true;
- if (!variant.forceFamily) {variant = MathJax.Hub.Insert({},variant)}
- variant.defaultFamily = FONTS; variant.noRemap = true;
- variant.h = this.unicode[0]; variant.d = this.unicode[1];
- return variant;
- }
- });
- });
- MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/unicode.js");
|