config.js (6962B)
1 /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ 2 /* vim: set ts=2 et sw=2 tw=80: */ 3 4 /************************************************************* 5 * 6 * MathJax/jax/output/HTML-CSS/config.js 7 * 8 * Initializes the HTML-CCS OutputJax (the main definition is in 9 * MathJax/jax/input/HTML-CSS/jax.js, which is loaded when needed). 10 * 11 * --------------------------------------------------------------------- 12 * 13 * Copyright (c) 2009-2015 The MathJax Consortium 14 * 15 * Licensed under the Apache License, Version 2.0 (the "License"); 16 * you may not use this file except in compliance with the License. 17 * You may obtain a copy of the License at 18 * 19 * http://www.apache.org/licenses/LICENSE-2.0 20 * 21 * Unless required by applicable law or agreed to in writing, software 22 * distributed under the License is distributed on an "AS IS" BASIS, 23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 * See the License for the specific language governing permissions and 25 * limitations under the License. 26 */ 27 28 MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({ 29 id: "HTML-CSS", 30 version: "2.6.1", 31 directory: MathJax.OutputJax.directory + "/HTML-CSS", 32 extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS", 33 autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload", 34 fontDir: MathJax.OutputJax.directory + "/HTML-CSS/fonts", // font name added later 35 webfontDir: MathJax.OutputJax.fontDir + "/HTML-CSS", // font name added later 36 37 config: { 38 noReflows: true, // true uses internal measurements to avoid browser reflows 39 matchFontHeight: true, // try to match math font height to surrounding font? 40 scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor 41 availableFonts: ["STIX","TeX"], // list of local fonts to check for 42 preferredFont: "TeX", // preferred local font (TeX or STIX) 43 webFont: "TeX", // web-based font to use when no local fonts found (TeX is only choice) 44 imageFont: "TeX", // font to use for image fallback mode (TeX is only choice) 45 undefinedFamily: "STIXGeneral,'Arial Unicode MS',serif", // fonts to use for unknown unicode characters 46 mtextFontInherit: false, // to make <mtext> be in page font rather than MathJax font 47 48 EqnChunk: (MathJax.Hub.Browser.isMobile ? 10: 50), 49 // number of equations to process before showing them 50 EqnChunkFactor: 1.5, // chunk size is multiplied by this after each chunk 51 EqnChunkDelay: 100, // milliseconds to delay between chunks (to let browser 52 // respond to other events) 53 54 linebreaks: { 55 automatic: false, // when false, only process linebreak="newline", 56 // when true, insert line breaks automatically in long expressions. 57 58 width: "container" // maximum width of a line for automatic line breaks (e.g. "30em"). 59 // use "container" to compute size from containing element, 60 // use "nn% container" for a portion of the container, 61 // use "nn%" for a portion of the window size 62 }, 63 64 styles: { 65 ".MathJax_Display": { 66 "text-align": "center", 67 margin: "1em 0em" 68 }, 69 70 ".MathJax .merror": { 71 "background-color": "#FFFF88", 72 color: "#CC0000", 73 border: "1px solid #CC0000", 74 padding: "1px 3px", 75 "font-style": "normal", 76 "font-size": "90%" 77 }, 78 79 // 80 // For mtextFontInherit version of \texttt{} 81 // 82 ".MathJax .MJX-monospace": { 83 "font-family": "monospace" 84 }, 85 86 // 87 // For mtextFontInherit version of \textsf{} 88 // 89 ".MathJax .MJX-sans-serif": { 90 "font-family": "sans-serif" 91 }, 92 93 "#MathJax_Tooltip": { 94 "background-color": "InfoBackground", color: "InfoText", 95 border: "1px solid black", 96 "box-shadow": "2px 2px 5px #AAAAAA", // Opera 10.5 97 "-webkit-box-shadow": "2px 2px 5px #AAAAAA", // Safari 3 and Chrome 98 "-moz-box-shadow": "2px 2px 5px #AAAAAA", // Forefox 3.5 99 "-khtml-box-shadow": "2px 2px 5px #AAAAAA", // Konqueror 100 filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')", // IE 101 padding: "3px 4px", 102 "z-index": 401 103 } 104 } 105 106 } 107 }); 108 if (MathJax.Hub.Browser.isMSIE && document.documentMode >= 9) 109 {delete MathJax.OutputJax["HTML-CSS"].config.styles["#MathJax_Tooltip"].filter} 110 111 if (!MathJax.Hub.config.delayJaxRegistration) 112 {MathJax.OutputJax["HTML-CSS"].Register("jax/mml")} 113 114 MathJax.Hub.Register.StartupHook("End Config",[function (HUB,HTMLCSS) { 115 var CONFIG = HUB.Insert({ 116 117 // 118 // The minimum versions that HTML-CSS supports 119 // 120 minBrowserVersion: { 121 Firefox: 3.0, 122 Opera: 9.52, 123 MSIE: 6.0, 124 Chrome: 0.3, 125 Safari: 2.0, 126 Konqueror: 4.0 127 }, 128 129 // 130 // For unsupported browsers, put back these delimiters for the preview 131 // 132 inlineMathDelimiters: ['$','$'], // or ["",""] or ["\\(","\\)"] 133 displayMathDelimiters: ['$$','$$'], // or ["",""] or ["\\[","\\]"] 134 // 135 // For displayed math, insert <BR> for \n? 136 // 137 multilineDisplay: true, 138 139 // 140 // The function to call to display the math for unsupported browsers 141 // 142 minBrowserTranslate: function (script) { 143 var MJ = HUB.getJaxFor(script), text = ["[Math]"], delim; 144 var span = document.createElement("span",{className: "MathJax_Preview"}); 145 if (MJ.inputJax === "TeX") { 146 if (MJ.root.Get("displaystyle")) { 147 delim = CONFIG.displayMathDelimiters; 148 text = [delim[0]+MJ.originalText+delim[1]]; 149 if (CONFIG.multilineDisplay) text = text[0].split(/\n/); 150 } else { 151 delim = CONFIG.inlineMathDelimiters; 152 text = [delim[0]+MJ.originalText.replace(/^\s+/,"").replace(/\s+$/,"")+delim[1]]; 153 } 154 } 155 for (var i = 0, m = text.length; i < m; i++) { 156 span.appendChild(document.createTextNode(text[i])); 157 if (i < m-1) {span.appendChild(document.createElement("br"))} 158 } 159 script.parentNode.insertBefore(span,script); 160 } 161 162 },(HUB.config["HTML-CSS"]||{})); 163 164 if (HUB.Browser.version !== "0.0" && 165 !HUB.Browser.versionAtLeast(CONFIG.minBrowserVersion[HUB.Browser]||0.0)) { 166 HTMLCSS.Translate = CONFIG.minBrowserTranslate; 167 HUB.Config({showProcessingMessages: false}); 168 MathJax.Message.Set(["MathJaxNotSupported", 169 "Your browser does not support MathJax"],null,4000); 170 HUB.Startup.signal.Post("MathJax not supported"); 171 } 172 173 },MathJax.Hub,MathJax.OutputJax["HTML-CSS"]]); 174 175 176 MathJax.OutputJax["HTML-CSS"].loadComplete("config.js");