From 69f7c0c69338a966841b3ecd4bd97df00bf28dbb Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 12 Aug 2013 22:42:14 -0400 Subject: updates to mathjax plugin, incl more examples #531 --- plugin/math/math.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'plugin/math') 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 ); + } ); } -- cgit v1.2.3