aboutsummaryrefslogtreecommitdiff
path: root/plugin/math/math.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/math/math.js')
-rwxr-xr-xplugin/math/math.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugin/math/math.js b/plugin/math/math.js
index 30dd38c..8ab74fa 100755
--- a/plugin/math/math.js
+++ b/plugin/math/math.js
@@ -6,10 +6,13 @@
*/
(function(){
+ var config = Reveal.getConfig().math || {};
+ config.mode = config.mode || 'TeX-AMS_HTML-full';
+
var head = document.querySelector( 'head' );
var script = document.createElement( 'script' );
script.type = 'text/javascript';
- script.src = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG-full';
+ script.src = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=' + config.mode;
// Detect when the script has loaded
script.onload = onScriptLoad;
@@ -28,8 +31,16 @@
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] }
});
+ // Process any math inside of the current slide when navigating,
+ // this is important since it's not possible to typeset
+ // equations within invisible elements (far future or past).
Reveal.addEventListener( 'slidechanged', function( event ) {
+
+ // This will only typeset equations that have not yet been
+ // processed, as well as equations that have change since
+ // last being processed.
MathJax.Hub.Update( event.currentSlide );
+
} );
}