cs150bf / ever-notedown

Atom Editor Plugin
MIT License
140 stars 13 forks source link

Feature request: Support for different MathJax fonts #42

Open 7k50 opened 8 years ago

7k50 commented 8 years ago

I'm hopeful this feature will make it into ever-notedown.

According to this MathJax docs page, MathJax supports the following assortment of fonts:

I'm not a big fan of the default TeX style, so it would be a very useful addition.

cs150bf commented 8 years ago

This feature actually has been implemented in the very beginning... for myself. I didn't put it in the published package for a few reasons:

1) Size. Those fonts files amount to ~ 11MB, too large for what I like for an Atom package. 2) Usability. I don't know how to configure and re-configure MathJax in the Atom environment without reloading the EVND package (or even restarting Atom). For that reason I cannot think of a straightforward way of implementing an option in the package settings that allows users to choose the font they like and see the effect in real time. Well, it's actually the same situation with MathJax macros. So maybe I can do the same thing again and just tell people to a reload/restart is required. But... 3) I wasn't motivated enough.

But if you are interested, I've made a new branch (basically what I use myself) that you might want to check out.

How to: 0) Exit Atom. 1) Move your ~/.atom/packages/ever-notedown/ folder to somewhere else; 2) Clone branch v0.2.18-morefonts of the repo

$ cd ~/.atom/packages
$ git clone --branch v0.2.18-morefonts https://github.com/cs150bf/ever-notedown

3) Re-install the package

$ cd ~/.atom/packages/ever-notedown
$ apm install

4) Choose your favorite MathJax font BEFORE starting Atom by checkout a specific tag. For example:

$ cd ~/.atom/packages/ever-notedown
$ git checkout tags/v0.2.18-Gyre-Pagella

Now if you start Atom and try again you should see MathJax font is now set to Gyre Pagella

5) If you want to change the font, you need to first exit Atom, do the git checkout tags/<tag name> ting again, and restart Atom. I know, it's quite painful...

6) You can use git tag to view available fonts, basically the 7 that you listed.

v0.2.18-Asana-Math
v0.2.18-Gyre-Pagella
v0.2.18-Gyre-Termes
v0.2.18-Latin-Modern
v0.2.18-Neo-Euler
v0.2.18-STIX-web
v0.2.18-TeX

In fact, if you look at the commits you'll see that all you really need to do is to change the config options in https://github.com/cs150bf/ever-notedown/blob/master/lib/mathjax-helper.coffee (scroll to the bottom). So theoretically a lot more config options can be done by modifying mathjax-helper.coffee, adding files to ever-notedown/assets/mathjax/, etc..

References: 1) http://mathjax.readthedocs.org/en/latest/options/SVG.html#configure-svg 2) http://mathjax.readthedocs.org/en/latest/font-support.html

7k50 commented 8 years ago

Hey, superb! I will use this branch from now on.

Thanks also for the excellent write-up. Went for STIX-web btw.

Moving forward: I'm just curious about future updates. I see that ever-notedown is present in Atom Settings → Packages, but would I really be able to use the built-in updater or apm?

Or would I have to use git fetch from the branch repo? Would updating also require me to switch to the desired tag HEAD by git checkout after each update?