UNPKG

declarations

Version:

[![npm version](https://badge.fury.io/js/declarations.svg)](https://www.npmjs.com/package/declarations)

794 lines (766 loc) 106 kB
// Type definitions for MathJax // Project: https://github.com/mathjax/MathJax // Definitions by: Roland Zwaga <https://github.com/rolandzwaga> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // These are slightly preliminary and can use some more strong typing here and there. Please feel free to improve. declare var MathJax:jax.IMathJax; declare namespace jax { export interface IMathJax { Hub?:IMathJaxHub; Ajax?:IAjax; Message?:IMessage; HTML?:IHTML; Callback?:ICallback; Localization?:ILocalization; InputJax?:IInputJax; OutputJax?:IOutputJax; } export interface ICallback { (fn:Function):ICallbackObject; (fns:Function[]):ICallbackObject; (objs:any[]):ICallbackObject; (obj:any):ICallbackObject; (code:string):ICallbackObject; /*Waits for the specified time (given in milliseconds) and then performs the callback. It returns the Callback * object (or a blank one if none was supplied). The returned callback structure has a timeout property set to * the result of the setTimeout() call that was used to perform the wait so that you can cancel the wait, if * needed. Thus MathJax.Callback.Delay() can be used to start a timeout delay that executes the callback if an * action doesn’t occur within the given time (and if the action does occur, the timeout can be canceled). * Since MathJax.Callback.Delay() returns a callback structure, it can be used in a callback queue to insert a * delay between queued commands. */ Delay(time:number, callback:any):ICallbackObject; /*Creates a MathJax.CallBack.Queue object and pushes the given callbacks into the queue. See Using Queues for * more details about MathJax queues. */ Queue(...args:any[]):IQueue; /*Looks for a named signal, creates it if it doesn’t already exist, and returns the signal object. See Using * Signals for more details. */ Signal(name:string):ISignal; /*Calls each callback in the hooks array (or the single hook if it is not an array), passing it the arguments * stored in the data array. If reset is true, then the callback’s reset() method will be called before each hook * is executed. If any of the hooks returns a Callback object, then it collects those callbacks and returns a new * callback that will execute when all the ones returned by the hooks have been completed. Otherwise, * MathJax.Callback.ExecuteHooks() returns null. */ ExecuteHooks(hooks:any[], data:any[], reset:boolean):ICallbackObject; /*Creates a prioritized list of hooks that are called in order based on their priority (low priority numbers are * handled first). This is meant to replace MathJax.Callback.ExecuteHooks() and is used internally for signal * callbacks, pre- and post-filters, and other lists of callbacks. */ Hooks(reset:boolean):IHooks; } export interface IHooks { Add(hook:any, priority:number):ICallbackObject; Remove(hook:ICallbackObject):void; Execute():ICallbackObject; } export interface IQueue { /*This is non-zero when the queue is waiting for a command to complete, i.e. a command being processed returns a * Callback object, indicating that the queue should wait for that action to complete before processing * additional commands. */ pending:number; /*This is non-zero when the queue is executing one of the commands in the queue.*/ running:number; /*An array containing the queued commands that are yet to be performed.*/ queue:any[]; /*Adds commands to the queue and runs them (if the queue is not pending or running another command). If one of * the callbacks is an actual Callback object rather than a callback specification, then the command queued is * an internal command to wait for the given callback to complete. That is, that callback is not itself queued * to be executed, but a wait for that callback is queued. The Push() method returns the last callback that was * added to the queue (so that it can be used for further synchronization, say as an entry in some other queue). */ Push(specs:any[]):ICallbackObject; /*Process the commands in the queue, provided the queue is not waiting for another command to complete. This * method is used internally; you should not need to call it yourself. */ Process():void; /*Increments the running property, indicating that any commands that are added to the queue should not be * executed immediately, but should be queued for later execution (when its Resume() is called). This method is * used internally; you should not need to call it yourself. */ Suspend():void; /*Decrements the running property, if it is positive. When it is zero, commands can be processed, but that is * not done automatically — you would need to call Process() to make that happen. This method is used * internally; you should not need to call it yourself. */ Resume():void; /*Used internally when an entry in the queue is a Callback object rather than a callback specification. * A callback to this function (passing it the original callback) is queued instead, and it simply returns the * callback it was passed. Since the queue will wait for a callback if it is the return value of one of the * commands it executes, this effectively makes the queue wait for the original callback at that point in the * command queue. */ wait(callback:Function):Function; /*An internal function used to restart processing of the queue after it has been waiting for a command to * complete. */ call():void; } export interface ISignal { /*The name of the signal. Each signal is named so that various components can access it. The first one to * request a particular signal causes it to be created, and other requests for the signal return references * to the same object. */ name:string; /*Array used internally to store the post history so that when new listeners express interests in this signal, * they can be informed of the signals that have been posted so far. This can be cleared using the signal’s * Clear() method. */ posted:any[]; /*Array of callbacks to the listeners who have expressed interest in hearing about posts to this signal. * When a post occurs, the listeners are called, each in turn, passing them the message that was posted. */ listeners:ICallbackObject[]; /*Posts a message to all the listeners for the signal. The listener callbacks are called in turn (with the * message as an argument), and if any return a Callback object, the posting will be suspended until the callback * is executed. In this way, the Post() call can operate asynchronously, and so the callback parameter is used to * synchronize with its operation; the callback will be called when all the listeners have responded to the post. * * If a Post() to this signal occurs while waiting for the response from a listener (either because a listener * returned a Callback object and we are waiting for it to complete when the Post() occurred, or because the * listener itself called the Post() method), the new message will be queued and will be posted after the current * message has been sent to all the listeners, and they have all responded. This is another way in which posting * can be asynchronous; the only sure way to know that a posting has occurred is through its callback. When the * posting is complete, the callback is called, passing it the signal object that has just completed. * * Returns the callback object (or a blank callback object if none was provided). */ Post(message:string):ICallbackObject; Post(message:string, callback:ICallbackObject):ICallbackObject; /*This causes the history of past messages to be cleared so new listeners will not receive them. Note that since * the signal may be operating asynchronously, the Clear() may be queued for later. In this way, the Post() and * Clear() operations will be performed in the proper order even when they are delayed. The callback is called * when the Clear() operation is completed. * * Returns the callback (or a blank callback if none is provided). */ Clear():ICallbackObject; Clear(callback:ICallbackObject):ICallbackObject; /*This method registers a new listener on the signal. It creates a Callback object from the callback * specification, attaches it to the signal, and returns that Callback object. When new messages are posted to * the signal, it runs the callback, passing it the message that was posted. If the callback itself returns a * Callback object, that indicates that the listener has started an asynchronous operation and the poster should * wait for that callback to complete before allowing new posts on the signal. * * If ignorePast is false or not present, then before Interest() returns, the callback will be called with all * the past messages that have been sent to the signal. */ Interest(callback:ICallbackObject):ICallbackObject; Interest(callback:ICallbackObject, ignorePast:boolean):ICallbackObject; /*This removes a listener from the signal so that no new messages will be sent to it. The callback should be the * one returned by the original Interest() call that attached the listener to the signal in the first place. * Once removed, the listener will no longer receive messages from the signal. */ NoInterest(callback:ICallbackObject):void; /*This creates a callback that is called whenever the signal posts the given message. This is a little easier * than having to write a function that must check the message each time it is called. Although the message here * is a string, if a message posted to the signal is an array, then only the first element of that array is used * to match against the message. That way, if a message contains an identifier plus arguments, the hook will * match the identifier and still get called with the complete set of arguments. * * Returns the Callback object that was produced. */ MessageHook(message:string, callback:ICallbackObject):ICallbackObject; /*Used internally to call the listeners when a particular message is posted to the signal.*/ ExecuteHook(message:string):void; } export interface ICallbackObject { /*The function to be called when the callback is executed.*/ hook:number; /*An array containing the arguments to pass to the callback function when it is executed.*/ data:any[]; /*The object to use as this during the call to the callback function.*/ object:any; /*Set to true after the callback has been called, and undefined otherwise. A callback will not be executed a * second time unless the callback’s reset() method is called first, or its autoReset property is set to true. */ called:boolean; /*Set this to true if you want to be able to call the callback more than once. (This is the case for signal * listeners, for example).*/ autoReset:boolean; /*Clears the callback’s called property.*/ reset():void; } export interface IMathJaxHub { /*This holds the configuration parameters for MathJax. Set these values using MathJax.Hub.Config() described * below. The options and their default values are given in the Core Options reference page. */ config?:IMathJaxConfig; /*The minimum time (in milliseconds) between updates of the “Processing Math” message. After this amount of time * has passed, and after the next equation has finished being processed, MathJax will stop processing momentarily * so that the update message can be displayed, and so that the browser can handle user interaction. */ processUpdateTime?:number; /*The amount of time (in milliseconds) that MathJax pauses after issuing its processing message before starting * the processing again (to give browsers time to handle user interaction). */ processUpdateDelay?:number; /*The hub processing signal (tied to the MathJax.Hub.Register.MessageHook() method).*/ signal?:ISignal; /*MathJax’s main processing queue. Use MathJax.Hub.Queue() to push callbacks onto this queue.*/ queue?:any; /*The name of the browser as determined by MathJax. It will be one of Firefox, Safari, Chrome, Opera, MSIE, * Konqueror, or unkown. This is actually an object with additional properties and methods concerning the * browser */ Browser?:IBrowserInfo; /*An object storing the MIME types associated with the various registered input jax (these are the types of the * <script> tags that store the math to be processed by each input jax). */ inputJax?:any; /*An object storing the output jax associate with the various element jax MIME types for the registered output * jax. */ outputJax?:any; Register?:IRegister; /*Sets the configuration options (stored in MathJax.Hub.config) to the values stored in the options object.*/ Config(config:IMathJaxConfig):void; /*When delayStartupUntil is specified in the configuration file or in the script that loads MathJax.js, * MathJax’s startup sequence is delayed until this routine is called. */ Configured():void; /*Pushes the given callbacks onto the main MathJax command queue. This synchronizes the commands with MathJax so * that they will be performed in the proper order even when some run asynchronously. See Using Queues for more * details about how to use queues, and the MathJax queue in particular. You may supply as many callback * specifications in one call to the Queue() method as you wish. */ Queue(callBack:any):any; /*Calls the preprocessors on the given element (or elements if it is an array of elements), and then typesets * any math elements within the element. If no element is provided, the whole document is processed. The element * is either the DOM id of the element, a reference to the DOM element itself, or an array of id’s or refereneces. * The callback is called when the process is complete. See the Modifying Math section for details of how to use * this method properly. */ Typeset(element:any, callBack:any):any; /*Calls the loaded preprocessors on the entire document, or on the given DOM element (or elements, if it is an * array of elements). The element is either the DOM id of the element, a reference to the DOM element itself, or * an array of id’s or references. The callback is called when the processing is complete. */ PreProcess(element:any, callBack:any):any; /*Scans either the entire document or a given DOM element (or array of elements) for MathJax <script> tags and * processes the math those tags contain. The element is either the DOM id of the element to scan, a reference to * the DOM element itself, or an array of id’s or references. The callback is called when the processing is * complete. */ Process(element:any, callBack:any):any; /*Scans either the entire document or a given DOM element (or elements if it is an array of elements) for * mathematics that has changed since the last time it was processed, or is new, and typesets the mathematics * they contain. The element is either the DOM id of the element to scan, a reference to the DOM element itself, * or an array of id’s or references. The callback is called when the processing is complete. */ Update(element:any, callBack:any):any; /*Removes any typeset mathematics from the document or DOM element (or elements if it is an array of elements), * and then processes the mathematics again, re-typesetting everything. This may be necessary, for example, if * the CSS styles have changed and those changes would affect the mathematics. Reprocess calls both the input and * output jax to completely rebuild the data for mathematics. The element is either the DOM id of the element to * scan, a reference to the DOM element itself, or an array of id’s or references. The callback is called when * the processing is complete. */ Reprocess(element:any, callBack:any):any; /*Removes any typeset mathematics from the document or DOM element (or elements if it is an array of elements), * and then renders the mathematics again, re-typesetting everything from the current internal version (without * calling the input jax again). The element is either the DOM id of the element to scan, a reference to the DOM * element itself, or an array of id’s or references. The callback is called when the processing is complete. */ Rerender(element:any, callBack:any):any; /*Returns a list of all the element jax in the document or a specific DOM element. The element is either the DOM * id of the element, or a reference to the DOM element itself. */ getAllJax(element:any):any[]; /*Returns a list of all the element jax of a given MIME-type in the document or a specific DOM element. The * element is either the DOM id of the element to search, or a reference to the DOM element itself. */ getJaxByType(type:string, element:any):void; /*Returns a list of all the element jax associated with input <script> tags with the given MIME-type within the * given DOM element or the whole document. The element is either the DOM id of the element to search, or a * reference to the DOM element itself. */ getJaxByInputType(type:string, element:any):void; /*Returns the element jax associated with a given DOM element. If the element does not have an associated * element jax, null is returned. The element is either the DOM id of the element, or a reference to the DOM * element itself. */ getJaxFor(element:any):any; /*Returns 0 if the element is not a <script> that can be processed by MathJax or the result of an output jax, * returns -1 if the element is an unprocessed <script> tag that could be handled by MathJax, and returns 1 if * the element is a processed <script> tag or an element that is the result of an output jax. */ isJax(element:any):number; /*Sets the output jax for the given element jax type (or jax/mml if none is specified) to be the one given by * renderer, which must be the name of a renderer, such as NativeMML or HTML-CSS. Note that this does not cause * the math on the page to be rerendered; it just sets the renderer for output in the future * (call :meth:Rerender() above to replace the current renderings by new ones). */ setRenderer(renderer:string, type:string):void; /*Inserts data from the src object into the dst object. The key:value pairs in src are (recursively) copied into * dst, so that if value is itself an object, its content is copied into the corresponding object in dst. * That is, objects within src are merged into the corresponding objects in dst (they don’t replace them). */ Insert(dst:any, src:any):any; /*This is called when an internal error occurs during the processing of a math element (i.e., an error in the * MathJax code itself). The script is a reference to the <script> tag where the error occurred, and error is the * Error object for the error. The default action is to insert an HTML snippet at the location of the script, but * this routine can be overriden during MathJax configuration in order to perform some other action. * MathJax.Hub.lastError holds the error value of the last error on the page. */ formatError(script:any, error:any):void; } export interface IRegister { /*Used by preprocessors to register themselves with MathJax so that they will be called during the * MathJax.Hub.PreProcess() action. */ PreProcessor(callBack:any):void; /*Registers a listener for a particular message being sent to the hub processing signal (where PreProcessing, * Processing, and New Math messages are sent). When the message equals the type, the callback will be called * with the message as its parameter. */ MessageHook(type:string, callBack:any):void; /*Registers a listener for a particular message being sent to the startup signal (where initialization and * component startup messages are sent). When the message equals the type, the callback will be called with the * message as its parameter. See the Using Signals documentation for more details. */ StartupHook(type:string, callBack:any):void; /*Registers a callback to be called when a particular file is completely loaded and processed. (The callback is * called when the file makes its MathJax.Ajax.loadComplete() call.) The file should be the complete file name, * e.g., "[MathJax]/config/default.js". */ LoadHook(file:string, callBack:Function):void; } export interface IBrowserInfo { /*The browser version number, e.g., "4.0"*/ version:string; /*These are boolean values that indicate whether the browser is running on a Macintosh computer or a Windows * computer. They will both be false for a Linux computer. */ isMac?:boolean; isPC?:boolean; /*This is true when MathJax is running a mobile version of a WebKit or Gecko-based browser.*/ isMobile?:boolean; /*These are true when the browser is the indicated one, and false otherwise.*/ isFirefox?:boolean; isSafari?:boolean; isChrome?:boolean; isOpera?:boolean; isMSIE?:boolean; isKonqueror?:boolean; /*This tests whether the browser version is at least that given in the version string. Note that you can not * simply do a numeric comparison, as version 4.10 should be considered later than 4.9, for example. Similarly, * 4.10 is different from 4.1, for instance.*/ versionAtLeast(version:string):void; /* 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: *MathJax.Hub.Browser.Select({ * MSIE: function (browser) { * if (browser.versionAtLeast("8.0")) {... do version 8 stuff ... } * ... do general MSIE stuff ... * }, * Firefox: function (browser) { * if (browser.isMac) {... do Mac stuff ... } * ... do general Firefox stuff * } *});*/ Select(choices:any):void; } export interface IAjax { /*Number of milliseconds to wait for a file to load before it is considered to have failed to load.*/ timeout?:number; STATUS:ISTATUS; /*An object containing the names of the files that have been loaded (or requested) so far. * MathJax.Ajax.loaded["file"] will be non-null when the file has been loaded, with the value being the * MathJax.Ajax.STATUS value of the load attempt. */ loaded:any; /*An object containing the files that are currently loading, the callbacks that are to be run when they load or * timeout, and additional internal data.*/ loading:boolean; /*An object containing the load hooks for the various files, set up by the LoadHook() method, or by the * MathJax.Hub.Register.LoadHook() method. */ loadHooks:any; /*Loads the given file if it hasn’t been already. The file must be a JavaScript file or a CSS stylesheet; i.e., * it must end in .js or .css. Alternatively, it can be an object with a single key:value pair where the key is * 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 * be created by a CGI script, for example, or to use a data:: URL). The file must be relative to the MathJax * home directory and can not contain ../ file path components. * * When the file is completely loaded and run, the callback, if provided, will be executed passing it the status * of the file load. If there was an error while loading the file, or if the file fails to load within the time * limit given by MathJax.Ajax.timout, the status will be MathJax.Ajax.STATUS.ERROR otherwise it will be * MathJax.Ajax.STATUS.OK. If the file is already loaded, the callback will be called immediately and the file * will not be loaded again. */ Require(file:string, callBack:any):any; /*Used internally to load a given file without checking if it already has been loaded, or where it is to * be found. */ Load(file:string, callBack:any):any; /*Called from within the loaded files to inform MathJax that the file has been completely loaded and * initialized. The file parameter is the name of the file that has been loaded. This routine will cause any * callback functions registered for the file or included in the MathJax.Ajax.Require() calls to be executed, * passing them the status of the load (MathJax.Ajax.STATUS.OK or MathJax.Ajax.STATUS.ERROR) as their * last parameter. */ loadComplete(file:string):void; /*Called when the timeout period is over and the file hasn’t loaded. This indicates an error condition, and the * MathJax.Ajax.loadError() method will be executed, then the file’s callback will be run with * MathJax.Ajax.STATUS.ERROR as its parameter. */ loadTimeout(file:string):void; /*The default error handler called when a file fails to load. It puts a warning message into the MathJax message * box on screen. */ loadError(file:string):void; /*Registers a callback to be executed when the given file is loaded. The file load operation needs to be started * when this method is called, so it can be used to register a hook for a file that may be loaded in the future. */ LoadHook(file:string, callBack:any):any; /*Used with combined configuration files to indicate what files are in the configuration file. Marks the files * as loading (since there will never be an explicit Load() or Require() call for them), so that load-hooks and * other load-related events can be properly processed when the loadComplete() occurs. */ Preloading(...args:any[]):void; /*Creates a stylesheet from the given style data. styles can either be a string containing a stylesheet * definition, or an object containing a CSS Style Object. */ Styles(styles:any, callback:any):any; /*Returns a complete URL to a file (replacing [MathJax] with the actual root URL location).*/ fileURL(file:string):string; } export interface ISTATUS { /*The value used to indicate that a file load has occurred successfully.*/ OK:string; /*The value used to indicate that a file load has caused an error or a timeout to occur.*/ ERROR:string; } export interface IMessage { /*This sets the message being displayed to the given message string. If n is not null, it represents a message * id number and the text is set for that message id, otherwise a new id number is created for this message. If * delay is provided, it is the time (in milliseconds) to display the message before it is cleared. If delay is * not provided, the message will not be removed automatically; you must call the MathJax.Messsage.Clear() method * by hand to remove it. If message is an array, then it represents a localizable string, as described in the * Localization strings documentation. */ Set(message:string, n:number, delay:number):number; /*This causes the message with id n to be removed after the given delay, in milliseconds. The default delay is * 600 milliseconds.*/ Clear(n:number, delay:number):void; /*This removes the message frame from the window (it will reappear when future messages are set, however).*/ Remove():void; /*This sets the message area to a “Loading file” message, where file is the name of the file (with [MathJax] * representing the root directory). */ File(file:string):number; /*This method is called on each message before it is displayed. It can be used to modify (e.g., shorten) the * various messages before they are displayed. The default action is to check if the messageStyle configuration * parameter is simple, and if so, convert loading and processing messages to a simpler form. This method can be * overridden to perform other sanitization of the message strings. */ filterText(text:string, n:number):string; /*Returns a string of all the messages issued so far, separated by newlines. This is used in debugging MathJax * operations. */ Log():string; } export interface IHTML { Cookie?:ICookie; /*Creates a DOM element of the given type. If attributes is non-null, it is an object that contains key:value * pairs of attributes to set for the newly created element. If contents is non-null, it is an HTML snippet that * describes the contents to create for the element. */ Element(type:string, attributes:any, contents:any):any; /*Creates a DOM element and appends it to the parent node provided. It is equivalent to: * parent.appendChild(MathJax.HTML.Element(type,attributes,content)) */ addElement(parent:any, type:string, attributes:any, content:any):any; /*Creates a DOM text node with the given text as its content.*/ TextNode(text:string):any; /*Creates a DOM text node with the given text and appends it to the parent node.*/ addText(parent:any, text:string):any; /*Sets the contents of the script element to be the given text, properly taking into account the browser * limitations and bugs. */ setScript(script:string, text:string):void; /*Gets the contents of the script element, properly taking into account the browser limitations and bugs.*/ getScript(script:string):string; } export interface ICookie { prefix?:string; expires?:number; /*Creates a MathJax cookie using the MathJax.HTML.Cookie.prefix and the name as the cookie name, and the * key:value pairs in the data object as the data for the cookie. */ Set(name:string,data:any):void /*Looks up the data for the cookie named name and merges the data into the given obj object, or returns a new * object containing the data. */ Get(name:string):any; Get(name:string,obj:any):any; } export interface IMenuSettings { /*This indicates when typeset mathematics should be zoomed. It can be set to "None", "Hover", "Click", or * "Double-Click" to set the zoom trigger. */ zoom?:string; /*These values indicate which keys must be pressed in order for math zoom to be triggered. For example, if CTRL * is set to true and zoom is "Click", then math will be zoomed only when the user control-clicks on mathematics * (i.e., clicks while holding down the CTRL key). If more than one is true, then all the indicated keys must be * pressed for the zoom to occur. */ CTRL?:boolean; ALT?:boolean; CMD?:boolean; Shift?:boolean; /*This is the zoom scaling factor, and it can be set to any of the values available in the Zoom Factor menu of * the Settings submenu of the contextual menu. */ zscale?:string; /*This controls what contextual menu will be presented when a right click (on a PC) or CTRL-click (on the Mac) * occurs over a typeset equation. When set to "MathJax", the MathJax contextual menu will appear; when set to * "Browser", the browser’s contextual menu will be used. For example, in Internet Explorer with the MathPlayer * plugin, if this is set to "Browser", you will get the MathPlayer contextual menu rather than the MathJax menu. */ context?:string; /*This controls whether the “Show Source” menu item includes special class names that help MathJax to typeset * the mathematics that was produced by the TeX input jax. If these are included, then you can take the output * from “Show Source” and put it into a page that uses MathJax’s MathML input jax and expect to get the same * results as the original TeX. (Without this, there may be some spacing differences.) */ texHints?: boolean; mpContext?: boolean; mpMouse?: boolean; } export interface IErrorSettings { /*This is an HTML snippet that will be inserted at the location of the mathematics for any formula that causes * MathJax to produce an internal error (i.e., an error in the MathJax code itself). See the description of HTML * snippets for details on how to represent HTML code in this way. */ message?:string[]; /*This is the CSS style description to use for the error messages produced by internal MathJax errors. See the * section on CSS style objects for details on how these are specified in JavaScript. */ style?:any; } export interface IMathJaxConfig { MathZoom?:IMathZoom; MathMenu?:IMathMenu; MathEvents?:IMathEvents; FontWarnings?:IFontWarnings; Safe?:ISafe; MatchWebFonts?:IMatchWebFonts; SVG?:ISVGOutputProcessor; MMLorHTML?:IMMLorHTMLConfiguration; NativeMML?:INativeMMLOutputProcessor; "HTML-CSS"?:IHTMLCSSOutputProcessor; AsciiMath?:IAsciiMathInputProcessor; MathML?:IMathMLInputProcessor; TeX?:ITeXInputProcessor; jsMath2jax?:IJSMath2jaxPreprocessor; asciimath2jax?:IAsciimath2jaxPreprocessor; mml2jax?:IMML2jaxPreprocessor; tex2jax?:ITEX2jaxPreprocessor; /*A list of input and output jax to initialize at startup. Their main code is loaded only when * they are actually used, so it is not inefficient to include jax that may not actually be used on the page. * These are found in the MathJax/jax directory. */ jax?:string[]; /*A list of extensions to load at startup. The default directory is MathJax/extensions. The * tex2jax and mml2jax preprocessors can be listed here, as well as a FontWarnings extension that you can use to * inform your user that mathematics fonts are available that they can download to improve their experience of * your site. */ extensions?:string[]; /*A list of configuration files to load when MathJax starts up, e.g., to define local macros, * etc., and there is a sample config file named config/local/local.js. The default directory is the * MathJax/config directory. The MMLorHTML.js configuration is one such configuration file, and there are a * number of other pre-defined configurations (see Using a configuration file for more details). */ config?:string[]; /*A list of CSS stylesheet files to be loaded when MathJax starts up. The default directory is * the MathJax/config directory. */ styleSheets?:string[]; /*CSS styles to be defined dynamically at startup time. These are in the form selector:rules (see CSS Style * Objects for complete details). */ styles?:any; /*Patterns to remove from before and after math script tags. If you are not using one of the preprocessors, you * need to insert something extra into your HTML file in order to avoid a bug in Internet Explorer. IE removes * spaces from the DOM that it thinks are redundant, and since a <script> tag usually doesn’t add content to the * page, if there is a space before and after a MathJax <script> tag, IE will remove the first space. When * MathJax inserts the typeset mathematics, this means there will be no space before it and the preceding text. * In order to avoid this, you should include some “guard characters” before or after the math SCRIPT tag; define * the patterns you want to use below. Note that these are used as part of a regular expression, so you will need * to quote special characters. Furthermore, since they are javascript strings, you must quote javascript special * characters as well. So to obtain a backslash, you must use \\ (doubled for javascript). For example, "\\[" * represents the pattern \[ in the regular expression, or [ in the text of the web page. That means that if you * want an actual backslash in your guard characters, you need to use "\\\\" in order to get \\ in the regular * expression, and \ in the actual text. If both preJax and postJax are defined, both must be present in order * to be removed. * * See also the preRemoveClass comments below. * * Examples: * * preJax: "\\\\\\\\\" makes a double backslash the preJax text * * preJax: "\\[\\[", postJax: "\\]\\]" makes it so jax scripts must be enclosed in double brackets. */ preJax?:any; postJax?:any; /*This is the CSS class name for math previews that will be removed preceding a MathJax SCRIPT tag. If the tag * just before the MathJax <script> tag is of this class, its contents are removed when MathJax processes the * <script> tag. This allows you to include a math preview in a form that will be displayed prior to MathJax * performing its typesetting. It also avoids the Internet Explorer space-removal bug, and can be used in place * of preJax and postJax if that is more convenient. * * For example * * <span class="MathJax_Preview">[math]</span><script type="math/tex">...</script> * would display “[math]” in place of the math until MathJax is able to typeset it. */ preRemoveClass?:string; /*This value controls whether the Processing Math: nn% messages are displayed in the lower left-hand corner. * Set to false to prevent those messages (though file loading and other messages will still be shown). */ showProcessingMessages?:boolean; /*This value controls the verbosity of the messages in the lower left-hand corner. Set it to "none" to eliminate * all messages, or set it to "simple" to show “Loading...” and “Processing...” rather than showing the full file * name or the percentage of the mathematics processed. */ messageStyle?:string; /*These two parameters control the alignment and shifting of displayed equations. The first can be "left", * "center", or "right", and determines the alignment of displayed equations. When the alignment is not "center", * the second determines an indentation from the left or right side for the displayed equations.*/ displayAlign?:string; displayIndent?:string; /*Normally MathJax will perform its startup commands (loading of configuration, styles, jax, and so on) as soon * as it can. If you expect to be doing additional configuration on the page, however, you may want to have it * wait until the page’s onload handler is called. If so, set this to "onload". You can also set this to * "configured", in which case, MathJax will delay its startup until you explicitly call * MathJax.Hub.Configured(). See Configuring MathJax after it is loaded for more details. */ delayStartupUntil?:string; /*Normally MathJax will typeset the mathematics on the page as soon as the page is loaded. If you want to delay * that process, in which case you will need to call MathJax.Hub.Typeset() yourself by hand, set this value to * true. */ skipStartupTypeset?:boolean; /*This is a list of DOM element ID’s that are the ones to process for mathematics when any of the Hub typesetting * calls (Typeset(), Process(), Update(), etc.) are called with no element specified, and during MathJax’s initial * typesetting run when it starts up. This lets you restrict the processing to particular containers rather than * scanning the entire document for mathematics. If none are supplied, the complete document is processed. */ elements?:string[]; /*ince typesetting usually changes the vertical dimensions of the page, if the URL contains an anchor position, * then after the page is typeset, you may no longer be positioned at the correct position on the page. MathJax * can reposition to that location after it completes its initial typesetting of the page. This value controls * whether MathJax will reposition the browser to the #hash location from the page URL after typesetting for * the page. */ positionToHash?:boolean; /*These control whether to attach the MathJax contextual menu to the expressions typeset by MathJax. Since the * code for handling MathPlayer in Internet Explorer is somewhat delicate, it is controlled separately via * showMathMenuMSIE, but the latter is now deprecated in favor of the MathJax contextual menu settings for * MathPlayer (see below). * * If showMathMenu is true, then right-clicking (on Windows or Linux) or control-clicking (on Mac OS X) will * produce a MathJax menu that allows you to get the source of the mathematics in various formats, change the * size of the mathematics relative to the surrounding text, get information about MathJax, and configure other * MathJax settings. * * Set this to false to disable the menu. When true, the MathMenu configuration block determines the operation * of the menu. See the MathMenu options for more details. * * These values used to be listed in the separate output jax, but have been moved to this more central location * since they are shared by all output jax. MathJax will still honor their values from their original positions, * if they are set there. */ showMathMenu?:boolean; showMathMenuMSIE?:boolean; /*This block contains settings for the mathematics contextual menu that act as the defaults for the user’s * settings in that menu. * There are also settings for format, renderer, font, mpContext, and mpMouse, but these are maintained by * MathJax and should not be set by the page author. */ menuSettings?:IMenuSettings; /*This block contains settings that control how MathJax responds to unexpected errors while processing * mathematical equations. Rather than simply crash, MathJax can report an error and go on. */ errorSettings?:IErrorSettings; "v1.0-compatible"?:boolean; } export interface IMathZoom { /*This is a list of CSS declarations for styling the zoomed mathematics. See the definitions in * extensions/MathZoom.js for details of what are defined by default. See CSS Style Objects for details on how * to specify CSS style in a JavaScript object. */ styles:any; } export interface IMathMenu { /*This is the hover delay for the display (in milliseconds) for submenus in the contextual menu: when the mouse * is over a submenu label for this long, the menu will appear. (The submenu also will appear if you click on its * label.) */ delay?:number; /*This is the URL for the MathJax Help menu item. When the user selects that item, the browser opens a new window * with this URL. */ helpURL?:string; /*This controls whether the “Math Renderer” item will be displayed in the “Math Settings” submenu of the MathJax * contextual menu. It allows the user to change between the HTML-CSS, NativeMML, and SVG output processors for * the mathematics on the page. Set to false to prevent this menu item from showing. */ showRenderer?:boolean; /*This controls whether the “Font Preference” item will be displayed in the “Math Settings” submenu of the MathJax * contextual menu. This submenu lets the user select what font to use in the mathematics produced by the HTML-CSS * output processor. Note that changing the selection in the font menu will cause the page to reload. Set to false * to prevent this menu item from showing. * */ showFontMenu?:boolean; /*This controls whether the “Language” item will be displayed in the MathJax contextual menu. This submenu allows * the user to select the language to use for the MathJax user interface, including the contextual menu, the about * and help dialogs, the message box at the lower left, and any warning messages produced by MathJax. Set this to * false to prevent this menu item from showing. This will force the user to use the language you have set for * MathJax. */ showLocale?:boolean; /*This controls whether the “MathPlayer” item will be displayed in the “Math Settings” submenu of the MathJax * contextual menu. This submenu lets the user select what events should be passed on to the MathPlayer plugin, * when it is present. Mouse events can be passed on (so that clicks will be processed by MathPlayer rather than * MathJax), and menu events can be passed on (to allow the user access to the MathPlayer menu). Set to false to * prevent this menu item from showing. * */ showMathPlayer?:boolean; /*This controls whether the “Contextual Menu” item will be displayed in the “Math Settings” submenu of the MathJax * contextual menu. It allows the user to decide whether the MathJax menu or the browser’s default contextual menu * will be shown when the context menu click occurs over mathematics typeset by MathJax. Set to false to prevent * this menu item from showing. */ showContext?:boolean; /*These are the settings for the Annotation submenu of the “Show Math As” menu. If the <math> root element has a * <semantics> child that contains one of the following annotation formats, the source will be available via the * “Show Math As” menu. Each format has a list of possible encodings. For example, "TeX": ["TeX", "LaTeX", * "application/x-tex"] will map an annotation with an encoding of "TeX", "LaTeX", or "application/x-tex" to the * "TeX" menu. */ semanticsAnnotations?:any; /*These are the settings for the window.open() call that creates the Show Source window. The initial width and * height will be reset after the source is shown in an attempt to make the window fit the output better. */ windowSettings?:any; /*This is a list of CSS declarations for styling the menu components. See the definitions in * extensions/MathMenu.js for details of what are defined by default. See CSS Style Objects for details on how * to specify CSS style in a JavaScript object. */ styles?:any; } export interface IMathEvents { /*This value is the time (in milliseconds) that a user must hold the mouse still over a math element before it * is considered to be hovering over the math. */ hover?:number; /*This is a list of CSS declarations for styling the zoomed mathematics. See the definitions in * extensions/MathEvents.js for details of what are defined by default. See CSS Style Objects for details on how * to specify CSS style