config.js 6.8 KB

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