@@ -40,6 +40,7 @@ var displayMessages = false; // don't log Message.Set() calls
4040var displayErrors = true ; // show error messages on the console
4141var undefinedChar = false ; // unknown characters are not saved in the error array
4242var extensions = '' ; // no additional extensions used
43+ var paths = { } ; // additional paths (for third party extensions)
4344var fontURL = '' ; // location of web fonts for CHTML
4445
4546var defaults = {
@@ -156,6 +157,11 @@ function ConfigureMathJax() {
156157 AuthorInit : function ( ) {
157158 MathJax = window . MathJax ;
158159
160+ // Add custom paths to configuration
161+ for ( let key in paths ) {
162+ MathJax . Ajax . config . path [ key ] = paths [ key ] ;
163+ }
164+
159165 delete MathJax . Hub . config . styles ; // don't need any styles
160166 MathJax . Hub . Startup . MenuZoom = function ( ) { } ; // don't load menu or zoom code
161167 MathJax . Extension . MathEvents = {
@@ -324,7 +330,7 @@ function ConfigureMathJax() {
324330 this . d = this . D = ( bbox . height + bbox . y ) * scale ;
325331 }
326332 } ) ;
327-
333+
328334 //
329335 // Don't have mglyph load images
330336 //
@@ -480,14 +486,16 @@ function ConfigureMathJax() {
480486 //
481487 // Set up None output jax (for when only MathML output is needed)
482488 //
483- MathJax . OutputJax . None = MathJax . OutputJax ( {
484- id : "None" ,
485- preTranslate : function ( ) { } ,
486- Translate : function ( ) { } ,
487- postTranslate : function ( ) { }
489+ MathJax . Hub . Register . StartupHook ( "End Jax" , function ( ) {
490+ MathJax . OutputJax . None = MathJax . OutputJax ( {
491+ id : "None" ,
492+ preTranslate : function ( ) { } ,
493+ Translate : function ( ) { } ,
494+ postTranslate : function ( ) { }
495+ } ) ;
496+ MathJax . OutputJax . None . loadComplete ( "jax.js" ) ;
497+ MathJax . OutputJax . None . Register ( "jax/mml" ) ;
488498 } ) ;
489- MathJax . OutputJax . None . loadComplete ( "jax.js" ) ;
490- MathJax . OutputJax . None . Register ( "jax/mml" ) ;
491499
492500 //
493501 // Reset the color extension after `autoload-all`
@@ -515,7 +523,7 @@ function ConfigureMathJax() {
515523 } ) ;
516524 }
517525 } ;
518-
526+
519527 if ( extensions ) {
520528 //
521529 // Parse added extensions list and add to standard ones
@@ -958,6 +966,7 @@ exports.config = function (config) {
958966 if ( config . displayErrors != null ) { displayErrors = config . displayErrors }
959967 if ( config . undefinedCharError != null ) { undefinedChar = config . undefinedCharError }
960968 if ( config . extensions != null ) { extensions = config . extensions }
969+ if ( config . paths != null ) { paths = config . paths }
961970 if ( config . fontURL != null ) { fontURL = config . fontURL }
962971 if ( config . MathJax ) {
963972 // strip MathJax config blocks to avoid errors
0 commit comments