Sean
So far you have done pretty well with removing what is not needed.
> This is our config:
>
> <script type="text/x-mathjax-config">
> MathJax.Hub.Config({
> imageFont: null,
> extensions: ["tex2jax.js"],
> jax: ["input/TeX","output/HTML-CSS"],
> tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
> });
> </script>
>
> Until now, I removed everything except:
>
> extensions/
> fonts/ (eot, svg, otf)
> jax/
> MathJax.js
>
> And is working so far so good: 498 elements, 3,3 MB total
As Sean suggested, the fonts/HTML-CSS/TeX/svg directory can also be
removed, as it is needed only for very old versions of Chrome, and
pretty old versions of iOS. This should save you about 1.1MB.
> However, I want to shrink the library further. In particular, I tried
> to remove:
>
> jax/element
>
> But then the math stopped rendering in Firefox.
The element jax is a core component (it implements the internal format
used by MathJax, and so nothing will work without it).
> jax/output/NativeMML
>
> Good. But as the option 'Right click -> Settings -> Math Renderer ->
> MathML' still there and I don't how to remove it from the menu.
I think someone already mentioned that you could add
MathMenu: { showRenderer: false }
to your configuration in order to remove the Renderer submenu.
> Do you have any advice on how to setup this in a better way, or what
> files and configuration may I use to shrink it even more?
There are still some files that can be removed. For example:
extensions/FontWarnings.js
extensions/jsMath2jax.js
extensions/mml2jax.js
extensions/v1.0-warnings
If you really want everything, you can also remove
extensions/TeX/autobold.js
extensions/TeX/noErrors.js
extensions/TeX/noUndefined.js
extensions/AMSsymbols.js
since you aren't using those and they don't get loaded automatically
when needed. (You might want to keep AMSsymbols, however, if that is
something you are likely to use later. The only other extension of
any size is AMSmath.js, but this one IS loaded automatically when
needed, so if you use AMS math environments, for example, you can't
get rid of that one.)
You can also remove jax/input/MathML if you haven't already (you
didn't list it as something you removed).
There are some pieces of the HTML-CSS output jax that can also go.
For example
jax/output/HTML-CSS/autoload/annotation-xml.js
jax/output/HTML-CSS/autoload/maction.js
jax/output/HTML-CSS/autoload/mglyph.js
jax/output/HTML-CSS/autoload/mmultiscripts.js
jax/output/HTML-CSS/autoload/ms.js
and probably
jax/output/HTML-CSS/autoload/menclose.js
though if you have added the \cancel command, the implementation I
suggested for that did use menclose, so you would need to keep that.
You can also get rid of
jax/output/HTML-CSS/imageFonts.js
since you are not going to use that.
The other big chunk of space is taken up by the HTML-CSS font metric
data. MathJax includes data for the STIX fonts, as well as its own
web-based fonts. If you are not using the \unicode{} macro, then you
can get away with using just the MathJax web fonts, and so you can
remove the (large) directory
jax/output/HTML-CSS/fonts/STIX
which will save you about 840KB. If you do, however, you will have to
add
"HTML-CSS": {
availableFonts: ["TeX"],
preferredFont: "TeX",
imageFont: null
}
to your configuration (note that the imageFont value must be in the
"HTML-CSS" section, not the main section, in any case). The one
caveat about doing this, however, is that you may have trouble with
Firefox's same-origin policy, which may prevent it from accessing the
web-based fonts. If you can put the MathJax directory in the same
directory as the HTML files that use it, then you should be OK, but
otherwise, MathJax will try to use the image fonts when you load a
file:// URL, and they won't be available. The alternative would be to
have your users install the MathJax fonts as system fonts, avoiding
the need to use web-based fonts.
Finally, you can remove
jax/output/HTML-CSS/fonts/TeX/Caligraphic/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/Greek/Bold/Main.js
jax/output/HTML-CSS/fonts/TeX/Greek/Italic/Main.js
jax/output/HTML-CSS/fonts/TeX/Greek/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/Main/Bold/Main.js
jax/output/HTML-CSS/fonts/TeX/Main/Italic/Main.js
jax/output/HTML-CSS/fonts/TeX/Main/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/Math/Italic/Main.js
jax/output/HTML-CSS/fonts/TeX/Size1/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/Size2/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/Size3/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/Size4/Regular/Main.js
jax/output/HTML-CSS/fonts/TeX/WinChrome/Regular/Main.js
(about 31KB) as well, as this data is already included in the jax/
output/HTML-CSS/fonts/TeX/fontdata.js file.
I think that is pretty much all that can be removed while still
allowing MathJax to function.
Davide
<tree.txt>
<script type="text/javascript" src="/Scripts/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mrow> <mover accent="true"> <mrow> <mo>∇</mo> </mrow> <mrow> <mo>→</mo> </mrow> </mover> <mo>×</mo> <mover accent="true"> <mrow> <mi>F</mi> </mrow> <mrow> <mo>→</mo> </mrow> </mover> <mo>=</mo> <mrow> <mo>(</mo> <mfrac> <mrow> <mo>∂</mo> <msub> <mrow> <mi>F</mi> </mrow> <mrow> <mi>z</mi> </mrow> </msub> </mrow> <mrow> <mo>∂</mo> <mi>y</mi> </mrow> </mfrac> <mo>−</mo> <mfrac> <mrow> <mo>∂</mo> <msub> <mrow> <mi>F</mi> </mrow> <mrow> <mi>y</mi> </mrow> </msub> </mrow> <mrow> <mo>∂</mo> <mi>z</mi> </mrow> </mfrac> <mo>)</mo> </mrow> <mstyle mathvariant="bold" mathsize="normal"> <mrow> <mi>i</mi> </mrow> </mstyle> <mo>+</mo> <mrow> <mo>(</mo> <mfrac> <mrow> <mo>∂</mo> <msub> <mrow> <mi>F</mi> </mrow> <mrow> <mi>x</mi> </mrow> </msub> </mrow> <mrow> <mo>∂</mo> <mi>z</mi> </mrow> </mfrac> <mo>−</mo> <mfrac> <mrow> <mo>∂</mo> <msub> <mrow> <mi>F</mi> </mrow> <mrow> <mi>z</mi> </mrow> </msub> </mrow> <mrow> <mo>∂</mo> <mi>x</mi> </mrow> </mfrac> <mo>)</mo> </mrow> <mstyle mathvariant="bold" mathsize="normal"> <mrow> <mi>j</mi> </mrow> </mstyle> <mo>+</mo> <mrow> <mo>(</mo> <mfrac> <mrow> <mo>∂</mo> <msub> <mrow> <mi>F</mi> </mrow> <mrow> <mi>y</mi> </mrow> </msub> </mrow> <mrow> <mo>∂</mo> <mi>x</mi> </mrow> </mfrac> <mo>−</mo> <mfrac> <mrow> <mo>∂</mo> <msub> <mrow> <mi>F</mi> </mrow> <mrow> <mi>x</mi> </mrow> </msub> </mrow> <mrow> <mo>∂</mo> <mi>y</mi> </mrow> </mfrac> <mo>)</mo> </mrow> <mstyle mathvariant="bold" mathsize="normal"> <mrow> <mi>k</mi> </mrow> </mstyle> </mrow> </math>
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["mml2jax.js"], jax: ["input/MathML","output/HTML-CSS"], showMathMenu: false, "HTML-CSS": { availableFonts: ["TeX"], preferredFont: "TeX", imageFont: null } }); MathJax.Hub.Startup.MenuZoom = function () {}; </script> <script type="text/javascript" src="../../Scripts/mathjax/MathJax.js"></script>
Any hints/tips/pointers etc would be greatly appreciated since I feel like I've been battling this for a few days now. I just wanna get this working and move on!
Humbly,
Brian
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ root: "/Scripts/mathjax", extensions: ["mml2jax.js"], jax: ["input/MathML","output/HTML-CSS"], menuSettings: {zoom: "Double-Click", zscale: "300%"}, MathMenu: {showRenderer: false}, "HTML-CSS": { availableFonts: ["TeX"], preferredFont: "TeX", imageFont: null } });
</script> <script type="text/javascript" src=""../../Scripts/mathjax/MathJax.js"></script>
--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.