Description: use system installation of MathJax instead of the bundled one
 This drops support for SIGIL_EXTRA_ROOT variable here, and given that common
 installation of MathJax are not single-file-built we need to configure the
 loader to load our the extensions we need.
 Thanks to Dmitry Shachnev <mitya57@debian.org> for helping out with the MathJax
 configuration.
Author: Mattia Rizzolo <mattia@debian.org>
Forwarded: no
Last-Update: 2016-06-13

--- a/src/MainUI/PreviewWindow.cpp
+++ b/src/MainUI/PreviewWindow.cpp
@@ -201,18 +201,21 @@
         mathjaxurl = "/" + QCoreApplication::applicationDirPath() + "/polyfills/MathJax.js";
 #else
         // all flavours of linux / unix
-        // user supplied environment variable to 'share/sigil' directory will overrides everything
-        if (!sigil_extra_root.isEmpty()) {
-            mathjaxurl = sigil_extra_root + "/polyfills/MathJax.js";
-        } else {
-            mathjaxurl = sigil_share_root + "/polyfills/MathJax.js";
-        }
+        mathjaxurl = "/usr/share/javascript/mathjax/MathJax.js";
 #endif
 
         mathjaxurl = "file://" + Utility::URLEncodePath(mathjaxurl);
         int endheadpos = text.indexOf("</head>");
         if (endheadpos > 1) {
             QString inject_mathjax = 
+              "<script type=\"text/x-mathjax-config\">"
+              " MathJax.Hub.Config({"
+              "  config: [\"MML_SVG.js\"],"
+              "  extensions: [\"MatchWebFonts.js\"],"
+              "  MathML: { extensions: [\"mml3.js\"] },"
+              "  SVG: { blacker: 1 },"
+              " });"
+              "</script>"
               "<script type=\"text/javascript\" "
               "src=\"" + mathjaxurl + "\"></script>";
             text.insert(endheadpos, inject_mathjax);
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -993,7 +993,6 @@
     if ( INSTALL_BUNDLED_DICTS )
         install( FILES ${DIC_FILES} DESTINATION ${SIGIL_SHARE_ROOT}/hunspell_dictionaries/ )
     endif()
-    install( FILES ${CMAKE_SOURCE_DIR}/src/Resource_Files/polyfills/MathJax.js DESTINATION ${SIGIL_SHARE_ROOT}/polyfills/ )
     install( DIRECTORY ${CMAKE_SOURCE_DIR}/src/Resource_Files/plugin_launchers/python/ DESTINATION ${SIGIL_SHARE_ROOT}/plugin_launchers/python )
     install( DIRECTORY ${CMAKE_SOURCE_DIR}/src/Resource_Files/python3lib/ DESTINATION ${SIGIL_SHARE_ROOT}/python3lib )
     install( FILES ${EXAMPLE_FILES} DESTINATION ${SIGIL_SHARE_ROOT}/examples/ )
