mathjax plugin updates #531

This commit is contained in:
Hakim El Hattab 2013-08-13 08:53:31 -04:00
parent 71218583f7
commit b17e285164
2 changed files with 14 additions and 13 deletions

View file

@ -182,8 +182,8 @@
transition: 'linear', transition: 'linear',
math: { math: {
// host: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js', // mathjax: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
mode: 'TeX-AMS_HTML-full' dialect: 'TeX-AMS_HTML-full'
}, },
dependencies: [ dependencies: [

View file

@ -7,25 +7,26 @@
var RevealMath = window.RevealMath || (function(){ var RevealMath = window.RevealMath || (function(){
var config = Reveal.getConfig().math || {}; var config = Reveal.getConfig().math || {};
config.host = config.host || 'http://cdn.mathjax.org/mathjax/latest/MathJax.js'; config.mathjax = config.mathjax || 'http://cdn.mathjax.org/mathjax/latest/MathJax.js';
config.mode = config.mode || 'TeX-AMS_HTML-full'; config.dialect = config.dialect || 'TeX-AMS_HTML-full';
loadScript( config.host + '?config=' + config.mode, function() { loadScript( config.mathjax + '?config=' + config.dialect, function() {
MathJax.Hub.Config({ MathJax.Hub.Config({
messageStyle: 'none', messageStyle: 'none',
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] } tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] },
skipStartupTypeset: true
}); });
// Process any math inside of the current slide when navigating, // Typeset followed by an immediate reveal.js layout since
// this is needed since it's not possible to typeset equations // the typesetting process could affect slide height
// within invisible elements (far future or past). MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
MathJax.Hub.Queue( Reveal.layout );
// Reprocess equations in slides when they turn visible
Reveal.addEventListener( 'slidechanged', function( event ) { Reveal.addEventListener( 'slidechanged', function( event ) {
// This will only typeset equations that have not yet been MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
// processed, as well as equations that have change since
// last being processed.
MathJax.Hub.Update( event.currentSlide );
} ); } );