[HOME] jsMath (Authors) [Prev][Up][Skip][Next]

Changing Other jsMath Attributes

The previous sections have described how to change the font warning messages, the math font sizes, and so on. There are a few other attributes that are also customizable for jsMath.

The Error Message Style

If jsMath encounters an error in the TeX code in a web page, it displays an error message in place of the mathematics. Normally, this is black text on a yellow background with a red border, but you can customize that using the ".typeset .error" CSS style. You can set this using
    <SCRIPT> jsMath = {styles: {'.typeset .error': {style-attributes}}} </SCRIPT>
before loading jsMath.js, or by
    <SCRIPT> jsMath.Setup.Styles({'.typeset .error': {style-attributes}}) </SSCRIPT>
afterward, where style-attributes are a list of key-value pairs indicating the style settings to be overridden. The default is equivalent to
    jsMath = {styles: {
      '.typeset .error':  {
        'font-size':        '90%',
        'font-style':       'italic',
        'background-color': '#FFFFCC',
         padding:           '1px',
         border:            '1px solid #CC0000'

The Default Fallback Method

You can specify the default fallback method by setting the jsMath.Font.fallback variable to one of "symbol", "image" or "unicode" before loading the jsMath.js file. The default is "symbol", which means letters and numbers (and a few other characters, like plus and parentheses) are shown in standard fonts, but math symbols are shown using images. For example
    <SCRIPT> jsMath = {Font: {fallback: "image"}} </SCRIPT>
will set the default fallback to be image mode, where all the characters are taken from the image fonts. The reason this is not the default is that the the images don't print as well as native fonts, and they can't be colored. Using images for symbols only seemed a reasonable compromise between quality and functionality.

Controlling the jsMath Cookie

The data that the user can modify in the jsMath control panel is stored in a cookie within the browser. A cookie is tied to a specific website and (optionally) to specific directories within that website. By default, jsMath stores site-wide cookies, which means that any page using jsMath that is loaded from your web server will have the same cookie values.

It is possible to tell jsMath to use a more restricted cookie by specifying the path for which the cookie is valid. For example, you can make the cookie be specific to the pages within the directory myMath/Examples (and all of its subdirectories) on your website by setting

    <SCRIPT> jsMath = {Controls: {cookiePath: "myMath/Examples"}} </SCRIPT>
before loading jsMath.js. If you are using a web site that is part of a larger domain and you want the settings to cover more than just your own server, but also the wider domain, you can set jsMath.Controls.cookieDomain to the appropriate domain name.

Get jsMath at SourceForge.net. Fast, secure and Free Open Source software downloads [HOME] jsMath web pages
Created: 10 Jul 2005
Last modified: 13 Sep 2008 09:40:41
Comments to: dpvc@union.edu
[Next] Adjusting Multiple jsMath Parameters
[Skip] Browser Support for jsMath
[Up] Information for jsMath Authors
[Prev] Changing the jsMath Button-Click Attributes