Setting defaults?

131 views
Skip to first unread message

Dana Chandler

unread,
Sep 20, 2012, 2:00:34 PM9/20/12
to mathja...@googlegroups.com
I know from the help files that it's possible to set defaults (scale factor, zoom trigger, etc). However, I've been having a bit of trouble figuring out exactly where to place the code with the options I'd like to set. I've found the corresponding values and blocks of codes I'd need to insert for each option, but I can't figure out exactly where to place the code.

I'm using the TeX-AMS-MML_HTMLorMML.js configuration and assume perhaps that there's somewhere in that file that I need to place the default code blocks, but I can't figure out where.

Thanks in advance for any help.

Peter Krautzberger

unread,
Sep 20, 2012, 2:06:21 PM9/20/12
to mathja...@googlegroups.com
We try to discourage modifying the combined configuration files -- it'll make upgrading more complicated for you.

Instead, you can place the configuration options in your document as in-line configurations or in a separate configuration file (MathJax can load multiple configuration files).


Peter.

Dana Chandler

unread,
Sep 20, 2012, 3:59:53 PM9/20/12
to mathja...@googlegroups.com
Hi Peter,

I appreciate the reply. I had read through the doc and tried to make several modifications but couldn't figure it out.

Is there one particular file where I can simply add in the parameters/values I'd like to set? If so, what function or where should I place it? Sorry for being dense, I'm not a programmer or otherwise I'm sure the documentation would make perfect sense.

Best,

Peter Krautzberger

unread,
Sep 20, 2012, 4:24:45 PM9/20/12
to mathja...@googlegroups.com
Hi,

No worries. The docs can be cryptic, especially if you're stepping into configurations for the first time. My advice: keep reading for a while ("Next Topic").

Anyway, if you use a file instead of inline, you can just create your own -- MathJax can handle multiple config files as described in the link.

The best thing is to go through the default.js (http://cdn.mathjax.org/mathjax/latest/config/default.js) to understand what's what. It's marked up well and contains almost all options. 

For example, trim default.js down to the options you want to change. Then load that file together with your favorite combined config files as explained in the link above (be mindful about the last line of your file containing the correct link to your file).

(Note: the combined files are very different beasts, combining a number of files that would be loaded given the configuration options -- it's not your average configuration file! This combined nature gains better load times.)

Peter.

Peter Krautzberger

unread,
Sep 22, 2012, 6:10:49 PM9/22/12
to Dana Chandler, mathja...@googlegroups.com
Hi Dana,

Actually, you're right -- I've looked again and the docs are lacking.

First off, the zoom settings you're looking for are not in the zoom-extension (http://www.mathjax.org/docs/2.0/options/MathZoom.html) -- except for the delay value if you want zoom on hover -- but in the menu-extension (http://www.mathjax.org/docs/2.0/options/MathMenu.html)

Neither is very well documented when it comes to zoom . Though you will find the relevant settings while going through default.js, you won't find the possible values for the zoom-trigger -- for this you'd have to look through the actual MathZoom.js file.

The values are "Click", "Double-Click", "Hover" for the trigger.

Anyway, here's a link to an example in jsfiddle to play around with http://jsfiddle.net/mf7JN/4/ This uses inline configuration instead of multiple config files.

Caveat emptor: it could just be jsfiddle, but in FF the hover delay doesn't work, in Chrome18 all values get interpreted as "Click".

Hope this helps,
Peter.





On Sat, Sep 22, 2012 at 2:09 PM, Dana Chandler <dcha...@gmail.com> wrote:
Hi Peter,

I'm still not able to figure it out... but thanks a lot for your help. I appreciate your instructions though and when I try to do this again at some point in the future, I'll return to your advice and the documentation once more.

Best,
-Dana

Davide P. Cervone

unread,
Sep 23, 2012, 10:43:22 AM9/23/12
to mathja...@googlegroups.com, Peter Krautzberger
Actually, you're right -- I've looked again and the docs are lacking.

The defaults are actually part of the core Hub configuration, using the menuSettings structure. See


and look for the highlighted menuSettings.  This lists the trigger, and does indicate the other possible values.

First off, the zoom settings you're looking for are not in the zoom-extension (http://www.mathjax.org/docs/2.0/options/MathZoom.html) -- except for the delay value if you want zoom on hover -- but in the menu-extension (http://www.mathjax.org/docs/2.0/options/MathMenu.html)

Note that delay has been moved to the MathEvents data, and so if you specify it in MathZoom, it has not effect, as documented in the link you gave above.

Caveat emptor: it could just be jsfiddle, but in FF the hover delay doesn't work,

As mentioned above, the delay should be set for MathEvents not MathZoom, and is now called "hover" so use

MathEvents: {
  hover: 1000
}

to set a 1 second hover delay instead.

in Chrome18 all values get interpreted as "Click".

I suspect you may have used the MathJax menu to set the trigger, which overrides the settings in the menuSettings object.  You might want to see if there is a mjx.menu cookie for jsFiddle and remove that if there is.  Then it should work for you.  I don't have Chrome18 any longer, but it works fine for me in Chrome21.

Davide

Peter Krautzberger

unread,
Sep 23, 2012, 12:55:08 PM9/23/12
to Davide P. Cervone, mathja...@googlegroups.com
Doh! Thanks Davide -- no wonder I remembered that I read it somewhere in the docs... 

Using MathEvents, everything works fine in Chrom18 and FF15 -- so I suspect that the incorrect config threw MathJax off.

Peter.
Reply all
Reply to author
Forward
0 new messages