aboutsummaryrefslogtreecommitdiff
path: root/plugin/math
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-08-12 22:42:14 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-08-12 22:42:14 -0400
commit69f7c0c69338a966841b3ecd4bd97df00bf28dbb (patch)
tree115d7c73464545bf1d50702c02458b8e5419b462 /plugin/math
parent9984cb1f2189b489afd7b05077c319fd123365af (diff)
downloadperl-software-in-gnu-guix-69f7c0c69338a966841b3ecd4bd97df00bf28dbb.tar
perl-software-in-gnu-guix-69f7c0c69338a966841b3ecd4bd97df00bf28dbb.tar.gz
updates to mathjax plugin, incl more examples #531
Diffstat (limited to 'plugin/math')
-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 );
+
} );
}