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

Adjusting Multiple jsMath Parameters

Many of these instruction pages describe how to set values for jsMath by setting the jsMath variable before loading the jsMath.js file. This is often indicated by a command of the form
    <SCRIPT> jsMath = {some-values} </SCRIPT>
You should only include one command that sets jsMath, otherwise you will overwrite the changes you have already made to it in the previous commands. If you need to issue more than one command that sets jsMath, you should combine them into one.

For example, if you want to set some styles and also the default scaling factor, you could use the following:

    <SCRIPT>
      jsMath = {
        styles: {'div.typeset': {'text-align': 'left', margin: '1em 0px 1em 1in'}},
        Controls: {cookie: {scale: 133}}
      }
    </SCRIPT>
If you issue several assignments to jsMath, only the last one will remain in effect when you load jsMath.js.

Once you have made one assignment to jsMath, it is possible to add more values to it using the jsMath.name syntax if you wish. For example,

    <SCRIPT>
      jsMath = {};
      jsMath.styles = {'div.typeset': {'text-align': 'left', margin: '1em 0px 1em 1in'}};
      jsMath.Controls = {cookie: {scale: 133}};
    </SCRIPT>
performs essentially the same assignments as the previous example. Or you could do:
    <SCRIPT>
      jsMath = {};
      jsMath.styles = {};
      jsMath.Controls = {};
      jsMath.Controls.cookie = {};

      jsMath.styles['div.typeset'] = {'text-align': 'left', margin: '1em 0px 1em 1in'};
      jsMath.Controls.cookie.scale = 133;
    </SCRIPT>
If you have to add items programmatically (in response to if-then statements, for example), this is one way to go about it.



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:44:17
Comments to: dpvc@union.edu
[Next] Adding Fonts to jsMath
[Skip] Browser Support for jsMath
[Up] Information for jsMath Authors
[Prev] Changing Other jsMath Attributes