mathjax.d.ts 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734
  1. // Type definitions for MathJax
  2. // Project: https://github.com/mathjax/MathJax
  3. // Definitions by: Roland Zwaga <https://github.com/rolandzwaga>
  4. // Definitions: https://github.com/borisyankov/DefinitelyTyped
  5. // These are slightly preliminary and can use some more strong typing here and there. Please feel free to improve.
  6. declare var MathJax:jax.IMathJax;
  7. declare module jax {
  8. export interface IMathJax {
  9. Hub?:IMathJaxHub;
  10. Ajax?:IAjax;
  11. Message?:IMessage;
  12. HTML?:IHTML;
  13. Callback?:ICallback;
  14. Localization?:ILocalization;
  15. InputJax?:IInputJax;
  16. OutputJax?:IOutputJax;
  17. }
  18. export interface ICallback {
  19. (fn:Function):ICallbackObject;
  20. (fns:Function[]):ICallbackObject;
  21. (objs:any[]):ICallbackObject;
  22. (obj:any):ICallbackObject;
  23. (code:string):ICallbackObject;
  24. /*Waits for the specified time (given in milliseconds) and then performs the callback. It returns the Callback
  25. * object (or a blank one if none was supplied). The returned callback structure has a timeout property set to
  26. * the result of the setTimeout() call that was used to perform the wait so that you can cancel the wait, if
  27. * needed. Thus MathJax.Callback.Delay() can be used to start a timeout delay that executes the callback if an
  28. * action doesn’t occur within the given time (and if the action does occur, the timeout can be canceled).
  29. * Since MathJax.Callback.Delay() returns a callback structure, it can be used in a callback queue to insert a
  30. * delay between queued commands.
  31. */
  32. Delay(time:number, callback:any):ICallbackObject;
  33. /*Creates a MathJax.CallBack.Queue object and pushes the given callbacks into the queue. See Using Queues for
  34. * more details about MathJax queues.
  35. */
  36. Queue(...args:any[]):IQueue;
  37. /*Looks for a named signal, creates it if it doesn’t already exist, and returns the signal object. See Using
  38. * Signals for more details.
  39. */
  40. Signal(name:string):ISignal;
  41. /*Calls each callback in the hooks array (or the single hook if it is not an array), passing it the arguments
  42. * stored in the data array. If reset is true, then the callback’s reset() method will be called before each hook
  43. * is executed. If any of the hooks returns a Callback object, then it collects those callbacks and returns a new
  44. * callback that will execute when all the ones returned by the hooks have been completed. Otherwise,
  45. * MathJax.Callback.ExecuteHooks() returns null.
  46. */
  47. ExecuteHooks(hooks:any[], data:any[], reset:boolean):ICallbackObject;
  48. /*Creates a prioritized list of hooks that are called in order based on their priority (low priority numbers are
  49. * handled first). This is meant to replace MathJax.Callback.ExecuteHooks() and is used internally for signal
  50. * callbacks, pre- and post-filters, and other lists of callbacks.
  51. */
  52. Hooks(reset:boolean):IHooks;
  53. }
  54. export interface IHooks {
  55. Add(hook:any, priority:number):ICallbackObject;
  56. Remove(hook:ICallbackObject):void;
  57. Execute():ICallbackObject;
  58. }
  59. export interface IQueue {
  60. /*This is non-zero when the queue is waiting for a command to complete, i.e. a command being processed returns a
  61. * Callback object, indicating that the queue should wait for that action to complete before processing
  62. * additional commands.
  63. */
  64. pending:number;
  65. /*This is non-zero when the queue is executing one of the commands in the queue.*/
  66. running:number;
  67. /*An array containing the queued commands that are yet to be performed.*/
  68. queue:any[];
  69. /*Adds commands to the queue and runs them (if the queue is not pending or running another command). If one of
  70. * the callbacks is an actual Callback object rather than a callback specification, then the command queued is
  71. * an internal command to wait for the given callback to complete. That is, that callback is not itself queued
  72. * to be executed, but a wait for that callback is queued. The Push() method returns the last callback that was
  73. * added to the queue (so that it can be used for further synchronization, say as an entry in some other queue).
  74. */
  75. Push(specs:any[]):ICallbackObject;
  76. /*Process the commands in the queue, provided the queue is not waiting for another command to complete. This
  77. * method is used internally; you should not need to call it yourself.
  78. */
  79. Process():void;
  80. /*Increments the running property, indicating that any commands that are added to the queue should not be
  81. * executed immediately, but should be queued for later execution (when its Resume() is called). This method is
  82. * used internally; you should not need to call it yourself.
  83. */
  84. Suspend():void;
  85. /*Decrements the running property, if it is positive. When it is zero, commands can be processed, but that is
  86. * not done automatically — you would need to call Process() to make that happen. This method is used
  87. * internally; you should not need to call it yourself.
  88. */
  89. Resume():void;
  90. /*Used internally when an entry in the queue is a Callback object rather than a callback specification.
  91. * A callback to this function (passing it the original callback) is queued instead, and it simply returns the
  92. * callback it was passed. Since the queue will wait for a callback if it is the return value of one of the
  93. * commands it executes, this effectively makes the queue wait for the original callback at that point in the
  94. * command queue.
  95. */
  96. wait(callback:Function):Function;
  97. /*An internal function used to restart processing of the queue after it has been waiting for a command to
  98. * complete.
  99. */
  100. call():void;
  101. }
  102. export interface ISignal {
  103. /*The name of the signal. Each signal is named so that various components can access it. The first one to
  104. * request a particular signal causes it to be created, and other requests for the signal return references
  105. * to the same object.
  106. */
  107. name:string;
  108. /*Array used internally to store the post history so that when new listeners express interests in this signal,
  109. * they can be informed of the signals that have been posted so far. This can be cleared using the signal’s
  110. * Clear() method.
  111. */
  112. posted:any[];
  113. /*Array of callbacks to the listeners who have expressed interest in hearing about posts to this signal.
  114. * When a post occurs, the listeners are called, each in turn, passing them the message that was posted.
  115. */
  116. listeners:ICallbackObject[];
  117. /*Posts a message to all the listeners for the signal. The listener callbacks are called in turn (with the
  118. * message as an argument), and if any return a Callback object, the posting will be suspended until the callback
  119. * is executed. In this way, the Post() call can operate asynchronously, and so the callback parameter is used to
  120. * synchronize with its operation; the callback will be called when all the listeners have responded to the post.
  121. *
  122. * If a Post() to this signal occurs while waiting for the response from a listener (either because a listener
  123. * returned a Callback object and we are waiting for it to complete when the Post() occurred, or because the
  124. * listener itself called the Post() method), the new message will be queued and will be posted after the current
  125. * message has been sent to all the listeners, and they have all responded. This is another way in which posting
  126. * can be asynchronous; the only sure way to know that a posting has occurred is through its callback. When the
  127. * posting is complete, the callback is called, passing it the signal object that has just completed.
  128. *
  129. * Returns the callback object (or a blank callback object if none was provided).
  130. */
  131. Post(message:string):ICallbackObject;
  132. Post(message:string, callback:ICallbackObject):ICallbackObject;
  133. /*This causes the history of past messages to be cleared so new listeners will not receive them. Note that since
  134. * the signal may be operating asynchronously, the Clear() may be queued for later. In this way, the Post() and
  135. * Clear() operations will be performed in the proper order even when they are delayed. The callback is called
  136. * when the Clear() operation is completed.
  137. *
  138. * Returns the callback (or a blank callback if none is provided).
  139. */
  140. Clear():ICallbackObject;
  141. Clear(callback:ICallbackObject):ICallbackObject;
  142. /*This method registers a new listener on the signal. It creates a Callback object from the callback
  143. * specification, attaches it to the signal, and returns that Callback object. When new messages are posted to
  144. * the signal, it runs the callback, passing it the message that was posted. If the callback itself returns a
  145. * Callback object, that indicates that the listener has started an asynchronous operation and the poster should
  146. * wait for that callback to complete before allowing new posts on the signal.
  147. *
  148. * If ignorePast is false or not present, then before Interest() returns, the callback will be called with all
  149. * the past messages that have been sent to the signal.
  150. */
  151. Interest(callback:ICallbackObject):ICallbackObject;
  152. Interest(callback:ICallbackObject, ignorePast:boolean):ICallbackObject;
  153. /*This removes a listener from the signal so that no new messages will be sent to it. The callback should be the
  154. * one returned by the original Interest() call that attached the listener to the signal in the first place.
  155. * Once removed, the listener will no longer receive messages from the signal.
  156. */
  157. NoInterest(callback:ICallbackObject):void;
  158. /*This creates a callback that is called whenever the signal posts the given message. This is a little easier
  159. * than having to write a function that must check the message each time it is called. Although the message here
  160. * is a string, if a message posted to the signal is an array, then only the first element of that array is used
  161. * to match against the message. That way, if a message contains an identifier plus arguments, the hook will
  162. * match the identifier and still get called with the complete set of arguments.
  163. *
  164. * Returns the Callback object that was produced.
  165. */
  166. MessageHook(message:string, callback:ICallbackObject):ICallbackObject;
  167. /*Used internally to call the listeners when a particular message is posted to the signal.*/
  168. ExecuteHook(message:string):void;
  169. }
  170. export interface ICallbackObject {
  171. /*The function to be called when the callback is executed.*/
  172. hook:number;
  173. /*An array containing the arguments to pass to the callback function when it is executed.*/
  174. data:any[];
  175. /*The object to use as this during the call to the callback function.*/
  176. object:any;
  177. /*Set to true after the callback has been called, and undefined otherwise. A callback will not be executed a
  178. * second time unless the callback’s reset() method is called first, or its autoReset property is set to true.
  179. */
  180. called:boolean;
  181. /*Set this to true if you want to be able to call the callback more than once. (This is the case for signal
  182. * listeners, for example).*/
  183. autoReset:boolean;
  184. /*Clears the callback’s called property.*/
  185. reset():void;
  186. }
  187. export interface IMathJaxHub {
  188. /*This holds the configuration parameters for MathJax. Set these values using MathJax.Hub.Config() described
  189. * below. The options and their default values are given in the Core Options reference page.
  190. */
  191. config?:IMathJaxConfig;
  192. /*The minimum time (in milliseconds) between updates of the “Processing Math” message. After this amount of time
  193. * has passed, and after the next equation has finished being processed, MathJax will stop processing momentarily
  194. * so that the update message can be displayed, and so that the browser can handle user interaction.
  195. */
  196. processUpdateTime?:number;
  197. /*The amount of time (in milliseconds) that MathJax pauses after issuing its processing message before starting
  198. * the processing again (to give browsers time to handle user interaction).
  199. */
  200. processUpdateDelay?:number;
  201. /*The hub processing signal (tied to the MathJax.Hub.Register.MessageHook() method).*/
  202. signal?:ISignal;
  203. /*MathJax’s main processing queue. Use MathJax.Hub.Queue() to push callbacks onto this queue.*/
  204. queue?:any;
  205. /*The name of the browser as determined by MathJax. It will be one of Firefox, Safari, Chrome, Opera, MSIE,
  206. * Konqueror, or unkown. This is actually an object with additional properties and methods concerning the
  207. * browser
  208. */
  209. Browser?:IBrowserInfo;
  210. /*An object storing the MIME types associated with the various registered input jax (these are the types of the
  211. * <script> tags that store the math to be processed by each input jax).
  212. */
  213. inputJax?:any;
  214. /*An object storing the output jax associate with the various element jax MIME types for the registered output
  215. * jax.
  216. */
  217. outputJax?:any;
  218. Register?:IRegister;
  219. /*Sets the configuration options (stored in MathJax.Hub.config) to the values stored in the options object.*/
  220. Config(config:IMathJaxConfig):void;
  221. /*When delayStartupUntil is specified in the configuration file or in the script that loads MathJax.js,
  222. * MathJax’s startup sequence is delayed until this routine is called.
  223. */
  224. Configured():void;
  225. /*Pushes the given callbacks onto the main MathJax command queue. This synchronizes the commands with MathJax so
  226. * that they will be performed in the proper order even when some run asynchronously. See Using Queues for more
  227. * details about how to use queues, and the MathJax queue in particular. You may supply as many callback
  228. * specifications in one call to the Queue() method as you wish.
  229. */
  230. Queue(callBack:any):any;
  231. /*Calls the preprocessors on the given element (or elements if it is an array of elements), and then typesets
  232. * any math elements within the element. If no element is provided, the whole document is processed. The element
  233. * is either the DOM id of the element, a reference to the DOM element itself, or an array of id’s or refereneces.
  234. * The callback is called when the process is complete. See the Modifying Math section for details of how to use
  235. * this method properly.
  236. */
  237. Typeset(element:any, callBack:any):any;
  238. /*Calls the loaded preprocessors on the entire document, or on the given DOM element (or elements, if it is an
  239. * array of elements). The element is either the DOM id of the element, a reference to the DOM element itself, or
  240. * an array of id’s or references. The callback is called when the processing is complete.
  241. */
  242. PreProcess(element:any, callBack:any):any;
  243. /*Scans either the entire document or a given DOM element (or array of elements) for MathJax <script> tags and
  244. * processes the math those tags contain. The element is either the DOM id of the element to scan, a reference to
  245. * the DOM element itself, or an array of id’s or references. The callback is called when the processing is
  246. * complete.
  247. */
  248. Process(element:any, callBack:any):any;
  249. /*Scans either the entire document or a given DOM element (or elements if it is an array of elements) for
  250. * mathematics that has changed since the last time it was processed, or is new, and typesets the mathematics
  251. * they contain. The element is either the DOM id of the element to scan, a reference to the DOM element itself,
  252. * or an array of id’s or references. The callback is called when the processing is complete.
  253. */
  254. Update(element:any, callBack:any):any;
  255. /*Removes any typeset mathematics from the document or DOM element (or elements if it is an array of elements),
  256. * and then processes the mathematics again, re-typesetting everything. This may be necessary, for example, if
  257. * the CSS styles have changed and those changes would affect the mathematics. Reprocess calls both the input and
  258. * output jax to completely rebuild the data for mathematics. The element is either the DOM id of the element to
  259. * scan, a reference to the DOM element itself, or an array of id’s or references. The callback is called when
  260. * the processing is complete.
  261. */
  262. Reprocess(element:any, callBack:any):any;
  263. /*Removes any typeset mathematics from the document or DOM element (or elements if it is an array of elements),
  264. * and then renders the mathematics again, re-typesetting everything from the current internal version (without
  265. * calling the input jax again). The element is either the DOM id of the element to scan, a reference to the DOM
  266. * element itself, or an array of id’s or references. The callback is called when the processing is complete.
  267. */
  268. Rerender(element:any, callBack:any):any;
  269. /*Returns a list of all the element jax in the document or a specific DOM element. The element is either the DOM
  270. * id of the element, or a reference to the DOM element itself.
  271. */
  272. getAllJax(element:any):any[];
  273. /*Returns a list of all the element jax of a given MIME-type in the document or a specific DOM element. The
  274. * element is either the DOM id of the element to search, or a reference to the DOM element itself.
  275. */
  276. getJaxByType(type:string, element:any):void;
  277. /*Returns a list of all the element jax associated with input <script> tags with the given MIME-type within the
  278. * given DOM element or the whole document. The element is either the DOM id of the element to search, or a
  279. * reference to the DOM element itself.
  280. */
  281. getJaxByInputType(type:string, element:any):void;
  282. /*Returns the element jax associated with a given DOM element. If the element does not have an associated
  283. * element jax, null is returned. The element is either the DOM id of the element, or a reference to the DOM
  284. * element itself.
  285. */
  286. getJaxFor(element:any):any;
  287. /*Returns 0 if the element is not a <script> that can be processed by MathJax or the result of an output jax,
  288. * returns -1 if the element is an unprocessed <script> tag that could be handled by MathJax, and returns 1 if
  289. * the element is a processed <script> tag or an element that is the result of an output jax.
  290. */
  291. isJax(element:any):number;
  292. /*Sets the output jax for the given element jax type (or jax/mml if none is specified) to be the one given by
  293. * renderer, which must be the name of a renderer, such as NativeMML or HTML-CSS. Note that this does not cause
  294. * the math on the page to be rerendered; it just sets the renderer for output in the future
  295. * (call :meth:Rerender() above to replace the current renderings by new ones).
  296. */
  297. setRenderer(renderer:string, type:string):void;
  298. /*Inserts data from the src object into the dst object. The key:value pairs in src are (recursively) copied into
  299. * dst, so that if value is itself an object, its content is copied into the corresponding object in dst.
  300. * That is, objects within src are merged into the corresponding objects in dst (they don’t replace them).
  301. */
  302. Insert(dst:any, src:any):any;
  303. /*This is called when an internal error occurs during the processing of a math element (i.e., an error in the
  304. * MathJax code itself). The script is a reference to the <script> tag where the error occurred, and error is the
  305. * Error object for the error. The default action is to insert an HTML snippet at the location of the script, but
  306. * this routine can be overriden during MathJax configuration in order to perform some other action.
  307. * MathJax.Hub.lastError holds the error value of the last error on the page.
  308. */
  309. formatError(script:any, error:any):void;
  310. }
  311. export interface IRegister {
  312. /*Used by preprocessors to register themselves with MathJax so that they will be called during the
  313. * MathJax.Hub.PreProcess() action.
  314. */
  315. PreProcessor(callBack:any):void;
  316. /*Registers a listener for a particular message being sent to the hub processing signal (where PreProcessing,
  317. * Processing, and New Math messages are sent). When the message equals the type, the callback will be called
  318. * with the message as its parameter.
  319. */
  320. MessageHook(type:string, callBack:any):void;
  321. /*Registers a listener for a particular message being sent to the startup signal (where initialization and
  322. * component startup messages are sent). When the message equals the type, the callback will be called with the
  323. * message as its parameter. See the Using Signals documentation for more details.
  324. */
  325. StartupHook(type:string, callBack:any):void;
  326. /*Registers a callback to be called when a particular file is completely loaded and processed. (The callback is
  327. * called when the file makes its MathJax.Ajax.loadComplete() call.) The file should be the complete file name,
  328. * e.g., "[MathJax]/config/default.js".
  329. */
  330. LoadHook(file:string, callBack:Function):void;
  331. }
  332. export interface IBrowserInfo {
  333. /*The browser version number, e.g., "4.0"*/
  334. version:string;
  335. /*These are boolean values that indicate whether the browser is running on a Macintosh computer or a Windows
  336. * computer. They will both be false for a Linux computer.
  337. */
  338. isMac?:boolean;
  339. isPC?:boolean;
  340. /*This is true when MathJax is running a mobile version of a WebKit or Gecko-based browser.*/
  341. isMobile?:boolean;
  342. /*These are true when the browser is the indicated one, and false otherwise.*/
  343. isFirefox?:boolean;
  344. isSafari?:boolean;
  345. isChrome?:boolean;
  346. isOpera?:boolean;
  347. isMSIE?:boolean;
  348. isKonqueror?:boolean;
  349. /*This tests whether the browser version is at least that given in the version string. Note that you can not
  350. * simply do a numeric comparison, as version 4.10 should be considered later than 4.9, for example. Similarly,
  351. * 4.10 is different from 4.1, for instance.*/
  352. versionAtLeast(version:string):void;
  353. /* This lets you perform browser-specific functions. Here, choices is an object whose properties are the names of the browsers and whose values are the functions to be performed. Each function is passed one parameter, which is the MathJax.Hub.Browser object. You do not need to include every browser as one of your choices — only those for which you need to do special processing. For example:
  354. *MathJax.Hub.Browser.Select({
  355. * MSIE: function (browser) {
  356. * if (browser.versionAtLeast("8.0")) {... do version 8 stuff ... }
  357. * ... do general MSIE stuff ...
  358. * },
  359. * Firefox: function (browser) {
  360. * if (browser.isMac) {... do Mac stuff ... }
  361. * ... do general Firefox stuff
  362. * }
  363. *});*/
  364. Select(choices:any):void;
  365. }
  366. export interface IAjax {
  367. /*Number of milliseconds to wait for a file to load before it is considered to have failed to load.*/
  368. timeout?:number;
  369. STATUS:ISTATUS;
  370. /*An object containing the names of the files that have been loaded (or requested) so far.
  371. * MathJax.Ajax.loaded["file"] will be non-null when the file has been loaded, with the value being the
  372. * MathJax.Ajax.STATUS value of the load attempt.
  373. */
  374. loaded:any;
  375. /*An object containing the files that are currently loading, the callbacks that are to be run when they load or
  376. * timeout, and additional internal data.*/
  377. loading:boolean;
  378. /*An object containing the load hooks for the various files, set up by the LoadHook() method, or by the
  379. * MathJax.Hub.Register.LoadHook() method.
  380. */
  381. loadHooks:any;
  382. /*Loads the given file if it hasn’t been already. The file must be a JavaScript file or a CSS stylesheet; i.e.,
  383. * it must end in .js or .css. Alternatively, it can be an object with a single key:value pair where the key is
  384. * one of js or css and the value is the file of that type to be loaded (this makes it possible to have the file
  385. * be created by a CGI script, for example, or to use a data:: URL). The file must be relative to the MathJax
  386. * home directory and can not contain ../ file path components.
  387. *
  388. * When the file is completely loaded and run, the callback, if provided, will be executed passing it the status
  389. * of the file load. If there was an error while loading the file, or if the file fails to load within the time
  390. * limit given by MathJax.Ajax.timout, the status will be MathJax.Ajax.STATUS.ERROR otherwise it will be
  391. * MathJax.Ajax.STATUS.OK. If the file is already loaded, the callback will be called immediately and the file
  392. * will not be loaded again.
  393. */
  394. Require(file:string, callBack:any):any;
  395. /*Used internally to load a given file without checking if it already has been loaded, or where it is to
  396. * be found.
  397. */
  398. Load(file:string, callBack:any):any;
  399. /*Called from within the loaded files to inform MathJax that the file has been completely loaded and
  400. * initialized. The file parameter is the name of the file that has been loaded. This routine will cause any
  401. * callback functions registered for the file or included in the MathJax.Ajax.Require() calls to be executed,
  402. * passing them the status of the load (MathJax.Ajax.STATUS.OK or MathJax.Ajax.STATUS.ERROR) as their
  403. * last parameter.
  404. */
  405. loadComplete(file:string):void;
  406. /*Called when the timeout period is over and the file hasn’t loaded. This indicates an error condition, and the
  407. * MathJax.Ajax.loadError() method will be executed, then the file’s callback will be run with
  408. * MathJax.Ajax.STATUS.ERROR as its parameter.
  409. */
  410. loadTimeout(file:string):void;
  411. /*The default error handler called when a file fails to load. It puts a warning message into the MathJax message
  412. * box on screen.
  413. */
  414. loadError(file:string):void;
  415. /*Registers a callback to be executed when the given file is loaded. The file load operation needs to be started
  416. * when this method is called, so it can be used to register a hook for a file that may be loaded in the future.
  417. */
  418. LoadHook(file:string, callBack:any):any;
  419. /*Used with combined configuration files to indicate what files are in the configuration file. Marks the files
  420. * as loading (since there will never be an explicit Load() or Require() call for them), so that load-hooks and
  421. * other load-related events can be properly processed when the loadComplete() occurs.
  422. */
  423. Preloading(...args:any[]):void;
  424. /*Creates a stylesheet from the given style data. styles can either be a string containing a stylesheet
  425. * definition, or an object containing a CSS Style Object.
  426. */
  427. Styles(styles:any, callback:any):any;
  428. /*Returns a complete URL to a file (replacing [MathJax] with the actual root URL location).*/
  429. fileURL(file:string):string;
  430. }
  431. export interface ISTATUS {
  432. /*The value used to indicate that a file load has occurred successfully.*/
  433. OK:string;
  434. /*The value used to indicate that a file load has caused an error or a timeout to occur.*/
  435. ERROR:string;
  436. }
  437. export interface IMessage {
  438. /*This sets the message being displayed to the given message string. If n is not null, it represents a message
  439. * id number and the text is set for that message id, otherwise a new id number is created for this message. If
  440. * delay is provided, it is the time (in milliseconds) to display the message before it is cleared. If delay is
  441. * not provided, the message will not be removed automatically; you must call the MathJax.Messsage.Clear() method
  442. * by hand to remove it. If message is an array, then it represents a localizable string, as described in the
  443. * Localization strings documentation.
  444. */
  445. Set(message:string, n:number, delay:number):number;
  446. /*This causes the message with id n to be removed after the given delay, in milliseconds. The default delay is
  447. * 600 milliseconds.*/
  448. Clear(n:number, delay:number):void;
  449. /*This removes the message frame from the window (it will reappear when future messages are set, however).*/
  450. Remove():void;
  451. /*This sets the message area to a “Loading file” message, where file is the name of the file (with [MathJax]
  452. * representing the root directory).
  453. */
  454. File(file:string):number;
  455. /*This method is called on each message before it is displayed. It can be used to modify (e.g., shorten) the
  456. * various messages before they are displayed. The default action is to check if the messageStyle configuration
  457. * parameter is simple, and if so, convert loading and processing messages to a simpler form. This method can be
  458. * overridden to perform other sanitization of the message strings.
  459. */
  460. filterText(text:string, n:number):string;
  461. /*Returns a string of all the messages issued so far, separated by newlines. This is used in debugging MathJax
  462. * operations.
  463. */
  464. Log():string;
  465. }
  466. export interface IHTML {
  467. Cookie?:ICookie;
  468. /*Creates a DOM element of the given type. If attributes is non-null, it is an object that contains key:value
  469. * pairs of attributes to set for the newly created element. If contents is non-null, it is an HTML snippet that
  470. * describes the contents to create for the element.
  471. */
  472. Element(type:string, attributes:any, contents:any):any;
  473. /*Creates a DOM element and appends it to the parent node provided. It is equivalent to:
  474. * parent.appendChild(MathJax.HTML.Element(type,attributes,content))
  475. */
  476. addElement(parent:any, type:string, attributes:any, content:any):any;
  477. /*Creates a DOM text node with the given text as its content.*/
  478. TextNode(text:string):any;
  479. /*Creates a DOM text node with the given text and appends it to the parent node.*/
  480. addText(parent:any, text:string):any;
  481. /*Sets the contents of the script element to be the given text, properly taking into account the browser
  482. * limitations and bugs.
  483. */
  484. setScript(script:string, text:string):void;
  485. /*Gets the contents of the script element, properly taking into account the browser limitations and bugs.*/
  486. getScript(script:string):string;
  487. }
  488. export interface ICookie {
  489. prefix?:string;
  490. expires?:number;
  491. /*Creates a MathJax cookie using the MathJax.HTML.Cookie.prefix and the name as the cookie name, and the
  492. * key:value pairs in the data object as the data for the cookie.
  493. */
  494. Set(name:string,data:any):void
  495. /*Looks up the data for the cookie named name and merges the data into the given obj object, or returns a new
  496. * object containing the data.
  497. */
  498. Get(name:string):any;
  499. Get(name:string,obj:any):any;
  500. }
  501. export interface IMenuSettings {
  502. /*This indicates when typeset mathematics should be zoomed. It can be set to "None", "Hover", "Click", or
  503. * "Double-Click" to set the zoom trigger.
  504. */
  505. zoom?:string;
  506. /*These values indicate which keys must be pressed in order for math zoom to be triggered. For example, if CTRL
  507. * is set to true and zoom is "Click", then math will be zoomed only when the user control-clicks on mathematics
  508. * (i.e., clicks while holding down the CTRL key). If more than one is true, then all the indicated keys must be
  509. * pressed for the zoom to occur.
  510. */
  511. CTRL?:boolean;
  512. ALT?:boolean;
  513. CMD?:boolean;
  514. Shift?:boolean;
  515. /*This is the zoom scaling factor, and it can be set to any of the values available in the Zoom Factor menu of
  516. * the Settings submenu of the contextual menu.
  517. */
  518. zscale?:string;
  519. /*This controls what contextual menu will be presented when a right click (on a PC) or CTRL-click (on the Mac)
  520. * occurs over a typeset equation. When set to "MathJax", the MathJax contextual menu will appear; when set to
  521. * "Browser", the browser’s contextual menu will be used. For example, in Internet Explorer with the MathPlayer
  522. * plugin, if this is set to "Browser", you will get the MathPlayer contextual menu rather than the MathJax menu.
  523. */
  524. context?:string;
  525. /*This controls whether the “Show Source” menu item includes special class names that help MathJax to typeset
  526. * the mathematics that was produced by the TeX input jax. If these are included, then you can take the output
  527. * from “Show Source” and put it into a page that uses MathJax’s MathML input jax and expect to get the same
  528. * results as the original TeX. (Without this, there may be some spacing differences.)
  529. */
  530. texHints?: boolean;
  531. mpContext?: boolean;
  532. mpMouse?: boolean;
  533. }
  534. export interface IErrorSettings {
  535. /*This is an HTML snippet that will be inserted at the location of the mathematics for any formula that causes
  536. * MathJax to produce an internal error (i.e., an error in the MathJax code itself). See the description of HTML
  537. * snippets for details on how to represent HTML code in this way.
  538. */
  539. message?:string[];
  540. /*This is the CSS style description to use for the error messages produced by internal MathJax errors. See the
  541. * section on CSS style objects for details on how these are specified in JavaScript.
  542. */
  543. style?:any;
  544. }
  545. export interface IMathJaxConfig {
  546. MathZoom?:IMathZoom;
  547. MathMenu?:IMathMenu;
  548. MathEvents?:IMathEvents;
  549. FontWarnings?:IFontWarnings;
  550. Safe?:ISafe;
  551. MatchWebFonts?:IMatchWebFonts;
  552. SVG?:ISVGOutputProcessor;
  553. MMLorHTML?:IMMLorHTMLConfiguration;
  554. NativeMML?:INativeMMLOutputProcessor;
  555. "HTML-CSS"?:IHTMLCSSOutputProcessor;
  556. CommonHTML: ICommonHTMLOutputProcessor;
  557. AsciiMath?:IAsciiMathInputProcessor;
  558. MathML?:IMathMLInputProcessor;
  559. TeX?:ITeXInputProcessor;
  560. jsMath2jax?:IJSMath2jaxPreprocessor;
  561. asciimath2jax?:IAsciimath2jaxPreprocessor;
  562. mml2jax?:IMML2jaxPreprocessor;
  563. tex2jax?:ITEX2jaxPreprocessor;
  564. /*A list of input and output jax to initialize at startup. Their main code is loaded only when
  565. * they are actually used, so it is not inefficient to include jax that may not actually be used on the page.
  566. * These are found in the MathJax/jax directory.
  567. */
  568. jax?:string[];
  569. /*A list of extensions to load at startup. The default directory is MathJax/extensions. The
  570. * tex2jax and mml2jax preprocessors can be listed here, as well as a FontWarnings extension that you can use to
  571. * inform your user that mathematics fonts are available that they can download to improve their experience of
  572. * your site.
  573. */
  574. extensions?:string[];
  575. /*A list of configuration files to load when MathJax starts up, e.g., to define local macros,
  576. * etc., and there is a sample config file named config/local/local.js. The default directory is the
  577. * MathJax/config directory. The MMLorHTML.js configuration is one such configuration file, and there are a
  578. * number of other pre-defined configurations (see Using a configuration file for more details).
  579. */
  580. config?:string[];
  581. /*A list of CSS stylesheet files to be loaded when MathJax starts up. The default directory is
  582. * the MathJax/config directory.
  583. */
  584. styleSheets?:string[];
  585. /*CSS styles to be defined dynamically at startup time. These are in the form selector:rules (see CSS Style
  586. * Objects for complete details).
  587. */
  588. styles?:any;
  589. /*Patterns to remove from before and after math script tags. If you are not using one of the preprocessors, you
  590. * need to insert something extra into your HTML file in order to avoid a bug in Internet Explorer. IE removes
  591. * spaces from the DOM that it thinks are redundant, and since a <script> tag usually doesn’t add content to the
  592. * page, if there is a space before and after a MathJax <script> tag, IE will remove the first space. When
  593. * MathJax inserts the typeset mathematics, this means there will be no space before it and the preceding text.
  594. * In order to avoid this, you should include some “guard characters” before or after the math SCRIPT tag; define
  595. * the patterns you want to use below. Note that these are used as part of a regular expression, so you will need
  596. * to quote special characters. Furthermore, since they are javascript strings, you must quote javascript special
  597. * characters as well. So to obtain a backslash, you must use \\ (doubled for javascript). For example, "\\["
  598. * represents the pattern \[ in the regular expression, or [ in the text of the web page. That means that if you
  599. * want an actual backslash in your guard characters, you need to use "\\\\" in order to get \\ in the regular
  600. * expression, and \ in the actual text. If both preJax and postJax are defined, both must be present in order
  601. * to be removed.
  602. *
  603. * See also the preRemoveClass comments below.
  604. *
  605. * Examples:
  606. *
  607. * preJax: "\\\\\\\\\" makes a double backslash the preJax text
  608. *
  609. * preJax: "\\[\\[", postJax: "\\]\\]" makes it so jax scripts must be enclosed in double brackets.
  610. */
  611. preJax?:any;
  612. postJax?:any;
  613. /*This is the CSS class name for math previews that will be removed preceding a MathJax SCRIPT tag. If the tag
  614. * just before the MathJax <script> tag is of this class, its contents are removed when MathJax processes the
  615. * <script> tag. This allows you to include a math preview in a form that will be displayed prior to MathJax
  616. * performing its typesetting. It also avoids the Internet Explorer space-removal bug, and can be used in place
  617. * of preJax and postJax if that is more convenient.
  618. *
  619. * For example
  620. *
  621. * <span class="MathJax_Preview">[math]</span><script type="math/tex">...</script>
  622. * would display “[math]” in place of the math until MathJax is able to typeset it.
  623. */
  624. preRemoveClass?:string;
  625. /*This value controls whether the Processing Math: nn% messages are displayed in the lower left-hand corner.
  626. * Set to false to prevent those messages (though file loading and other messages will still be shown).
  627. */
  628. showProcessingMessages?:boolean;
  629. /*This value controls the verbosity of the messages in the lower left-hand corner. Set it to "none" to eliminate
  630. * all messages, or set it to "simple" to show “Loading...” and “Processing...” rather than showing the full file
  631. * name or the percentage of the mathematics processed.
  632. */
  633. messageStyle?:string;
  634. /*These two parameters control the alignment and shifting of displayed equations. The first can be "left",
  635. * "center", or "right", and determines the alignment of displayed equations. When the alignment is not "center",
  636. * the second determines an indentation from the left or right side for the displayed equations.*/
  637. displayAlign?:string;
  638. displayIndent?:string;
  639. /*Normally MathJax will perform its startup commands (loading of configuration, styles, jax, and so on) as soon
  640. * as it can. If you expect to be doing additional configuration on the page, however, you may want to have it
  641. * wait until the page’s onload handler is called. If so, set this to "onload". You can also set this to
  642. * "configured", in which case, MathJax will delay its startup until you explicitly call
  643. * MathJax.Hub.Configured(). See Configuring MathJax after it is loaded for more details.
  644. */
  645. delayStartupUntil?:string;
  646. /*Normally MathJax will typeset the mathematics on the page as soon as the page is loaded. If you want to delay
  647. * that process, in which case you will need to call MathJax.Hub.Typeset() yourself by hand, set this value to
  648. * true.
  649. */
  650. skipStartupTypeset?:boolean;
  651. /*This is a list of DOM element ID’s that are the ones to process for mathematics when any of the Hub typesetting
  652. * calls (Typeset(), Process(), Update(), etc.) are called with no element specified, and during MathJax’s initial
  653. * typesetting run when it starts up. This lets you restrict the processing to particular containers rather than
  654. * scanning the entire document for mathematics. If none are supplied, the complete document is processed.
  655. */
  656. elements?:string[];
  657. /*ince typesetting usually changes the vertical dimensions of the page, if the URL contains an anchor position,
  658. * then after the page is typeset, you may no longer be positioned at the correct position on the page. MathJax
  659. * can reposition to that location after it completes its initial typesetting of the page. This value controls
  660. * whether MathJax will reposition the browser to the #hash location from the page URL after typesetting for
  661. * the page.
  662. */
  663. positionToHash?:boolean;
  664. /*These control whether to attach the MathJax contextual menu to the expressions typeset by MathJax. Since the
  665. * code for handling MathPlayer in Internet Explorer is somewhat delicate, it is controlled separately via
  666. * showMathMenuMSIE, but the latter is now deprecated in favor of the MathJax contextual menu settings for
  667. * MathPlayer (see below).
  668. *
  669. * If showMathMenu is true, then right-clicking (on Windows or Linux) or control-clicking (on Mac OS X) will
  670. * produce a MathJax menu that allows you to get the source of the mathematics in various formats, change the
  671. * size of the mathematics relative to the surrounding text, get information about MathJax, and configure other
  672. * MathJax settings.
  673. *
  674. * Set this to false to disable the menu. When true, the MathMenu configuration block determines the operation
  675. * of the menu. See the MathMenu options for more details.
  676. *
  677. * These values used to be listed in the separate output jax, but have been moved to this more central location
  678. * since they are shared by all output jax. MathJax will still honor their values from their original positions,
  679. * if they are set there.
  680. */
  681. showMathMenu?:boolean;
  682. showMathMenuMSIE?:boolean;
  683. /*This block contains settings for the mathematics contextual menu that act as the defaults for the user’s
  684. * settings in that menu.
  685. * There are also settings for format, renderer, font, mpContext, and mpMouse, but these are maintained by
  686. * MathJax and should not be set by the page author.
  687. */
  688. menuSettings?:IMenuSettings;
  689. /*This block contains settings that control how MathJax responds to unexpected errors while processing
  690. * mathematical equations. Rather than simply crash, MathJax can report an error and go on.
  691. */
  692. errorSettings?:IErrorSettings;
  693. "v1.0-compatible"?:boolean;
  694. }
  695. export interface IMathZoom {
  696. /*This is a list of CSS declarations for styling the zoomed mathematics. See the definitions in
  697. * extensions/MathZoom.js for details of what are defined by default. See CSS Style Objects for details on how
  698. * to specify CSS style in a JavaScript object.
  699. */
  700. styles:any;
  701. }
  702. export interface IMathMenu {
  703. /*This is the hover delay for the display (in milliseconds) for submenus in the contextual menu: when the mouse
  704. * is over a submenu label for this long, the menu will appear. (The submenu also will appear if you click on its
  705. * label.)
  706. */
  707. delay?:number;
  708. /*This is the URL for the MathJax Help menu item. When the user selects that item, the browser opens a new window
  709. * with this URL.
  710. */
  711. helpURL?:string;
  712. /*This controls whether the “Math Renderer” item will be displayed in the “Math Settings” submenu of the MathJax
  713. * contextual menu. It allows the user to change between the HTML-CSS, NativeMML, and SVG output processors for
  714. * the mathematics on the page. Set to false to prevent this menu item from showing.
  715. */
  716. showRenderer?:boolean;
  717. /*This controls whether the “Font Preference” item will be displayed in the “Math Settings” submenu of the MathJax
  718. * contextual menu. This submenu lets the user select what font to use in the mathematics produced by the HTML-CSS
  719. * output processor. Note that changing the selection in the font menu will cause the page to reload. Set to false
  720. * to prevent this menu item from showing.
  721. * */
  722. showFontMenu?:boolean;
  723. /*This controls whether the “Language” item will be displayed in the MathJax contextual menu. This submenu allows
  724. * the user to select the language to use for the MathJax user interface, including the contextual menu, the about
  725. * and help dialogs, the message box at the lower left, and any warning messages produced by MathJax. Set this to
  726. * false to prevent this menu item from showing. This will force the user to use the language you have set for
  727. * MathJax.
  728. */
  729. showLocale?:boolean;
  730. /*This controls whether the “MathPlayer” item will be displayed in the “Math Settings” submenu of the MathJax
  731. * contextual menu. This submenu lets the user select what events should be passed on to the MathPlayer plugin,
  732. * when it is present. Mouse events can be passed on (so that clicks will be processed by MathPlayer rather than
  733. * MathJax), and menu events can be passed on (to allow the user access to the MathPlayer menu). Set to false to
  734. * prevent this menu item from showing.
  735. * */
  736. showMathPlayer?:boolean;
  737. /*This controls whether the “Contextual Menu” item will be displayed in the “Math Settings” submenu of the MathJax
  738. * contextual menu. It allows the user to decide whether the MathJax menu or the browser’s default contextual menu
  739. * will be shown when the context menu click occurs over mathematics typeset by MathJax. Set to false to prevent
  740. * this menu item from showing.
  741. */
  742. showContext?:boolean;
  743. /*These are the settings for the Annotation submenu of the “Show Math As” menu. If the <math> root element has a
  744. * <semantics> child that contains one of the following annotation formats, the source will be available via the
  745. * “Show Math As” menu. Each format has a list of possible encodings. For example, "TeX": ["TeX", "LaTeX",
  746. * "application/x-tex"] will map an annotation with an encoding of "TeX", "LaTeX", or "application/x-tex" to the
  747. * "TeX" menu.
  748. */
  749. semanticsAnnotations?:any;
  750. /*These are the settings for the window.open() call that creates the Show Source window. The initial width and
  751. * height will be reset after the source is shown in an attempt to make the window fit the output better.
  752. */
  753. windowSettings?:any;
  754. /*This is a list of CSS declarations for styling the menu components. See the definitions in
  755. * extensions/MathMenu.js for details of what are defined by default. See CSS Style Objects for details on how
  756. * to specify CSS style in a JavaScript object.
  757. */
  758. styles?:any;
  759. }
  760. export interface IMathEvents {
  761. /*This value is the time (in milliseconds) that a user must hold the mouse still over a math element before it
  762. * is considered to be hovering over the math.
  763. */
  764. hover?:number;
  765. /*This is a list of CSS declarations for styling the zoomed mathematics. See the definitions in
  766. * extensions/MathEvents.js for details of what are defined by default. See CSS Style Objects for details on how
  767. * to specify CSS style in a JavaScript object.
  768. */
  769. styles?:any;
  770. }
  771. export interface IFontWarnings {
  772. /*This sets the CSS styles to be used for the font warning message window. See the extensions/FontWarnings.js
  773. * file for details of what are set by default. See the CSS style objects for details about how to specify CSS
  774. * styles via javascript objects.
  775. */
  776. messageStyle?:any;
  777. /*This block contains HTML snippets to be used for the various messages that the FontWarning extension can
  778. * produce.
  779. * See the description of HTML snippets for details about how to describe the messages using HTML snippets. Note
  780. * that in addition to the usual rules for defining such snippets, the FontWarnings snippets can include
  781. * references to pre-defined snippets (that represent elements common to all three messages). These are defined
  782. * below in the HTML block, and are referenced using ["name"] within the snippet, where name is the name of one
  783. * of the snippets defined in the HTML configuration block
  784. */
  785. Message?:IHTMLMessages;
  786. /*This object defines HTML snippets that are common to more than one message in the Message section above. They
  787. * can be included in other HTML snippets by by using ["name"] in an HTML snippet, where name refers to the name
  788. * of the snippet in the HTML block.
  789. * You can add your own pre-defined HTML snippets to this object, or override the ones that are there with your
  790. * own text.
  791. */
  792. HTML?:IHTMLSnippets;
  793. /*This is the amount of time to show the FontWarning message, in milliseconds. The default is 12 seconds.
  794. * Setting this value to zero means that the message will not fade out (the user must close it manually).
  795. */
  796. removeAfter?:number;
  797. /*This is the number of steps to take while fading out the FontWarning message. More steps make for a smoother
  798. * fade-out. Set to zero to cause the message to be removed without fading.
  799. */
  800. fadeoutSteps?:number;
  801. /*This is the time used to perform the fade-out, in milliseconds. The default is 1.5 seconds.*/
  802. fadeoutTime?:number;
  803. }
  804. export interface IHTMLMessages {
  805. /*The message used for when MathJax uses web-based fonts (rather than local fonts installed on the user’s
  806. * system).
  807. */
  808. webFont?:any[];
  809. /*The message used for when MathJax must use image fonts rather than local or web-based fonts (for those
  810. * browsers that don’t handle the @font-face CSS directive).
  811. */
  812. imageFonts?:any[];
  813. /*The message used when MathJax is unable to find any font to use (i.e., neither local nor web-based nor
  814. * image-based fonts are available).
  815. */
  816. noFonts?:any[];
  817. }
  818. export interface IHTMLSnippets {
  819. /*The HTML for the close box in the FontWarning message.*/
  820. closeBox?:string;
  821. /*The HTML for a paragraph suggesting an upgrade to a more modern browser that supports web fonts.*/
  822. webfonts?:string;
  823. /*HTML that includes links to the MathJax and STIX font download pages.*/
  824. fonts?:string;
  825. /*HTML that gives the download link for the STIX fonts only. (Used in place of fonts when the HTML-CSS option
  826. * for availableFonts only includes the STIX fonts.)
  827. */
  828. STIXfonts?:string;
  829. /*HTML that gives the download link for the MathJax TeX fonts only. (Used in place of fonts when the HTML-CSS
  830. * option for availableFonts only includes the TeX fonts.)
  831. */
  832. TeXfonts?:string;
  833. }
  834. export interface ISafe {
  835. /*This block contains the flags that control what the Safe extension will allow, and what it will block. The
  836. * flags can be set to "all", "none", or "safe". When set to "all", no filtering is done for these values (this
  837. * gives MathJax’s default behavior). When set to "none", these values are always filtered out. When set to
  838. * "safe", then only some values are allowed.
  839. */
  840. allow?:ISafeAllow;
  841. /*This is the minimum font size (in em’s) that the TeX input jax will allow when fontsize is set to "safe" above.
  842. * The default is the size of \scriptsize. Values less than this are set to this value.
  843. */
  844. sizeMin?:number;
  845. /*This is the maximum font size (in em’s) that the TeX input jax will allow when fontsize is set to "safe" above.
  846. * The default is the size of \large. Values larger than this are set to this value.
  847. */
  848. sizeMax?:number;
  849. /*This is an object that lists the protocols that can be used in href attributes and the \href macro when URLs
  850. * is set to "safe" above.
  851. * Note that if a protocol doesn’t appear in the list, it is assumed to be false, so technically, javascript need
  852. * not have been listed, but it is given to make it explicit that it should not be allowed.
  853. */
  854. safeProtocols?:ISafeProtocols;
  855. /*This is an object that lists the style properties that can be used in MathML style attributes and the \style
  856. * and \bbox macros when styles is set to "safe" in the allowed property above.
  857. * Any style property that doesn’t appear on this list is not allowed to be entered and will be removed (silently)
  858. * from the style definition.
  859. */
  860. safeStyles?:ISafeStyles;
  861. /*This is an object that lists the TeX extensions that can be loaded via the \require{} macro when require is
  862. * set to "safe" in the allowed property above.
  863. * These configuration options give you a lot of control over what actions MathJax is allowed to take. It is also
  864. * possible override the individual filtering functions in order to customize the filtering even further, should
  865. * that be needed. See the code for the details of the function names and their definitions.
  866. */
  867. safeRequire?:ISafeRequire;
  868. }
  869. export interface ISafeAllow {
  870. /*When set to "safe" only URL’s with protocols that are listed in the safeProtocols property (see below) are
  871. * allowed as targets of href attributes or the \href macro. By default, these are http://, https://, and
  872. * file:// URL’s.
  873. */
  874. URLs?:string;
  875. /*When set to "safe", only class names that begin with MJX- and contain only letters, numbers, or the
  876. * characters -, _, or . are allowed.
  877. */
  878. classes?:string;
  879. /*When set to "safe", only ID’s that begin with MJX- and contain only letters, numbers, or the characters -, _,
  880. * or . are allowed.
  881. */
  882. cssIDs?:string;
  883. /*When set to "safe", only styles taken from a predefined set of styles are allowed to be given. These are
  884. * listed in the safeStyles property (see below).
  885. */
  886. styles?:string;
  887. /*When set to "safe", only the extensions listed in the safeRequire property (see below) are allowed to be
  888. * loaded by the \require{} macro.
  889. */
  890. require?:string;
  891. /*When set to "safe", MathJax will try to limit the font size to sizes between those given by the sizeMin and
  892. * sizeMax properties. These are .7 and 1.44 by default, which means sizes between \scriptsize and \large are
  893. * allowed. This also filters MathML fontsize, mathsize, and scriptminsize attributes, but here, "safe" acts as
  894. * "none", since they are given in sizes with units, and the actual size of the units is not determined at input
  895. * time (it is part of the output processing). In addition, the scriptlevel attribute is restricted to
  896. * non-negative values (so scripts can’t be made larger), and the scriptsizemultiplier is restricted to being
  897. * no larger than 1, and no less than .6.
  898. */
  899. fontsize?:string;
  900. }
  901. export interface ISafeProtocols {
  902. http?:boolean;
  903. https?:boolean;
  904. file?:boolean;
  905. javascript?:boolean;
  906. }
  907. export interface ISafeStyles {
  908. color?:boolean;
  909. backgroundColor?:boolean;
  910. border?:boolean;
  911. cursor?:boolean;
  912. margin?:boolean;
  913. padding?:boolean;
  914. textShadow?:boolean;
  915. fontFamily?:boolean;
  916. fontSize?:boolean;
  917. fontStyle?:boolean;
  918. fontWeight?:boolean;
  919. opacity?:boolean;
  920. outline?:boolean;
  921. }
  922. export interface ISafeRequire {
  923. action?:boolean;
  924. amscd?:boolean;
  925. amsmath?:boolean;
  926. amssymbols?:boolean;
  927. autobold?:boolean;
  928. "autoload-all"?:boolean;
  929. bbox?:boolean;
  930. begingroup?:boolean;
  931. boldsymbol?:boolean;
  932. cancel?:boolean;
  933. color?:boolean;
  934. enclose?:boolean;
  935. extpfeil?:boolean;
  936. HTML?:boolean;
  937. mathchoice?:boolean;
  938. mhchem?:boolean;
  939. newcommand?:boolean;
  940. noErrors?:boolean;
  941. noUndefined?:boolean;
  942. unicode?:boolean;
  943. verb?:boolean;
  944. }
  945. export interface IMatchWebFonts {
  946. /*This block controls whether to apply font size matching for each output mode.*/
  947. matchFor?:IMatchFor;
  948. /*Initial delay before the first check for web fonts (in milliseconds).*/
  949. fontCheckDelay?:number;
  950. /*How long to keep looking for fonts (in milliseconds).*/
  951. fontCheckTimeout?:number;
  952. }
  953. export interface IMatchFor {
  954. /*Whether to match the font size for the HTML-CSS output.*/
  955. "HTML-CSS"?:boolean;
  956. /*Whether to match the font size for the NativeMML output.*/
  957. NativeMML?:boolean;
  958. /*Whether to match the font size for the SVG output.*/
  959. SVG?:boolean;
  960. }
  961. export interface ISVGOutputProcessor {
  962. /*The scaling factor (as a percentage) of math with respect to the surrounding text. The SVG output processor
  963. * tries to match the ex-size of the mathematics with that of the text where it is placed, but you may want to
  964. * adjust the results using this scaling factor. The user can also adjust this value using the contextual menu
  965. * item associated with the typeset mathematics.
  966. */
  967. scale?:number;
  968. /*This gives a minimum scale (as a percent) for the scaling used by MathJax to match the equation to the
  969. * surrounding text. This will prevent MathJax from making the mathematics too small.
  970. */
  971. minScaleAdjust?:number;
  972. /*This is the font to use for rendering the mathematics. The possible values are TeX, STIX-Web, Asana-Math,
  973. * Neo-Euler, Gyre-Pagella, Gyre-Termes and Latin-Modern. Note that not all mathematical characters are available
  974. * in all fonts (e.g., Neo-Euler does not include italic characters), so some mathematics may work better in some
  975. * fonts than in others. The STIX-Web font is the most complete.
  976. */
  977. font?:string;
  978. /*This is the stroke width to use for all character paths (1em = 1000 units). This is a cheap way of getting
  979. * slightly lighter or darker characters, but remember that not all displays will act the same, so a value that
  980. * is good for you may not be good for everyone.
  981. */
  982. blacker?:number;
  983. /*This is the font-family CSS value used for characters that are not in the selected font (e.g., this is where
  984. * to look for characters not included in the MathJax TeX fonts). IE will stop looking after the first font that
  985. * exists on the system (even if it doesn’t contain the needed character), so order these carefully.
  986. */
  987. undefinedFamily?:string[];
  988. /*This setting controls whether <mtext> elements will be typeset using the math fonts or the font of the
  989. * surrounding text. When false, the font for mathvariant="normal" will be used; when true, the font will be
  990. * inherited from the surrounding paragraph.
  991. */
  992. mtextFontInherit?:boolean;
  993. /*This controls whether the MathML structure is retained and CSS classes are added to mark the original MathML
  994. * elements (as in the output from the HTML-CSS output jax). By default, the SVG output jax removes unneeded
  995. * nesting in order to produce a more efficient markup, but if you want to use CSS to style the elements as if
  996. * they were MathML, you might need to set this to true.
  997. */
  998. addMMLclasses?:boolean;
  999. /*EqnChunk is the number of equations that will be typeset before they appear on screen. Larger values make for
  1000. * less visual flicker as the equations are drawn, but also mean longer delays before the reader sees anything.
  1001. */
  1002. EqnChunk?:number;
  1003. /*EqChunkFactor is the factor by which the EqnChunk will grow after each chunk is displayed.*/
  1004. EqnChunkFactor?:number;
  1005. /*EqChunkDelay is the time (in milliseconds) to delay between chunks (to allow the browser to respond to other
  1006. * user interaction).
  1007. * Set EqnChunk to 1, EqnChunkFactor to 1, and EqnChunkDelay to 10 to get the behavior from MathJax v1.1 and
  1008. * below.
  1009. */
  1010. EqnChunkDelay?:number;
  1011. /*This option indicates whether MathJax should try to adjust the x-height of equations to match the x-height of
  1012. * the surrounding text. See the MatchWebFonts options for finer control, especially if you are using Web fonts.
  1013. */
  1014. matchFontHeight?:boolean;
  1015. /*This is an object that configures automatic linebreaking in the SVG output. In order to be backward compatible
  1016. * with earlier versions of MathJax, only explicit line breaks are performed by default, so you must enable line
  1017. * breaks if you want automatic ones.
  1018. */
  1019. linebreaks?:ILineBreaks;
  1020. /*This is a list of CSS declarations for styling the SVG output. See the definitions in jax/output/SVG/config.js
  1021. * for some examples of what are defined by default. See CSS Style Objects for details on how to specify CSS
  1022. * style in a JavaScript object.
  1023. */
  1024. styles?:any;
  1025. /*This sets the configuration options for <maction> elements with actiontype="tooltip". (See also the
  1026. * #MathJax_Tooltip style setting in jax/output/SVG/config.js, which can be overridden using the styles option
  1027. * above.)
  1028. */
  1029. tooltip?:IToolTip;
  1030. }
  1031. export interface ILineBreaks {
  1032. /*This controls the automatic breaking of expressions: when false, only linebreak="newline" is processed; when
  1033. * true, line breaks are inserted automatically in long expressions.
  1034. */
  1035. automatic?:boolean;
  1036. /*This controls how wide the lines of mathematics can be.
  1037. * Use an explicit width like "30em" for a fixed width. Use "container" to compute the size from the containing
  1038. * element. Use "nn% container" for a portion of the container. Use "nn%" for a portion of the window size.
  1039. * The container-based widths may be slower, and may not produce the expected results if the layout width changes
  1040. * due to the removal of previews or inclusion of mathematics during typesetting.
  1041. */
  1042. width?:string;
  1043. }
  1044. export interface IToolTip {
  1045. /*The delay (in milliseconds) before the tooltip is posted after the mouse is moved over the maction element.*/
  1046. delayPost:number;
  1047. /*The delay (in milliseconds) before the tooltop is cleared after the mouse moves out of the maction element.*/
  1048. delayClear:number;
  1049. /*The X offset from the mouse position (in pixels) where the tooltip will be placed.*/
  1050. offsetX:number;
  1051. /*The Y offset from the mouse position (in pixels) where the tooltip will be placed.*/
  1052. offsetY:number;
  1053. }
  1054. export interface IMMLorHTMLConfiguration {
  1055. /*This lets you set the preferred renderer on a browser-by-browser basis. You set the browser to either "MML" or
  1056. * "HTML" depending on whether you want to use the NativeMML or HTML-CSS output processor. Note that although
  1057. * Opera and Safari do process some MathML natively, their support is not sufficient to handle the more
  1058. * complicated output generated by MathJax, so their settings are "HTML" by default. Although Firefox does
  1059. * support a large subset of MathJax, it does not implement all the features needed by MathJax, and so it is
  1060. * also set to "HTML" by default (this is new in v2.0).
  1061. *
  1062. * Note that users can still use the MathJax contextual menu to select a different renderer after the default
  1063. * one has been chosen by MMLorHTML.js.
  1064. */
  1065. prefer?:IBrowserPreference;
  1066. }
  1067. export interface IBrowserPreference {
  1068. MSIE?:string;
  1069. Firefox?:string;
  1070. Safari?:string;
  1071. Chrome?:string;
  1072. Opera?:string;
  1073. other?:string;
  1074. }
  1075. export interface INativeMMLOutputProcessor {
  1076. /*The scaling factor (as a percentage) of math with respect to the surrounding text. The NativeMML output
  1077. * processor tries to match the ex-size of the mathematics with that of the text where it is placed, but you may
  1078. * want to adjust the results using this scaling factor. The user can also adjust this value using the contextual
  1079. * menu item associated with the typeset mathematics.
  1080. */
  1081. scale?:number;
  1082. /*This gives a minimum scale (as a percent) for the scaling used by MathJax to match the equation to the
  1083. * surrounding text. This will prevent MathJax from making the mathematics too small.
  1084. */
  1085. minScaleAdjust?:number;
  1086. /*This option indicates whether MathJax should try to adjust the x-height of equations to match the x-height of
  1087. * the surrounding text. See the MatchWebFonts options for finer control, especially if you are using Web fonts.
  1088. */
  1089. matchFontHeight?:boolean;
  1090. /*This is a list of CSS declarations for styling the NativeMML output. See the definitions in
  1091. * jax/output/NativeMML/config.js for some examples of what are defined by default. See CSS Style Objects for
  1092. * details on how to specify CSS style in a JavaScript object.
  1093. */
  1094. styles?:any;
  1095. }
  1096. export interface IHTMLCSSOutputProcessor {
  1097. /*The scaling factor (as a percentage) of math with respect to the surrounding text. The HTML-CSS output
  1098. * processor tries to match the ex-size of the mathematics with that of the text where it is placed, but you may
  1099. * want to adjust the results using this scaling factor. The user can also adjust this value using the contextual
  1100. * menu item associated with the typeset mathematics.
  1101. */
  1102. scale?:number;
  1103. /*This gives a minimum scale (as a percent) for the scaling used by MathJax to match the equation to the
  1104. * surrounding text. This will prevent MathJax from making the mathematics too small.
  1105. */
  1106. minScaleAdjust?:number;
  1107. /*This is a list of the fonts to look for on a user’s computer in preference to using MathJax’s web-based fonts.
  1108. * These must correspond to directories available in the jax/output/HTML-CSS/fonts directory, where MathJax
  1109. * stores data about the characters available in the fonts. Set this to ["TeX"], for example, to prevent the use
  1110. * of the STIX fonts, or set it to an empty list, [], if you want to force MathJax to use web-based or image
  1111. * fonts.
  1112. */
  1113. availableFonts?:string[];
  1114. /*Which font to prefer out of the availableFonts list, when more than one is available on the user’s computer.
  1115. * Set it to null if you want MathJax to use web-based or image fonts.
  1116. */
  1117. preferredFont?:string;
  1118. /*This is the web-based font to use when none of the fonts listed above are available on the user’s computer. The
  1119. * possible values are TeX, STIX-Web, Asana-Math, Neo-Euler, Gyre-Pagella, Gyre-Termes and Latin-Modern. Note
  1120. * that not all mathematical characters are available in all fonts (e.g., Neo-Euler does not include italic
  1121. * characters), so some mathematics may work better in some fonts than in others. The STIX-Web font is the most
  1122. * complete.
  1123. *
  1124. * These fonts are stored in the fonts/HTML-CSS folder in the MathJax directory. Set this to null to disable web
  1125. * fonts.
  1126. */
  1127. webFont?:string;
  1128. /* This is the font to use for image fallback mode (when none of the fonts listed above are available and the
  1129. * browser doesn’t support web-fonts via the @font-face CSS directive). Note that currently only the TeX font is
  1130. * available as an image font (they are stored in the fonts/HTML-CSS directory).
  1131. *
  1132. * Set this to null if you want to prevent the use of image fonts (e.g., you have deleted or not installed the
  1133. * image fonts on your server). In this case, only browsers that support web-based fonts will be able to view
  1134. * your pages without having the fonts installed on the client computer. The browsers that support web-based
  1135. * fonts include: IE6 and later, Chrome, Safari3.1 and above, Firefox3.5 and later, and Opera10 and later. Note
  1136. * that Firefox3.0 is not on this list.
  1137. */
  1138. imageFont?:string;
  1139. /*This is the font-family CSS value used for characters that are not in the selected font (e.g., for web-based
  1140. * fonts, this is where to look for characters not included in the MathJax web fonts). IE will stop looking after
  1141. * the first font that exists on the system (even if it doesn’t contain the needed character), so order these
  1142. * carefully.
  1143. */
  1144. undefinedFamily?:string[];
  1145. /*This setting controls whether <mtext> elements will be typeset using the math fonts or the font of the
  1146. * surrounding text. When false, the font for mathvariant="normal" will be used; when true, the font will be
  1147. * inherited from the surrounding paragraph.
  1148. */
  1149. mtextFontInherit?:boolean;
  1150. /*EqnChunk is the number of equations that will be typeset before they appear on screen. Larger values make for
  1151. * less visual flicker as the equations are drawn, but also mean longer delays before the reader sees anything.
  1152. */
  1153. EqnChunk?:number;
  1154. /*EqChunkFactor is the factor by which the EqnChunk will grow after each chunk is displayed.*/
  1155. EqnChunkFactor?:number;
  1156. /*EqChunkDelay is the time (in milliseconds) to delay between chunks (to allow the browser to respond to other
  1157. * user interaction).
  1158. * Set EqnChunk to 1, EqnChunkFactor to 1, and EqnChunkDelay to 10 to get the behavior from MathJax v1.1 and
  1159. * below.
  1160. */
  1161. EqnChunkDelay?:number;
  1162. /*This option indicates whether MathJax should try to adjust the x-height of equations to match the x-height of
  1163. * the surrounding text. See the MatchWebFonts options for finer control, especially if you are using Web fonts.
  1164. */
  1165. matchFontHeight?:boolean;
  1166. /*This is an object that configures automatic linebreaking in the SVG output. In order to be backward compatible
  1167. * with earlier versions of MathJax, only explicit line breaks are performed by default, so you must enable line
  1168. * breaks if you want automatic ones.
  1169. */
  1170. linebreaks?:ILineBreaks;
  1171. /*This is a list of CSS declarations for styling the SVG output. See the definitions in jax/output/SVG/config.js
  1172. * for some examples of what are defined by default. See CSS Style Objects for details on how to specify CSS
  1173. * style in a JavaScript object.
  1174. */
  1175. styles?:any;
  1176. /*This value has been moved to the core configuration block, since it applies to all output jax, but it will
  1177. * still be honored (for now) if it is set here. See the Core configuration options for more details.
  1178. */
  1179. showMathMenu?:boolean;
  1180. /*This sets the configuration options for <maction> elements with actiontype="tooltip". (See also the
  1181. * #MathJax_Tooltip style setting in jax/output/SVG/config.js, which can be overridden using the styles option
  1182. * above.)
  1183. */
  1184. tooltip?:IToolTip;
  1185. }
  1186. export interface ICommonHTMLOutputProcessor {
  1187. /*The scaling factor (as a percentage) of math with respect to the surrounding text. The HTML-CSS output
  1188. * processor tries to match the ex-size of the mathematics with that of the text where it is placed, but you may
  1189. * want to adjust the results using this scaling factor. The user can also adjust this value using the contextual
  1190. * menu item associated with the typeset mathematics.
  1191. */
  1192. scale?:number;
  1193. /*This gives a minimum scale (as a percent) for the scaling used by MathJax to match the equation to the
  1194. * surrounding text. This will prevent MathJax from making the mathematics too small.
  1195. */
  1196. minScaleAdjust?:number;
  1197. /*This setting controls whether <mtext> elements will be typeset using the math fonts or the font of the
  1198. * surrounding text. When false, the font for mathvariant="normal" will be used; when true, the font will be
  1199. * inherited from the surrounding paragraph.
  1200. */
  1201. mtextFontInherit?:boolean;
  1202. /*This is an object that configures automatic linebreaking in the SVG output. In order to be backward compatible
  1203. * with earlier versions of MathJax, only explicit line breaks are performed by default, so you must enable line
  1204. * breaks if you want automatic ones.
  1205. */
  1206. linebreaks?:ILineBreaks;
  1207. }
  1208. export interface IAsciiMathInputProcessor {
  1209. /*Determines whether operators like summation symbols will have their limits above and below the operators
  1210. * (true) or to their right (false). The former is how they would appear in displayed equations that appear on
  1211. * their own lines, while the latter is better suited to in-line equations so that they don’t interfere with the
  1212. * line spacing so much.
  1213. */
  1214. displaystyle?:boolean;
  1215. /*This is the character to be used for decimal points in numbers. if you change this to ",", then you need to be
  1216. * careful about entering points or intervals. E.g., use (1, 2) rather than (1,2) in that case.
  1217. */
  1218. decimal?:string;
  1219. }
  1220. export interface IMathMLInputProcessor {
  1221. /*Specifies whether to use TeX spacing or MathML spacing when the HTML-CSS output jax is used.*/
  1222. useMathMLspacing?:boolean;
  1223. }
  1224. export interface ITeXInputProcessor {
  1225. /*This specifies the side on which \tag{} macros will place the tags. Set it to "left" to place the tags on the
  1226. * left-hand side.
  1227. */
  1228. TagSide?:string;
  1229. /*This is the amount of indentation (from the right or left) for the tags produced by the \tag{} macro.*/
  1230. TagIndent?:string;
  1231. /*The width to use for the multline environment that is part of the AMSmath extension. This width gives room for
  1232. * tags at either side of the equation, but if you are displaying mathematics in a small area or a thin column of
  1233. * text, you might need to change the value to leave sufficient margin for tags.
  1234. */
  1235. MultLineWidth?:string;
  1236. /*This object controls the automatic equation numbering and the equation referencing.*/
  1237. equationNumbers?:IEquationNumbers;
  1238. /*This lists macros to define before the TeX input processor begins. These are name:value pairs where the name
  1239. * gives the name of the TeX macro to be defined, and value gives the replacement text for the macro. The value
  1240. * can be an array of the form [value,n], where value is the replacement text and n is the number of parameters
  1241. * for the macro. Note that since the value is a javascript string, backslashes in the replacement text must be
  1242. * doubled to prevent them from acting as javascript escape characters.
  1243. */
  1244. Macros?:any;
  1245. /*Because a definition of the form \def\x{\x} \x would cause MathJax to loop infinitely, the MAXMACROS constant
  1246. * will limit the number of macro substitutions allowed in any expression processed by MathJax.
  1247. */
  1248. MAXMACROS?:number;
  1249. /*Because a definition of the form \def\x{\x aaa} \x would loop infinitely, and at the same time stack up lots
  1250. * of a’s in MathJax’s equation buffer, the MAXBUFFER constant is used to limit the size of the string being
  1251. * processed by MathJax. It is set to 5KB, which should be sufficient for any reasonable equation.
  1252. */
  1253. MAXBUFFER?: number;
  1254. /*A comma-separated list of extensions to load at startup. The default directory is MathJax/extensions. The
  1255. * tex2jax and mml2jax preprocessors can be listed here, as well as a FontWarnings extension that you can use to
  1256. * inform your user that mathematics fonts are available that they can download to improve their experience of
  1257. * your site.
  1258. */
  1259. extensions?: string[];
  1260. }
  1261. export interface IEquationNumbers {
  1262. /*This controls whether equations are numbered and how. By default it is set to "none" to be compatible with
  1263. * earlier versions of MathJax where auto-numbering was not performed (so pages will not change their
  1264. * appearance). You can change this to "AMS" for equations numbered as the AMSmath package would do, or "all" to
  1265. * get an equation number for every displayed equation.
  1266. */
  1267. autoNumber?:string;
  1268. /*A function that tells MathJax what tag to use for equation number n. This could be used to have the equations
  1269. * labeled by a sequence of symbols rather than numbers, or to use section and subsection numbers instead.
  1270. */
  1271. formatNumber?:(n:number)=>string;
  1272. /*A function that tells MathJax how to format an equation number for displaying as a tag for an equation. This
  1273. * is what appears in the margin of a tagged or numbered equation.*/
  1274. formatTag?:(n:number)=>string;
  1275. /*A function that tells MathJax what ID to use as an anchor for the equation (so that it can be used in URL
  1276. * references).
  1277. */
  1278. formatID?:()=>string;
  1279. /*A function that takes an equation ID and returns the URL to link to it.*/
  1280. formatURL?:(id:string)=>string;
  1281. /*This controls whether element ID’s use the \label name or the equation number. When true, use the label, when
  1282. * false, use the equation number.
  1283. */
  1284. useLabelIds?:boolean;
  1285. }
  1286. export interface IJSMath2jaxPreprocessor {
  1287. /*This controls whether jsMath2jax inserts MathJax_Preview spans to make a preview available, and what preview
  1288. * to use, when it locates in-line or display mathematics in the page. The default is "TeX", which means use the
  1289. * TeX code as the preview (which will be visible until it is processed by MathJax). Set to "none" to prevent
  1290. * previews from being inserted (the math will simply disappear until it is typeset). Set to an array containing
  1291. * the description of an HTML snippet in order to use the same preview for all equations on the page.
  1292. */
  1293. preview:any;
  1294. }
  1295. export interface IAsciimath2jaxPreprocessor {
  1296. /*Array of pairs of strings that are to be used as math delimiters. The first in each pair is the initial
  1297. * delimiter and the second is the terminal delimiter. You can have as many pairs as you want. For example,
  1298. *
  1299. * delimiters: [ ['$','$'], ['`','`'] ]
  1300. * would cause asciimath2jax to look for $...$ and `...` as delimiters for inline mathematics. (Note that the
  1301. * single dollar signs are not enabled by default because they are used too frequently in normal text, so if you
  1302. * want to use them for math delimiters, you must specify them explicitly.)
  1303. *
  1304. * Note that the delimiters can’t look like HTML tags (i.e., can’t include the less-than sign), as these would be
  1305. * turned into tags by the browser before MathJax has the chance to run. You can only include text, not tags,
  1306. * as your math delimiters.
  1307. */
  1308. delimiters?:any;
  1309. /*This controls whether asciimath2jax inserts MathJax_Preview spans to make a preview available, and what
  1310. * preview to use, when it locates in-line or display mathematics in the page. The default is "AsciiMath", which
  1311. * means use the ASCIIMath code as the preview (which will be visible until it is processed by MathJax). Set to
  1312. * "none" to prevent previews from being inserted (the math will simply disappear until it is typeset). Set to
  1313. * an array containing the description of an HTML snippet in order to use the same preview for all equations
  1314. * on the page.
  1315. *
  1316. * Examples:
  1317. *
  1318. * preview: ["[math]"], // insert the text "[math]" as the preview
  1319. * preview: [["img",{src: "/images/mypic.jpg"}]], // insert an image as the preview
  1320. */
  1321. preview?:any;
  1322. /*This array lists the names of the tags whose contents should not be processed by asciimath2jax (other than to
  1323. * look for ignore/process classes as listed below). You can add to (or remove from) this list to prevent MathJax
  1324. * from processing mathematics in specific contexts.
  1325. */
  1326. skipTags?:string[];
  1327. /*This is the class name used to mark elements whose contents should not be processed by asciimath2jax (other
  1328. * than to look for the processClass pattern below). Note that this is a regular expression, and so you need to
  1329. * be sure to quote any regexp special characters. The pattern is inserted into one that requires your pattern to
  1330. * match a complete word, so setting ignoreClass: "class2" would cause it to match an element with class="class1
  1331. * class2 class3" but not class="myclass2". Note that you can assign several classes by separating them by the
  1332. * vertical line character (|). For instance, with ignoreClass: "class1|class2" any element assigned a class of
  1333. * either class1 or class2 will be skipped.
  1334. */
  1335. ignoreClass?:string;
  1336. /*This is the class name used to mark elements whose contents should be processed by asciimath2jax. This is used
  1337. * to restart processing within tags that have been marked as ignored via the ignoreClass or to cause a tag that
  1338. * appears in the skipTags list to be processed rather than skipped. Note that this is a regular expression, and
  1339. * so you need to be sure to quote any regexp special characters. The pattern is inserted into one that requires
  1340. * your pattern to match a complete word, so setting processClass: "class2" would cause it to match an element
  1341. * with class="class1 class2 class3" but not class="myclass2". Note that you can assign several classes by
  1342. * separating them by the vertical line character (|). For instance, with processClass: "class1|class2" any
  1343. * element assigned a class of either class1 or class2 will have its contents processed.
  1344. */
  1345. processClass?:string;
  1346. }
  1347. export interface IMML2jaxPreprocessor {
  1348. /*This controls whether mml2jax inserts MathJax_Preview spans to make a preview available, and what preview to
  1349. * use, when it locates mathematics on the page. Possible values are: "mathml", "alttext", , "altimg", "none",
  1350. * or an HTML snippet.
  1351. *
  1352. * The default is "mathml", in which case MathJax keeps the content of the <math> tag as the preview (until it is
  1353. * processed by MathJax). Set to "alttext", to use the <math> tag’s alttext attribute as the preview, if the tag
  1354. * has one. Set to "altimg" to use an image described by the altimg* attributes of the <math> element. Set to
  1355. * "none" to prevent the previews from being inserted (the math will simply disappear until it is typeset). Set
  1356. * to an array containing the description of an HTML snippet in order to use the same preview for all equations
  1357. * on the page (e.g., you could have it say "[math]" or load an image).
  1358. *
  1359. * Examples:
  1360. *
  1361. * preview: ["[math]"], // insert the text "[math]" as the preview
  1362. * preview: [["img",{src: "/images/mypic.jpg"}]], // insert an image as the preview
  1363. */
  1364. preview?:any;
  1365. }
  1366. export interface ITEX2jaxPreprocessor {
  1367. /*Array of pairs of strings that are to be used as in-line math delimiters. The first in each pair is the
  1368. * initial delimiter and the second is the terminal delimiter. You can have as many pairs as you want. For
  1369. * example,
  1370. *
  1371. * inlineMath: [ ['$','$'], ['\\(','\\)'] ]
  1372. * would cause tex2jax to look for $...$ and \(...\) as delimiters for inline mathematics. (Note that the single
  1373. * dollar signs are not enabled by default because they are used too frequently in normal text, so if you want to
  1374. * use them for math delimiters, you must specify them explicitly.)
  1375. *
  1376. * Note that the delimiters can’t look like HTML tags (i.e., can’t include the less-than sign), as these would be
  1377. * turned into tags by the browser before MathJax has the chance to run. You can only include text, not tags, as
  1378. * your math delimiters.
  1379. */
  1380. inlineMath?:any;
  1381. /*Array of pairs of strings that are to be used as delimiters for displayed equations. The first in each pair is
  1382. * the initial delimiter and the second is the terminal delimiter. You can have as many pairs as you want.
  1383. *
  1384. * Note that the delimiters can’t look like HTML tags (i.e., can’t include the less-than sign), as these would be
  1385. * turned into tags by the browser before MathJax has the chance to run. You can only include text, not tags, as
  1386. * your math delimiters.
  1387. */
  1388. displayMath?:any;
  1389. /*This value determines whether tex2jax requires braces to be balanced within math delimiters (which allows for
  1390. * nested dollar signs). Set to false to get pre-v2.0 compatibility. When true,
  1391. *
  1392. * $y = x^2 \hbox{ when $x > 2$}$.
  1393. * will be properly handled as a single expression. When false, it would be interpreted as two searpate
  1394. * expressions, each with improperly balanced braces.
  1395. */
  1396. balanceBraces?:boolean;
  1397. /*When set to true, you may use \$ to represent a literal dollar sign, rather than using it as a math delimiter.
  1398. * When false, \$ will not be altered, and the dollar sign may be considered part of a math delimiter. Typically
  1399. * this is set to true if you enable the $ ... $ in-line delimiters, so you can type \$ and tex2jax will convert
  1400. * it to a regular dollar sign in the rendered document.
  1401. */
  1402. processEscapes?:boolean;
  1403. /*When true, tex2jax looks not only for the in-line and display math delimiters, but also for LaTeX environments
  1404. * (\begin{something}...\end{something}) and marks them for processing by MathJax. When false, LaTeX environments
  1405. * will not be processed outside of math mode.
  1406. */
  1407. processEnvironments?:boolean;
  1408. /*This controls whether tex2jax inserts MathJax_Preview spans to make a preview available, and what preview to
  1409. * use, when it locates in-line or display mathematics in the page. The default is "TeX", which means use the TeX
  1410. * code as the preview (which will be visible until it is processed by MathJax). Set to "none" to prevent
  1411. * previews from being inserted (the math will simply disappear until it is typeset). Set to an array containing
  1412. * the description of an HTML snippet in order to use the same preview for all equations on the page.
  1413. *
  1414. * Examples:
  1415. *
  1416. * preview: ["[math]"], // insert the text "[math]" as the preview
  1417. * preview: [["img",{src: "/images/mypic.jpg"}]], // insert an image as the preview
  1418. */
  1419. preview?:any;
  1420. /*This array lists the names of the tags whose contents should not be processed by tex2jax (other than to look
  1421. * for ignore/process classes as listed below). You can add to (or remove from) this list to prevent MathJax from
  1422. * processing mathematics in specific contexts.
  1423. */
  1424. skipTags?:string[];
  1425. /*This is the class name used to mark elements whose contents should not be processed by tex2jax (other than to
  1426. * look for the processClass pattern below). Note that this is a regular expression, and so you need to be sure
  1427. * to quote any regexp special characters. The pattern is inserted into one that requires your pattern to match
  1428. * a complete word, so setting ignoreClass: "class2" would cause it to match an element with class="class1 class2
  1429. * class3" but not class="myclass2". Note that you can assign several classes by separating them by the vertical
  1430. * line character (|). For instance, with ignoreClass: "class1|class2" any element assigned a class of either
  1431. * class1 or class2 will be skipped.
  1432. */
  1433. ignoreClass?:string;
  1434. /*This is the class name used to mark elements whose contents should be processed by tex2jax. This is used to
  1435. * restart processing within tags that have been marked as ignored via the ignoreClass or to cause a tag that
  1436. * appears in the skipTags list to be processed rather than skipped. Note that this is a regular expression, and
  1437. * so you need to be sure to quote any regexp special characters. The pattern is inserted into one that requires
  1438. * your pattern to match a complete word, so setting processClass: "class2" would cause it to match an element
  1439. * with class="class1 class2 class3" but not class="myclass2". Note that you can assign several classes by
  1440. * separating them by the vertical line character (|). For instance, with processClass: "class1|class2" any
  1441. * element assigned a class of either class1 or class2 will have its contents processed.*/
  1442. processClass?:string;
  1443. }
  1444. export interface ILocalization {
  1445. /*The currently selected locale, e.g., "fr". This is set by the setLocale() method, and should not be modified
  1446. * by hand.
  1447. */
  1448. locale:string;
  1449. /*The URL for the localization data files. This can be overridden for individual languages or domains
  1450. * (see below). The default is [MathJax]/localization.
  1451. */
  1452. directory:string;
  1453. /*This is the main data structure that holds the translation strings. It consists of an entry for each language
  1454. * that MathJax knows about, e.g., there would be an entry with key fr whose value is the data for the French
  1455. * translation. Initially, these simply reference the files that define the translation data, which MathJax will
  1456. * load when needed. After the file is loaded, they will contain the translation data as well. This is described
  1457. * in more detail below.
  1458. */
  1459. strings:any;
  1460. /*The function (described in detail above) that returns the translated string for a given id, substituting the
  1461. * given arguments as needed.
  1462. */
  1463. _(id:number, message:string, ...args:any[]):void;
  1464. /*Sets the selected locale to the given one*/
  1465. setLocale(locale:string):void;
  1466. /*Defines (or adds to) the translation data for the given locale and domain. The def is the definition to be
  1467. * merged with the current translation data (if it exists) or to be used as the complete definition (if not).
  1468. */
  1469. addTranslation(locale:string, domain:string, def:any):void;
  1470. /*Sets the CSS for the given div to reflect the needs of the locale. In particular, it sets the font-family,
  1471. * if needed, and the direction (for right-to-left languages).
  1472. */
  1473. setCSS(div:any):any;
  1474. /*Get the font-family needed to display text in the selected language. Returns null if no special font is
  1475. * required.
  1476. */
  1477. fontFamily():string;
  1478. /*Get the direction needed to display text in the selected language. Returns null if no special font is
  1479. * required.*/
  1480. fontDirection():string;
  1481. /*The method that returns the index into the list of plural texts for the value n. See the [CLDR rules]
  1482. * (http://unicode.org/cldr/charts/supplemental/language_plural_rules.html) for more information. This calls the
  1483. * locale’s plural() method, if there is one, otherwise it defaults to the English version.
  1484. */
  1485. plural(value:any):number;
  1486. /*The method that returns the localized version of the number n. This calls the locale’s number() method, if
  1487. * there is one, otherwise it defaults to the English version.
  1488. */
  1489. number(value:number):string;
  1490. /*This causes MathJax to load the data file for the given domain in the current language, and calls the callback
  1491. * when that is complete. If the domain is already loaded, the callback is called immediately. This lets you
  1492. * synchronize actions that require localization with the loading of the needed data so that you are sure that
  1493. * the needed translations are available. See the section on synchonization above for details.
  1494. */
  1495. loadDomain(domain:string):ICallbackObject;
  1496. loadDomain(domain:string, callback:ICallbackObject):ICallbackObject;
  1497. /*This method runs the function fn with error trapping and if an asynchronous file load is performed (for loading
  1498. * localizaton data), reruns the function again after the file loads. This lets you synchronize actions that
  1499. * require localization with the loading of the needed data (see the section on synchronization above for
  1500. * details). Note that the function should be one that can be run multiple times, if needed. Also note that Try()
  1501. * can return before the fn has been completed, so you should consider fn to be running asynchronously (you can
  1502. * use callbacks to synchronize with other actions, if needed).
  1503. */
  1504. Try(spec:any):void;
  1505. }
  1506. export interface IInputJax {
  1507. /*The name of the jax.*/
  1508. id:string;
  1509. /*The version number of the jax.*/
  1510. version:string;
  1511. /*The directory where the jax files are stored (e.g., "[MathJax]/jax/input/TeX").*/
  1512. directory:string;
  1513. /*The name of the ElementJax class that this input jax will produce (typically mml, as that is the only
  1514. * ElementJax at the moment).
  1515. */
  1516. elementJax:string;
  1517. /*This is the method that the MathJax.Hub calls when it needs the input jax to process the given math <script>.
  1518. * Its default action is to do the following:
  1519. *
  1520. * Start loading any element jax specified in the elementJax array;
  1521. * Start loading the jax’s jax.js file;
  1522. * Start loading the required output jax (so it is ready when needed); and
  1523. * Redefine itself to simply return the callback for the load operation (so that further calls to it will cause
  1524. * the processing to wait for the callback).
  1525. * Once the jax.js file has loaded, this method is replaced by the jax’s Translate() method (see below), so that
  1526. * subsequent calls to Process() will perform the appropriate translation.
  1527. */
  1528. Process(script:any, state:any):any;
  1529. /*This is the main routine called by MathJax when a <script> of the appropriate type is found. The default
  1530. * Translate() method throws an error indicating that Translate() hasn’t been defined, so when the jax.js file
  1531. * loads, it should override the default Translate() with its own version that does the actual translation.
  1532. *
  1533. * The translation process should include the creation of an Element Jax that stores the data needed for this
  1534. * element.
  1535. */
  1536. Translate(script:any, state:any):IElementJax;
  1537. /*This registers the MIME-type associated with this input jax so that MathJax knows to call this input jax when
  1538. * it sees a <script> of that type. An input jax can register more than one type, but it will be responsible for
  1539. * distinguishing elements of the various types from one another.
  1540. */
  1541. Register(mimetype:string):void;
  1542. /*This implements the element jax’s needsUpdate() method, and returns true if the jax needs to be rerendered
  1543. * (i.e., the text has changed), and false otherwise.
  1544. */
  1545. needsUpdate(element:any):boolean;
  1546. }
  1547. export interface IOutputJax {
  1548. /*The name of the jax.*/
  1549. id:string;
  1550. /*The version number of the jax.*/
  1551. version:string;
  1552. /*The directory where the jax files are stored (e.g., "[MathJax]/jax/output/HTML-CSS");*/
  1553. directory:string;
  1554. /*The directory where the fonts are stored (e.g., "[MathJax]/fonts")*/
  1555. fontDir:string;
  1556. /*The directory where MathJax images are found (e.g. "[MathJax]/images")*/
  1557. imageDir:string;
  1558. /*This is called by MathJax.Hub to ask the output processor to prepare to process math scripts. Its default
  1559. * action is to start loading the jax’s jax.js file, and redefine itself to simply return the callback for the
  1560. * load operation (so that further calls to it will cause the processing to wait for the callback).
  1561. *
  1562. * Once the jax.js file has loaded, this method is replaced by the jax’s preTranslate() method, so that subsequent
  1563. * calls to preProcess() will perform the appropriate translation.
  1564. */
  1565. preProcess(state:any):void;
  1566. /*This routine replaces preProcess() above when the jax’s jax.js file is loaded. It is called by MathJax.Hub to
  1567. * ask the output processor to prepare to process math scripts. (For example, the HTML-CSS output jax uses this
  1568. * to determine em-sizes for all the mathematics at once, to minimize page reflows that slow down Internet
  1569. * Explorer.)
  1570. *
  1571. * The routine can use state.jax[this.id] to obtain the array of element jax that are to be processed. The output
  1572. * jax can use the state variable to maintain its own state information, but any properties that it adds to the
  1573. * variable should have a prefix that is the output jax’s ID. For example, the HTML-CSS output jax might use
  1574. * state.HTMLCSSlast to keep track of the last equation it processed, or could add state.HTMLCSS = {...} to
  1575. * create an object of its own within the state variable.
  1576. */
  1577. preTranslate(state:any):void;
  1578. /*This is the main routine called by MathJax when an element jax is to be converted to output. The default
  1579. * Translate() method throws an error indicating that Translate() hasn’t been defined, so when the jax.js file
  1580. * loads, it should override the default Translate() with its own version that does the actual translation.
  1581. *
  1582. * You should use MathJax.Hub.getJaxFor(script) to obtain the element jax for the given script. The translation
  1583. * process may modify the element jax (e.g., if it has data that needs to be stored with the jax), and may insert
  1584. * DOM elements into the document near the jax’s <script> tag. The output jax can use the state variable to
  1585. * maintain information about its processing state, but see preTranslate() above for naming conventions for
  1586. * properties that are added.
  1587. */
  1588. Translate(script:any, state:any):IElementJax;
  1589. /*This routines is called by MathJax.Hub when the translation of math elements is complete, and can be used by
  1590. * the output processor to finalize any actions that it needs to complete. (For example, making the mathematics
  1591. * visible, or forcing a reflow of the page.)
  1592. *
  1593. * The routine can use state.jax[this.id] to obtain the array of element jax that were processed, or can use the
  1594. * state variable to store its own state information (see preProcess() above for caveats about naming
  1595. * properties).
  1596. */
  1597. postTranslate(state:any):void;
  1598. /*This registers the MIME-type for the element jax associated with this output jax so that MathJax knows to call
  1599. * this jax when it wants to display an element jax of that type. Several output jax may register for the same
  1600. * input jax, in which case the first one to register will be the default one for that type.
  1601. */
  1602. Register(mimetype:string):void;
  1603. /*Removes the output associated with the given element jax. The routine can use jax.SourceElement() to locate
  1604. * the <script> tag associated with the element jax.
  1605. */
  1606. Remove(jax:any):void;
  1607. /*This is called by the event-handling code (MathEvents) to get the element jax associated with the DOM element
  1608. * that caused an event to occur. The output jax will have attached event handlers to some DOM element that is
  1609. * part of its output, and the MathEvents code uses this routine to map back to the jax associated with that
  1610. * output.
  1611. */
  1612. getJaxFromMath(math:any):IElementJax;
  1613. Zoom(jax:any, span:any, math:any, Mw:number, Mh:number):IZoomStruct;
  1614. }
  1615. export interface IZoomStruct {
  1616. /*The vertical offset from the top of the span to the baseline of the mathematics*/
  1617. Y:number;
  1618. /*The width of the original mathematics element*/
  1619. mW:number;
  1620. /*The height of the original mathematics element*/
  1621. mH:number;
  1622. /*The width of the zoomed math*/
  1623. zW:number;
  1624. /*The height of the zoomed math*/
  1625. zH:number;
  1626. }
  1627. export interface IElementJax {
  1628. /*The name of the jax.*/
  1629. id:string;
  1630. /*The version number of the jax.*/
  1631. version:string;
  1632. /*The directory where the jax files are stored (e.g., "[MathJax]/jax/element/mml").*/
  1633. directory:string;
  1634. /*The name of the input jax that created the element.*/
  1635. inputJax:string;
  1636. /*The name of the output jax that has processed this element.*/
  1637. outputJax:string;
  1638. /*The DOM id of the <script> tag that generated this element (if it doesn’t have one initially, the MathJax hub
  1639. * will supply one). Note that this is not a reference to the element itself; that element will have a reference
  1640. * to this element jax, and if inputID were a reference back, that would cause a reference loop, which some
  1641. * browsers would not free properly during trash collection, thus causing a memory leak.
  1642. */
  1643. inputID:string;
  1644. /*A string indicating the original input text that was processed for this element. (In the future, this may be
  1645. * managed by the input jax rather than MathJax.Hub.)
  1646. */
  1647. originalText:string;
  1648. /*The MIME-type of the element jax (jax/mml in the case of an mml element jax).*/
  1649. mimeType:string;
  1650. /*Sets the input text for this element to the given text and reprocesses the mathematics. (I.e., updates the
  1651. * equation to the new one given by text). When the processing is complete, the callback, if any, is called.
  1652. */
  1653. Text(text:string):ICallbackObject;
  1654. Text(text:string, callback:any):ICallbackObject;
  1655. /*Removes the output and produces it again (for example, if CSS has changed that would alter the spacing of the
  1656. * mathematics). Note that the internal representation isn’t regenerated; only the output is. The callback, if
  1657. * any, is called when the process completes.
  1658. */
  1659. Rerender(callback:any):ICallbackObject;
  1660. /*Removes the output and then retranslates the input into the internal form and reredners the output again. The
  1661. * callback, if any, is called when the process completes.
  1662. */
  1663. Reprocess(callback:any):ICallbackObject;
  1664. /*Removes the output for this element from the web page (but does not remove the original <script>). The
  1665. * <script> will be considered unprocessed, and the next call to MathJax.hub.Typeset() will re-display it.
  1666. */
  1667. Remove():void;
  1668. /*Returns a reference to the original <script> DOM element associated to this element jax.*/
  1669. SourceElement():any;
  1670. /*Indicates whether the mathematics has changed so that its output needs to be updated.*/
  1671. needsUpdate():boolean;
  1672. }
  1673. }