comments and failesafes for #531

This commit is contained in:
Hakim El Hattab 2013-08-12 23:01:35 -04:00
parent 69f7c0c693
commit 3901904057
2 changed files with 29 additions and 14 deletions

View file

@ -38,6 +38,7 @@
<section> <section>
<h3>The Lorenz Equations</h3> <h3>The Lorenz Equations</h3>
\[\begin{aligned} \[\begin{aligned}
\dot{x} &amp; = \sigma(y-x) \\ \dot{x} &amp; = \sigma(y-x) \\
\dot{y} &amp; = \rho x - y - xz \\ \dot{y} &amp; = \rho x - y - xz \\
@ -104,6 +105,10 @@
Reveal.initialize({ Reveal.initialize({
transition: 'linear', transition: 'linear',
math: {
mode: 'TeX-AMS_HTML-full'
},
dependencies: [ dependencies: [
{ src: '../lib/js/classList.js', condition: function() { return !document.body.classList; } }, { src: '../lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, { src: '../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },

View file

@ -4,7 +4,9 @@
* *
* @author Hakim El Hattab * @author Hakim El Hattab
*/ */
(function(){ var RevealMath = window.RevealMath || (function(){
var loaded = false;
var config = Reveal.getConfig().math || {}; var config = Reveal.getConfig().math || {};
config.mode = config.mode || 'TeX-AMS_HTML-full'; config.mode = config.mode || 'TeX-AMS_HTML-full';
@ -16,32 +18,40 @@
// Detect when the script has loaded // Detect when the script has loaded
script.onload = onScriptLoad; script.onload = onScriptLoad;
// IE
script.onreadystatechange = function() { script.onreadystatechange = function() {
if ( this.readyState === 'loaded' ) { if ( this.readyState === 'loaded' ) {
onScriptLoad.call(); onScriptLoad.call();
} }
} }
// Normal browsers
head.appendChild( script ); head.appendChild( script );
function onScriptLoad() { function onScriptLoad() {
MathJax.Hub.Config({ // Conditioned just in case both onload and readystate fire
messageStyle: 'none', if( loaded === false ) {
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] } loaded = true;
});
// Process any math inside of the current slide when navigating, MathJax.Hub.Config({
// this is important since it's not possible to typeset messageStyle: 'none',
// equations within invisible elements (far future or past). tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] }
Reveal.addEventListener( 'slidechanged', function( event ) { });
// This will only typeset equations that have not yet been // Process any math inside of the current slide when navigating,
// processed, as well as equations that have change since // this is needed since it's not possible to typeset equations
// last being processed. // within invisible elements (far future or past).
MathJax.Hub.Update( event.currentSlide ); 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 );
} );
}
} }