@@ -19,7 +19,7 @@ exports.convertToTspans = function(_context, gd, _callback) {
1919 // Until we get tex integrated more fully (so it can be used along with non-tex)
2020 // allow some elements to prohibit it by attaching 'data-notex' to the original
2121 var tex = ( ! _context . attr ( 'data-notex' ) ) &&
22- gd . _context . typesetMath &&
22+ gd && gd . _context . typesetMath &&
2323 ( typeof MathJax !== 'undefined' ) &&
2424 str . match ( FIND_TEX ) ;
2525
@@ -188,6 +188,7 @@ function texToSVG(_texString, _config, _callback) {
188188 var originalRenderer ,
189189 originalConfig ,
190190 originalProcessSectionDelay ,
191+ noOriginalInlineMath ,
191192 tmpDiv ;
192193
193194 var setConfig = function ( ) {
@@ -212,6 +213,7 @@ function texToSVG(_texString, _config, _callback) {
212213
213214 if ( ! MathJax . config . tex . inlineMath ) {
214215 MathJax . config . tex . inlineMath = inlineMath ;
216+ noOriginalInlineMath = true ;
215217 }
216218 }
217219 } ;
@@ -291,7 +293,11 @@ function texToSVG(_texString, _config, _callback) {
291293 }
292294 return MathJax . Hub . Config ( originalConfig ) ;
293295 } else {
294- MathJax . config . tex . inlineMath = originalConfig . tex . inlineMath ;
296+ if ( noOriginalInlineMath ) {
297+ delete MathJax . config . tex . inlineMath ;
298+ } else {
299+ MathJax . config . tex . inlineMath = originalConfig . tex . inlineMath ;
300+ }
295301 }
296302 } ;
297303
0 commit comments