Use revealjs's math plugin for mathjax.
This is a thin wrapper around mathjax that makes math look better on revealjs. See https://github.com/hakimel/reveal.js/#mathjax We do this by setting the 'mathjax' boolean variable and using it in the revealjs template. Also, for revealjs and mathjax, we don't assign the usual thing to the 'math' variable, since it's handled by mathjax config. Closes #3743.
This commit is contained in:
parent
abd2e94f5a
commit
ec3992b2f0
2 changed files with 18 additions and 3 deletions
|
@ -229,15 +229,24 @@ $endif$
|
||||||
$if(maxScale)$
|
$if(maxScale)$
|
||||||
maxScale: $maxScale$,
|
maxScale: $maxScale$,
|
||||||
$endif$
|
$endif$
|
||||||
|
$if(mathjax)$
|
||||||
|
math: {
|
||||||
|
mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
|
||||||
|
config: 'TeX-AMS_HTML-full',
|
||||||
|
},
|
||||||
|
$endif$
|
||||||
|
|
||||||
// Optional reveal.js plugins
|
// Optional reveal.js plugins
|
||||||
dependencies: [
|
dependencies: [
|
||||||
{ src: '$revealjs-url$/lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
{ src: '$revealjs-url$/lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
||||||
{ src: '$revealjs-url$/plugin/zoom-js/zoom.js', async: true },
|
{ src: '$revealjs-url$/plugin/zoom-js/zoom.js', async: true },
|
||||||
$if(notes-server)$
|
$if(notes-server)$
|
||||||
{ src: '$revealjs-url$/socket.io/socker.io.js', async: true },
|
{ src: '$revealjs-url$/socket.io/socker.io.js', async: true },
|
||||||
{ src: '$revealjs-url$/plugin/notes-server/client.js', async: true },
|
{ src: '$revealjs-url$/plugin/notes-server/client.js', async: true },
|
||||||
$endif$
|
$endif$
|
||||||
|
$if(mathjax)$
|
||||||
|
{ src: '$revealjs-url$/plugin/math/math.js', async: true },
|
||||||
|
$endif$
|
||||||
{ src: '$revealjs-url$/plugin/notes/notes.js', async: true }
|
{ src: '$revealjs-url$/plugin/notes/notes.js', async: true }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -253,7 +253,9 @@ pandocToHtml opts (Pandoc meta blocks) = do
|
||||||
H.script ! A.src (toValue url)
|
H.script ! A.src (toValue url)
|
||||||
! A.type_ "text/javascript"
|
! A.type_ "text/javascript"
|
||||||
$ mempty
|
$ mempty
|
||||||
MathJax url ->
|
MathJax url
|
||||||
|
| slideVariant /= RevealJsSlides ->
|
||||||
|
-- mathjax is handled via a special plugin in revealjs
|
||||||
H.script ! A.src (toValue url)
|
H.script ! A.src (toValue url)
|
||||||
! A.type_ "text/javascript"
|
! A.type_ "text/javascript"
|
||||||
$ case slideVariant of
|
$ case slideVariant of
|
||||||
|
@ -285,6 +287,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
|
||||||
(if stMath st
|
(if stMath st
|
||||||
then defField "math" (renderHtml' math)
|
then defField "math" (renderHtml' math)
|
||||||
else id) $
|
else id) $
|
||||||
|
defField "mathjax"
|
||||||
|
(case writerHTMLMathMethod opts of
|
||||||
|
MathJax _ -> True
|
||||||
|
_ -> False) $
|
||||||
defField "quotes" (stQuotes st) $
|
defField "quotes" (stQuotes st) $
|
||||||
maybe id (defField "toc" . renderHtml') toc $
|
maybe id (defField "toc" . renderHtml') toc $
|
||||||
defField "author-meta" authsMeta $
|
defField "author-meta" authsMeta $
|
||||||
|
|
Loading…
Add table
Reference in a new issue