Attention
Version 3 is now the current version of MathJax. This document is for version 2.
The FontWarnings extension
The options below control the operation of the FontWarnings
extension that is run when you include "FontWarnings.js"
in the
extensions array of your configuration. They are listed with their
default values. To set any of these options, include a
FontWarnings
section in your MathJax.Hub.Config()
call.
For example
MathJax.Hub.Config({
FontWarnings: {
fadeoutTime: 2*1000
}
});
would set the fadeoutTime
option to 2000 milliseconds (2 seconds).
- messageStyle: { ... }
This sets the CSS styles to be used for the font warning message window. See the
extensions/FontWarnings.js
file for details of what are set by default. See the CSS style objects for details about how to specify CSS styles via javascript objects.
- Message: { ... }
This block contains HTML snippets to be used for the various messages that the FontWarning extension can produce. There are three messages that you can redefine to suit your needs:
- webFont: [ ... ]
The message used for when MathJax uses web-based fonts (rather than local fonts installed on the user’s system).
- imageFonts: [ ... ]
The message used for when MathJax must use image fonts rather than local or web-based fonts (for those browsers that don’t handle the
@font-face
CSS directive).
- noFonts: [ ... ]
The message used when MathJax is unable to find any font to use (i.e., neither local nor web-based nor image-based fonts are available).
Any message that is set to
null
rather than an HTML snippet array will not be presented to the user, so you can set, for example, thewebFont
message tonull
in order to have theimageFonts
andnoFonts
messages, but no message if MathJax uses web-based fonts.See the description of HTML snippets for details about how to describe the messages using HTML snippets. Note that in addition to the usual rules for defining such snippets, the FontWarnings snippets can include references to pre-defined snippets (that represent elements common to all three messages). These are defined below in the
HTML
block, and are referenced using["name"]
within the snippet, where name is the name of one of the snippets defined in theHTML
configuration block. For exampleMessage: { noFonts: [ ["closeBox"], "MathJax is unable to locate a font to use to display ", "its mathematics, and image fonts are not available, so it ", "is falling back on generic unicode characters in hopes that ", "your browser will be able to display them. Some characters ", "may not show up properly, or possibly not at all.", ["fonts"], ["webfonts"] ] }
refers to the
closeBox
,fonts
andwebfonts
snippets declared in theHTML
section.
- HTML: { ... }
This object defines HTML snippets that are common to more than one message in the
Message
section above. They can be included in other HTML snippets by by using["name"]
in an HTML snippet, where name refers to the name of the snippet in theHTML
block. The pre-defined snippets are:- closeBox
The HTML for the close box in the FontWarning message.
- webfonts
The HTML for a paragraph suggesting an upgrade to a more modern browser that supports web fonts.
- fonts
HTML that includes links to the MathJax and STIX font download pages.
- STIXfonts
HTML that gives the download link for the STIX fonts only. (Used in place of fonts when the HTML-CSS option for availableFonts only includes the STIX fonts.)
- TeXfonts
HTML that gives the download link for the MathJax TeX fonts only. (Used in place of fonts when the HTML-CSS option for availableFonts only includes the TeX fonts.)
You can add your own pre-defined HTML snippets to this object, or override the ones that are there with your own text.
- removeAfter: 12*1000
This is the amount of time to show the FontWarning message, in milliseconds. The default is 12 seconds. Setting this value to zero means that the message will not fade out (the user must close it manually).
- fadeoutSteps: 10
This is the number of steps to take while fading out the FontWarning message. More steps make for a smoother fade-out. Set to zero to cause the message to be removed without fading.
- fadeoutTime: 1.5*1000
This is the time used to perform the fade-out, in milliseconds. The default is 1.5 seconds.