|
@@ -7,19 +7,26 @@
|
|
var RevealMath = window.RevealMath || (function(){
|
|
var RevealMath = window.RevealMath || (function(){
|
|
|
|
|
|
var options = Reveal.getConfig().math || {};
|
|
var options = Reveal.getConfig().math || {};
|
|
- options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
|
|
|
|
- options.config = options.config || 'TeX-AMS_HTML-full';
|
|
|
|
- options.tex2jax = options.tex2jax || {
|
|
|
|
- inlineMath: [['$','$'],['\\(','\\)']] ,
|
|
|
|
- skipTags: ['script','noscript','style','textarea','pre'] };
|
|
|
|
|
|
+ var mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
|
|
|
|
+ var config = options.config || 'TeX-AMS_HTML-full';
|
|
|
|
+ var url = mathjax + '?config=' + config;
|
|
|
|
|
|
- loadScript( options.mathjax + '?config=' + options.config, function() {
|
|
|
|
|
|
+ var defaultOptions = {
|
|
|
|
+ messageStyle: 'none',
|
|
|
|
+ tex2jax: {
|
|
|
|
+ inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ],
|
|
|
|
+ skipTags: [ 'script', 'noscript', 'style', 'textarea', 'pre' ]
|
|
|
|
+ },
|
|
|
|
+ skipStartupTypeset: true
|
|
|
|
+ };
|
|
|
|
|
|
- MathJax.Hub.Config({
|
|
|
|
- messageStyle: 'none',
|
|
|
|
- tex2jax: options.tex2jax,
|
|
|
|
- skipStartupTypeset: true
|
|
|
|
- });
|
|
|
|
|
|
+ defaults( options, defaultOptions );
|
|
|
|
+ defaults( options.tex2jax, defaultOptions.tex2jax );
|
|
|
|
+ options.mathjax = options.config = null;
|
|
|
|
+
|
|
|
|
+ loadScript( url, function() {
|
|
|
|
+
|
|
|
|
+ MathJax.Hub.Config( options );
|
|
|
|
|
|
// Typeset followed by an immediate reveal.js layout since
|
|
// Typeset followed by an immediate reveal.js layout since
|
|
// the typesetting process could affect slide height
|
|
// the typesetting process could affect slide height
|
|
@@ -35,6 +42,16 @@ var RevealMath = window.RevealMath || (function(){
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
+ function defaults( options, defaultOptions ) {
|
|
|
|
+
|
|
|
|
+ for ( var i in defaultOptions ) {
|
|
|
|
+ if ( !options.hasOwnProperty( i ) ) {
|
|
|
|
+ options[i] = defaultOptions[i];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
function loadScript( url, callback ) {
|
|
function loadScript( url, callback ) {
|
|
|
|
|
|
var head = document.querySelector( 'head' );
|
|
var head = document.querySelector( 'head' );
|