wiki-mathjax icon indicating copy to clipboard operation
wiki-mathjax copied to clipboard

Simplifying equation scaling

Open pkra opened this issue 11 years ago • 4 comments

I was planning to create a smoother transition (letting MathJax replace the images on the fly rather than taking them out of the page and then run MathJax) and I noticed the way you implemented two scaling levels (for inline and display-style equations).

So before I make a pull request, I was wondering: is this intentional or is this just a hack to imitate Wikipedia's image rendering? It seems more natural to me to have one scaling option, possibly as an option for the extension but i'm not sure what your plan was.

pkra avatar Aug 11 '13 05:08 pkra

That would be a great improvement! I was trying to implement it recently, but didn't find any event to bind to. Since extension using jQuery it needs complete DOM model and the only event I can use is document.load. So replacing images on-the-fly is not possible. Though it would be a cool feature and will drastically increase the load speeds.

Yes, I was trying to mimic Wikipedia as close as possible. There is actually another hack -- display equation alignment, I manually set it to left. Unfortunately, I don't know how to make it use original alignment as I'm unable to find anything explicit in CSS of img element.

I didn't have many plans for this extension and was hoping that Wikipedia will permanently move to MathJax in the near future. However more than a year passed without a change.

I recently wrote another extension for myself that is also working on doxygen-generated docs and on the pages generated with Latex2html. I was thinking to publish it soon, but there are a lot of GUI things to finish and I don't have much time for it right now. So, If you are interested in this one I can push it to GitHub as well.

bgromov avatar Aug 11 '13 06:08 bgromov

I'll make a pull request with the on-the-fly conversion. It's not hard, since MathJax already has this built in.

MathJax should inherit the CSS for the alignment. Personally, I find the extra zoom annoying. Perhaps it could be an option at some point.

I know what you mean about Wikipedia shipping it more widely. We've been trying to move things forward but the community is not supporting it strongly enough.

What I couldn't figure out yet is how to ship a (slim) copy of MathJax with the extension -- that would speed things up considerably. I don't really know anything about Chrome extensions so if you have a pointer that's be great.

Then there's also the potential of using the extension more widely. E.g., for any MathML content, on wordpress.com etc.

pkra avatar Aug 12 '13 15:08 pkra

I didn't consider any settings for Zoom since it is available through MathJax context menu, it saves the settings on per site basis. You can change the behaviour by Right-Click on equation -> Math Settings -> Zoom Trigger -> No Zoom. Zoom Factor can be changed similarly.

Is there actually a slim version of MathJax? The only thing I found was 17Mb, which is pretty big I think.

Anyway, it is fairly easy to add it to extension. For example jQuery is shipped like this already. The only possible problem is the security restrictions. It may be necessary to add all the scripts invoked implicitly by MathJax to the scripts list in manifest.json, but I'm not sure. So the best option would be to have a single file version of MathJax.

bgromov avatar Aug 13 '13 06:08 bgromov

With an option, I meant the extension itself -- MathJax only zooms all math, the extension only display style. Deactivating that display-only zoom (which IIUC is only because of Wikipedia's image renderings) would be a nice option (well, for me at least).

The size of MathJax is due to cross browser support (especially fonts). You can slim it down to 1.5MB (unzipped). There's no single-file version however, but generating a manifest shouldn't be a problem.

pkra avatar Aug 13 '13 14:08 pkra