Last modified: 2014-10-27 15:55:19 UTC
The SVG produced by MathJax is a bit verbose. It is possible to reduce the size using tools like scour (apt-get install python-scour): scour --indent=none --shorten-ids -i /tmp/test.svg -o /tmp/test.scoured.svg ls -lh /tmp/test* -rw-r--r-- 1 gabriel gabriel 20K Oct 26 21:42 /tmp/test.svg -rw-r--r-- 1 gabriel gabriel 15K Oct 26 22:05 /tmp/test.scoured.svg After gzip -9 on each of the SVG files: -rw-r--r-- 1 gabriel gabriel 7.3K Oct 26 21:57 /tmp/test.svg.gz -rw-r--r-- 1 gabriel gabriel 5.5K Oct 26 22:05 /tmp/test.scoured.svg.gz So about a 25% reduction of the compressed size, I believe without any quality loss. There is a partial port of scour to JS (https://github.com/preciousforever/SVG-Cleaner), but it does miss the crucial path simplification pass from scour.
I got even better results with https://github.com/svg/svgo, which is already a node module. svgo --disable=removeUselessStrokeAndFill -i /tmp/test.svg -o /tmp/test.svgo.svg -rw-r--r-- 1 gabriel gabriel 14K Oct 26 22:26 /tmp/test.svgo.svg -rw-r--r-- 1 gabriel gabriel 5.3K Oct 26 22:27 /tmp/test.svgo.svg.gz We can just drop this into mathoid as-is.