updates to mathjax plugin, incl more examples #531

This commit is contained in:
Hakim El Hattab
2013-08-12 22:42:14 -04:00
parent 9984cb1f21
commit 69f7c0c693
2 changed files with 44 additions and 7 deletions

View File

@ -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 );
} );
}