Allow tex2jax options to be passed into math plugin.

Closes #2026.

This does not change the default behavior of the math plugin,
but it allows $ delimiters to be disabled (which is usually
what you want, since otherwise normal uses of $ for currency get
treated as math delimiters).

To use:

    Reveal.initialize({
      math: {
        tex2jax: { inlineMath: [['\\(','\\)']],
                   skipTags: ['script','noscript','style',
                              'textarea','pre'] }
            },
      etc.
      });
This commit is contained in:
John MacFarlane 2017-11-29 21:53:10 -08:00
parent a0c013606e
commit 773569b4a2

View File

@ -9,15 +9,15 @@ 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.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
options.config = options.config || 'TeX-AMS_HTML-full'; options.config = options.config || 'TeX-AMS_HTML-full';
options.tex2jax = options.tex2jax || {
inlineMath: [['$','$'],['\\(','\\)']] ,
skipTags: ['script','noscript','style','textarea','pre'] };
loadScript( options.mathjax + '?config=' + options.config, function() { loadScript( options.mathjax + '?config=' + options.config, function() {
MathJax.Hub.Config({ MathJax.Hub.Config({
messageStyle: 'none', messageStyle: 'none',
tex2jax: { tex2jax: options.tex2jax,
inlineMath: [['$','$'],['\\(','\\)']] ,
skipTags: ['script','noscript','style','textarea','pre']
},
skipStartupTypeset: true skipStartupTypeset: true
}); });